/* Lineup components — outlines over fills, one weight, size does hierarchy. */

/* header */
.top {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.top .brand-logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  object-fit: contain;
}
.top .brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 15px;
}
.brand-wordmark {
  display: inline-block;
  width: 108px; height: 32px;
  background: currentColor;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: left center; mask-position: left center;
  -webkit-mask-size: contain; mask-size: contain;
}
.top h1 { font-size: var(--fs-sub); letter-spacing: 0; }

/* cards */
.card {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--sp-4);
  background: var(--surface);
}
.card.raise { background: var(--surface-raise); }
.card.tappable { width: 100%; text-align: left; transition: border-color .12s; }
.card.tappable:active { border-color: var(--line-strong); }

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: 0 var(--sp-5);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-input);
  font-size: var(--fs-body);
  background: var(--surface);
  color: var(--ink);
}
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { border-color: var(--line); }
.btn.wide { width: 100%; }
.btn.small { min-height: 36px; padding: 0 var(--sp-4); font-size: var(--fs-small); }
.btn:disabled { opacity: .4; pointer-events: none; }

/* chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-chip);
  font-size: var(--fs-small);
  background: var(--surface);
  white-space: nowrap;
}
.chip.on { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.chip-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* status */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-chip);
  font-size: var(--fs-micro);
  font-family: var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.ok   { color: var(--ok);   background: var(--ok-bg); }
.status.late { color: var(--late); background: var(--late-bg); }
.status.wait { color: var(--wait); background: var(--wait-bg); }
.status.busy { color: var(--busy); background: var(--busy-bg); }

/* inputs */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field label { font-size: var(--fs-small); color: var(--ink-soft); }
.input, select.input, textarea.input {
  min-height: var(--tap);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  background: var(--surface);
  width: 100%;
}
.input:focus { outline: none; border-color: var(--ink); }
textarea.input { min-height: 96px; resize: vertical; }
select.input { appearance: none; }

/* progress ring */
.ring { position: relative; width: 52px; height: 52px; flex-shrink: 0; }
.ring svg { transform: rotate(-90deg); }
.ring .track { stroke: var(--line); }
.ring .fill { stroke: var(--ink); transition: stroke-dashoffset .4s; }
.ring.done .fill { stroke: var(--ok); }
.ring .num {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
}

/* task rows */
.task {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  text-align: left;
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--line);
}
.task:last-child { border-bottom: none; }
.task .tick {
  width: 28px; height: 28px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
  color: transparent;
}
.task.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.task.done .task-name { color: var(--ink-faint); text-decoration: line-through; }
.task .task-meta { font-size: var(--fs-small); color: var(--ink-soft); }
.task .need {
  font-size: var(--fs-micro);
  font-family: var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: var(--r-chip);
  padding: 2px 10px;
  flex-shrink: 0;
}

/* PIN pad */
.pinpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
  max-width: 300px;
  margin: 0 auto;
}
.pinpad button {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: var(--fs-title);
  font-family: var(--font-mono);
}
.pinpad button:active { background: var(--ink); color: var(--bg); }
.pin-dots { display: flex; gap: var(--sp-3); justify-content: center; }
.pin-dots span {
  width: 14px; height: 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
}
.pin-dots span.filled { background: var(--ink); }
.pin-dots.error span { border-color: var(--late); background: var(--late-bg); }

/* face grid (staff picker) */
.faces {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: var(--sp-3);
}
.face {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}
.face:active { border-color: var(--ink); }
.face .avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: grid; place-items: center;
  font-size: var(--fs-sub);
}
.face .name { font-size: var(--fs-small); }

/* tabs */
.tabs {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-2) calc(var(--sp-2) + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
  z-index: 20;
}
.tabs button {
  flex: 1;
  max-width: 120px;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: var(--r-input);
  font-size: var(--fs-micro);
  font-family: var(--font-mono);
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.tabs button.on { color: var(--ink); }
.tabs button .ico { font-size: 20px; line-height: 1; }

/* sheet */
.sheet-wrap {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.sheet-wrap.open { display: flex; }
.sheet {
  width: 100%;
  max-width: 640px;
  background: var(--bg);
  border-radius: var(--r-card) var(--r-card) 0 0;
  padding: var(--sp-5) var(--sp-4) calc(var(--sp-5) + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-sheet);
  max-height: 86dvh;
  overflow-y: auto;
}
.sheet .grab {
  width: 44px; height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 0 auto var(--sp-4);
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--bg);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-chip);
  font-size: var(--fs-small);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 60;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* stat tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.tile { border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--sp-4); }
.tile .big { font-size: var(--fs-title); font-family: var(--font-mono); }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(4, 1fr); } }

/* bar chart (demo) */
.bars { display: flex; align-items: flex-end; gap: var(--sp-2); height: 120px; }
.bars .bar {
  flex: 1;
  background: var(--surface-raise);
  border: 1px solid var(--line);
  border-radius: 6px 6px 0 0;
  position: relative;
  min-width: 0;
}
.bars .bar.hot { background: var(--accent); border-color: var(--accent); }
.bars-labels { display: flex; gap: var(--sp-2); }
.bars-labels span { flex: 1; text-align: center; font-size: var(--fs-micro); font-family: var(--font-mono); color: var(--ink-faint); }

/* list-builder rows */
.drag-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--line);
}
.drag-row:last-child { border-bottom: none; }
.drag-row .handle { color: var(--ink-faint); cursor: grab; font-size: 18px; }

/* photo proof */
.proof-thumb {
  width: 56px; height: 56px;
  border-radius: var(--r-input);
  object-fit: cover;
  border: 1px solid var(--line);
}
.photo-drop {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-card);
  min-height: 140px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-size: var(--fs-small);
}

/* desktop split for admin/console */
@media (min-width: 900px) {
  .cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); align-items: start; }
  .sheet { border-radius: var(--r-card); margin-bottom: 10vh; }
  .sheet-wrap { align-items: center; }
}

/* desktop: tab bar becomes a left rail */
@media (min-width: 1024px) {
  .tabs {
    left: 0; top: 0; bottom: 0; right: auto;
    width: 112px;
    flex-direction: column;
    justify-content: flex-start;
    gap: var(--sp-2);
    padding: var(--sp-7) var(--sp-2) var(--sp-4);
    border-top: none;
    border-right: 1px solid var(--line);
  }
  .tabs button { max-width: none; width: 100%; flex: 0 0 auto; }
  .toast { bottom: var(--sp-6); }
}

/* very thin phones */
@media (max-width: 350px) {
  .pinpad { max-width: 250px; }
  .faces { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .tiles { gap: var(--sp-2); }
  .tile { padding: var(--sp-3); }
  .brand-wordmark { width: 88px; }
}

/* ultrawide: let card lists breathe in two columns */
@media (min-width: 1440px) {
  .stack.wide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
  .stack.wide-grid > * { margin-top: 0; }
}

/* ---------- login ---------- */
body.login-mode .top { display: none; }

.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--sp-5) var(--sp-4);
}
.login-card {
  width: 100%;
  max-width: 380px;
}
.login-mark {
  display: block;
  margin: 0 auto var(--sp-5);
}
.login-mark .brand-wordmark {
  width: 168px;
  height: 46px;
  -webkit-mask-position: center; mask-position: center;
}
.login-mark .brand-mark {
  width: 56px; height: 56px;
  border-radius: 16px;
  margin: 0 auto;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-size: 24px;
}
.login-title { font-size: var(--fs-title); }

.phone-row {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  overflow: hidden;
}
.phone-row:focus-within { border-color: var(--ink); }
.phone-cc {
  display: grid; place-items: center;
  padding: 0 var(--sp-3);
  color: var(--ink-soft);
  border-right: 1px solid var(--line);
  flex-shrink: 0;
}
.phone-row .input {
  border: none;
  border-radius: 0;
  letter-spacing: 0.08em;
}
.phone-row .input:focus { border: none; }

.pin-input {
  letter-spacing: 0.6em;
  font-size: var(--fs-sub);
}
.btn.big { min-height: 56px; font-size: var(--fs-sub); }
.login-err { color: var(--late); }
.center-row { justify-content: center; }

/* ---------- audit ---------- */
.audit-head {
  border-radius: var(--r-card);
  padding: var(--sp-4);
  background: var(--ink);
  color: var(--bg);
}
.audit-head .micro, .audit-head .small { color: inherit; opacity: .65; }
.audit-head h2 { letter-spacing: -0.01em; }
.audit-progress {
  height: 6px;
  border-radius: 3px;
  background: rgba(128,128,128,.35);
  overflow: hidden;
}
.audit-progress i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .2s;
}
.audit-score-huge {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(3.2rem, 20vw, 5.5rem);
  line-height: 1;
}
.score-ok { color: var(--ok); }
.score-wait { color: var(--wait); }
.score-late { color: var(--late); }

.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.seg3 button {
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  font-size: var(--fs-small);
}
.seg3 button.on-pass { background: var(--ok); border-color: var(--ok); color: #fff; }
.seg3 button.on-fail { background: var(--late); border-color: var(--late); color: #fff; }
.seg3 button.on-na { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.audit-cp { padding: var(--sp-4) 0; border-bottom: 1px solid var(--line); }
.audit-cp:last-child { border-bottom: none; padding-bottom: 0; }
.audit-cp:first-child { padding-top: 0; }
.audit-thumb {
  width: 48px; height: 48px;
  border-radius: var(--r-input);
  object-fit: cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.row .btn.grow { flex: 1; }

.updown { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.updown button {
  width: 32px; height: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 10px;
  color: var(--ink-soft);
  display: grid; place-items: center;
}
.updown button:active { border-color: var(--ink); color: var(--ink); }

/* print report — screen never sees it, print sees only it */
.audit-print { display: none; }
@media print {
  body.audit-printing > *:not(.audit-print) { display: none !important; }
  body.audit-printing .audit-print {
    display: block !important;
    color: #000;
    background: #fff;
    font-family: var(--font);
    font-size: 12px;
    line-height: 1.5;
  }
  .audit-print h1 { font-size: 26px; margin-bottom: 4px; }
  .audit-print h2 { font-size: 17px; margin: 18px 0 8px; }
  .audit-print .audit-print-meta { color: #555; margin-bottom: 2px; }
  .audit-print .audit-print-overall { font-size: 16px; margin: 8px 0 14px; }
  .audit-print-table { width: 100%; border-collapse: collapse; }
  .audit-print-table td { border-bottom: 1px solid #ddd; padding: 5px 0; }
  .audit-print-table td.num { text-align: right; font-family: var(--font-mono); }
  .audit-print-flag { margin-bottom: 12px; page-break-inside: avoid; }
  .audit-print-flag .note { color: #555; }
  .audit-print-flag img { max-height: 180px; max-width: 240px; border: 1px solid #ddd; border-radius: 8px; margin-top: 4px; }
}

/* ---------- sales: payment split ---------- */
.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}
.sales-day { padding: var(--sp-2) 0; border-top: 1px solid var(--line); }
.sales-day p { margin-top: 2px; overflow-wrap: anywhere; }

/* ---------- books ---------- */
.book-entry {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--line);
}
.book-entry:first-child { border-top: none; }
.book-entry p { margin-top: 2px; overflow-wrap: anywhere; }

/* ---------- inventory ---------- */
/* count-sheet rows: item left, big numeric qty right; the input carries the
   live low colour — red below half of par, amber below par, green at/above */
.inv-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--line);
}
.inv-row:first-child { border-top: none; }
.inv-row .grow { min-width: 0; }
.inv-row .input {
  width: 110px;
  flex-shrink: 0;
  text-align: right;
  font-size: var(--fs-sub);
}
.inv-row.low-late .input { border-color: var(--late); color: var(--late); }
.inv-row.low-wait .input { border-color: var(--wait); color: var(--wait); }
.inv-row.low-ok .input { border-color: var(--ok); }

/* ---------- recipe book ---------- */
.recipe-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  text-align: left;
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--line);
}
.recipe-row:first-child { border-top: none; }
.recipe-row .grow { min-width: 0; }
.recipe-thumb {
  width: 48px; height: 48px;
  border-radius: var(--r-input);
  object-fit: cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.recipe-photo {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: var(--r-card);
  border: 1px solid var(--line);
}
/* money is always bold mono, tabular so columns line up */
.recipe-cost {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.recipe-cost.big-cost { font-size: var(--fs-title); }
.method-step {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--line);
}
.method-step:first-child { border-top: none; }
.method-step .n {
  font-family: var(--font-mono);
  color: var(--ink-faint);
  flex-shrink: 0;
}
/* editor: name row on top, qty / unit / ₹-per-unit under it, line cost right */
.ing-row { padding: var(--sp-3) 0; border-top: 1px solid var(--line); }
.ing-row:first-child { border-top: none; }
.ing-nums {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}
.ing-line { min-height: 1.2em; }

/* open-maintenance count on the Manage Books tab */
.tabs button { position: relative; }
.tab-badge {
  position: absolute;
  top: 3px;
  left: 50%;
  margin-left: 12px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--wait);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0;
  display: grid;
  place-items: center;
}

/* ---------- profile rows ---------- */
.me-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  text-align: left;
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--line);
}
.me-row:last-child { border-bottom: none; }
.me-row .grow { min-width: 0; }
.avatar-lg {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: grid; place-items: center;
  font-size: var(--fs-sub);
  flex-shrink: 0;
}
