/* Homeschool Transcripts — warm academic paper look, print-first transcript. */

/*
 * The soft pastel palette, exactly as specified. Because these pastels are too
 * light to sit under white type, anything painted with them carries DEEP SLATE
 * text instead — the colours are unchanged, the text on top is what moved.
 */
:root {
  --ink:        #334155;  /* deep slate — body text */
  --ink-soft:   #64748b;
  --paper:      #faf5ff;  /* soft lavender — background */
  --card:       #ffffff;
  --line:       #e8e2f0;
  --line-soft:  #f4f0f9;

  --accent:     #fda4af;  /* dusty rose — buttons, current week */
  --accent-dk:  #fb8f9e;  /* the same rose a shade down, for hover only */
  --accent-tint:#fff1f3;

  --success:    #a7f3d0;  /* muted sage — completed, success */
  --success-dk: #8ee9c0;
  --success-tint:#e9fcf3;

  --peri:       #dbeafe;  /* pale periwinkle — in progress */
  --peri-strong:#c084fc;  /* the brighter periwinkle, for student and subject nav */

  --gold:       #f59e0b;  /* muted amber — honours, highlights */
  --danger:     #e11d48;
  --danger-tint:#fff1f3;
  --radius:     12px;
  --shadow:     0 1px 2px rgba(51,65,85,.05), 0 8px 24px rgba(51,65,85,.06);
}

* { box-sizing: border-box; }

/* `display` rules below would otherwise beat the hidden attribute. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 15px/1.5 ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p  { margin: 0; }

.muted { color: var(--ink-soft); font-size: 13.5px; }
.error { color: var(--danger); font-size: 13.5px; }
.stack { display: grid; gap: 14px; }
.row   { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }

/* ------------------------------------------------------------- controls */

.btn {
  font: inherit; font-weight: 600;
  padding: 9px 15px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover  { background: var(--line-soft); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.btn-primary:hover { background: var(--accent-dk); border-color: var(--accent-dk); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: rgba(0,0,0,.05); color: var(--ink); }
.btn-danger { color: #9f1239; border-color: #fecdd3; background: #fff1f2; }
.btn-danger:hover { background: #f6e1e1; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }

.icon-btn {
  border: 0; background: transparent; cursor: pointer;
  font-size: 16px; color: var(--ink-soft); padding: 6px 8px; border-radius: 7px; line-height: 1;
}
.icon-btn:hover { background: rgba(0,0,0,.06); color: var(--ink); }

.field { display: grid; gap: 5px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  font: inherit; color: var(--ink);
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--card); width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--peri-strong); outline-offset: -1px; border-color: var(--accent);
}
.field textarea { min-height: 64px; resize: vertical; }

.pw { position: relative; display: block; }
.pw input { padding-right: 66px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink);
  padding: 4px 8px; border-radius: 6px;
}
.pw-toggle:hover { background: var(--accent-tint); }

.radio-set { display: flex; gap: 14px; flex-wrap: wrap; padding-top: 4px; }
.radio-set label { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; cursor: pointer; }

/* ------------------------------------------------------------ sign in */

.auth-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1100px 500px at 50% -10%, var(--accent-tint), var(--paper));
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; padding: 30px; box-shadow: var(--shadow);
}
.auth-mark { font-size: 34px; line-height: 1; margin-bottom: 10px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card form { margin-top: 20px; }

/* -------------------------------------------------------------- shell */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 22px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 16px; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.student-picker {
  font: inherit; font-weight: 600; padding: 8px 12px;
  border: 2px solid var(--peri-strong); border-radius: 9px; background: var(--card); color: var(--ink);
}

.tabs {
  display: flex; gap: 2px; padding: 0 16px; background: var(--card);
  border-bottom: 1px solid var(--line); overflow-x: auto;
  position: sticky; top: 55px; z-index: 19;
}
.tab {
  font: inherit; font-weight: 600; font-size: 14px;
  border: 0; background: transparent; color: var(--ink-soft);
  padding: 11px 14px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--accent); background: var(--accent-tint); }

main { max-width: 1120px; margin: 0 auto; padding: 24px 22px 80px; }
.view-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

.empty {
  text-align: center; padding: 52px 20px; color: var(--ink-soft);
  border: 1px dashed var(--line); border-radius: var(--radius); background: var(--card);
}
.empty h3 { color: var(--ink); margin-bottom: 6px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------- classes list */

.year-block { margin-bottom: 22px; }
.year-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 8px; flex-wrap: wrap;
}
.year-head h3 { display: flex; align-items: baseline; gap: 9px; }
.year-label { font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.year-stats { font-size: 13px; color: var(--ink-soft); display: flex; gap: 14px; }
.year-stats b { color: var(--ink); font-weight: 650; }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
table.tbl th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-soft); padding: 10px 12px; background: var(--line-soft); border-bottom: 1px solid var(--line);
  font-weight: 650;
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: #fcfbf8; }
.td-name { font-weight: 600; }
.td-actions { text-align: right; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 650; background: var(--line-soft); color: var(--ink-soft);
}
.pill-honors { background: #f6efdd; color: var(--gold); }
.pill-grade  { background: var(--accent-tint); color: var(--accent-dk); font-size: 13px; padding: 3px 9px; }
.pill-none   { background: var(--line-soft); color: var(--ink-soft); }
.pill-met      { background: var(--success); color: var(--ink); }
.pill-progress { background: var(--peri); color: var(--ink); }
.pill-short    { background: #ffe4e6; color: #9f1239; }

table.tbl tfoot th {
  text-align: left; padding: 10px 12px; font-size: 13px; font-weight: 700;
  background: var(--line-soft); border-top: 1px solid var(--line); text-transform: none; letter-spacing: 0;
}
table.tbl tfoot th.num { text-align: right; }

.quick-add { border-color: var(--accent); }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-head { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--ink-soft); padding-bottom: 4px; }
.cal-cell {
  position: relative; aspect-ratio: 1 / .82; min-height: 46px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--card);
  font: inherit; cursor: pointer; padding: 5px 7px; text-align: left;
  transition: background .1s, border-color .1s;
}
.cal-cell:hover { border-color: var(--accent); background: var(--accent-tint); }
.cal-cell.is-weekend { background: #faf8f3; }
.cal-cell.is-on { background: var(--success); border-color: var(--success); color: var(--ink); }
.cal-cell.is-blank { border: 0; background: transparent; cursor: default; }
.cal-num { font-size: 13px; font-weight: 600; }
.cal-dot {
  position: absolute; right: 7px; bottom: 7px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--gold);
}
.cal-cell.is-on .cal-dot { background: var(--ink); }

.big-stat { font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.bar { height: 9px; border-radius: 6px; background: var(--line-soft); overflow: hidden; }
.bar-fill { height: 100%; background: var(--success); border-radius: 6px; transition: width .3s; }
table.tbl tr.is-done td { color: var(--ink-soft); }
table.tbl tr.is-done .td-name, table.tbl tr.is-done b { text-decoration: line-through; }

.pdf-drop {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 14px; background: #fdfcf9;
}
.findings { margin-top: 12px; border-top: 1px solid var(--line-soft); padding-top: 12px; max-height: 260px; overflow: auto; }
.finding {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 6px 8px; border-radius: 8px; font-size: 13.5px; cursor: pointer;
}
.finding:hover { background: var(--line-soft); }
.finding input { margin-top: 3px; }
.finding .src { display: block; font-size: 11.5px; margin-top: 2px; }

.note-mark { color: var(--accent); font-size: 11px; vertical-align: super; margin-left: 2px; }

/* ------------------------------------------------- transcript (print) */

.sheet-wrap { display: flex; justify-content: center; }
.sheet {
  background: #fff; color: #000; width: 100%; max-width: 1240px;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 34px 38px; box-shadow: var(--shadow);
  font-family: ui-serif, Georgia, "Times New Roman", serif;
}

.sheet-head {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 22px;
  margin-bottom: 14px; padding-bottom: 12px; font-size: 12px; line-height: 1.45;
  border-bottom: 1.5px solid #334155;
}
.sheet-head strong { display: block; font-size: 14.5px; letter-spacing: -.01em; }
.sheet-head .col-r { text-align: right; }

.tsc { width: 100%; min-width: 1000px; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.tsc td, .tsc th { border: 1px solid #7fc9a8; padding: 3px 7px; vertical-align: top; }
.tsc .yr-head { background: #a7f3d0; font-weight: 700; font-size: 11.5px; letter-spacing: .01em; }
.tsc .col-head { background: #d3f7e7; font-weight: 700; font-size: 10px; }
.tsc .term { background: #edfcf5; font-weight: 700; font-style: italic; }
/* The table keeps a generous minimum width and scrolls sideways on screen,
   so class names never wrap. Print drops the minimum and fits the page. */
.tsc-scroll { overflow-x: auto; }
.tsc .cls { white-space: nowrap; }
.tsc .cr, .tsc .gr { text-align: center; font-variant-numeric: tabular-nums; }
.tsc col.c-cr, .tsc col.c-gr { width: 30px; }
.tsc col.c-gap { width: 14px; }
.tsc .blank { border: 1px solid transparent; }
.tsc .totals { background: #e9fcf3; font-size: 10.5px; line-height: 1.5; }
.tsc .totals div { white-space: nowrap; }

.sheet-foot { display: flex; justify-content: space-between; gap: 30px; margin-top: 14px; align-items: flex-start; }
.footnotes { font-size: 11px; line-height: 1.6; }
.footnotes sup { color: #000; }
.scale-box { font-size: 10.5px; }
.scale-box table { border-collapse: collapse; }
.scale-box th { background: #d3f7e7; font-weight: 700; }
.scale-box th, .scale-box td { border: 1px solid #7fc9a8; padding: 1px 7px; text-align: left; }
.sheet-sign { margin-top: 34px; font-size: 12px; display: flex; gap: 46px; }
.sig-line { border-top: 1px solid #000; padding-top: 4px; min-width: 240px; }

/* ------------------------------------------------------------- modal */

.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(29,43,51,.42); }
.modal-card {
  position: relative; background: var(--card); border-radius: 16px;
  width: 100%; max-width: 620px; max-height: 88vh; overflow: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.24);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--card); z-index: 1;
}
.modal-body { padding: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.modal-actions .spacer { flex: 1; }

/* ------------------------------------------------------------- toast */

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 600; z-index: 90; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.toast.is-error { background: var(--danger); }

/* ------------------------------------------------------------- print */

@media print {
  /* Browsers drop background fills when printing unless the page insists.
     Without this the transcript's green banding and the attendance calendar
     come out blank. */
  .sheet, .sheet *, .cal, .cal * , .tsc, .tsc * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  body { background: #fff; }
  .no-print, .topbar, .tabs, .toast, .modal { display: none !important; }
  main { max-width: none; padding: 0; }
  .sheet { border: 0; box-shadow: none; border-radius: 0; padding: 0; max-width: none; }
  .view[hidden] { display: none !important; }
  .tsc-scroll { overflow: visible; }
  .tsc { font-size: 10px; min-width: 0; }
  .tsc td, .tsc th { padding: 1.5px 4px; }
  .tsc tr { page-break-inside: avoid; }
  @page { size: letter landscape; margin: 0.4in; }
}

.age-badge {
  display: inline-block; margin-left: 7px; padding: 1px 8px; border-radius: 20px;
  background: var(--peri); color: var(--ink);
  font-size: 11.5px; font-weight: 650; text-transform: none; letter-spacing: 0;
}
.age-badge:empty { display: none; }

/* ------------------------------------------------------------ branding */

.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark { height: 36px; width: auto; display: block; }
.auth-logo { display: block; width: 100%; max-width: 250px; margin: -6px auto 12px; }

/* ------------------------------------------------- lesson plan print grid */

.print-only { display: none; }

.plan-grid { width: 100%; border-collapse: collapse; margin-bottom: 14px; table-layout: fixed; }
.plan-grid th {
  background: var(--accent-tint); border: 1px solid #e3b7bd; padding: 5px 8px;
  font-size: 12px; text-align: left;
}
.plan-grid th span { display: block; font-weight: 500; font-size: 10.5px; color: var(--ink-soft); }
.plan-grid td { border: 1px solid #d8cfe4; padding: 6px 8px; vertical-align: top; width: 20%; }
.plan-item { margin-bottom: 7px; font-size: 11px; line-height: 1.35; }
.plan-item b { display: block; font-size: 11.5px; }
.plan-item span { display: block; }
.plan-item em { display: block; font-style: normal; color: var(--ink-soft); font-size: 10px; }
.plan-item.done b::after { content: " ✓"; color: #0f6d4c; }
.plan-empty { color: var(--ink-soft); }

@media print {
  .printing-lessons .view[data-view="lessons"] { display: none !important; }
  .printing-lessons .print-only { display: block; }
  #lessonPrintSheet, #lessonPrintSheet * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .plan-item.done b::after { color: #0f6d4c; }
}

.qa-grid {
  display: grid; gap: 12px; align-items: end;
  grid-template-columns: minmax(170px, 1.6fr) 110px 110px 160px 150px 130px auto;
}
@media (max-width: 1000px) { .qa-grid { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 620px)  { .qa-grid { grid-template-columns: 1fr; } }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check-row input { width: auto; }
.plan-item b i { font-style: normal; font-weight: 600; color: var(--ink-soft); font-size: 10px; }
.tickbox {
  display: inline-block; width: 9px; height: 9px; margin-right: 5px;
  border: 1px solid var(--ink-soft); border-radius: 2px; vertical-align: 0;
}
.plan-item.done .tickbox { background: var(--success); border-color: var(--success); }

.day-block {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px;
  background: var(--peri); border: 1px solid #b9d4fb; border-radius: 9px;
  padding: 9px 13px; font-size: 14px;
}
.day-block b { font-size: 14.5px; }
.day-block span { color: var(--ink-soft); font-size: 12.5px; }
.plan-block {
  background: var(--peri); border-radius: 4px; padding: 3px 5px;
  margin-bottom: 6px; font-size: 10.5px;
}

/* ------------------------------------------- attendance year, one sheet */

.ap-year { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; }
.ap-month { break-inside: avoid; }
.ap-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--line); padding-bottom: 2px; margin-bottom: 3px;
}
.ap-head b { font-size: 11px; }
.ap-head span { font-size: 10px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.ap-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.ap-dow { font-size: 7.5px; font-weight: 700; color: var(--ink-soft); text-align: center; }
.ap-day {
  font-size: 8.5px; text-align: center; padding: 2px 0; border-radius: 3px;
  font-variant-numeric: tabular-nums; line-height: 1.25;
}
.ap-day.is-on { background: var(--success); font-weight: 700; }
.ap-day.is-pad { visibility: hidden; }

@media print {
  .printing-attendance .view[data-view="attendance"] { display: none !important; }
  .printing-attendance .print-only { display: block; }
  #attPrintSheet, #attPrintSheet * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #attPrintSheet .ap-year { gap: 8px 12px; }
}

/* Tick box sits beside the work, not above it. */
.plan-item { display: flex; gap: 5px; align-items: flex-start; }
.plan-item .tickbox { flex: 0 0 auto; margin-top: 3px; }
.plan-text { flex: 1; min-width: 0; }
.plan-item.done b::after { content: " ✓"; color: #0f6d4c; }

@media print {
  /* Two weeks means two week-rows on one page, so everything tightens up. */
  #lessonPrintSheet.range-2weeks .plan-grid th { font-size: 10px; padding: 3px 5px; }
  #lessonPrintSheet.range-2weeks .plan-grid td { padding: 4px 5px; }
  #lessonPrintSheet.range-2weeks .plan-item { font-size: 9.5px; margin-bottom: 4px; }
  #lessonPrintSheet.range-2weeks .plan-item b { font-size: 10px; }
  #lessonPrintSheet.range-2weeks .plan-item em { font-size: 8.5px; }
  #lessonPrintSheet.range-2weeks .plan-grid { margin-bottom: 8px; }
  #lessonPrintSheet.range-2weeks { font-size: 10px; }
}

/* ------------------------------------------------- week grid for planning */

.pw-grid { width: 100%; border-collapse: separate; border-spacing: 3px; min-width: 720px; }
.pw-grid th, .pw-grid td { vertical-align: top; }
.pw-corner { width: 150px; }
.pw-grid thead th {
  background: var(--line-soft); border-radius: 9px; padding: 7px 9px;
  font-size: 12px; font-weight: 700; text-align: left; line-height: 1.3;
}
.pw-grid thead th.is-today { background: var(--accent-tint); box-shadow: inset 0 0 0 1.5px var(--accent); }
.pw-grid thead th span { display: block; font-weight: 500; font-size: 10.5px; color: var(--ink-soft); }
.pw-grid thead th em {
  display: block; font-style: normal; font-size: 10px; font-weight: 700;
  color: #2c4a86; background: var(--peri); border-radius: 4px; padding: 1px 5px; margin-top: 3px;
}
.pw-subject {
  background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px; font-size: 13px; font-weight: 650; text-align: left;
}
.pw-subject span { display: block; font-weight: 500; font-size: 11px; color: var(--ink-soft); }
.pw-grid td {
  background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  padding: 7px; cursor: pointer; min-height: 46px; transition: border-color .1s, background .1s;
}
.pw-grid td:hover { border-color: var(--accent); background: var(--accent-tint); }
.pw-grid td.is-today { border-color: var(--accent); }
.pw-grid td.is-gap { background: #fbf9fd; border-style: dashed; }
.pw-item {
  display: block; font-size: 12px; padding: 2px 0; line-height: 1.35;
}
.pw-item.done { color: var(--ink-soft); text-decoration: line-through; }
.pw-add { color: #c9c1d8; font-size: 17px; font-weight: 700; }
.pw-grid td:hover .pw-add { color: var(--accent); }
