/* ==========================================================================
   "My classroom tab" — page-specific components
   Loaded ONLY by /playground/classroom-tab/, after calstrs.css (which supplies
   the shared calculator pieces: .calc-card, .segmented, .result/.hero,
   .stats, .warn, the disclaimer). main.css is never modified.

   Every colour is a main.css token. Light mode only, like calstrs.css.
   Amber TEXT uses --amber-text; --amber is graphics-only.
   ========================================================================== */

@layer components {

  .t-hero { padding-block: var(--s4) 0; }
  .t-subtitle {
    margin: 4px 0 0; font-family: var(--serif); font-style: italic; font-weight: 400;
    font-size: clamp(1.125rem, 2vw, 1.375rem); line-height: 1.3; color: var(--ink-soft);
  }
  .t-private {
    margin: var(--s2) 0 0; max-width: 66ch; font-size: var(--fs-small); color: var(--ink-soft);
  }
  .t-private strong { color: var(--emerald); }
  .t-storagewarn {
    margin: var(--s1) 0 0; padding: 10px 14px; border-radius: 9px; max-width: 66ch;
    background: var(--amber-soft); color: var(--ink); font-size: var(--fs-small);
  }
  .t-storagewarn[hidden] { display: none; }
  .t-body { padding-top: var(--s3); }
  .t-opt { font-weight: 400; color: var(--ink-soft); font-size: var(--fs-eyebrow); }
  .t-lbl {
    display: block; font-size: var(--fs-small); font-weight: 700;
    color: var(--ink); margin-bottom: 5px;
  }

  /* ── quick add ────────────────────────────────────────────────────── */
  .t-add { display: grid; gap: var(--s2); max-width: 640px; margin-top: 0; }
  .t-add.editing { border-left: 5px solid var(--amber); }
  .calc-body .t-cardtitle {
    margin: 0; font-family: var(--serif); font-weight: 400;
    font-size: clamp(1.375rem, 2vw, 1.625rem);
  }
  .calc-body .t-add input[type="text"],
  .calc-body .t-add input[type="date"],
  .calc-body .t-picker select {
    width: 100%; min-height: 44px; padding: 9px 11px; font-size: 1rem;
    font-family: var(--sans); color: var(--ink);
    background: var(--paper); border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
  }
  .calc-body .t-add input:focus-visible,
  .calc-body .t-picker select:focus-visible {
    outline: 2px solid var(--emerald); outline-offset: 1px;
  }
  .t-amount {
    display: flex; align-items: center; gap: 6px;
    background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-sm);
    padding: 0 14px;
  }
  .t-amount:focus-within { outline: 2px solid var(--emerald); outline-offset: 1px; }
  .t-amount span {
    font-family: var(--mono); font-size: 2rem; font-weight: 500; color: var(--ink-soft);
  }
  .calc-body .t-add .t-amount input[type="text"] {
    border: 0; background: transparent; padding: 8px 0; min-height: 64px;
    font-family: var(--mono); font-size: 2.25rem; font-weight: 500;
    letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  }
  .calc-body .t-add .t-amount input[type="text"]:focus-visible { outline: none; }
  .t-err { display: block; font-size: var(--fs-small); color: #A1302A; min-height: 0; }
  .t-err:empty { display: none; }
  .t-invalid { border-color: #A1302A !important; }

  .t-chips { border: 0; margin: 0; padding: 0; min-width: 0; }
  .t-chips legend {
    padding: 0; font-size: var(--fs-small); font-weight: 700; color: var(--ink); margin-bottom: 6px;
  }
  .t-chips > div { display: flex; flex-wrap: wrap; gap: 8px; }
  .t-chip { position: relative; }
  .t-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; pointer-events: none; }
  .t-chip span {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
    font-size: .9375rem; font-weight: 700; color: var(--ink-soft);
    background: #fff; border: 1px solid var(--rule); border-radius: 999px; cursor: pointer;
    user-select: none;
  }
  .t-chip span:hover { border-color: var(--emerald-bright); }
  .t-chip input:checked + span { background: var(--emerald); border-color: var(--emerald); color: #fff; }
  .t-chip input:focus-visible + span { outline: 2px solid var(--emerald); outline-offset: 2px; }

  .t-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s2); }
  .t-addbtns { display: flex; flex-wrap: wrap; gap: var(--s1); }
  .t-addbtns [hidden], .t-empty [hidden] { display: none; }
  .t-submit { flex: 1 1 auto; justify-content: center; font-size: 1.0625rem; }
  @media (max-width: 420px) { .t-pair { grid-template-columns: minmax(0, 1fr); } }

  /* ── the school year ──────────────────────────────────────────────── */
  .t-yearhead {
    display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between;
    gap: var(--s1) var(--s3); margin-top: var(--s8);
  }
  .calc-body .t-yearhead h2 { margin: 0; }
  .t-picker { min-width: 170px; }
  .t-sample {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2);
    margin-top: var(--s3); padding: 12px 16px; border-radius: var(--radius-sm);
    background: var(--amber-soft); border-left: 4px solid var(--amber);
  }
  .t-sample[hidden] { display: none; }
  .t-sample p { margin: 0; flex: 1 1 260px; font-size: var(--fs-small); color: var(--ink); }
  .t-sample .btn { min-height: 44px; padding: 8px 18px; font-size: var(--fs-small); background: #fff; }
  .t-result.is-sample { border-left-color: var(--amber); }
  /* main.css's homepage .hero adds section padding; the total doesn't want it */
  .t-result .hero { padding-block: 0; overflow: visible; overflow-wrap: anywhere; }
  .t-fun { margin: var(--s1) 0 0; font-size: 1rem; color: var(--ink-soft); font-style: italic; }
  .t-fun:empty { display: none; }
  .t-biggestwhat {
    font-size: var(--fs-small); color: var(--ink-soft); overflow-wrap: anywhere;
  }
  .t-empty { text-align: left; }
  .t-empty[hidden], .t-charts[hidden], .t-listcard[hidden] { display: none; }
  .t-empty p { color: var(--ink-soft); }

  .t-charts {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 var(--s3);
  }
  .t-charts .calc-card { padding: var(--s3); min-width: 0; }
  .calc-body .t-charts h3, .calc-body .t-listcard h3, .calc-body .t-export h3 { margin-top: 0; }
  .t-cats { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
  .t-cats li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; font-size: var(--fs-small); }
  .t-cats .nm { color: var(--ink); font-weight: 700; }
  .t-cats .v { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); text-align: right; }
  .t-cats .v small { color: var(--ink-soft); margin-left: 6px; }
  .t-cats .bar { grid-column: 1 / -1; height: 10px; border-radius: 5px; background: var(--paper-deep); overflow: hidden; }
  .t-cats .bar i { display: block; height: 100%; background: var(--emerald-bright); border-radius: 5px; }
  .t-cats li.zero .nm, .t-cats li.zero .v { color: var(--ink-soft); font-weight: 400; }

  .t-months {
    display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px;
    align-items: end; height: 190px; padding-top: 18px;
  }
  .t-mo { display: grid; grid-template-rows: 1fr auto; height: 100%; min-width: 0; }
  .t-mo .col { position: relative; display: flex; align-items: flex-end; border-bottom: 1px solid var(--rule); }
  .t-mo .col i {
    display: block; width: 100%; min-height: 0; background: var(--emerald);
    border-radius: 4px 4px 0 0;
  }
  .t-mo.peak .col i { background: var(--amber); }
  .t-mo .col b {
    position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap;
    font-family: var(--mono); font-size: .6875rem; font-weight: 500; color: var(--ink-soft);
  }
  .t-mo .lb {
    text-align: center; font-family: var(--mono); font-size: .6875rem; color: var(--ink-soft);
    padding-top: 4px;
  }
  .t-monthnote { margin: var(--s1) 0 0; }

  .t-list { list-style: none; margin: 0; padding: 0; }
  .t-list li {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--s2);
    padding: 12px 0; border-top: 1px solid var(--rule-soft); align-items: center;
  }
  .t-list .what { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
  .t-list .meta { font-size: var(--fs-small); color: var(--ink-soft); overflow-wrap: anywhere; }
  .t-list .amt {
    font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums;
    color: var(--ink); text-align: right;
  }
  .t-list .acts { grid-column: 1 / -1; display: flex; gap: var(--s1); }
  .t-list .acts button, .t-linkbtn {
    font: inherit; font-size: var(--fs-small); font-weight: 700; color: var(--emerald);
    background: none; border: 0; padding: 0 4px; min-height: 36px; cursor: pointer;
    text-decoration: underline; text-underline-offset: 2px;
  }
  .t-list .tag {
    display: inline-block; font-size: .6875rem; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; color: var(--amber-text); border: 1px solid var(--amber);
    border-radius: 999px; padding: 0 7px; margin-left: 6px; vertical-align: 2px;
  }
  .t-more { margin-top: var(--s1); }
  @media (min-width: 700px) {
    .t-list li { grid-template-columns: minmax(0, 1fr) auto auto; }
    .t-list .acts { grid-column: auto; }
  }

  /* ── tax time ─────────────────────────────────────────────────────── */
  .t-tax { max-width: 76ch; }
  .t-taxcard { display: grid; gap: var(--s2); }
  .t-taxcard .t-picker { max-width: 360px; }
  .calc-prose .t-taxline { margin: 0; font-size: 1.0625rem; color: var(--ink); }
  .t-taxline b { font-family: var(--mono); font-variant-numeric: tabular-nums; }
  .t-taxcard .calc-note { margin: 0; }

  /* ── exports ──────────────────────────────────────────────────────── */
  .t-export { display: grid; gap: var(--s1); }
  .calc-body .t-export h3 { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--rule-soft); }
  .t-export .segmented { justify-self: start; }
  .t-btnrow { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s1); }
  .t-btnrow .btn { font-size: .9375rem; }
  .calc-body label.t-filebtn {
    display: inline-flex; margin: 0; font-size: .9375rem; font-weight: 600; cursor: pointer;
  }
  #restoreFile:focus-visible + * { outline: 2px solid var(--emerald); }
  .t-filebtn:focus-within { outline: 2px solid var(--emerald); outline-offset: 2px; }
  .t-msg { margin: var(--s1) 0 0; font-size: var(--fs-small); color: var(--ink); }
  .t-msg:empty { display: none; }
  .t-msg.bad { color: #A1302A; }

  /* ── undo toast ───────────────────────────────────────────────────── */
  .t-toast {
    position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: max-content; max-width: calc(100vw - 32px);
    display: flex; align-items: center; gap: var(--s2);
    padding: 8px 8px 8px 18px; border-radius: 999px;
    background: var(--ink); color: var(--paper-on-ink); font-size: .9375rem;
    box-shadow: var(--shadow-2);
  }
  .t-toast[hidden] { display: none; }
  .t-toast span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .t-toast button {
    flex: none; font: inherit; font-weight: 700; color: var(--ink);
    background: var(--paper-on-ink); border: 0; border-radius: 999px;
    min-height: 40px; padding: 0 16px; cursor: pointer;
  }
  .t-toast button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

  .t-print { display: none; }

  @media print {
    @page { margin: 14mm; }
    body { background: #fff; padding: 0; }
    body > *:not(main), main > *:not(.t-print) { display: none !important; }
    .t-print { display: block; color: #000; font-family: var(--sans); font-size: 10.5pt; }
    .t-print h1 { font-family: var(--serif); font-size: 20pt; margin: 0 0 2pt; }
    .t-print .sub { margin: 0 0 10pt; color: #333; }
    .t-print table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
    .t-print th, .t-print td { text-align: left; padding: 4pt 6pt; border-bottom: .5pt solid #bbb; vertical-align: top; }
    .t-print th { font-size: 8.5pt; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1pt solid #000; }
    .t-print .num { text-align: right; white-space: nowrap; }
    .t-print td.date { white-space: nowrap; }
    .t-print tfoot td { font-weight: 700; border-bottom: 0; border-top: 1pt solid #000; }
    .t-print thead { display: table-header-group; }
    .t-print tr { break-inside: avoid; }
    .t-print h2 { font-family: var(--sans); font-size: 11pt; font-weight: 700; margin: 14pt 0 4pt; }
    .t-print .totals { width: auto; min-width: 50%; }
    .t-print .foot { margin-top: 12pt; font-size: 8.5pt; color: #444; }
  }
}
