/* ===== Swole Spartan Ops — design tokens =====
   Brand: strength-focused supplements retailer. Orange is the real logo
   accent (kept), paired with a COOL neutral (not cream) to suit the
   Spartan identity and to avoid the generic warm-cream/terracotta look.
   Boldness is spent in one place: the orange marks the primary action
   and the active state; everything else is quiet ink + cool grey. */
:root {
  --ink:        #17181c;
  --ink-soft:   #2b2d33;
  --paper:      #f2f3f5;
  --surface:    #ffffff;
  --line:       #e3e5e9;
  --muted:      #676b73;
  --accent:     #E8853A;
  --accent-dark:#c96f2c;
  --ok:         #1d7a4c;
  --bad:        #b0362c;
  --radius:     10px;
  --shadow:     0 1px 2px rgba(20,22,28,.04), 0 4px 16px rgba(20,22,28,.05);
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--paper);
  margin: 0;
  padding: 0;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

.card {
  max-width: 640px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 4px; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.005em; }
.header-row { margin-bottom: 16px; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }

input, select, textarea {
  width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; box-sizing: border-box; background: #fff;
  color: var(--ink); transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,133,58,.18);
}
textarea { height: auto; padding: 8px 11px; }

.required, .err { color: var(--bad); }
.err { font-size: 12px; margin: 4px 0 0; min-height: 14px; }

.btn {
  margin-top: 12px; width: 100%; min-height: 40px; padding: 0 16px;
  border-radius: 8px; border: 1px solid var(--line); background: #fff;
  font-size: 14px; font-weight: 500; cursor: pointer; color: var(--ink);
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--paper); }
.btn:active { transform: translateY(1px); }
/* primary = ink; the single most important action per screen */
.btn-primary {
  background: var(--ink); color: #fff; border-color: var(--ink);
  width: auto; margin-top: 0;
}
.btn-primary:hover { background: var(--ink-soft); }
/* accent variant for when the primary action is the brand moment (e.g. Checkout) */
.btn-accent {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.footer-row { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.lines-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.line-row { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid #eef0f3; font-size: 13px; }
.right { text-align: right; }
.muted { color: var(--muted); }
#post-result { font-size: 13px; margin: 10px 0 0; min-height: 16px; }
#post-result.ok, .ok { color: var(--ok); }
#post-result.err { color: var(--bad); }
.link-btn { background: none; border: none; color: var(--accent); text-decoration: none; cursor: pointer; font-size: 13px; padding: 0; font-weight: 500; }
.link-btn:hover { color: var(--accent-dark); text-decoration: underline; }

/* ---- top navigation ---- */
/* ---- left sidebar ---- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 220px; background: var(--ink);
  display: flex; flex-direction: column;
  z-index: 100; transition: width .2s;
  overflow: hidden;
}
.sidebar.collapsed { width: 52px; }
.sidebar-logo-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 12px 10px; border-bottom: 1px solid #2b2d33;
  min-height: 60px;
}
.sidebar-logo { height: 32px; width: 32px; object-fit: contain; border-radius: 4px; flex-shrink: 0; }
.sidebar-brand { color: #fff; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; }
.sidebar-toggle {
  margin-left: auto; background: none; border: none;
  color: #b6b9c0; cursor: pointer; font-size: 18px; padding: 2px 4px;
  flex-shrink: 0; line-height: 1;
}
.sidebar-toggle:hover { color: #fff; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-group { padding: 4px 0; }
.sidebar-group-label {
  font-size: 10px; font-weight: 600; letter-spacing: .08em;
  color: #555; text-transform: uppercase;
  padding: 8px 14px 3px; white-space: nowrap; overflow: hidden;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; color: #b6b9c0; text-decoration: none;
  font-size: 13px; white-space: nowrap; border-radius: 0;
  transition: background .1s, color .1s;
}
.sidebar-nav a:hover { background: #1e2026; color: #fff; }
.sidebar-nav a.on { background: var(--accent); color: #fff; }
.sidebar-nav a.on:hover { background: var(--accent-dark); }
.sidebar-nav a .nav-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-nav a .nav-label { overflow: hidden; }
.sidebar-bottom {
  padding: 12px; border-top: 1px solid #2b2d33;
  display: flex; align-items: center; gap: 8px; min-height: 54px;
}
.sidebar-user { color: #b6b9c0; font-size: 12px; flex: 1; overflow: hidden; white-space: nowrap; }
.sidebar-signout {
  background: none; border: 1px solid #2b2d33; color: #b6b9c0;
  font-size: 11px; padding: 5px 8px; border-radius: 6px; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.sidebar-signout:hover { background: #1e2026; color: #fff; }
/* content area pushed right of sidebar */
.page-wrap { margin-left: 220px; padding: 2rem 1.5rem; transition: margin-left .2s; min-height: 100vh; }
.page-wrap.sidebar-collapsed { margin-left: 52px; }
.topnav-logo { height: 30px; width: auto; display: block; }

/* ---- responsive ---- */
@media (max-width: 820px) {
  body { padding: 1rem 0.5rem; }
  .card { max-width: 100%; padding: 1.1rem; }
  input, select, button, textarea { font-size: 16px; }  /* avoids iOS zoom */
  .field-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .pos-layout { grid-template-columns: 1fr !important; }
  .row, .prow, .drow, .srow, .alert-row, .tbl-row, .rt-line, .qrow, .bar-row { font-size: 12px; }
  h1 { font-size: 20px; }
}
@media (max-width: 720px) {
  .topnav-inner { height: auto; padding: 8px 1rem; gap: 8px 12px; }
  .topnav-links { order: 3; width: 100%; }
}
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- status pills (Wave-inspired: Paid/Unpaid/Partial) ---- */
.pill { display: inline-block; font-size: 11px; font-weight: 600;
        padding: 2px 8px; border-radius: 12px; white-space: nowrap; }
.pill-green  { background: #d4edda; color: #1d7a4c; }
.pill-orange { background: #fde8cc; color: #9a5700; }
.pill-grey   { background: #e8eaed; color: #555; }
.pill-red    { background: #fde0de; color: #b0362c; }
.pill-blue   { background: #dce8fb; color: #1a5ca8; }

/* ---- list page header pattern (title + primary action right-aligned) ---- */
.list-header { display: flex; justify-content: space-between;
               align-items: center; margin-bottom: 16px; }
.list-header h1 { margin: 0; }

/* ---- purchasing list metric tiles ---- */
.po-metrics {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; max-width: 720px; margin-bottom: 16px;
}
.pm-tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 16px;
}
.pm-lbl { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.pm-val { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.pm-warn { color: var(--bad); }
@media (max-width: 600px) { .po-metrics { grid-template-columns: 1fr 1fr; } }
