/* exam.4ab.in — Homework Checker (app/homework.html), BRIEF-5-F3.
   Loads after tokens.css, app.css and check.css — reuses their classes
   (.card, .btn, .chip, .inp, .chk-*, .stats/.stat, .actions, .note) wherever
   they already say what is needed, and only adds new rules under the `.hw-`
   prefix so nothing here can collide with either sheet. Every colour is a
   token, same rule as the rest of the site, so light/dark both work with
   nothing new to define here. */

body { background: var(--bg); color: var(--body); }

.hw-shell { max-width: 980px; margin: 0 auto; padding: 10px 18px 28px; flex: 1 0 auto; width: 100%; box-sizing: border-box; }

/* Sticky footer for this page only (task 4): body becomes a flex column so
   the credit bar sits at the bottom of the viewport on a short page and
   directly after the content on a long one. Scoped to .ex-p-homework so no
   other page's layout changes. script tags are UA display:none and do not
   participate in the flex layout, so this is safe with the tag order in
   homework.html. */
body.ex-p-homework { display: flex; flex-direction: column; min-height: 100vh; }
body.ex-p-homework .ab-credit { flex: 0 0 auto; margin-top: 0; }
body.ex-p-homework #hwTabBar { flex: 0 0 auto; }
body.ex-p-homework #hwAnalyzeRoot { flex: 1 0 auto; width: 100%; box-sizing: border-box; }

/* Tighten the shared hero on this page only (not editing app-ab.css) — less
   dead space above the tabs/panel. */
body.ex-p-homework .ex-hero { margin: 10px auto 4px; }

.hw-honest {
  margin: 0 0 16px; padding: 11px 14px; border-radius: var(--r-md);
  background: var(--chip-bg); border: 1px solid var(--chip-line);
  font-size: 13px; color: var(--body);
}

/* ---------------------------------------------------------- paper source */
.hw-src-row { display: flex; flex-wrap: wrap; gap: 14px 20px; }
.hw-src-row .check { font-size: 13.5px; }

/* -------------------------------------------------------------- per-card */
.hw-q { padding: 14px 16px 16px; margin-bottom: 14px; }
.hw-crop { margin-top: 4px; }

.hw-kindtoggle { display: flex; margin: 10px 0; font-size: 12.5px; color: var(--muted); }

.hw-written { margin-top: 10px; }
.hw-ta {
  width: 100%; min-height: 110px; padding: 9px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--card-2); color: var(--ink);
  font: inherit; resize: vertical;
}
.hw-ta:focus { border-color: var(--focus); }
.hw-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.hw-ai-out:empty { display: none; }

.hw-unscored { margin-top: 10px; }
.hw-manual-wrap { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.hw-manual-wrap[hidden] { display: none; }
.hw-manual-wrap .inp { max-width: 140px; }

@media (max-width: 760px) {
  .hw-shell { padding: 12px 12px 48px; }
  .hw-row { flex-direction: column; align-items: stretch; }
}

/* ------------------------------------------------------------------ print */
@media print {
  .hw-honest, .noprint, .chk-noprint { display: none !important; }
  .hw-shell { max-width: none; padding: 0; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ---------------------------------------------------- Phase-1 analyse tab
   (homework-analyze.js). Own `.hw-a-` prefix, same rule as the rest of this
   file — nothing here collides with the teacher-batch flow's classes. */
.hw-a-tabs { max-width: 980px; margin: 0 auto; padding: 0 18px; display: flex; gap: 8px; }
.hw-a-tab {
  padding: 9px 16px; border-radius: var(--r-sm) var(--r-sm) 0 0; border: 1px solid var(--line);
  border-bottom: none; background: var(--card-2); color: var(--muted); font: inherit; cursor: pointer;
}
.hw-a-tab.active { background: var(--card); color: var(--ink); font-weight: 600; }

.hw-a-card { padding: 16px; }
.hw-a-filelist { margin: 8px 0; padding-left: 18px; font-size: 13px; }
.hw-a-file { color: var(--body); }
.hw-a-err {
  margin-top: 10px; padding: 9px 12px; border-radius: var(--r-sm);
  /* --danger-bg / --danger-ink DO NOT EXIST in this project's token set
     (checked 2026-09-12), so those fallbacks fired on every theme and painted a
     DARK red box in light mode. This is the same recipe .chip--bad already uses
     in app-ab.css, and --red is theme-aware. */
  background: rgba(192, 51, 43, .10);
  border: 1px solid rgba(192, 51, 43, .32);
  color: var(--red);
  font-size: 13px;
}
.hw-a-note {
  margin: 0 0 10px; padding: 9px 12px; border-radius: var(--r-sm);
  background: var(--chip-bg); border: 1px solid var(--chip-line); font-size: 12.5px; color: var(--muted);
}
.hw-a-total { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.hw-a-review { font-size: 11.5px; color: var(--muted); }
.hw-a-table td { vertical-align: top; }
.hw-a-easy td:first-child { border-left: 3px solid var(--green); }
.hw-a-hard td:first-child { border-left: 3px solid var(--amber); }
.hw-a-veryhard td:first-child { border-left: 3px solid var(--red); }

/* ---------------------------------------------------- Upload rebuild (2026-09-12)
   Two upload slots + a sticky live-price side panel, own `.hw-a-` prefix
   (as before). Everything is a token, so light/dark both work with nothing
   new to define. Scoped so it cannot collide with app.css/check.css/app-ab.css. */

.hw-a-wrap { padding-top: 4px; }

.hw-a-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}
.hw-a-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }

.hw-a-slot { padding: 14px 16px; }
.hw-a-slothint { margin: 0 0 10px; font-size: 12.5px; }

.hw-a-filelist { margin: 8px 0 0; padding-left: 0; list-style: none; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.hw-a-file {
  color: var(--body); display: flex; align-items: center; gap: 8px;
  padding: 4px 8px; border-radius: var(--r-sm); background: var(--card-2);
}
.hw-a-rm {
  margin-left: auto; border: none; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 13px; line-height: 1; padding: 2px 4px; border-radius: 4px;
  min-width: 24px; min-height: 24px;
}
.hw-a-rm:hover, .hw-a-rm:focus { color: var(--ink); background: var(--chip-bg); }

/* NOT sticky. A sticky box that is TALLER than the viewport never unpins, so
   it kept scrolling over the File guidelines card beneath it — the overlapping
   text in the owner's screenshot, 2026-09-12. The panel grows as stages,
   quote, tick list and price band are added, so it will always outgrow a short
   window; plain flow is the only version that cannot collide. */
.hw-a-price {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hw-a-stages { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.hw-a-stage {
  font-size: 12px; color: var(--muted); padding: 3px 8px; border-radius: var(--r-sm);
  border-left: 3px solid transparent;
}
.hw-a-stage-done { color: var(--body); border-left-color: var(--green); }
.hw-a-stage-cur { color: var(--ink); font-weight: 600; border-left-color: var(--focus); background: var(--chip-bg); }
.hw-a-waitnote { margin: 4px 0 10px; font-size: 12px; }

.hw-a-est { margin: 0 0 4px; font-size: 15.5px; }
.hw-a-confirmed { color: var(--ink); }
.hw-a-estnote { margin: 0 0 10px; font-size: 12px; }
.hw-a-pdfnote { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.hw-a-caps { margin: 10px 0 0; font-size: 11.5px; }

@media (max-width: 900px) {
  .hw-a-grid { grid-template-columns: 1fr; }
  .hw-a-price { position: static; order: -1; }
}

@media (max-width: 760px) {
  .hw-a-grid { gap: 12px; }
  .hw-a-slot { padding: 12px; }
}

/* Tap targets (measured on a real 375px viewport 2026-09-12: the remove ✕ was
   24px, "Get exact price" 41px, the tabs 43px — all under the 44px minimum this
   project holds itself to). Applied at touch widths only, so the desktop
   density is unchanged. */
@media (max-width: 900px) {
  .hw-a-rm { min-width: 44px; min-height: 44px; font-size: 15px; }
  .hw-a-tab { min-height: 44px; }
  .hw-a-wrap .btn { min-height: 44px; }
  /* The native file input is not itself the tap target — its own "Choose files"
     button is, and the browser sizes that. Left alone deliberately. */
}

/* ------------------------------------------------ Upload step, layout v2
   (2026-09-12) The two-slot + sidebar shell rebuilt to the owner's layout:
   a 4-step rail, two large drop panels, an Advanced Options card, and a side
   column holding the live price estimate above the file guidelines.
   Every colour is a token, so light and dark both work with nothing extra. */

/* --- step rail --- */
.hw-a-steps {
  list-style: none; margin: 0 0 16px; padding: 14px 16px;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
}
.hw-a-step { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.hw-a-stepn {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 700;
  background: var(--chip-bg); color: var(--muted); border: 1px solid var(--chip-line);
}
.hw-a-step.is-cur .hw-a-stepn { background: var(--focus); color: #fff; border-color: var(--focus); }
.hw-a-step.is-done .hw-a-stepn { background: var(--green); color: #fff; border-color: var(--green); }
.hw-a-steptx { min-width: 0; display: flex; flex-direction: column; }
.hw-a-steptx b { font-size: 13.5px; color: var(--muted); }
.hw-a-steptx i { font-style: normal; font-size: 11.5px; color: var(--muted); }
.hw-a-step.is-cur .hw-a-steptx b, .hw-a-step.is-done .hw-a-steptx b { color: var(--ink); }

/* --- side column --- */
.hw-a-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* --- upload slots --- */
.hw-a-slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hw-a-slot {
  text-align: center; padding: 20px 16px;
  border: 1px dashed var(--line); background: var(--card-2);
  transition: border-color .15s, background .15s;
}
.hw-a-slot.is-drag { border-color: var(--focus); background: var(--chip-bg); }
.hw-a-slot--answer { border-color: rgba(31, 122, 63, .34); }
.hw-a-slot-icon {
  width: 44px; height: 44px; margin: 0 auto 8px; border-radius: 12px;
  display: grid; place-items: center; font-size: 20px;
  background: var(--chip-bg); border: 1px solid var(--chip-line);
}
.hw-a-slot-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.hw-a-opt { font-weight: 400; color: var(--muted); }
.hw-a-slot .hw-a-slothint { margin: 4px 0 12px; font-size: 12.5px; }
/* Visually hidden, NOT display:none — a hidden input cannot be focused, and
   the <label for> + keyboard path depends on it still being focusable. */
.hw-a-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.hw-a-choose { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 40px; }
.hw-a-slot--answer .hw-a-choose { background: var(--green); border-color: var(--green); color: #fff; }
.hw-a-drop { margin: 10px 0 4px; font-size: 12.5px; }
.hw-a-slotcaps { margin: 0; font-size: 11.5px; }
.hw-a-slot .hw-a-filelist { margin-top: 10px; text-align: left; }

.hw-a-tip {
  margin: 12px 0 0; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--chip-bg); border: 1px solid var(--chip-line);
  font-size: 12.5px; color: var(--body);
}

/* --- advanced options --- */
.hw-a-adv { margin-top: 12px; padding: 14px 16px; }
.hw-a-advhead { display: flex; align-items: center; gap: 12px; }
.hw-a-advhead > div:nth-child(2) { flex: 1 1 auto; min-width: 0; }
.hw-a-advhead .hw-a-slothint { margin: 2px 0 0; }
.hw-a-advicon, .hw-a-guideicon, .hw-a-priceicon {
  width: 34px; height: 34px; margin: 0; font-size: 16px; border-radius: 10px;
}
.hw-a-advtoggle { min-height: 36px; }
.hw-a-advgrid {
  margin-top: 14px; display: grid; gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.hw-a-advcol {
  min-width: 0; padding: 12px; border-radius: var(--r-sm);
  background: var(--card-2); border: 1px solid var(--line);
}
.hw-a-advcol .flabel { margin-bottom: 8px; }
.hw-a-radio { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; cursor: pointer; }
.hw-a-radio.is-off { opacity: .55; cursor: not-allowed; }
.hw-a-advnote {
  grid-column: 1 / -1; margin: 0; padding: 9px 12px; border-radius: var(--r-sm);
  background: var(--chip-bg); border: 1px solid var(--chip-line);
  font-size: 12px; color: var(--muted);
}

/* --- tick lists (price "what we'll do" + guidelines) --- */
.hw-a-ticks { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hw-a-ticks li { position: relative; padding-left: 22px; font-size: 12.5px; color: var(--body); }
.hw-a-ticks li::before {
  content: '\2713'; position: absolute; left: 0; top: 0;
  color: var(--green); font-weight: 700;
}
.hw-a-guide { padding: 14px 16px; }
.hw-a-guidehead { display: flex; align-items: center; gap: 10px; }

.hw-a-pricenote {
  margin-top: 12px; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--chip-bg); border: 1px solid var(--chip-line);
  display: flex; flex-direction: column; gap: 4px;
}
.hw-a-pricenote b { font-size: 12.5px; color: var(--ink); }
.hw-a-pricenote span { font-size: 11.5px; color: var(--muted); }

/* --- next button --- */
.hw-a-golane { margin-top: 14px; }
.hw-a-next { flex: 1 1 auto; min-height: 48px; font-size: 15px; justify-content: center; }
.hw-a-nextarrow { margin-left: 8px; }

@media (max-width: 900px) {
  .hw-a-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hw-a-advgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .hw-a-slots { grid-template-columns: 1fr; }
  .hw-a-steps { grid-template-columns: 1fr; gap: 8px; }
  .hw-a-advgrid { grid-template-columns: 1fr; }
}

/* Compact page header that replaced the hero on the tool pages (2026-09-12).
   Lives here because both homework.html and check.html load this sheet via the
   app bundle; it is deliberately plain — a working page earns attention with
   the work, not with a banner. */
.ex-phead { margin: 14px auto 12px; }
.ex-phead h1 {
  margin: 0; font-size: 24px; line-height: 1.2; color: var(--ink);
  font-family: var(--font-display, Georgia, serif); font-weight: 700;
}
.ex-phead p { margin: 6px 0 0; max-width: 78ch; font-size: 13.5px; color: var(--muted); }
@media (max-width: 760px) {
  .ex-phead { margin: 10px auto 8px; padding-inline: 12px; }
  .ex-phead h1 { font-size: 20px; }
}
