/* GateKeeper polish layer (Nov 18 2026, proposal for Rob). Presentation only: loaded last, overrides app.css/crm.css.
   Keeps the senior-friendly basics: 18px base text, 44–48px tap targets, AA contrast. Remove this file's <link> to roll back. */
:root {
  --bg: #F5F7FA; --card: #fff; --ink: #1A2233; --ink-2: #364152; --muted: #586274;
  --line: #E1E6EE; --line-2: #D3DAE5; --field: #8792A5;
  --blue: #2F6BC0; --blue-d: #22549C; --navy: #142C5C; --tint: #EDF3FC;
  --ok: #1B6E46; --warn: #8A5200; --danger: #B42318;
  --radius: 12px; --r-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-pop: 0 12px 32px rgba(16, 24, 40, .14);
}
body { background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
.num, .stat-n, .tstat-n, .table td.num, .bucket-list strong { font-variant-numeric: tabular-nums; }

/* ---------- Type scale: one step per level, tighter headings ---------- */
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; color: var(--navy); margin: 0; }
h2 { font-size: 1.1rem; font-weight: 700; color: var(--navy); letter-spacing: -.005em; }
h3 { font-size: 1rem; font-weight: 700; }
.h-sub { color: var(--muted); font-size: .95rem; font-weight: 500; }
.small { font-size: .85rem; }

/* ---------- Header: quieter bar, pill nav, neutral store switcher ---------- */
.topbar { background: rgba(255, 255, 255, .97); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(16, 24, 40, .02); }
.topbar-inner { min-height: 60px; padding-top: .35rem; padding-bottom: .35rem; }
.brand img { height: 40px; }
.topbar-inner .brand-app { font-size: .95rem; font-weight: 700; color: var(--navy); border-left: 1px solid var(--line-2); padding-left: .65rem; }
.mainnav { align-items: center; gap: .1rem; }
.mainnav a, .mainnav .nav-group > summary {
  min-height: 42px; padding: 0 .6rem; border: 0; border-radius: var(--r-sm); color: var(--ink-2); font-weight: 600;
}
.mainnav a:hover, .mainnav .nav-group > summary:hover { background: #F1F4F9; color: var(--navy); }
.mainnav a.active, .mainnav .nav-group > summary.active { background: var(--tint); color: var(--navy); border: 0; box-shadow: inset 0 -2px 0 var(--blue); }
.mainnav .nav-group[open] > summary { background: var(--tint); }
.mainnav .nav-group { align-items: center; }
@media (min-width: 1280px) {
  .mainnav a, .mainnav .nav-group > summary { padding: 0 .5rem; font-size: .95rem; }
}
.navmenu > summary { border-radius: var(--r-sm); color: var(--ink-2); }
.settings-btn.active { box-shadow: inset 0 -2px 0 var(--blue); border-radius: var(--r-sm); background: var(--tint); }
.navmenu-panel { border-color: var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); padding: .35rem; }
.navmenu-panel a { border-radius: 6px; font-weight: 600; color: var(--ink-2); }
.navmenu-panel a.active { background: var(--tint); box-shadow: inset 3px 0 0 var(--blue); }
.who .btn-ghost, .who .signout-bar .btn { color: var(--ink-2); font-weight: 600; }
.store-switch select, .topbar-inner .store-switch select {
  border: 1px solid var(--field); border-radius: var(--r-sm); background-color: #fff; font-weight: 600; color: var(--ink); min-height: 2.4rem;
}
.store-switch select:hover { border-color: var(--blue); }
.topbar-inner .gsearch input { border: 1px solid var(--field); border-radius: var(--r-sm); background-color: #fff; }
.nav-count { background: #C2410C; font-weight: 700; }

/* ---------- Page layout ---------- */
.wrap { padding: 1.5rem 1.25rem; }
@media (min-width: 1300px) { .wrap, .topbar-inner { max-width: 1440px; } }
.page-head { align-items: center; margin-bottom: 1.1rem; gap: .75rem 1rem; }
.page-head h1 { margin: 0; }
.crumbs { margin: 0 0 .35rem; font-size: .9rem; }
.crumbs a { text-decoration: none; color: var(--muted); font-weight: 600; min-height: 36px; }
.crumbs a:hover { color: var(--blue-d); text-decoration: underline; }
.foot { color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1rem; }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.35rem; }
.card > h2:first-child, .card-head h2 { font-size: 1.05rem; }
.card > h2:first-child { margin-bottom: .85rem; }
.card.empty { border-style: dashed; border-color: var(--line-2); background: #FBFCFE; box-shadow: none; padding: 2.25rem 1.5rem; }
.card.empty p { margin: 0; }
.grid-2 { gap: 1.25rem; }

/* ---------- Buttons: one clear primary, calm secondary ---------- */
.btn { border-radius: var(--r-sm); border-width: 1px; font-weight: 600; min-height: 44px; padding: 0 1rem; transition: background-color .12s, border-color .12s, color .12s; }
.btn-primary { background: var(--blue); border-color: var(--blue); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.btn-primary:hover { background: var(--blue-d); border-color: var(--blue-d); }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line-2); box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
.btn-secondary:hover { background: #F5F8FC; border-color: var(--field); color: var(--navy); }
.btn-danger { border-color: #E6A39C; }
.btn-ghost:hover { background: #F1F4F9; }
.btn-block { min-height: 48px; }

/* ---------- Forms ---------- */
label { font-size: .9rem; font-weight: 600; color: var(--ink-2); margin-bottom: .3rem; }
label.check { font-size: 1rem; color: var(--ink); }
input, select, textarea { border: 1px solid var(--field); border-radius: var(--r-sm); min-height: 44px; padding: .5rem .75rem; }
input::placeholder, textarea::placeholder { color: #6B7587; opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: #6E7A8E; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: 3px solid rgba(47, 107, 192, .22); outline-offset: 0; }
.filters { gap: .75rem 1rem; }
.hint { color: var(--muted); }

/* ---------- Tables: calmer header, airier rows, no wrapping dates ---------- */
.table-card { padding: 0; }
.table th, .table td { padding: .7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table thead th { background: #F8FAFC; color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .045em; padding-top: .6rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line-2); }
.table thead th a { color: inherit; }
.table tbody tr:hover { background: #F7F9FC; }
.table td { font-size: .95rem; }
.table td a { text-decoration: none; font-weight: 600; }
.table td a:hover { text-decoration: underline; }
.table td[data-label="Date"], .table td[data-label="Received"], .table td[data-label="Order #"], .table td[data-label="When"],
.table td[data-label="Store"], .table td[data-label="Total"], .table td[data-label="Customer"] .small, .table td[data-label="Contact"] .small { white-space: nowrap; }
@media (min-width: 761px) { .table th, .table td { padding-left: .85rem; padding-right: .85rem; } }
.table .status-form.compact select { min-height: 40px; font-size: .9rem; padding-top: .3rem; padding-bottom: .3rem; }

/* ---------- Status pills: tinted with a colour dot (readable, AA) ---------- */
.badge { font-weight: 600; font-size: .85rem; padding: .22em .7em; border-radius: 999px; line-height: 1.4; }
.badge[class*="st-"] {
  background: color-mix(in srgb, var(--st, #2F6BC0) 12%, #fff);
  color: color-mix(in srgb, var(--st, #2F6BC0) 55%, #000);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--st, #2F6BC0) 28%, #fff);
  display: inline-flex; align-items: center; gap: .45em;
}
.badge[class*="st-"]::before { content: ""; width: .5em; height: .5em; border-radius: 50%; background: var(--st, #2F6BC0); flex: none; }
.big-badge .badge { font-size: 1rem; padding: .3em .9em; }
.tag { border-radius: 6px; font-weight: 600; background: #EEF2F7; color: var(--ink-2); }
.tag-warn { background: #FFF1D6; color: #6E3F00; }

/* ---------- Flash / banners: light fill, slim accent ---------- */
.flash { border: 1px solid; border-left-width: 4px; border-radius: 10px; font-weight: 500; }
.flash-success { background: #F0F9F4; border-color: #A8D5BC; border-left-color: var(--ok); }
.flash-error { background: #FEF3F2; border-color: #F3B9B2; border-left-color: var(--danger); }
.flash-info { background: #F2F7FD; border-color: #BCD3EF; border-left-color: var(--blue); }
.flash-warn { background: #FFF9EB; border-color: #F1D49A; border-left-color: #C27C00; }

/* ---------- Desk: one KPI card style; attention shown with an accent, not a fill ---------- */
.today-strip { gap: 1rem; margin-bottom: 1.25rem; }
.tstat, .stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.2rem; transition: border-color .12s, box-shadow .12s; }
.tstat:hover, .stat:hover { border-color: #B9C8DD; box-shadow: 0 4px 12px rgba(16, 24, 40, .07); }
.tstat-l, .stat-l { order: -1; font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .045em; }
.tstat-n, .stat-n { font-size: 2rem; font-weight: 700; color: var(--navy); letter-spacing: -.015em; line-height: 1.15; margin: .15rem 0 .1rem; }
.tstat-s, .stat-s { font-size: .85rem; color: var(--muted); }
.stat-row { gap: 1rem; }
.stat-action, .stat-warn { background: #fff; border-color: var(--line); box-shadow: inset 4px 0 0 #D97706, var(--shadow); }
.stat-action .stat-l, .stat-warn .stat-l { color: #8A4B00; }
.bucket-list li { border-left: 0; background: none; border-radius: 0; margin: 0; border-bottom: 1px solid var(--line); position: relative; }
.bucket-list li:last-child { border-bottom: 0; }
.bucket-list a { padding: .25rem .25rem .25rem 1.35rem; font-weight: 600; color: var(--ink); border-radius: 6px; }
.bucket-list a:hover { background: #F7F9FC; }
.bucket-list li::before { content: ""; position: absolute; left: .3rem; top: 50%; width: .6rem; height: .6rem; margin-top: -.3rem; border-radius: 50%; background: var(--st, #2F6BC0); }
.bucket-list strong { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.activity li { padding: .65rem 0; border-bottom-color: var(--line); font-size: .95rem; }
.activity a { color: var(--ink); text-decoration: none; }
.activity a:hover { color: var(--blue-d); text-decoration: underline; }
.act-when { color: var(--muted); font-size: .85rem; white-space: nowrap; }

/* ---------- Detail pages ---------- */
.dl { gap: .5rem 1rem; }
.dl dt { color: var(--muted); font-weight: 600; font-size: .9rem; padding-top: .1rem; }
.danger-zone { border-top: 1px solid var(--line); }

/* ---------- Tabs / segmented controls: one style everywhere ---------- */
.tabs { gap: .4rem; }
.tabs a, .seg a {
  min-height: 42px; padding: 0 .95rem; border: 1px solid var(--line-2); border-radius: 999px; background: #fff;
  color: var(--ink-2); font-weight: 600; box-shadow: var(--shadow);
}
.tabs a:hover, .seg a:hover { border-color: var(--field); color: var(--navy); }
body .tabs a.active, body .seg a.active, .crm-sub a.active { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: none; }
body .tabs a.active .small, body .tabs a.active .muted { color: #E3EAF6; opacity: 1; }
.tabs .count { background: #EEF2F7; color: var(--ink-2); font-weight: 700; }
body .tabs a.active .count { background: rgba(255, 255, 255, .2); color: #fff; }

/* ---------- Drafts ---------- */
.draft { border-left: 1px solid var(--line); box-shadow: inset 4px 0 0 var(--blue), var(--shadow); }
.draft-approved { box-shadow: inset 4px 0 0 var(--ok), var(--shadow); }
.draft-sent, .draft-posted, .draft-discarded { box-shadow: inset 4px 0 0 #9AA3B2, var(--shadow); }
.draft-title a { text-decoration: none; }
.draft-title a:hover { text-decoration: underline; }
.draft-body { background: #F8FAFC; border-color: var(--line); }

/* ---------- Sign-in ---------- */
body.public { background: radial-gradient(1200px 500px at 50% -10%, #E6EEF9 0, var(--bg) 60%); padding-top: 4rem; }
.auth-card { border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px rgba(16, 24, 40, .08); padding: 2.25rem 2rem; max-width: 26rem; }
.auth-logo { width: 200px; }
.auth-app { color: var(--muted); font-size: .9rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 1.5rem; }
.auth-card h1 { font-size: 1.4rem; margin-bottom: 1rem; }

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  .wrap { padding: 1rem .75rem; }
  h1 { font-size: 1.45rem; }
  .table-card { background: none; border: 0; box-shadow: none; }
  .table.responsive tr { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: .75rem; padding: .55rem 0; }
  .table.responsive tr:hover { background: #fff; }
  /* label sits in a fixed left column; mixed cell content (name + phone + tag) stays together on the right */
  .table.responsive td { display: block; position: relative; padding: .3rem 1rem .3rem 8.25rem; border: 0; font-size: .95rem; min-height: 2rem; }
  .table.responsive td::before { position: absolute; left: 1rem; top: .45rem; width: 6.75rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 0; line-height: 1.3; }
  .table.responsive td[data-label=""] { display: flex; gap: .5rem; padding-left: 1rem; }
  .table td[data-label="Customer"] .small, .table td[data-label="Contact"] .small { white-space: normal; overflow-wrap: anywhere; }
  .stat-row { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .today-strip { grid-template-columns: 1fr 1fr; }
  .today-strip .tstat:last-child:nth-child(odd), .stat-row .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .tabs a { border-radius: 12px; }
  .tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabs a { justify-content: center; text-align: center; }
  .table.responsive td[data-label="Order #"], .table.responsive td[data-label="Name"] { font-size: 1.05rem; }
  .today-strip { gap: .6rem; }
  .tstat, .stat { padding: .8rem .9rem; }
  .stat-l, .tstat-l { font-size: .72rem; }
  .tstat-n, .stat-n { font-size: 1.7rem; }
  body.public { padding-top: 1.5rem; }
  .auth-card { padding: 1.5rem 1.25rem; }
}
