:root {
  --gold: #b8860b; --gold-soft: #faf5e6; --ink: #1c1c1c; --muted: #6b7280;
  --line: #e5e7eb; --bg: #f7f7f5; --ok: #15803d; --warn: #b45309; --err: #b91c1c;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--bg); }
a { color: inherit; }
/* App shell: fixed left sidebar + scrolling main */
body.app { display: flex; min-height: 100vh; }
.sidebar { width: 224px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 16px 12px 14px;
  display: flex; flex-direction: column; gap: 6px; }
.brand { font-weight: 700; text-decoration: none; font-size: 16px; display: flex; align-items: center;
  gap: 8px; padding: 4px 8px 12px; }
.brand-logo { width: 24px; height: 24px; object-fit: contain; }
.side-nav { display: flex; flex-direction: column; gap: 14px; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-group-label { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 0 8px 4px; }
.side-nav a { text-decoration: none; color: var(--ink); font-weight: 600; font-size: 13.5px;
  padding: 7px 10px; border-radius: 8px; opacity: .8; }
.side-nav a:hover { background: var(--bg); opacity: 1; }
.side-nav a.active { background: var(--gold-soft); color: var(--gold); opacity: 1; }
.logout { margin-top: auto; color: var(--muted); text-decoration: none; font-size: 13px;
  font-weight: 600; padding: 10px 10px 2px; border-top: 1px solid var(--line); }
.logout:hover { color: var(--gold); }
.app-main { flex: 1; min-width: 0; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* Searchable dropdown (progressive enhancement of select[data-searchable]) */
.combo { position: relative; width: 100%; }
.combo-input { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.combo-list { position: absolute; z-index: 40; left: 0; top: 100%; background: #fff;
  border: 1px solid var(--line); border-top: none; border-radius: 0 0 8px 8px;
  overflow-y: auto; box-shadow: 0 6px 18px rgba(0,0,0,.10); overscroll-behavior: contain;
  min-width: 100%; width: max-content; max-width: min(640px, 92vw);
  max-height: min(760px, 80vh); }  /* ~25 rows visible, scrolls for the rest */
.combo-item { padding: 7px 10px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.combo-item.active, .combo-item:hover { background: var(--gold-soft); color: var(--gold); }

@media (max-width: 820px) {
  body.app { display: block; }
  .sidebar { position: static; width: auto; height: auto; border-right: none;
    border-bottom: 1px solid var(--line); }
  .side-nav { flex-flow: row wrap; gap: 8px 16px; }
  .nav-group { flex-direction: row; align-items: center; gap: 4px; }
  .nav-group-label { display: none; }
  .logout { margin: 0 0 0 auto; border-top: none; }
}

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 24px 0 10px; }
.sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h3 { margin: 0 0 4px; font-size: 14px; }
.card .big { font-size: 28px; font-weight: 700; color: var(--gold); }

.board { display: grid; grid-auto-flow: column; grid-auto-columns: 260px; gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.col { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.col h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tile { display: block; text-decoration: none; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; background: #fff; }
.tile:hover { border-color: var(--gold); }
.tile .po { font-weight: 700; font-size: 14px; }
.tile .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { background: var(--gold-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #7a5c00; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.info { background: #e0f2fe; color: #075985; }
.badge.warning { background: #fef3c7; color: var(--warn); }
.badge.error { background: #fee2e2; color: var(--err); }
.badge.ok { background: #dcfce7; color: var(--ok); }
.badge.muted { background: #f3f4f6; color: var(--muted); }

.btn { display: inline-block; border: 1px solid var(--gold); background: var(--gold); color: #fff;
  padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.danger { background: #fff; color: var(--err); border-color: #fecaca; }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.flag { border-left: 3px solid var(--warn); padding: 8px 12px; margin: 8px 0; background: #fffbeb; border-radius: 6px; font-size: 13px; }
.flag.error { border-color: var(--err); background: #fef2f2; }
.recon { display: flex; gap: 24px; align-items: baseline; font-size: 14px; }
.recon .num { font-weight: 700; font-size: 18px; }
input[type=text], input[type=number], input[type=email], select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.muted { color: var(--muted); }
.right { text-align: right; }

/* landing-page PO process cards + stepper */
.gatekey { color: var(--gold); font-weight: 700; }
.po-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.po-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.po-num { font-weight: 700; font-size: 15px; text-decoration: none; }
.po-num:hover { color: var(--gold); }
.po-meta { color: var(--muted); font-size: 12px; }
.drive-link { color: var(--gold); text-decoration: none; font-weight: 600; }
.stepper { display: flex; align-items: flex-start; gap: 0; margin-top: 14px; overflow-x: auto; padding-bottom: 4px; }
.step { position: relative; flex: 1 1 0; min-width: 78px; text-align: center; }
.step a { text-decoration: none; color: inherit; display: block; }
.step .dot { display: block; width: 26px; height: 26px; line-height: 26px; margin: 0 auto 5px; border-radius: 50%;
  font-size: 13px; font-weight: 700; background: #eef0f2; color: #9aa1a9; border: 2px solid #eef0f2; position: relative; z-index: 1; }
.step .lbl { font-size: 11px; color: var(--muted); display: block; line-height: 1.2; }
.step .gatemark { color: var(--gold); }
/* connector line between dots */
.step::before { content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px; background: #e5e7eb; z-index: 0; }
.step:first-child::before { display: none; }
.step.done .dot { background: var(--gold); border-color: var(--gold); color: #fff; }
.step.done::before { background: var(--gold); }
.step.done .lbl { color: var(--ink); }
.step.active .dot { background: #fff; border-color: var(--gold); color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.step.active .lbl { color: var(--gold); font-weight: 700; }
.step.attention .dot { background: #fff; border-color: var(--err); color: var(--err); box-shadow: 0 0 0 3px #fee2e2; }
.step.attention .lbl { color: var(--err); font-weight: 700; }
.step a:hover .dot { filter: brightness(0.95); }

/* ── Appointments calendar ─────────────────────────────────────────────── */
.daynav { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; }
.daynav .d { font-weight: 700; font-size: 15px; }
.daynav .nav-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 11px;
  text-decoration: none; color: var(--muted); font-weight: 700; }
.daynav .nav-btn:hover { border-color: var(--gold); color: var(--gold); }

.cal { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.cal-head { display: grid; border-bottom: 1px solid var(--line); background: var(--gold-soft); }
.cal-head .rh { padding: 9px 12px; font-weight: 700; font-size: 13px; color: #7a5c00; display: flex; align-items: center; gap: 8px; }
.cal-head .rh + .rh { border-left: 1px solid var(--line); }
.cal-head .ava { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff; }
.cal-body { display: grid; position: relative; }
.cal-hours { border-right: 1px solid var(--line); }
.cal-hr { font-size: 10.5px; color: var(--muted); text-align: right; padding: 2px 6px 0 0; box-sizing: border-box; }
.cal-res { position: relative; border-left: 1px solid var(--line); }
.cal-res:first-child { border-left: none; }
.appt { position: absolute; left: 5px; right: 5px; border-radius: 8px; padding: 5px 8px; overflow: hidden;
  text-decoration: none; color: var(--ink); background: #fff; border-left: 3px solid var(--muted);
  box-shadow: 0 1px 3px rgba(0,0,0,.08); font-size: 12px; }
.appt:hover { box-shadow: 0 2px 8px rgba(0,0,0,.16); }
.appt .at { font-weight: 700; }
.appt .an { color: var(--muted); font-size: 11px; }
.appt.ok { border-left-color: var(--ok); }
.appt.warn { border-left-color: var(--warn); background: #fffdf5; }
.appt.bad { border-left-color: var(--err); }
.appt.done { border-left-color: #9aa1a9; background: #fafafa; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted); }
.legend .lg { display: flex; align-items: center; gap: 6px; }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; }

/* close-out control */
.outcome { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.outcome label { display: flex; gap: 10px; align-items: center; border: 1.5px solid var(--line);
  border-radius: 9px; padding: 10px 12px; cursor: pointer; }
.outcome label:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); }
.outcome .ot { font-weight: 700; font-size: 13px; }
.outcome .op { font-size: 12px; color: var(--muted); }
.att-toggle { display: flex; gap: 8px; margin-bottom: 8px; }
.att-toggle label { flex: 1; text-align: center; border: 1.5px solid var(--line); border-radius: 9px;
  padding: 8px; cursor: pointer; font-weight: 700; font-size: 13px; color: var(--muted); }
.att-toggle label:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); color: var(--ink); }
.att-toggle input { display: none; }
