/* PartsLogic shell CSS, lifted from Protect's protect.css per PLAN-search-admin.md
   section 3 / SUITE-ADMIN-REQUIREMENTS.md 4.3. Tokens only; trimmed to what the
   console shell needs (nav, header, cards, forms) instead of Protect's queue UI. */

:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1b1f24;
  --muted: #6b7280;
  --line: #e2e5ea;
  --accent: #1f4e79;
  --good: #197a3d;    --good-bg: #e7f5ec;
  --warning: #9a6700; --warning-bg: #fdf3dd;
  --critical: #b3261e;--critical-bg: #fce9e7;
  --muted-tag: #4b5563;--muted-bg: #eef0f3;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 2px; }
h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px; background: var(--accent); color: #fff;
}
.topbar .brand { color: #fff; font-size: 16px; letter-spacing: .02em; }
.topbar .brand strong { font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.tenant-switcher select { padding: 5px 8px; border-radius: 6px; border: 1px solid transparent; font: inherit; }
.topbar-right form { display: inline; }
.topbar-right a { color: #fff; text-decoration: underline; }

/* shell layout: left nav + content */
.shell { display: flex; align-items: flex-start; max-width: 1280px; margin: 0 auto; }
.side-nav {
  flex: 0 0 200px; padding: 20px 12px; border-right: 1px solid var(--line);
  min-height: calc(100vh - 48px);
}
.side-nav a {
  display: block; padding: 8px 12px; border-radius: 6px; color: var(--ink);
  font-weight: 600; font-size: 13px; margin-bottom: 2px;
}
.side-nav a:hover { background: #fafcff; text-decoration: none; }
.side-nav a.active { background: var(--muted-bg); color: var(--accent); }

.wrap { flex: 1 1 auto; min-width: 0; padding: 20px 24px 60px; }

/* flash messages */
.flash { list-style: none; margin: 0 0 16px; padding: 0; }
.flash li { padding: 10px 14px; border-radius: 6px; margin-bottom: 6px; border: 1px solid; }
.flash-success { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.flash-error { background: var(--critical-bg); border-color: var(--critical); color: var(--critical); }
.flash-info { background: var(--muted-bg); border-color: var(--line); color: var(--ink); }

/* cards + forms, shared by every screen agent that builds on this shell */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.btn { font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.btn:hover { background: #f6f7f9; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; max-width: 320px; }
.field label { font-size: 12px; color: var(--muted); }
.field input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.errorlist { list-style: none; margin: 0 0 8px; padding: 0; color: var(--critical); font-size: 12.5px; }

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* tables: compact and readable everywhere; numbers right-aligned via .num-col */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
td.num-col, th.num-col { text-align: right; font-variant-numeric: tabular-nums; }
.ok { color: var(--good); font-weight: 600; }
.bad { color: var(--critical); }

/* dashboard stat cards: one number per thing that can go wrong, each with a
   drill-in link to the screen that owns the detail */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; }
.stat h2 { margin-bottom: 4px; }
.stat .num { font-size: 26px; font-weight: 600; line-height: 1.15; margin: 0; font-variant-numeric: tabular-nums; }
.stat .num.bad { color: var(--critical); }
.stat .unit { font-size: 14px; font-weight: 400; color: var(--muted); }
.stat .sub { font-size: 12px; color: var(--muted); margin: 2px 0 0; }
.stat .stat-err { font-size: 14px; color: var(--critical); margin: 0; }
.stat .drill { font-size: 12px; margin-top: auto; padding-top: 10px; }
.stat form { margin: 0; }

/* inline SVG chart: server-rendered geometry, no chart library, no JS */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--muted); stroke-width: 1; }
.chart .bar { fill: var(--accent); }
.chart .bar-zero { fill: var(--warning); }
.chart .ylab { font-size: 10px; fill: var(--muted); text-anchor: end; }
.chart .xlab { font-size: 10px; fill: var(--muted); text-anchor: middle; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; }
.key-bar { background: var(--accent); }
.key-zero { background: var(--warning); }

/* embed skin: no chrome when rendered inside a platform iframe (P3) */
body.embed-frame .topbar,
body.embed-frame .side-nav { display: none; }
body.embed-frame .shell { display: block; }
body.embed-frame .wrap { padding: 12px; }

/* "Search index" card: the one control merchants used to open a ticket for, so
   it sits at the top of the dashboard with the number on the left and the
   button on the right. Disabled states are honest — the engine owns the
   throttle and this only renders its answer. */
.index-card { border-left: 3px solid var(--accent); }
.index-head { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.index-card .num { font-size: 26px; font-weight: 600; line-height: 1.15; margin: 0; font-variant-numeric: tabular-nums; }
.index-card .unit { font-size: 14px; font-weight: 400; color: var(--muted); }
.index-card .sub { font-size: 12px; color: var(--muted); margin: 4px 0 0; max-width: 62ch; }
.index-action { text-align: right; }
.index-action form { margin: 0; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #17395a; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:disabled:hover { background: #fff; }
