:root {
  --background: #f5f7fb;
  --foreground: #172033;
  --panel: #ffffff;
  --panel-soft: #eef4f8;
  --muted: #667085;
  --line: #d9e2ea;
  --ink-soft: #344054;
  --blue: #3268a8;
  --green: #2d7a55;
  --amber: #936315;
  --red: #b33b3b;
  --purple: #6d55a3;
  --shadow: 0 18px 45px rgba(30, 48, 76, 0.09);
  --brand-logo-width: 240px;
  --brand-logo-height: 128px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 16px;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(50, 104, 168, 0.09), transparent 34%),
    linear-gradient(315deg, rgba(45, 122, 85, 0.08), transparent 32%), var(--background);
  color: var(--foreground);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.auth-page {
  min-height: 100vh;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  padding: 28px;
  place-items: center;
}

.auth-card {
  display: grid;
  gap: 18px;
  width: min(420px, 100%);
  padding: 30px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-logo {
  width: 190px;
  height: auto;
}

.auth-heading {
  display: grid;
  gap: 6px;
}

.auth-heading h1 {
  margin-bottom: 0;
  font-size: 24px;
}

.auth-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.auth-alert {
  padding: 10px 12px;
  color: var(--red);
  font-size: 14px;
  background: rgba(179, 59, 59, 0.08);
  border: 1px solid rgba(179, 59, 59, 0.2);
  border-radius: 6px;
}

.auth-alert-success {
  color: var(--green);
  background: rgba(45, 122, 85, 0.08);
  border-color: rgba(45, 122, 85, 0.22);
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form label {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.auth-form input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  color: var(--foreground);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.auth-form input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(50, 104, 168, 0.18);
}

.auth-form button {
  height: 44px;
  margin-top: 8px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  background: var(--blue);
  border: 0;
  border-radius: 6px;
}

.auth-form button:hover,
.auth-form button:focus-visible {
  background: #24558f;
}

.dashboard-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.brand-header {
  display: grid;
  grid-template-columns: var(--brand-logo-width) minmax(0, 1fr);
  gap: 16px 24px;
  align-items: start;
  padding: 0 2px 18px;
  color: var(--muted);
  font-size: 13px;
}

.brand-logo {
  display: block;
  width: var(--brand-logo-width);
  height: auto;
}

.brand-copy {
  display: grid;
  align-content: center;
  gap: 5px;
  min-height: var(--brand-logo-height);
  min-width: 0;
}

.session-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 12px;
}

.session-bar a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}

.session-bar a:hover,
.session-bar a:focus-visible {
  text-decoration: underline;
}

.update-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  min-width: 0;
}

.update-summary strong {
  color: var(--foreground);
  font-weight: 600;
}

.update-summary span {
  font-size: 12px;
  line-height: 1.35;
}

.update-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.update-meta span:not(:last-child)::after,
.update-meta strong::after {
  margin-left: 8px;
  color: var(--line);
  content: "|";
}

.update-day-chart {
  display: grid;
  grid-template-columns: repeat(21, minmax(18px, 1fr));
  gap: 4px;
  align-items: end;
  max-width: 100%;
  min-height: 68px;
  padding-top: 2px;
  overflow: hidden;
}

.update-day-bar {
  display: grid;
  grid-template-rows: 12px 42px 12px;
  gap: 2px;
  align-items: end;
  justify-items: center;
  color: var(--muted);
  font-size: 10px;
  text-decoration: none;
  border-radius: 6px;
  outline-offset: 3px;
  transition:
    background-color 140ms ease,
    color 140ms ease;
}

.update-day-bar:hover,
.update-day-bar:focus-visible,
.update-day-bar.is-active {
  color: var(--foreground);
  background: rgba(50, 104, 168, 0.08);
}

.update-day-count {
  color: var(--ink-soft);
  font-weight: 600;
  line-height: 1;
}

.update-day-track {
  position: relative;
  display: flex;
  align-items: end;
  width: 16px;
  height: 42px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(50, 104, 168, 0.12);
}

.update-day-fill {
  display: block;
  width: 100%;
  min-height: 6px;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--blue), var(--green));
}

.update-day-label {
  line-height: 1;
  white-space: nowrap;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.dashboard-main {
  min-width: 0;
}

.side-menu {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 32px);
  padding: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.side-menu-header {
  display: grid;
  gap: 3px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.side-menu-header strong {
  color: var(--foreground);
  font-size: 15px;
}

.side-menu-header span {
  color: var(--muted);
  font-size: 12px;
}

.side-menu-list {
  display: grid;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.side-menu-nav {
  display: grid;
  gap: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.side-menu-link {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  padding: 6px 8px;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: 6px;
}

.side-menu-link:hover,
.side-menu-link:focus-visible,
.side-menu-link.is-active {
  color: var(--foreground);
  background: rgba(50, 104, 168, 0.1);
}

.side-menu-link b {
  min-width: 26px;
  padding: 2px 6px;
  color: var(--blue);
  font-size: 12px;
  text-align: center;
  background: rgba(50, 104, 168, 0.1);
  border-radius: 999px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-weight: 600;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 880px;
  margin-bottom: 14px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 20px;
}

.stat-card,
.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-card span,
.section-heading p,
.risk-item p,
.score-item span,
td span,
.controls span {
  color: var(--muted);
}

.panel {
  padding: 20px;
  margin-bottom: 16px;
  overflow: hidden;
}

#student-actions {
  min-height: 72vh;
  scroll-margin-top: 16px;
}

.section-heading {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-heading p {
  margin-bottom: 0;
  line-height: 1.5;
}

.weekly-heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.week-nav {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  overflow: hidden;
  color: var(--ink-soft);
  background: rgba(50, 104, 168, 0.08);
  border: 1px solid rgba(50, 104, 168, 0.16);
  border-radius: 999px;
}

.week-nav a {
  display: inline-grid;
  width: 38px;
  min-height: 40px;
  place-items: center;
  color: var(--blue);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.week-nav a:hover,
.week-nav a:focus-visible {
  color: #fff;
  background: var(--blue);
}

.week-nav strong {
  min-width: 144px;
  padding: 0 10px;
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
}

.weekly-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 42px;
  border-radius: 999px;
  background: rgba(179, 59, 59, 0.1);
  color: var(--red);
}

.empty-week {
  margin: 0;
  padding: 18px;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
  background: var(--panel-soft);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

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

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

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

.absence-item {
  display: grid;
  gap: 12px;
  align-content: space-between;
  min-height: 168px;
  padding: 14px;
  border-top: 3px solid rgba(50, 104, 168, 0.45);
  background: var(--panel-soft);
}

.first-class-item {
  display: grid;
  gap: 12px;
  align-content: space-between;
  min-height: 168px;
  padding: 14px;
  border-top: 3px solid rgba(45, 122, 85, 0.48);
  background: rgba(45, 122, 85, 0.07);
}

.weekly-makeup-item {
  display: grid;
  gap: 12px;
  align-content: space-between;
  min-height: 168px;
  padding: 14px;
  border-top: 3px solid rgba(50, 104, 168, 0.5);
  background: rgba(50, 104, 168, 0.07);
}

.absence-date,
.first-class-date,
.weekly-makeup-date,
.makeup-schedule {
  color: var(--blue);
  font-weight: 600;
}

.first-class-date {
  color: var(--green);
}

.absence-date,
.first-class-date,
.weekly-makeup-date {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.notice-date {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.absence-item strong,
.first-class-item strong,
.weekly-makeup-item strong {
  display: block;
  margin-bottom: 6px;
}

.absence-item p,
.first-class-item p,
.weekly-makeup-item p,
.absence-followup span:first-child,
.first-class-check span:first-child,
.weekly-makeup-check span:first-child {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
}

.absence-followup,
.first-class-check,
.weekly-makeup-check {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

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

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

.workbook-list {
  display: grid;
  gap: 14px;
}

.workbook-group {
  display: grid;
  gap: 8px;
}

.workbook-group-heading {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  color: var(--ink-soft);
  background: rgba(45, 122, 85, 0.1);
  border: 1px solid rgba(45, 122, 85, 0.18);
  border-radius: 8px;
}

.workbook-group-heading strong {
  color: var(--green);
}

.workbook-group-heading span {
  min-width: 44px;
  padding: 3px 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  background: rgba(45, 122, 85, 0.12);
  border-radius: 999px;
}

.unconfirmed-makeup-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.8fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-left: 3px solid var(--red);
  background: rgba(179, 59, 59, 0.06);
}

.workbook-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.9fr) auto;
  align-items: center;
  overflow: hidden;
  border-left: 3px solid var(--green);
  border-top: 1px solid rgba(45, 122, 85, 0.18);
  border-right: 1px solid rgba(45, 122, 85, 0.18);
  border-bottom: 1px solid rgba(45, 122, 85, 0.18);
  border-radius: 8px;
  background: rgba(45, 122, 85, 0.06);
}

.workbook-item:hover {
  background: rgba(45, 122, 85, 0.1);
}

.workbook-item > * {
  min-height: 100%;
  padding: 14px;
}

.workbook-item > * + * {
  border-left: 1px solid rgba(45, 122, 85, 0.18);
}

.unconfirmed-makeup-item p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.workbook-item p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.unconfirmed-makeup-item > span:nth-child(2) {
  color: var(--ink-soft);
  line-height: 1.45;
}

.workbook-item > span:nth-child(2) {
  color: var(--ink-soft);
  line-height: 1.45;
}

.makeup-item {
  display: grid;
  grid-template-columns: 120px minmax(180px, 1fr) minmax(140px, 1fr) auto;
  align-items: center;
  border: 1px solid rgba(50, 104, 168, 0.2);
  border-radius: 8px;
  background: rgba(50, 104, 168, 0.035);
}

.makeup-item:hover {
  background: rgba(50, 104, 168, 0.075);
}

.makeup-item > * {
  min-height: 100%;
  padding: 12px;
}

.makeup-item > * + * {
  border-left: 1px solid rgba(50, 104, 168, 0.24);
}

.makeup-item p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.makeup-item > span:nth-child(3) {
  color: var(--ink-soft);
  line-height: 1.45;
}

.stats-grid,
.dashboard-grid {
  display: grid;
  gap: 16px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.stat-card {
  display: block;
  padding: 18px;
  color: inherit;
  text-decoration: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.stat-card:hover,
.stat-card:focus-visible {
  border-color: rgba(50, 104, 168, 0.45);
  box-shadow: 0 22px 50px rgba(30, 48, 76, 0.14);
  outline: none;
  transform: translateY(-2px);
}

.stat-card strong {
  display: block;
  margin: 8px 0;
  font-size: 34px;
}

.stat-card p {
  margin-bottom: 0;
  color: var(--ink-soft);
}

.dashboard-grid {
  grid-template-columns: 1fr 1fr;
  margin-top: 16px;
}

.with-controls {
  align-items: end;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.controls label {
  display: grid;
  gap: 6px;
}

.controls span {
  font-size: 12px;
}

select,
input,
button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--foreground);
  padding: 0 12px;
}

button {
  background: var(--blue);
  color: #fff;
  cursor: pointer;
}

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

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

td {
  line-height: 1.45;
}

td:first-child strong,
td:first-child span {
  display: block;
}

.chat-date-cell strong,
.chat-date-cell span {
  display: block;
}

.chat-date-cell strong {
  color: var(--foreground);
}

.chat-date-cell span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.tone-blue {
  background: rgba(50, 104, 168, 0.14);
  color: var(--blue);
}
.tone-green {
  background: rgba(45, 122, 85, 0.14);
  color: var(--green);
}
.tone-amber {
  background: rgba(147, 99, 21, 0.16);
  color: var(--amber);
}
.tone-red {
  background: rgba(179, 59, 59, 0.14);
  color: var(--red);
}
.tone-purple {
  background: rgba(109, 85, 163, 0.14);
  color: var(--purple);
}
.tone-gray {
  background: var(--panel-soft);
  color: var(--ink-soft);
}

.risk-list,
.score-list {
  display: grid;
  gap: 10px;
}

.risk-item,
.score-item {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.risk-item p {
  margin: 4px 0 0;
  line-height: 1.5;
}

.score-item b {
  display: block;
  text-align: right;
  color: var(--blue);
  font-size: 28px;
}

.score-item > div:last-child span {
  display: block;
  max-width: 160px;
  text-align: right;
}

.debug-shell {
  max-width: none;
}

.debug-header {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  margin-bottom: 18px;
}

.debug-logo {
  display: block;
  width: 180px;
  height: auto;
}

.debug-header h1 {
  margin: 8px 0 8px;
  font-size: 34px;
}

.debug-header p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.debug-input-panel {
  overflow: visible;
}

.debug-layout {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.debug-main {
  min-width: 0;
}

.debug-side-menu {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.debug-side-menu-header {
  display: grid;
  gap: 3px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.debug-side-menu-header strong {
  color: var(--foreground);
  font-size: 15px;
}

.debug-side-menu-header span {
  color: var(--muted);
  font-size: 12px;
}

.debug-side-menu a {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 8px;
  color: var(--ink-soft);
  font-weight: 700;
  text-decoration: none;
  border-radius: 6px;
}

.debug-side-menu a:hover,
.debug-side-menu a:focus-visible {
  color: var(--foreground);
  background: rgba(50, 104, 168, 0.1);
}

.debug-form {
  display: grid;
  gap: 10px;
}

.debug-form label {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.debug-form textarea {
  width: 100%;
  min-height: 280px;
  padding: 14px;
  color: var(--foreground);
  line-height: 1.55;
  resize: vertical;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.debug-form textarea:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(50, 104, 168, 0.16);
}

.debug-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.debug-form-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.debug-form-actions a:hover,
.debug-form-actions a:focus-visible {
  text-decoration: underline;
}

.debug-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.debug-empty-preview {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.debug-empty-preview p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.debug-empty-preview a {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
  background: rgba(50, 104, 168, 0.1);
  border-radius: 6px;
}

.debug-empty-preview a:hover,
.debug-empty-preview a:focus-visible {
  text-decoration: underline;
}

.debug-raw-archive {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.debug-raw-filter {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.debug-raw-filter label {
  display: grid;
  gap: 6px;
}

.debug-raw-filter span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.debug-raw-filter select,
.debug-raw-filter input {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  color: var(--foreground);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.debug-raw-filter button,
.debug-raw-filter a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  font-weight: 700;
  white-space: nowrap;
  border-radius: 6px;
}

.debug-raw-filter a {
  color: var(--blue);
  text-decoration: none;
  background: rgba(50, 104, 168, 0.1);
}

.debug-raw-filter a:hover,
.debug-raw-filter a:focus-visible {
  text-decoration: underline;
}

.debug-raw-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.debug-raw-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.debug-raw-list {
  display: grid;
  max-height: 640px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  scrollbar-width: thin;
}

.debug-raw-head,
.debug-raw-row {
  display: grid;
  grid-template-columns: minmax(132px, 0.6fr) minmax(120px, 0.5fr) minmax(420px, 2.4fr);
  min-width: 820px;
}

.debug-raw-head {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.debug-raw-head span {
  padding: 10px 12px;
}

.debug-raw-row {
  border-bottom: 1px solid var(--line);
}

.debug-raw-row:last-child {
  border-bottom: 0;
}

.debug-raw-row > * {
  min-width: 0;
  padding: 10px 12px;
}

.debug-raw-head span + span,
.debug-raw-row > * + * {
  border-left: 1px solid var(--line);
}

.debug-raw-row strong {
  display: grid;
  gap: 3px;
  align-content: start;
  color: var(--foreground);
  font-size: 13px;
}

.debug-raw-row small {
  color: var(--muted);
  font-size: 12px;
}

.debug-raw-row span {
  color: var(--ink-soft);
  font-weight: 700;
}

.debug-raw-row p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.debug-search-hit {
  padding: 0 2px;
  color: #c62828;
  font-weight: 800;
  background: rgba(198, 40, 40, 0.12);
  border-radius: 3px;
}

.debug-card-builder {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.debug-card-json-form textarea {
  min-height: 220px;
  font-family: Consolas, "Courier New", monospace;
}

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

.debug-card-source-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-height: 520px;
  overflow: auto;
}

.debug-card-source-list .debug-card-source {
  position: static;
}

.debug-card-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.debug-card-group-list {
  display: grid;
  gap: 14px;
}

.debug-card-group {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.8fr);
  gap: 14px;
  align-items: start;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.debug-card-group .debug-card-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.debug-card-source {
  position: sticky;
  top: 14px;
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.debug-card-source strong {
  display: flex;
  gap: 8px;
  align-items: baseline;
  color: var(--foreground);
  font-size: 13px;
}

.debug-card-source small {
  color: var(--muted);
  font-size: 12px;
}

.debug-card-source span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

.debug-card-source p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
  white-space: normal;
}

.debug-card-row {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  background: var(--card-bg, var(--panel));
  border: 1px solid var(--card-border, var(--line));
  border-left: 5px solid var(--card-accent, var(--blue));
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.debug-card-row:hover {
  border-color: var(--card-border-strong, rgba(50, 104, 168, 0.28));
  border-left-color: var(--card-accent, var(--blue));
}

.debug-card-row.is-absence {
  --card-accent: #d4515f;
  --card-bg: #fff6f7;
  --card-border: rgba(212, 81, 95, 0.24);
  --card-border-strong: rgba(212, 81, 95, 0.42);
}

.debug-card-row.is-makeup {
  --card-accent: #3268a8;
  --card-bg: #f4f8ff;
  --card-border: rgba(50, 104, 168, 0.22);
  --card-border-strong: rgba(50, 104, 168, 0.4);
}

.debug-card-row.is-makeup-pending {
  --card-accent: #d8891f;
  --card-bg: #fff8ea;
  --card-border: rgba(216, 137, 31, 0.28);
  --card-border-strong: rgba(216, 137, 31, 0.46);
}

.debug-card-row.is-first-class {
  --card-accent: #2d7a55;
  --card-bg: #f3fbf6;
  --card-border: rgba(45, 122, 85, 0.22);
  --card-border-strong: rgba(45, 122, 85, 0.4);
}

.debug-card-row.is-workbook {
  --card-accent: #168c8c;
  --card-bg: #f1fbfb;
  --card-border: rgba(22, 140, 140, 0.22);
  --card-border-strong: rgba(22, 140, 140, 0.4);
}

.debug-card-row.is-consultation {
  --card-accent: #8064a8;
  --card-bg: #f8f5fc;
  --card-border: rgba(128, 100, 168, 0.24);
  --card-border-strong: rgba(128, 100, 168, 0.42);
}

.debug-card-row.is-leave {
  --card-accent: #667085;
  --card-bg: #f7f8fa;
  --card-border: rgba(102, 112, 133, 0.24);
  --card-border-strong: rgba(102, 112, 133, 0.42);
}

.debug-card-row.is-transfer {
  --card-accent: #3182bd;
  --card-bg: #f3f9fd;
  --card-border: rgba(49, 130, 189, 0.22);
  --card-border-strong: rgba(49, 130, 189, 0.4);
}

.debug-card-topline {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.debug-card-topline > div {
  display: grid;
  flex: 1 1 auto;
  gap: 3px;
  min-width: 0;
}

.debug-card-topline strong {
  color: var(--foreground);
  font-size: 16px;
}

.debug-card-topline span,
.debug-card-topline time,
.debug-card-row small {
  color: var(--muted);
  font-size: 12px;
}

.debug-card-topline time {
  display: grid;
  gap: 3px;
  flex: 0 0 auto;
  text-align: right;
}

.debug-card-topline .debug-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  color: #ffffff;
  background: var(--card-accent, var(--blue));
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}

.debug-card-topline .debug-card-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.debug-card-row p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.debug-card-facts {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 10px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--card-border, var(--line));
  border-radius: 8px;
}

.debug-card-facts div {
  display: flex;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
}

.debug-card-facts dt,
.debug-card-facts dd {
  margin: 0;
  font-size: 12px;
}

.debug-card-facts dt {
  color: var(--muted);
  font-weight: 700;
}

.debug-card-facts dd {
  color: var(--foreground);
  font-weight: 700;
  text-align: right;
}

.debug-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: start;
}

.debug-card-tags span,
.debug-card-tags b,
.debug-card-type {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin: 0;
  padding: 0 8px;
  font-size: 12px;
  border-radius: 999px;
}

.debug-card-tags span {
  color: var(--blue);
  background: rgba(50, 104, 168, 0.1);
}

.debug-card-type {
  color: #fff;
  background: var(--card-accent, var(--blue));
}

.debug-card-tags b {
  color: var(--green);
  background: rgba(45, 122, 85, 0.1);
}

.debug-card-row small {
  justify-self: start;
}

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

.debug-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.debug-chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  color: var(--ink-soft);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.debug-chip b {
  color: var(--foreground);
}

.debug-paired-list {
  display: grid;
  max-height: 920px;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  scrollbar-width: thin;
}

.debug-paired-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 0.9fr) minmax(420px, 1.2fr);
  min-width: 1060px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.debug-paired-head span {
  padding: 11px 12px;
}

.debug-paired-head span + span {
  border-left: 1px solid var(--line);
}

.debug-paired-row {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 0.9fr) minmax(420px, 1.2fr);
  min-width: 1060px;
  border-bottom: 1px solid var(--line);
}

.debug-paired-row:last-child {
  border-bottom: 0;
}

.debug-paired-row > * {
  min-width: 0;
  padding: 10px;
}

.debug-paired-row > * + * {
  border-left: 1px solid var(--line);
}

.debug-paired-row.is-empty-candidate {
  background: rgba(102, 112, 133, 0.035);
}

.debug-message {
  display: grid;
  gap: 8px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.debug-message div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
}

.debug-message span {
  color: var(--muted);
  font-size: 13px;
}

.debug-message p {
  margin-bottom: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.debug-candidate {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: rgba(50, 104, 168, 0.07);
  border: 1px solid rgba(50, 104, 168, 0.18);
  border-radius: 8px;
}

.debug-candidate-stack {
  display: grid;
  gap: 8px;
  align-content: start;
}

.debug-confirm-heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.debug-candidate-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.debug-candidate-tags span,
.debug-candidate-tags b {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  font-size: 12px;
  border-radius: 999px;
}

.debug-candidate-tags span {
  color: var(--blue);
  background: rgba(50, 104, 168, 0.12);
}

.debug-candidate-tags b {
  color: var(--green);
  background: rgba(45, 122, 85, 0.12);
}

.debug-candidate p {
  margin-bottom: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.debug-no-candidate {
  margin: 0;
  padding: 12px;
  color: var(--muted);
  text-align: center;
  background: var(--panel-soft);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.debug-confirm-form {
  display: grid;
  gap: 12px;
}

.debug-confirm-form > button {
  width: 100%;
}

.debug-confirm-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: rgba(45, 122, 85, 0.055);
  border: 1px solid rgba(45, 122, 85, 0.18);
  border-radius: 8px;
}

.debug-confirm-apply {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  width: fit-content;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.debug-confirm-apply input {
  width: 16px;
  min-height: 16px;
}

.debug-confirm-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.debug-confirm-fields label {
  display: grid;
  gap: 4px;
}

.debug-confirm-fields span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.debug-confirm-fields input,
.debug-confirm-fields select {
  width: 100%;
  min-height: 34px;
  padding: 0 9px;
  font-size: 13px;
  border-radius: 6px;
}

.debug-confirm-wide {
  grid-column: 1 / -1;
}

@media (max-width: 1000px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .debug-layout {
    grid-template-columns: 1fr;
  }

  .debug-side-menu {
    position: static;
  }

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

  .debug-side-menu-header {
    grid-column: 1 / -1;
  }

  .side-menu {
    position: static;
    max-height: none;
  }
  .side-menu-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-height: 190px;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid,
  .debug-summary-grid,
  .weekly-absence-grid,
  .first-class-grid,
  .weekly-makeup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .makeup-item {
    grid-template-columns: 104px minmax(0, 1fr) auto;
  }

  .unconfirmed-makeup-list {
    grid-template-columns: 1fr;
  }

  .debug-count-grid {
    grid-template-columns: 1fr;
  }

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

  .debug-card-group {
    grid-template-columns: 1fr;
  }

  .debug-card-source-list {
    grid-template-columns: 1fr;
  }

  .debug-card-source {
    position: static;
  }

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

  .makeup-item > span:nth-child(3) {
    grid-column: 2 / 4;
  }
  .with-controls {
    align-items: start;
    flex-direction: column;
  }
  .weekly-heading-actions {
    justify-content: flex-start;
  }
  .controls {
    justify-content: start;
  }
}

@media (max-width: 640px) {
  .dashboard-shell {
    padding: 18px;
  }
  .brand-header {
    grid-template-columns: 1fr;
    --brand-logo-width: min(220px, 82vw);
    --brand-logo-height: auto;
  }

  .debug-header {
    grid-template-columns: 1fr;
  }

  .debug-logo {
    width: min(180px, 72vw);
  }

  .brand-copy {
    min-height: 0;
  }
  .session-bar {
    justify-content: flex-start;
  }
  .brand-logo {
    width: var(--brand-logo-width);
  }
  .update-day-chart {
    grid-template-columns: repeat(7, minmax(24px, 1fr));
  }
  .side-menu-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stats-grid,
  .debug-summary-grid,
  .weekly-absence-grid,
  .first-class-grid,
  .weekly-makeup-grid {
    grid-template-columns: 1fr;
  }

  .debug-confirm-fields {
    grid-template-columns: 1fr;
  }

  .debug-raw-filter {
    grid-template-columns: 1fr;
  }

  .debug-card-list {
    grid-template-columns: 1fr;
  }

  .debug-card-group .debug-card-list {
    grid-template-columns: 1fr;
  }

  .panel,
  .stat-card {
    padding: 16px;
  }
  h1 {
    font-size: 36px;
  }
  .controls,
  .controls label,
  select,
  input,
  button {
    width: 100%;
  }
  .weekly-heading-actions,
  .week-nav {
    width: 100%;
  }
  .week-nav {
    justify-content: space-between;
  }
  .week-nav strong {
    min-width: 0;
  }
  .makeup-item {
    grid-template-columns: 1fr;
  }

  .unconfirmed-makeup-item {
    grid-template-columns: 1fr;
  }

  .workbook-item {
    grid-template-columns: 1fr;
  }

  .workbook-item > * {
    min-height: 0;
  }

  .workbook-item > * + * {
    border-top: 1px solid rgba(45, 122, 85, 0.18);
    border-left: 0;
  }

  .makeup-item > span:nth-child(3) {
    grid-column: auto;
  }

  .makeup-item > * + * {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .risk-item,
  .score-item {
    align-items: flex-start;
    flex-direction: column;
  }
  .score-item b,
  .score-item > div:last-child span {
    text-align: left;
  }
}
