/* CafeCost — single committed light theme (internal tool). */
:root {
  --bg: #FAF6F0;
  --panel: #FFFFFF;
  --ink: #2C2018;
  --muted: #8A7A6C;
  --line: #E8DFD4;
  --espresso: #3E2A1E;
  --accent: #C67C3B;
  --accent-dark: #A8632A;
  --good: #2E7D4F;
  --bad: #C0392B;
  --warn: #B7791F;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 14.5px/1.55 -apple-system, 'Segoe UI', Inter, sans-serif;
}
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }

.logo { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; color: var(--espresso); }
.logo span { color: var(--accent); }

/* Auth */
.auth-screen { min-height: 100vh; display: grid; place-items: center; background: var(--espresso); }
.auth-card { background: var(--panel); border-radius: 14px; padding: 32px; width: 380px; max-width: 92vw; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.auth-card .logo { margin-bottom: 12px; }

/* Layout */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px; flex-shrink: 0; background: var(--espresso); color: #EADFD3;
  display: flex; flex-direction: column; padding: 18px 0; position: sticky; top: 0; height: 100vh;
}
.sidebar .logo { color: #fff; padding: 0 18px 14px; }
.sidebar nav { flex: 1; overflow-y: auto; }
.sidebar a {
  display: block; padding: 9px 18px; color: #D8C8B8; text-decoration: none; font-weight: 500;
  border-left: 3px solid transparent;
}
.sidebar a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar a.active { background: rgba(255,255,255,.1); color: #fff; border-left-color: var(--accent); }
.sidebar-foot { padding: 12px 18px 0; font-size: 12.5px; color: #B8A692; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar .link { background: none; border: 0; color: var(--accent); padding: 4px 0; }

main { flex: 1; padding: 26px 30px 60px; max-width: 1200px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn {
  background: var(--accent); color: #fff; border: 0; border-radius: 7px;
  padding: 8px 14px; font-weight: 600;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { background: var(--bg); }
.btn.danger { background: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }

/* Cards, tables */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }

.tablebox { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: #FCFAF6; white-space: nowrap;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #FCF8F2; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.good { color: var(--good); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.warn { color: var(--warn); font-weight: 600; }
.mut { color: var(--muted); }

.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; }
.pill.draft { background: #EEE6DB; color: #6B5A48; }
.pill.sent, .pill.pending, .pill.open, .pill.partial { background: #FFF3D6; color: #8A6510; }
.pill.received, .pill.approved, .pill.closed { background: #DFF0E5; color: #1E6B41; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(30,20,12,.5); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal {
  background: var(--panel); border-radius: 12px; padding: 22px; width: 560px; max-width: 95vw;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal h2 { margin: 0 0 8px; font-size: 18px; }
.modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal .err { color: var(--bad); font-size: 13px; margin-top: 10px; }

/* Toast */
#toast-root { position: fixed; bottom: 20px; right: 20px; z-index: 99; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--espresso); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 360px; }
.toast.error { background: var(--bad); }

.filters { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; }
.filters > div { min-width: 130px; }
.empty { color: var(--muted); padding: 30px; text-align: center; }
.subline { font-size: 12.5px; color: var(--muted); }

@media (max-width: 820px) {
  #app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar nav { display: flex; }
  .sidebar a { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; }
  .sidebar a.active { border-bottom-color: var(--accent); }
  .sidebar-foot { border-top: 0; }
  main { padding: 16px; }
}
