/* EWS Portal — house skin (design-standard brands/ews.md): Plus Jakarta Sans + IBM Plex Mono, jade accent,
   dark by default (light follows the OS), sidebar always dark. Inside pages: one framed panel per page
   (summary strip → toolbar → table), mono eyebrow labels echoing the sign-in slip, row actions behind a ⋯ menu. */
:root {
  color-scheme: dark;
  --bg: #1a1d23; --card: #1e2228; --ink: #e8ebf0; --mute: #94a3b8; --line: #262c35; --line-strong: #2e3540;
  --row-hover: #2a323d; --row-alt: #232a33; --row-sel: rgba(19, 182, 133, .16);
  --acc: #13b685; --acc-hover: #0d9970; --acc-muted: rgba(19, 182, 133, .12);
  --rose: #f43f5e; --rose-muted: rgba(244, 63, 94, .12); --amber: #f59e0b; --amber-muted: rgba(245, 158, 11, .14);
  --sky: #0ea5e9; --sky-muted: rgba(14, 165, 233, .12); --purple: #8b5cf6; --purple-muted: rgba(139, 92, 246, .14);
  --side: #0c0e12; --side-hover: #1e2228; --side-active: #262c35;
  --panel-shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 16px 40px -28px rgba(0, 0, 0, .7);
  --pop-shadow: 0 12px 32px rgba(0, 0, 0, .4);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease-out: cubic-bezier(.23, 1, .32, 1); --ease-drawer: cubic-bezier(.32, .72, 0, 1);
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f8fafb; --card: #ffffff; --ink: #0c0e12; --mute: #64748b; --line: #e2e8f0; --line-strong: #cbd5e1;
    --row-hover: #eef3f8; --row-alt: #f6f8fb; --row-sel: rgba(19, 182, 133, .14);
    --panel-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 32px -28px rgba(15, 23, 42, .35);
    --pop-shadow: 0 12px 32px rgba(15, 23, 42, .18);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--acc); }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }

/* ── shared primitives (the sign-in slip restyles these in auth.css, loaded after this file) ── */
.err { color: var(--rose); font-size: 13px; margin: 0; }
.ok { color: var(--acc); font-size: 13px; margin: 0; }
.note { color: var(--mute); font-size: 13px; margin: 0; }
.center { text-align: center; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--mute); font-weight: 500; }
input[type=email], input[type=password], input[type=text], input[type=search], select {
  font-size: 15px; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); }
input:focus, select:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 2px var(--acc-muted); }
.ts { display: flex; justify-content: center; min-height: 65px; }
.btn { appearance: none; border: 1px solid var(--line-strong); background: transparent; border-radius: 8px; padding: 8px 13px; font-weight: 500;
  cursor: pointer; display: inline-flex; gap: 8px; align-items: center; justify-content: center; white-space: nowrap; min-height: 36px;
  transition: background-color .12s var(--ease-out), transform .1s var(--ease-out); }
.btn:hover:not(:disabled) { background: var(--row-hover); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: #fff; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .04); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--acc-hover); }
.btn.danger { border-color: var(--rose); color: var(--rose); }
.btn.danger:hover:not(:disabled) { background: var(--rose); color: #fff; }
.btn.wide { width: 100%; padding: 11px 14px; font-weight: 600; font-size: 15px; }
.btn.google { background: #fff; color: #1f1f1f; border-color: #dadce0; }
.btn.google:hover:not(:disabled) { background: #f3f4f6; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; min-height: 30px; }
.btn.icon { width: 36px; height: 36px; min-height: 0; padding: 0; border-radius: 8px; color: var(--mute); }
.btn.icon:hover:not(:disabled) { color: var(--ink); }
.btn svg { width: 16px; height: 16px; flex: none; }
.or { display: flex; align-items: center; gap: 10px; color: var(--mute); font-size: 12px; }
.or:before, .or:after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.shell :focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* ── app shell: always-dark sidebar (sticky) + main column ── */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side { background: var(--side); color: rgba(255, 255, 255, .85); display: flex; flex-direction: column; padding: 18px 12px 14px; gap: 2px;
  border-right: 1px solid rgba(255, 255, 255, .07); position: sticky; top: var(--pb-h, 0px); height: calc(100dvh - var(--pb-h, 0px)); overflow: auto; align-self: start; }
.side .brand { display: flex; align-items: center; gap: 9px; color: #fff; padding: 4px 10px 18px; font-size: 15px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.side .brand-mark { width: 11px; height: 11px; border-radius: 3px; background: var(--acc); box-shadow: 0 0 0 3px rgba(19, 182, 133, .18); flex: none; }
.side .brand-name b { font-weight: 500; color: rgba(255, 255, 255, .55); }
.side .nav { display: flex; flex-direction: column; gap: 2px; }
.side a { color: rgba(255, 255, 255, .78); text-decoration: none; font-size: 13px; font-weight: 500; padding: 8px 10px; border-radius: 7px; position: relative;
  transition: background-color .12s var(--ease-out), color .12s var(--ease-out); }
.side a:hover { background: var(--side-hover); color: #fff; }
.side a.active { background: var(--side-active); color: #fff; font-weight: 600; }
.side a.active::before { content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%); width: 3px; height: 18px; background: var(--acc); border-radius: 0 3px 3px 0; }
.side .sect { font: 600 10.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .38); padding: 18px 10px 7px; white-space: nowrap; }
.side .me { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .07); padding: 14px 6px 0; display: flex; flex-direction: column; gap: 10px; font-size: 12px; color: rgba(255, 255, 255, .45); }
.side .me .who { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0 4px; }
.side .me .avatar { width: 32px; height: 32px; border-radius: 9px; background: var(--side-active); color: #fff; font: 600 12px var(--mono); letter-spacing: .04em; display: grid; place-items: center; flex: none; }
.side .me .who > span { min-width: 0; line-height: 1.3; }
.side .me b { color: #fff; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .me button { background: transparent; border: 1px solid rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .85); border-radius: 7px; padding: 7px 10px; cursor: pointer; text-align: left; font-size: 12.5px; min-height: 36px; }
.side .me button:hover { background: var(--side-hover); }
.main { padding: 30px 32px 48px; min-width: 0; display: flex; flex-direction: column; gap: 20px; width: 100%; max-width: 1360px; }

/* page head: mono eyebrow (like the slip's labels) over a big title */
.page-head { display: flex; flex-direction: column; gap: 3px; }
.eyebrow { font: 600 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--acc); }
.page-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: 4px 0 0; overflow-wrap: anywhere; }
.page-head p { color: var(--mute); margin: 4px 0 0; font-size: 14px; max-width: 72ch; }

/* the one framed panel per page */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--panel-shadow); overflow: hidden; }
.panel-bar { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-bar .spacer { flex: 1; }
.panel-title { font-size: 13px; font-weight: 600; margin: 0; }
.panel-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.panel-body + .panel-body { border-top: 1px solid var(--line); }
.stats { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 0; min-width: 0; }
.stat { display: inline-flex; align-items: baseline; gap: 7px; padding: 0 16px; border-left: 1px solid var(--line); font-size: 12.5px; color: var(--mute); white-space: nowrap; }
.stat:first-child { padding-left: 0; border-left: 0; }
.stat b { font: 700 20px/1 var(--mono); letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat .pill { position: relative; top: -1px; }
.add-body { padding: 16px 18px 14px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--acc) 5%, var(--card)); }
.add-body[hidden] { display: none; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 18px; }
.toolbar input[type=search] { min-width: 260px; font-size: 13.5px; padding: 7px 10px; }
.toolbar .spacer { flex: 1; }
.sel-count { color: var(--mute); font-size: 12.5px; }

/* ── data tables (house standard: checkboxes, search, bulk Actions, zebra, column separators) ── */
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table.dt { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.dt th { background: var(--bg); color: var(--mute); font: 600 10.5px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; text-align: left; padding: 10px 12px; white-space: nowrap; }
table.dt td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
table.dt th + th, table.dt td + td { border-left: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
table.dt tbody tr:nth-child(even) td { background: var(--row-alt); }
table.dt tbody tr:hover td { background: var(--row-hover); }
table.dt tbody tr.selected td { background: var(--row-sel) !important; }
table.dt tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--acc); }
table.dt td.cb, table.dt th.cb { width: 36px; text-align: center; padding-left: 14px; }
table.dt.no-cb td.cb, table.dt.no-cb th.cb { display: none; }
table.dt.no-cb th:nth-child(2), table.dt.no-cb td:nth-child(2) { border-left: 0; }
table.dt tr.off td { color: var(--mute); }
table.dt td.acts { white-space: nowrap; text-align: right; width: 52px; padding-right: 10px; }
table.dt select { font-size: 13px; padding: 5px 8px; }
.email { overflow-wrap: anywhere; }
table.dt td.person { min-width: 220px; }
table.dt td.person b { font-weight: 600; }
table.dt td.person .email { overflow-wrap: normal; word-break: break-all; }
table.dt .num { white-space: nowrap; }
table.dt td .pill + .pill { margin-left: 6px; }
.empty { padding: 32px; text-align: center; color: var(--mute); }
table.dt tbody tr.flag td { box-shadow: inset 0 0 0 9999px var(--rose-muted); }

.pill { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.pill.ok { background: var(--acc-muted); color: var(--acc); box-shadow: inset 0 0 0 1px rgba(19, 182, 133, .25); }
.pill.wait { background: var(--amber-muted); color: var(--amber); box-shadow: inset 0 0 0 1px rgba(245, 158, 11, .25); }
.pill.bad { background: var(--rose-muted); color: var(--rose); box-shadow: inset 0 0 0 1px rgba(244, 63, 94, .25); }
.pill.info { background: var(--sky-muted); color: var(--sky); box-shadow: inset 0 0 0 1px rgba(14, 165, 233, .25); }
.pill.role { background: var(--purple-muted); color: var(--purple); box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .25); }
.pill.gray { background: rgba(100, 116, 139, .14); color: var(--mute); box-shadow: inset 0 0 0 1px rgba(100, 116, 139, .22); }

/* menus (bulk Actions in the toolbar; row ⋯ menus pop out of the table so the scrolling wrapper can't clip them) */
.menu { position: relative; }
.menu-list { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 200px; background: var(--card); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 4px; box-shadow: var(--pop-shadow); display: none; }
.menu.open .menu-list { display: block; animation: pop-in .12s var(--ease-out); transform-origin: top left; }
.menu-list button, .pop button { display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--ink); min-height: 34px; }
.menu-list button:hover:not(:disabled), .pop button:hover:not(:disabled) { background: var(--row-hover); }
.menu-list button:disabled, .pop button:disabled { opacity: .45; cursor: default; }
.menu-list button.danger, .pop button.danger { color: var(--rose); }
.pop { position: fixed; z-index: 70; min-width: 210px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 10px; padding: 4px;
  box-shadow: var(--pop-shadow); transform-origin: top right; animation: pop-in .12s var(--ease-out); }
.pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } }

/* forms */
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row label.field { min-width: 180px; flex: 1; }
.form-row label.field.short { flex: 0 1 180px; }
.form-row .btn { min-height: 38px; }
.devlink { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; padding: 10px; border: 1px dashed var(--amber); border-radius: 8px; background: var(--amber-muted); }
.devlink input { flex: 1; min-width: 260px; font: 12px var(--mono); }

/* drawer (Access / Allowed items) */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 40; animation: fade-in .18s var(--ease-out); }
.drawer { position: fixed; top: var(--pb-h, 0px); right: 0; bottom: 0; width: min(460px, 100vw); background: var(--card); border-left: 1px solid var(--line-strong); z-index: 41;
  display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(0, 0, 0, .35); animation: slide-in .26s var(--ease-drawer); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.drawer header { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.drawer header h2 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 2px; }
.drawer header .x { margin-left: auto; }
.drawer .body { padding: 14px 18px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.drawer footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.tree { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tree .node { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line); font-size: 13.5px; min-height: 40px; }
.tree .node:first-child { border-top: 0; }
.tree .node.retailer { font-weight: 600; background: var(--bg); }
.tree .node.page { padding-left: 30px; }
.tree .node.feature { padding-left: 52px; font-size: 13px; }
.tree .node .k { margin-left: auto; color: var(--mute); font: 11px var(--mono); }
.tree .node.disabled { opacity: .5; }
.warn-box { border: 1px solid var(--amber); background: var(--amber-muted); color: var(--ink); border-radius: 8px; padding: 10px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 8px; }
.warn-box b { color: var(--amber); }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60; padding: 10px 16px; border-radius: 8px; background: var(--card);
  border: 1px solid var(--line-strong); box-shadow: var(--pop-shadow); font-size: 13.5px; max-width: 90vw; }
.toast.ok { border-color: var(--acc); }
.toast.err { border-color: var(--rose); color: var(--rose); }

/* loading skeleton (shell before app.js renders) */
.skel { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--line) 0%, var(--line-strong) 50%, var(--line) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── P2: retailer chooser (Home) + Requests ── */
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.hub-tile { display: flex; flex-direction: column; justify-content: space-between; gap: 18px; min-height: 112px; padding: 16px 18px;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--card); color: var(--ink); text-decoration: none;
  transition: border-color .12s var(--ease-out), background-color .12s var(--ease-out), transform .1s var(--ease-out); }
.hub-tile .hub-name { font-size: 19px; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.hub-tile .hub-go { display: inline-flex; align-items: center; gap: 6px; color: var(--acc); font-weight: 600; font-size: 13px; }
.hub-tile .hub-go svg { width: 16px; height: 16px; }
@media (hover: hover) { a.hub-tile:hover { border-color: var(--acc); background: var(--row-hover); } }
a.hub-tile:active { transform: scale(.98); }
a.hub-tile:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.hub-tile.soon { opacity: .55; border-style: dashed; cursor: default; }
.hub-tile.soon .pill { align-self: flex-start; }
.hub-none { margin: 0 0 14px; font-size: 14px; }
@media (max-width: 760px) { .hub-tile { min-height: 92px; padding: 14px; } .hub-tile .hub-name { font-size: 17px; } }
.side .nav a .count { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--amber); color: #111; font: 600 11px/18px var(--mono); text-align: center; }
.req-sum { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); margin-bottom: 14px; overflow-wrap: anywhere; }
.req-sum blockquote { margin: 10px 0 0; padding-left: 10px; border-left: 2px solid var(--line-strong); white-space: pre-wrap; font-size: 13px; }
.sub-h { font-size: 13px; margin: 16px 0 8px; color: var(--mute); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.warn-note { color: var(--amber); }
table.dt .msg { display: inline-block; max-width: 280px; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; } /* the header row keeps its own height; the page takes the rest */
  .side { position: static; height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand me" "nav nav"; padding: 10px 12px 8px; gap: 8px 10px; overflow: visible; }
  .side .brand { grid-area: brand; padding: 2px 0; }
  .side .me { grid-area: me; margin: 0; border: 0; padding: 0; flex-direction: row; align-items: center; gap: 8px; }
  .side .me .who { padding: 0; }
  .side .me .who > span:not(.avatar) { display: none; }
  .side .me .avatar { width: 30px; height: 30px; }
  .side .me button { padding: 6px 10px; }
  .side .nav { grid-area: nav; flex-direction: row; gap: 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin: 0 -12px; padding: 0 12px; }
  .side .nav::-webkit-scrollbar { display: none; }
  .side .nav a { white-space: nowrap; flex: none; }
  .side .sect { display: none; }
  .side a.active::before { display: none; }
  .main { padding: 18px 14px 36px; gap: 14px; }
  .page-head h1 { font-size: 24px; }
  .panel { border-radius: 12px; }
  .panel-bar, .toolbar, .add-body, .panel-body { padding-left: 14px; padding-right: 14px; }
  .stat { padding: 0 10px; font-size: 12px; }
  .stat b { font-size: 17px; }
  .toolbar input[type=search] { min-width: 0; flex: 1; }
  .form-row label.field { min-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .menu.open .menu-list, .pop, .scrim, .drawer, .skel { animation: none; }
  .btn, .side a { transition: none; }
}
