/* Brand: Big Brothers Pawn red on white. One light theme everywhere (no dark mode), so
   sheets and packets look the same on every phone, screen and printer. Rating colours
   (green / yellow / red chips) always sit beside a number or label (SPEC 9). */
:root {
  --bg: #ffffff;
  --card: #ffffff;
  --ink: #1d1a1a;
  --muted: #6b6264;
  --line: #ecdfe1;
  --brand: #c8102e;          /* header, buttons, links */
  --brand-dark: #9e0b23;     /* hover, active */
  --brand-tint: #fff3f4;     /* soft red wash for highlighted rows */
  --accent: var(--brand);
  --accent-ink: #ffffff;
  --ok-bg: #e6f4ea; --ok-ink: #1e6b34;
  --err-bg: #fdecea; --err-ink: #a1271b;
  --radius: 8px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

.top { display: flex; align-items: center; gap: 24px; padding: 12px 20px;
  background: var(--brand); color: #fff; border-bottom: 3px solid var(--brand-dark); }
.brand { font-weight: 800; letter-spacing: .01em; text-decoration: none; color: #fff; }
.top nav { display: flex; gap: 18px; }
.top nav a { text-decoration: none; color: rgba(255,255,255,.82); padding: 6px 0; border-bottom: 2px solid transparent; }
.top nav a:hover { color: #fff; }
.top nav a.on { color: #fff; border-bottom-color: #fff; }
.top .muted { color: rgba(255,255,255,.85); }
.top a.small { color: #fff; }
.top .linkish { color: #fff; text-decoration: underline; }

main { max-width: 1040px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { margin: 0 0 4px; font-size: 24px; color: var(--brand-dark); }
.lede { margin: 0 0 16px; color: var(--muted); max-width: 70ch; }
.notice { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 16px; }
.notice.ok { background: var(--ok-bg); color: var(--ok-ink); }
.notice.err { background: var(--err-bg); color: var(--err-ink); }

.group { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(200,16,46,.06);
  padding: 14px 16px 16px; margin-bottom: 16px; }
.group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.group-head h2 { margin: 0; font-size: 18px; color: var(--brand-dark); }
.group-head .sub { color: var(--muted); font-size: 13px; }

.grid { display: grid; grid-template-columns: 2.2fr 1.3fr 1.2fr 1.8fr 60px; gap: 8px; align-items: center; }
.grid.head { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  padding: 0 0 4px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.grid.row { padding: 4px 0; }
.cell { display: flex; flex-direction: column; min-width: 0; }
.cell .lbl { display: none; }
.cell.check { align-items: center; }
.since { font-size: 12px; color: var(--muted); margin-top: 2px; }

input[type=text], input[type=date], input[type=password], select {
  width: 100%; padding: 8px 10px; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 6px; min-height: 38px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }

button { font: inherit; cursor: pointer; border-radius: 6px; min-height: 40px; }
.add { margin-top: 10px; background: transparent; color: var(--accent);
  border: 1px dashed var(--accent); padding: 6px 14px; }
.actions { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); }
.save { background: var(--brand); color: #fff; border: 0; padding: 10px 22px; font-weight: 600; }
.save:hover { background: var(--brand-dark); }

/* Phone: each employee becomes a small stacked card. */
@media (max-width: 720px) {
  .grid.head { display: none; }
  .grid.row { grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px 0;
    border-bottom: 1px solid var(--line); }
  .grid.row .cell:first-of-type { grid-column: 1 / -1; }
  .cell .lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
  .cell.check { flex-direction: row; gap: 8px; align-items: center; }
  .cell.check .lbl { margin: 0; }
  .save { width: 100%; }
}

@media print {
  .top, .add, .actions { display: none; }
  body { background: #fff; }
  .group { break-inside: avoid; border-color: #999; }
}

/* ------------------------------------------------------------- sheets */
:root { --good-bg: #e3f3e7; --good-ink: #1d6a33; --mid-bg: #fdf3d6; --mid-ink: #7a5600;
        --low-bg: #fde7e4; --low-ink: #a3261a; --none-bg: #f1eeef; --none-ink: #6b6264; }
.b-good { background: var(--good-bg); color: var(--good-ink); }
.b-mid  { background: var(--mid-bg);  color: var(--mid-ink); }
.b-low  { background: var(--low-bg);  color: var(--low-ink); }
.b-none { background: var(--none-bg); color: var(--none-ink); }
.muted { color: var(--muted); } .small { font-size: 12px; }
.ok-text { color: var(--ok-ink); font-size: 13px; }

.row-head, .sheet-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.sheet-head h1 { margin-bottom: 2px; }
.meta { margin: 0; color: var(--muted); }
.tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 12px;
  background: var(--mid-bg); color: var(--mid-ink); }
.month-pick { display: flex; gap: 8px; align-items: center; }
.month-pick select { width: auto; }
.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); padding: 6px 14px; }
.legend { color: var(--muted); font-size: 13px; margin: 10px 0 16px; }

.people { display: flex; flex-direction: column; gap: 6px; }
.store-h { font-size: 15px; margin: 14px 0 2px; color: var(--brand-dark); text-transform: uppercase; letter-spacing: .04em; }
.person { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--card);
  border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.person:hover { background: var(--brand-tint); }
.pname { font-weight: 600; flex: 1; }
.pstatus { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--none-bg); color: var(--none-ink); }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0;
  box-shadow: 0 1px 2px rgba(200,16,46,.06); }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { margin: 0; font-size: 17px; flex: 1; color: var(--brand-dark); }
.score { font-size: 20px; font-weight: 700; padding: 2px 12px; border-radius: 6px; min-width: 52px; text-align: center; }
.flag { width: 100%; font-size: 12px; font-weight: 600; color: var(--low-ink); }

table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-dark);
  font-weight: 700; padding: 4px 6px; border-bottom: 2px solid var(--brand-tint); }
td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.num { text-align: right; white-space: nowrap; }
.kpis td:first-child { width: 46%; }
.klabel { display: block; font-weight: 600; }
.ktype, .kdetail, .knote, .single { display: block; font-size: 12px; color: var(--muted); }
.knote { color: var(--mid-ink); }
.kpis a { color: var(--ink); text-decoration: underline dotted; text-underline-offset: 3px; font-weight: 600; }
.chip { display: inline-block; min-width: 26px; text-align: center; padding: 1px 6px; border-radius: 5px; font-weight: 700; }
.chip.sm { font-weight: 600; font-size: 13px; min-width: 34px; }
.extra { font-size: 13px; margin: 8px 0 0; } .extra span { color: var(--muted); }

.guide { margin-top: 12px; }
.guide h3 { font-size: 14px; margin: 0 0 4px; }
.guide td { font-size: 13px; }
.guide tr.match td { background: var(--mid-bg); color: var(--mid-ink); }

.facts { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; text-align: right; font-weight: 600; }
.notes textarea { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line);
  border-radius: 6px; padding: 10px; margin-bottom: 8px; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.drill td, .drill th { white-space: nowrap; font-size: 13px; }

@media (max-width: 720px) {
  .cards, .cards.two { grid-template-columns: 1fr; }
  .kpis th:nth-child(5), .kpis td:nth-child(5) { display: none; }
  .kpis td:first-child { width: auto; }
}
@media print {
  .noprint, .month-pick { display: none !important; }
  main { max-width: none; padding: 0; }
  .cards { gap: 8px; }
  .card { break-inside: avoid; padding: 8px 10px; }
  .kpis a { text-decoration: none; }
  .notes textarea { min-height: 120px; border-color: #999; }
  .b-good, .b-mid, .b-low, .b-none { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------------------------------------------------------- dashboard */
.table-wrap.flat { border: 0; background: transparent; }
.grid-table td, .grid-table th { white-space: nowrap; }
.grid-table tr.unscored td { color: var(--muted); }
.floor { color: var(--low-ink); margin-left: 3px; font-size: 12px; }
.kpis.compact td { padding: 5px 6px; font-size: 13px; }
details.more { margin-top: 10px; } details.more summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.pill { display: inline-block; padding: 1px 8px; margin: 0 4px 4px 0; border-radius: 999px; background: var(--none-bg); color: var(--none-ink); }
.card + .card { margin-top: 0; }
section.card { margin-bottom: 14px; }

/* ------------------------------------------------------ store, packet */
a.btn { display: inline-flex; align-items: center; min-height: 40px; text-decoration: none; border-radius: 6px; }
.points { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.point { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; break-inside: avoid; }
.point h3 { margin: 0 0 6px; font-size: 15px; }
.point ul { margin: 0; padding-left: 18px; } .point li { margin: 3px 0; font-size: 14px; }
.write-in { margin-top: 8px; color: var(--muted); font-size: 12px; min-height: 40px; border-top: 1px dashed var(--line); padding-top: 4px; }
@media (max-width: 720px) { .points { grid-template-columns: 1fr; } }
@media print {
  .points { grid-template-columns: 1fr 1fr; }
  .write-in { min-height: 70px; }
}

/* ------------------------------------------------------------ uploads */
.upload-form { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; align-items: end; }
.upload-form .drop { grid-column: 1 / -1; }
.upload-form .save { justify-self: start; }
.lbl.show { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.drop { display: flex; align-items: center; justify-content: center; min-height: 96px; padding: 16px; text-align: center;
  border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); cursor: pointer; }
.drop.over { border-color: var(--accent); color: var(--accent); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.err-text { color: var(--err-ink) !important; }
.small-btn { min-height: 30px; padding: 2px 10px; font-size: 13px; }
ul.plain { margin: 0; padding-left: 18px; }
@media (max-width: 720px) { .upload-form { grid-template-columns: 1fr; } }

.nowrap { white-space: nowrap; }
.notice.warn { background: var(--mid-bg); color: var(--mid-ink); }
.tag.needs { background: var(--low-bg); color: var(--low-ink); }
.batch tr.st-skip td, .batch tr.st-unrecognized td { color: var(--muted); }
.batch select { min-width: 220px; }
.batch td:last-child { min-width: 340px; }
.batch td:first-child { max-width: 220px; overflow-wrap: anywhere; }
.batch td:nth-child(3) { white-space: nowrap; }

/* ------------------------------------------------------------- config */
.toc { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 14px; font-size: 14px; }
.cfg-fields { display: grid; gap: 2px; }
.cfg-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 12px; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--line); }
.cfg-label { font-size: 14px; }
.cfg-input { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.unit-wrap { display: inline-flex; align-items: center; gap: 4px; width: 100%; }
.unit-wrap input { max-width: 140px; }
.unit { color: var(--muted); }
.changed { font-size: 12px; color: var(--mid-ink); background: var(--mid-bg); border-radius: 999px; padding: 1px 8px; }
.cfg-table td { vertical-align: middle; }
.cfg-table input[type=text] { max-width: 110px; }
.cfg textarea { width: 100%; font: inherit; background: #fff; color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px; }
.inline-note { max-width: 180px; min-height: 30px; padding: 4px 8px; }
@media (max-width: 720px) { .cfg-row { grid-template-columns: 1fr; gap: 4px; } }

/* -------------------------------------------------------------- auth */
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; }
form.inline { display: inline; }
.linkish { background: none; border: 0; color: var(--accent); padding: 0; min-height: 0; font-size: 12px; }
.card.narrow { max-width: 440px; margin: 40px auto; border-top: 4px solid var(--brand); }
.stack { display: grid; gap: 12px; } .stack label { display: grid; gap: 4px; font-size: 14px; }
.stack input, .stack select, .user-form input, .user-form select { width: 100%; }
.user-form { display: grid; grid-template-columns: 2fr 1.4fr 1fr auto; gap: 10px; align-items: end; }
.user-form label { display: grid; gap: 4px; font-size: 13px; }
.mono { font-family: ui-monospace, Menlo, monospace; letter-spacing: .02em; }
.note-read { white-space: pre-wrap; }
@media (max-width: 720px) { .user-form { grid-template-columns: 1fr; } .who { margin-left: 0; } .top { flex-wrap: wrap; } }
