/* MTM Inventory — every colour is a token. No literals below the token blocks. */

:root {
  /* Brand. Georgia State blue, constant across themes. */
  --mtm-blue: #0039A6;
  --mtm-blue-ink: #ffffff;
  --mtm-blue-hover: #002d85;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eceef2;
  --ink: #14171c;
  --ink-2: #3d4450;
  --ink-3: #59606d;
  --line: #d7dbe2;
  --line-strong: #b6bcc7;
  --accent: #0039A6;
  --accent-ink: #ffffff;
  --accent-soft: #e4ebfa;
  --good: #1c6b3f;
  --good-soft: #dff0e5;
  --warn: #8a5300;
  --warn-soft: #fbeed5;
  --danger: #a3231f;
  --danger-soft: #fbe3e2;
  --shadow: 0 1px 2px rgba(20, 23, 28, .09), 0 6px 18px rgba(20, 23, 28, .06);

  --radius: 10px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

/* Dark tokens are defined once, as a redefinition of tokens that already exist
   in :root. A palette written twice drifts, and then it is wrong only for
   system-default users — now the majority path. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101318;
    --surface: #191d24;
    --surface-2: #222831;
    --ink: #eef1f5;
    --ink-2: #c2cad5;
    --ink-3: #9aa4b2;
    --line: #2c333d;
    --line-strong: #3d4550;
    --accent: #6c9bff;
    --accent-ink: #0b0f15;
    --accent-soft: #1b2740;
    --good: #6cd39a;
    --good-soft: #12291d;
    --warn: #e8b563;
    --warn-soft: #2c2213;
    --danger: #f08b86;
    --danger-soft: #2e1817;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

:root[data-theme="dark"] {
  --bg: #101318;
  --surface: #191d24;
  --surface-2: #222831;
  --ink: #eef1f5;
  --ink-2: #c2cad5;
  --ink-3: #9aa4b2;
  --line: #2c333d;
  --line-strong: #3d4550;
  --accent: #6c9bff;
  --accent-ink: #0b0f15;
  --accent-soft: #1b2740;
  --good: #6cd39a;
  --good-soft: #12291d;
  --warn: #e8b563;
  --warn-soft: #2c2213;
  --danger: #f08b86;
  --danger-soft: #2e1817;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

.topbar {
  background: var(--mtm-blue);
  color: var(--mtm-blue-ink);
  padding: 12px 16px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.wordmark { font-weight: 700; letter-spacing: .01em; }
.brand-ver { font-family: var(--mono); font-size: 12px; opacity: .8; }
.topbar .spacer { flex: 1; }

.wrap { max-width: 900px; margin: 0 auto; padding: 16px 16px 64px; }
.phone { max-width: 520px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

h1 { font-size: 22px; margin: 4px 0 2px; }
h2 { font-size: 16px; margin: 0 0 10px; }
p { line-height: 1.5; color: var(--ink-2); }
.muted { color: var(--ink-3); font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12px; }

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 12px 16px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn:hover { border-color: var(--ink-3); }
.btn-primary { background: var(--mtm-blue); color: var(--mtm-blue-ink); border-color: var(--mtm-blue); }
.btn-primary:hover { background: var(--mtm-blue-hover); }
.btn-huge { display: block; width: 100%; padding: 22px 16px; font-size: 19px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-small { padding: 7px 11px; font-size: 13px; }

.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
}
.pill-good { background: var(--good-soft); color: var(--good); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }

.progress-rail { display: flex; gap: 4px; margin: 10px 0 16px; }
.progress-rail button {
  flex: 1; height: 5px; border-radius: 3px; background: var(--line);
  border: 0; padding: 0; cursor: pointer;
  /* A bigger invisible target than the 5px bar, so a thumb can hit it. */
  background-clip: content-box; padding-block: 10px; box-sizing: content-box; margin-block: -10px;
}
.progress-rail button.done { background-color: var(--good); }
.progress-rail button.flagged { background-color: var(--warn); }
.progress-rail button.here { background-color: var(--accent); }
.rack-nav { display: flex; justify-content: space-between; gap: 8px; margin: -4px 0 12px; }
.rack-nav .btn:disabled { opacity: .4; }

.photo-frame {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 18px;
  margin-bottom: 12px;
  overflow: hidden;
}
.photo-frame img { width: 100%; height: 100%; object-fit: contain; }
/* A blank frame reads as "nothing should be here", so the empty state speaks. */
.photo-frame.empty { border-style: dashed; border-color: var(--line-strong); }
.photo-frame.empty p { margin: 0; color: var(--ink-2); font-size: 14px; }

.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.item-list li:last-child { border-bottom: 0; }
.item-name { flex: 1; }
.item-name small { display: block; color: var(--ink-3); font-family: var(--mono); font-size: 11px; }

.notice {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 14px;
}
.notice-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.notice-good { background: var(--good-soft); color: var(--good); border-color: var(--good); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-3); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.table-scroll { overflow-x: auto; }

.stat-row { display: flex; gap: 12px; flex-wrap: wrap; }
.stat {
  flex: 1 1 150px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.stat b { display: block; font-size: 26px; line-height: 1.1; }
.stat span { color: var(--ink-3); font-size: 13px; }

textarea, input[type="text"] {
  font: inherit; width: 100%; padding: 10px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}

.footer { text-align: center; color: var(--ink-3); font-size: 12px; padding: 24px 0; }

/* ---------- room -> part -> rack (v0.26.0) ---------- */
.crumb { color: var(--ink-3); font-size: 13px; margin: 0 0 2px; }
.crumb button { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.picks { list-style: none; margin: 0; padding: 0; }
.picks li button {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 13px 10px; border: 0; border-bottom: 1px solid var(--line); background: none;
  color: var(--ink); font: inherit; text-align: left; border-radius: 8px; cursor: pointer;
}
.picks li:last-child button { border-bottom: 0; }
.picks li.suggested button { background: var(--accent-soft); }
.pick-name { font-size: 16px; font-weight: 600; }
.pick-sub { display: block; font-size: 13px; color: var(--ink-3); font-weight: 400; }
.chev { color: var(--line-strong); font-size: 20px; flex: 0 0 auto; }
.gallery {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory;
  margin-bottom: 8px; padding-bottom: 4px;
}
.gallery figure { flex: 0 0 88%; margin: 0; scroll-snap-align: start; }
.gallery figure:only-child { flex-basis: 100%; }
.gallery figure { display: flex; flex-direction: column; }
/* Students must see the whole rack without tapping: never crop, let the photo keep its own shape. */
.gallery img {
  width: 100%; height: auto; max-height: 75vh; object-fit: contain; display: block;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2);
}
.gallery figcaption { font-size: 12px; color: var(--ink-3); margin-top: 3px;
  display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.gallery .turns { display: flex; align-items: center; gap: 6px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.thumb { position: relative; width: 84px; }
.thumb img { width: 84px; height: 63px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.thumb small { display: block; font-size: 11px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone {
  border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 10px 12px;
  margin: 8px 0 14px; background: var(--surface-2);
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone h3 { margin: 0; font-size: 15px; }
.rack-row { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
