/* Brooklynn's Deposit App — practical pizza-shop tool, dense but clean. */

:root {
  /* Warm pizza-shop palette: cream, brick, deep green. */
  --bg:           #F7F4EC;
  --surface:     #FBF9F2;
  --surface-alt: #FFFFFF;
  --border:      #DCD6C6;
  --border-strong: #B8B19E;
  --text:        #221E18;
  --text-muted:  #6B6759;
  --text-faint:  #9C9786;
  --primary:     #7A2018;  /* brick red */
  --primary-hover: #5C140D;
  --accent:      #2D5238;  /* basil green for positive */
  --warning:     #9A5A11;
  --error:       #B0241E;
  --info:        #1F4F73;

  --radius: 6px;
  --radius-sm: 4px;
  --shadow-sm: 0 1px 2px rgba(34, 30, 24, 0.06);
  --shadow-md: 0 2px 8px rgba(34, 30, 24, 0.08);

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
}

header.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
header.topbar .logo { display: flex; align-items: center; gap: 10px; }
header.topbar h1 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}
header.topbar .subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.card h2 {
  margin: 0 0 4px 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
}
.card h2 .step {
  display: inline-block;
  width: 18px; height: 18px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  text-align: center;
  font-size: 11px;
  line-height: 18px;
  margin-right: 8px;
}
.card .hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 12px 0;
}

/* Bill counter table */
.bill-grid {
  display: grid;
  grid-template-columns: 70px 1fr 100px;
  gap: 6px 12px;
  align-items: center;
  margin-top: 8px;
}
.bill-grid .denom { font-weight: 600; font-variant-numeric: tabular-nums; }
.bill-grid input[type="number"] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 14px;
  text-align: right;
  background: white;
}
.bill-grid input[type="number"]:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
}
.bill-grid .subtotal {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 13px;
}

.totals-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-strong);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.totals-block .label { color: var(--text-muted); }
.totals-block .value { text-align: right; font-weight: 600; }
.totals-block .grand { font-size: 20px; color: var(--primary); }

/* Inputs */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.field label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.field input, .field select {
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  background: white;
}
.field input:focus, .field select:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
}
.row-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.row-inputs.check-entry { grid-template-columns: 1fr 140px 1.5fr auto; align-items: end; }
.row-inputs.eod-grid { grid-template-columns: repeat(4, 1fr); }
.button-field { justify-content: end; }
@media (max-width: 900px) {
  .row-inputs, .row-inputs.check-entry, .row-inputs.eod-grid { grid-template-columns: 1fr; }
}

/* File input */
.file-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.file-row input[type="file"] { font-size: 13px; }
.file-status {
  font-size: 12px;
  color: var(--text-muted);
}
.file-status.ok { color: var(--accent); font-weight: 600; }
.file-status.err { color: var(--error); font-weight: 600; }

/* Buttons */
button, .btn {
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease;
}
button:hover, .btn:hover { background: var(--primary-hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--border-strong);
}
button.secondary:hover { background: var(--surface-alt); }
button.danger {
  background: white;
  color: var(--error);
  border: 1px solid var(--error);
}
button.danger:hover { background: #FEE; }

/* Report values display */
.kv-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  font-size: 13px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.kv-grid .label { color: var(--text-muted); font-family: var(--font); }
.kv-grid .value { text-align: right; font-weight: 600; }
.kv-grid .label.strong { color: var(--text); font-weight: 600; }
.kv-grid .value.strong { color: var(--primary); }

/* Loot bag row */
.loot-table-wrap {
  overflow-x: auto;
  margin: 8px -16px -8px -16px;
  padding: 0 16px 8px 16px;
}
table.loot {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.loot th, table.loot td {
  text-align: right;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
table.loot th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-family: var(--font);
  font-weight: 600;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border-strong);
}
table.loot th:first-child, table.loot td:first-child { text-align: left; }
table.loot td.date, table.loot td.manager { font-family: var(--font); }
table.loot tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--border-strong);
  background: var(--surface-alt);
}
.diff-pos { color: var(--accent); font-weight: 600; }
.diff-neg { color: var(--error); font-weight: 600; }
.diff-zero { color: var(--text-muted); }

.issue-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.issue-pill.no { background: #E8EDE9; color: var(--accent); }
.issue-pill.yes { background: #FCE6E5; color: var(--error); }

/* Compare callout */
.compare-callout {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  font-size: 13px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.compare-callout .label { font-family: var(--font); color: var(--text-muted); }
.compare-callout .value { text-align: right; font-weight: 700; }

/* Deposit slip summary */
.deposit-slip {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-strong);
}
.deposit-slip h3 {
  margin: 0 0 4px 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
}
.deposit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.deposit-panel {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.deposit-actions {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 8px 0;
}
.deposit-denom-grid {
  display: grid;
  grid-template-columns: 58px minmax(90px, 1fr) 110px;
  gap: 6px 10px;
  align-items: center;
}
.deposit-denom-grid .denom {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.deposit-denom-grid input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: right;
  background: white;
}
.deposit-denom-grid input:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
}
.deposit-denom-grid .subtotal {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 12px;
}
.grand-value {
  font-size: 18px;
}
.deposit-status {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: var(--bg);
  font-size: 12px;
}
.deposit-status.ok {
  border-color: rgba(45, 82, 56, 0.45);
  background: #E8EDE9;
  color: var(--accent);
  font-weight: 600;
}
.deposit-status.bad {
  border-color: rgba(176, 36, 30, 0.55);
  background: #FCE6E5;
  color: var(--error);
  font-weight: 600;
}
.check-list {
  margin-top: 10px;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
@media (max-width: 900px) {
  .deposit-grid { grid-template-columns: 1fr; }
}

/* Session table */
table.session, table.checks {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 8px;
}
table.session th, table.session td, table.checks th, table.checks td {
  text-align: right;
  padding: 5px 6px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.session th, table.checks th {
  font-size: 10px;
  font-family: var(--font);
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-alt);
}
table.session th:first-child, table.session td:first-child { text-align: left; }
table.checks th:first-child, table.checks td:first-child,
table.checks th:nth-child(3), table.checks td:nth-child(3) { text-align: left; }
table.checks td.text-left { text-align: left; font-family: var(--font); }
table.session th:nth-child(2), table.session td:nth-child(2) { text-align: left; font-family: var(--font); }
table.session th.act, table.session td.act, table.checks th.act, table.checks td.act { text-align: center; }
table.session tfoot td, table.checks tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--border-strong);
  background: var(--surface-alt);
}

button.icon-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 3px;
}
button.icon-btn:hover {
  background: var(--surface-alt);
  color: var(--error);
  border-color: var(--error);
}

/* Errors */
.error-box {
  background: #FCEEEE;
  border: 1px solid var(--error);
  color: var(--error);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin: 8px 0;
}
.error-box.warn { background: #FBF1DA; border-color: var(--warning); color: var(--warning); }

/* Debug drawer */
details.debug {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--surface-alt);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
details.debug summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 11px;
}
details.debug pre {
  margin: 8px 0 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 280px;
  overflow: auto;
  background: var(--bg);
  padding: 8px;
  border-radius: 3px;
}

/* CSV export drawer */
textarea.csv-out {
  width: 100%;
  height: 100px;
  font-family: var(--font-mono);
  font-size: 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  background: white;
}

/* Section header inside a card */
.section-sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin: 14px 0 6px 0;
}

/* Tolerance dot */
.tol-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.tol-dot.zero { background: var(--text-faint); }
.tol-dot.pos { background: var(--accent); }
.tol-dot.neg { background: var(--error); }

footer.foot {
  margin-top: 20px;
  padding: 10px;
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
}
