:root {
  --navy: #13233a;
  --navy-2: #1e3556;
  --gold: #c7982f;
  --gold-soft: #fff4d6;
  --paper: #ffffff;
  --bg: #f5f7fb;
  --ink: #1d2430;
  --muted: #647084;
  --line: #dbe2ec;
  --danger: #c43d3d;
  --danger-soft: #fff0f0;
  --success: #247a52;
  --success-soft: #eaf7f0;
  --warning: #946600;
  --warning-soft: #fff8e7;
  --info: #28668c;
  --info-soft: #eef8ff;
  --shadow: 0 8px 22px rgba(19, 35, 58, 0.08);
  --soft-shadow: 0 2px 12px rgba(19, 35, 58, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
    "Noto Sans KR", sans-serif;
  letter-spacing: 0;
  padding-bottom: 84px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 14px 12px 36px;
}

.app-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px;
  background: var(--navy);
  color: white;
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.15;
}

.today-line {
  margin: 8px 0 0;
  color: #dbe5f2;
  font-size: 0.95rem;
}

.staff-switcher {
  min-width: 126px;
}

.staff-switcher label {
  display: block;
  margin-bottom: 6px;
  color: #dbe5f2;
  font-size: 0.78rem;
  font-weight: 700;
}

.staff-switcher select,
.field input,
.field select,
.field textarea,
.search-bar input,
.search-bar select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  padding: 12px 12px;
}

.staff-switcher select {
  border-color: rgba(255, 255, 255, 0.24);
}

.staff-switcher select:disabled {
  opacity: 1;
  color: var(--navy);
  background: #eef3fa;
}

.primary-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 8px;
  scrollbar-width: none;
}

.primary-nav::-webkit-scrollbar {
  display: none;
}

.nav-button,
.action-button,
.ghost-button,
.danger-button,
.icon-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
}

.nav-button {
  flex: 0 0 auto;
  background: var(--paper);
  color: var(--navy);
  padding: 8px 11px;
  border-color: var(--line);
  white-space: nowrap;
  font-size: 0.9rem;
}

.nav-button.active {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}

.view-root {
  display: grid;
  gap: 12px;
}

.section,
.card,
.list-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
}

.section {
  padding: 14px;
}

.onboarding-panel,
.detail-panel,
.admin-lock-panel,
.reminder-nudge-panel {
  border-color: rgba(199, 152, 47, 0.45);
}

.admin-lock-panel.ready,
.onboarding-step.done {
  border-color: var(--success);
  background: var(--success-soft);
}

.admin-lock-panel.locked {
  background: var(--warning-soft);
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title {
  margin: 0;
  color: var(--navy);
  font-size: 1.08rem;
}

.section-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.dashboard-grid,
.card-grid,
.form-grid,
.record-grid,
.admin-grid {
  display: grid;
  gap: 12px;
}

.dashboard-grid,
.card-grid,
.record-grid {
  grid-template-columns: 1fr;
}

.card,
.list-card {
  padding: 14px;
}

.mode-panel {
  display: grid;
  gap: 12px;
  border-color: #ccd8e8;
}

.mode-panel-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f7;
}

.mode-button {
  display: grid;
  gap: 3px;
  min-height: 54px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 8px 6px;
  text-align: center;
}

.mode-button strong {
  color: var(--navy);
  font-size: 0.95rem;
}

.mode-button span {
  font-size: 0.75rem;
}

.mode-button.active {
  background: white;
  box-shadow: var(--soft-shadow);
}

.routine-overview {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.onboarding-steps {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.onboarding-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.status-pill {
  display: inline-grid;
  min-width: 46px;
  min-height: 28px;
  place-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--navy);
  color: white;
  font-size: 0.78rem;
  font-weight: 800;
}

.onboarding-step.done .status-pill {
  background: var(--success);
}

.data-import-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.reminder-card.danger {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.reminder-card.warning {
  border-color: var(--warning);
  background: var(--warning-soft);
}

.reminder-card.success,
.reminder-card.info {
  border-color: var(--info);
  background: var(--info-soft);
}

.metric-card {
  display: grid;
  gap: 10px;
  min-height: 142px;
  text-align: left;
}

.routine-hero {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid #e2c677;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff9eb 0%, #ffffff 100%);
}

.routine-hero.compact {
  background: var(--paper);
  border-color: #d9e1ec;
}

.routine-kicker {
  margin: 0 0 5px;
  color: var(--warning);
  font-size: 0.84rem;
  font-weight: 900;
}

.routine-score {
  margin: 0;
  color: var(--navy);
  font-size: 1.7rem;
  font-weight: 950;
  line-height: 1.15;
}

.routine-progress {
  display: grid;
  gap: 8px;
  align-content: center;
  color: var(--navy);
  font-weight: 900;
}

.routine-section.opening {
  border-color: #cbd8ea;
}

.routine-section.closing {
  border-color: #ead4a0;
}

.routine-list {
  display: grid;
  gap: 12px;
}

.routine-card {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.routine-card.todo {
  border-color: #ead4a0;
  background: #fffaf0;
}

.routine-card.done {
  border-color: #b9dfc9;
  background: #f5fbf7;
}

.routine-status-dot {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--gold);
}

.routine-card.done .routine-status-dot {
  background: var(--success);
}

.routine-card-main {
  display: grid;
  gap: 10px;
}

.routine-card h3 {
  margin: 0;
  color: var(--navy);
  font-size: 1.05rem;
}

.routine-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.pwa-panel {
  border-color: #cbd8ea;
}

.closing-focus-panel {
  border-color: #ead4a0;
}

.closing-next-card {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid #e2c677;
  border-radius: 8px;
  background: #fffaf0;
}

.closing-next-card strong {
  color: var(--navy);
  font-size: 1.15rem;
}

.closing-next-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.closing-flow {
  display: grid;
  gap: 10px;
}

.closing-goal-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.pwa-grid {
  display: grid;
  gap: 12px;
}

.pwa-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.pwa-card h3 {
  margin: 0;
  color: var(--navy);
  font-size: 1.05rem;
}

.pwa-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.profile-panel.needs-setup {
  border-color: #ead4a0;
  background: #fffdf7;
}

.profile-panel.ready {
  border-color: #b9dfc9;
}

.profile-details {
  display: grid;
  gap: 12px;
}

.profile-details summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--navy);
  font-weight: 900;
  cursor: pointer;
}

.quick-start-panel {
  border-color: #d8c07b;
}

.quick-start-grid {
  display: grid;
  gap: 12px;
}

.quick-start-grid textarea {
  min-height: 112px;
}

.closing-summary-panel {
  border-color: #cbd8ea;
}

.summary-strip {
  padding: 14px;
  border: 1px solid #d8e0eb;
  border-radius: 8px;
  background: #f7faff;
  color: var(--navy);
  font-weight: 900;
  line-height: 1.6;
}

.habit-panel {
  border-color: #cbd8ea;
}

.habit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.habit-card {
  display: grid;
  gap: 6px;
  min-height: 104px;
  align-content: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.habit-number {
  color: var(--navy);
  font-size: 1.55rem;
  font-weight: 950;
  line-height: 1;
}

.missed-panel {
  border-color: #ead4a0;
}

.missed-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid #ead4a0;
  border-radius: 8px;
  background: #fffaf0;
}

.missed-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.weekly-review-panel {
  border-color: #cbd8ea;
}

.review-grid {
  display: grid;
  gap: 10px;
}

.review-card {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.review-card strong {
  color: var(--navy);
  line-height: 1.45;
}

.backup-panel {
  border-color: #cbd8ea;
}

.backup-panel.due {
  border-color: #f0b5b5;
  background: #fffafa;
}

.metric-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.metric-title {
  margin: 0;
  color: var(--navy);
  font-size: 1rem;
}

.metric-value {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 900;
}

.metric-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  background: #e9edf4;
  border-radius: 999px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--gold);
  border-radius: 999px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--info-soft);
  color: var(--info);
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.badge.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.success {
  background: var(--success-soft);
  color: var(--success);
}

.checklist {
  display: grid;
  gap: 10px;
}

.check-row {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.check-row input[type="checkbox"] {
  width: 26px;
  height: 26px;
  margin: 1px 0 0;
  accent-color: var(--gold);
}

.check-row-title {
  display: block;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.35;
}

.check-row-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.check-row.incomplete {
  border-color: #ead4a0;
  background: #fffaf0;
}

.segmented {
  display: flex;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf1f7;
}

.segmented button {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--navy);
  font-weight: 900;
}

.segmented button.active {
  background: white;
  box-shadow: 0 3px 10px rgba(19, 35, 58, 0.08);
}

.field {
  display: grid;
  gap: 7px;
}

.field label,
.inline-label {
  color: var(--navy);
  font-size: 0.86rem;
  font-weight: 900;
}

.field-help {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.student-picker-field input[type="search"] {
  padding-right: 12px;
}

.template-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-chip {
  min-height: 38px;
  border: 1px solid #d8e0eb;
  border-radius: 999px;
  background: #fbfcfe;
  color: var(--navy);
  padding: 8px 11px;
  font-weight: 900;
}

.template-chip:focus,
.template-chip:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.form-grid {
  grid-template-columns: 1fr;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.action-button {
  background: var(--navy);
  color: white;
  padding: 11px 14px;
}

.ghost-button {
  background: white;
  color: var(--navy);
  border-color: var(--line);
  padding: 11px 14px;
}

.danger-button {
  background: var(--danger);
  color: white;
  padding: 10px 12px;
}

.icon-button {
  width: 44px;
  background: white;
  color: var(--navy);
  border-color: var(--line);
  font-size: 1.1rem;
}

.manual-list {
  display: grid;
  gap: 10px;
  counter-reset: manual-step;
}

.manual-step {
  position: relative;
  padding: 13px 13px 13px 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.manual-step::before {
  counter-increment: manual-step;
  content: counter(manual-step);
  position: absolute;
  left: 12px;
  top: 12px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--navy);
  color: white;
  font-size: 0.82rem;
  font-weight: 900;
}

.manual-step strong {
  display: block;
  color: var(--navy);
}

.manual-step span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.notice-box {
  padding: 12px;
  border: 1px solid #efd59b;
  border-radius: 8px;
  background: var(--warning-soft);
  color: #6b4c00;
  line-height: 1.55;
}

.danger-box {
  padding: 12px;
  border: 1px solid #f0b5b5;
  border-radius: 8px;
  background: var(--danger-soft);
  color: #842222;
  line-height: 1.55;
}

.student-row,
.record-row,
.admin-row {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.student-row {
  grid-template-columns: 1fr;
}

.student-status-grid {
  display: grid;
  gap: 10px;
}

.record-title {
  margin: 0;
  color: var(--navy);
  font-weight: 900;
}

.record-meta,
.small-muted {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.search-bar {
  display: grid;
  gap: 10px;
}

.filter-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  font-weight: 800;
}

.filter-chip input {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
}

.empty-state {
  padding: 18px;
  border: 1px dashed #bdc8d8;
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.toast {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 88px;
  z-index: 30;
  display: none;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--navy);
  color: white;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.toast.show {
  display: block;
}

.two-column {
  display: grid;
  gap: 12px;
}

.compact-list {
  display: grid;
  gap: 8px;
}

.bottom-quickbar {
  position: fixed;
  left: 50%;
  bottom: 10px;
  width: min(calc(100% - 20px), 640px);
  transform: translateX(-50%);
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(219, 226, 236, 0.92);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 26px rgba(19, 35, 58, 0.16);
  backdrop-filter: blur(12px);
}

.quickbar-button {
  display: grid;
  place-items: center;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 6px 4px;
  font-size: 0.78rem;
  font-weight: 900;
}

.quickbar-button.active {
  background: var(--navy);
  color: white;
}

@media (min-width: 720px) {
  .app-shell {
    padding: 24px 20px 44px;
  }

  body {
    padding-bottom: 96px;
  }

  .dashboard-grid,
  .card-grid,
  .record-grid,
  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field.full,
  .button-row.full,
  .notice-box.full,
  .danger-box.full {
    grid-column: 1 / -1;
  }

  .two-column {
    grid-template-columns: 1.1fr 0.9fr;
  }

  .pwa-grid {
    grid-template-columns: 0.85fr 1.15fr;
  }

  .quick-start-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .habit-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .review-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-card.wide {
    grid-column: 1 / -1;
  }

  .student-row {
    grid-template-columns: minmax(120px, 1fr) minmax(170px, 220px) minmax(160px, 1fr);
    align-items: center;
  }
}

@media (min-width: 980px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .app-header {
    display: grid;
  }

  .staff-switcher {
    width: 100%;
  }
}
