:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-soft: #4b5563;
  --text-muted: #9ca3af;
  --primary: #5e6ad2;
  --primary-soft: #eef0fd;
  --header-h: 64px;
  --sidebar-w: 240px;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

/* Header */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-link {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-soft);
  text-decoration: none;
}

.header-link:hover {
  background: var(--bg);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
}

.icon-button:hover {
  background: var(--bg);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
}

.user-avatar svg {
  width: 15px;
  height: 15px;
}

.user-chip:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Auth gate */

.gate-screen[hidden] {
  display: none;
}

.gate-screen {
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--header-h));
  padding: 40px 20px;
}

.gate-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.gate-card strong {
  font-size: 16px;
}

.gate-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.gate-uid {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-soft);
  font-size: 12px;
  word-break: break-all;
  user-select: all;
}

/* Body layout */

.app-body[hidden] {
  display: none;
}

.app-body {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - var(--header-h));
}

.sidebar {
  position: sticky;
  top: var(--header-h);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  padding: 16px 12px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.nav-link svg {
  color: var(--text-muted);
}

.nav-link:hover {
  background: var(--bg);
}

.nav-link.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-link.is-active svg {
  color: var(--primary);
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
}

.upload-button:hover {
  background: var(--bg);
}

.help-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: var(--primary-soft);
  text-decoration: none;
}

.help-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--surface);
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.help-text {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.help-text strong {
  font-size: 13px;
  color: var(--text);
}

.help-text small {
  font-size: 12px;
  color: var(--text-muted);
}

/* Content */

.content {
  flex: 1 1 auto;
  min-width: 0;
  padding: 28px 32px 56px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-head h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.page-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.page-actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-outline {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--bg);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: #4d58c4;
}

/* Stat cards */

.stat-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 10px;
}

.stat-icon--blue { background: #eaf0ff; color: #3b82f6; }
.stat-icon--green { background: #e9fbf0; color: #22c55e; }
.stat-icon--purple { background: #f1ecfe; color: #8b5cf6; }
.stat-icon--amber { background: #fff4e5; color: #f59e0b; }

.stat-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.stat-value small {
  margin-left: 2px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-soft);
}

.stat-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* Views (client-side nav) */

.view[hidden] {
  display: none;
}

.empty-state {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  padding: 40px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 15px;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
}

/* Forms */

.field-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.field input,
.field select {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.field input:focus,
.field select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.field-error {
  margin: 0;
  color: #dc2626;
  font-size: 13px;
}

.field-error[hidden] {
  display: none;
}

.field-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.panel-count {
  font-size: 13px;
  color: var(--text-muted);
}

.table-empty {
  padding: 24px 12px !important;
  color: var(--text-muted);
  text-align: center;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.icon-btn-sm {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-muted);
}

.icon-btn-sm:hover {
  background: var(--bg);
  color: var(--text);
}

.icon-btn-sm svg {
  width: 14px;
  height: 14px;
}

.badge-status-active { background: #e9fbf0; color: #16a34a; }
.badge-status-paused { background: #fef3d6; color: #b45309; }
.badge-status-left { background: #f3f4f6; color: var(--text-muted); }

/* Panels */

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}

.side-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.home-today-session-table {
  max-height: 260px;
  overflow-y: auto;
}

.home-today-session-table .cell-wrap {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-wide {
  width: 100%;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.panel-head h2 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.info-dot {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  cursor: help;
}

.panel-link {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}

.panel-link:hover {
  text-decoration: underline;
}

.panel-desc {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.table-footnote {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.panel-subsection {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* Table */

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  vertical-align: top;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--bg);
}

.data-table tbody tr.recommend-student-row {
  cursor: pointer;
}

.data-table tbody tr.recommend-student-row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.data-table tbody tr.today-session-row,
.schedule-student-item {
  cursor: pointer;
}

.data-table tbody tr.today-session-row:focus-visible,
.schedule-student-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.data-table tbody tr.student-row {
  cursor: pointer;
}

.data-table tbody tr.student-row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.data-table td:nth-child(2),
.data-table td:nth-child(3) {
  color: var(--text);
  font-weight: 600;
}

/* Badges */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-high { background: #fde8e8; color: #dc2626; }
.badge-mid { background: #fef3d6; color: #b45309; }
.badge-low { background: #e6f0ff; color: #2563eb; }
.badge-info { background: #eef0fd; color: var(--primary); }
.badge-active { background: #e9fbf0; color: #16a34a; }
.badge-done { background: #eef2f6; color: var(--text-soft); }
.badge-reserved { background: #fdf4ff; color: #9333ea; }
.badge-method { background: #fff7ed; color: #ea580c; }
.badge-admission { background: #eff6ff; color: #2563eb; font-size: 11px; padding: 2px 6px; }
.badge-outing { background: #fef3c7; color: #92400e; font-size: 11px; padding: 2px 6px; }

/* Schedule list */

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.schedule-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.schedule-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--text-muted);
}

.schedule-dot--active {
  background: #22c55e;
  box-shadow: 0 0 0 4px #e9fbf0;
}

.schedule-time {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.schedule-name {
  flex: 1 1 auto;
  color: var(--text);
  font-weight: 700;
}

/* Attendance donut */

.attendance-summary {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-top: 6px;
}

.donut {
  position: relative;
  width: 108px;
  height: 108px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--donut);
}

.donut-hole {
  position: absolute;
  inset: 16px;
  border-radius: 999px;
  background: var(--surface);
}

.legend-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--text-soft);
}

.legend-list strong {
  margin-left: 4px;
  color: var(--text);
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 999px;
}

.legend-dot--green { background: #22c55e; }
.legend-dot--gray { background: #d9dde3; }
.legend-dot--red { background: #ef4444; }

.legend-total {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

/* Checkbox group (전형 등 복수 선택 필드) */

.field-checkgroup {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 0 2px;
}

.checkgroup-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.checkgroup-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Checkbox field */

.field--checkbox {
  flex-direction: row;
  align-items: center;
  align-self: flex-end;
  gap: 8px;
  cursor: pointer;
  padding-bottom: 9px;
}

.field--checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Textarea */

.field textarea {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.field textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* Student detail */

.detail-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
}

/* Session cards (student detail) */

.session-list {
  padding: 0 4px;
}

.session-card {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.session-card:last-child {
  border-bottom: none;
}

.session-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.session-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-date {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.session-summary {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.6;
  word-break: break-word;
  cursor: default;
}

.session-next {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  word-break: break-word;
  cursor: default;
}

.session-next-body {
  display: inline;
}

/* Markdown rendered output */

.md-h1, .md-h2, .md-h3 {
  margin: 6px 0 2px;
  line-height: 1.4;
}

.md-h1 { font-size: 15px; font-weight: 700; color: var(--text); }
.md-h2 { font-size: 14px; font-weight: 700; color: var(--text); }
.md-h3 { font-size: 13px; font-weight: 600; color: var(--text); }

.md-ul, .md-ol {
  margin: 4px 0;
  padding-left: 18px;
}

.md-ul li, .md-ol li {
  margin: 2px 0;
  line-height: 1.5;
}

.md-hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

.md-code {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}

.session-next-label {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
}

.session-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
}

/* Calendar */

.cal-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cal-month-label {
  min-width: 100px;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.cal-dow-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  margin-bottom: 1px;
}

.cal-dow-row span {
  padding: 8px 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
}

.cal-cell {
  background: var(--surface);
  min-height: 96px;
  padding: 6px;
}

.cal-cell--other {
  background: var(--bg);
}

.cal-cell--other .cal-day-num {
  color: var(--border);
}

.cal-day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-bottom: 4px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.cal-day-num--today {
  background: var(--primary);
  color: #fff;
}

.cal-entry {
  padding: 2px 6px 2px 7px;
  border-radius: 4px;
  border-left: 3px solid;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.cal-entry--reserved {
  background: #fdf4ff;
  color: #9333ea;
  border-color: #9333ea;
}

.cal-entry--done {
  background: #f8fafc;
  color: var(--text-soft);
  border-color: #cbd5e1;
}

.cal-entry--planned {
  background: #eef0fd;
  color: var(--primary);
  border-color: var(--primary);
}

/* Student autocomplete picker */

.student-picker-wrap {
  position: relative;
}

.student-picker-dropdown {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  padding: 4px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
}

.student-picker-dropdown[hidden] {
  display: none;
}

.picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.picker-item:hover {
  background: var(--bg);
}

.picker-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.picker-id {
  font-size: 12px;
  color: var(--text-muted);
}

/* Reservation list (below calendar) */

.res-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.res-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.res-item:last-child {
  border-bottom: none;
}

.res-date {
  flex: 0 0 auto;
  min-width: 80px;
  color: var(--text-muted);
  font-weight: 600;
}

.res-name {
  font-weight: 700;
  color: var(--text);
}

.res-note {
  flex: 1 1 auto;
  color: var(--text-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res-item .icon-btn-sm {
  flex: 0 0 auto;
  margin-left: auto;
}

/* Calendar cell — clickable + selected state */

.cal-cell {
  cursor: pointer;
}

.cal-cell:hover {
  background: var(--bg);
}

.cal-cell--other:hover {
  background: color-mix(in srgb, var(--bg) 80%, var(--border));
}

.cal-cell--selected {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

/* Day detail panel */

.day-feedback {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.day-note-area {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  resize: vertical;
  font-family: inherit;
}

.day-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 8px;
}

/* Compact session info list */

.day-info-list {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.day-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.day-info-row:last-child {
  border-bottom: none;
}

.day-info-row--clickable {
  cursor: pointer;
  border-radius: 6px;
}

.day-info-row--clickable:hover {
  background: var(--bg);
}

.day-info-row--clickable:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.day-info-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.day-session-time {
  font-size: 12px;
  color: var(--text-muted);
}


/* Home — recent notes */

.recent-notes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0;
}

.recent-note-item {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}

.recent-note-item:last-child {
  border-bottom: none;
}

.recent-note-date {
  flex: 0 0 100px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.recent-note-text {
  margin: 0;
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
  word-break: break-word;
}

/* All sessions table */

.cell-wrap {
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 260px;
}

/* Upload overlay / modal */

.upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 24, 40, 0.45);
  backdrop-filter: blur(2px);
}

.upload-overlay[hidden] {
  display: none;
}

.upload-sheet {
  display: flex;
  flex-direction: column;
  width: min(1000px, 95vw);
  max-height: 85vh;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.upload-sheet-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.upload-sheet-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 800;
}

.upload-meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.upload-sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 24px;
}

.upload-sheet-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
}

.upload-save-status {
  flex: 1 1 auto;
  font-size: 13px;
  font-weight: 700;
  color: #16a34a;
}

.upload-save-status[hidden] {
  display: none;
}

/* Responsive */

@media (max-width: 1180px) {
  .grid-two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .sidebar {
    display: none;
  }

  .content {
    padding: 20px 16px 40px;
  }

  .page-head {
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .stat-row {
    grid-template-columns: 1fr;
  }

  .attendance-summary {
    flex-direction: column;
    align-items: flex-start;
  }
}
