/* MarketIntel HQ client portal — design system. See DESIGN.md.
   Tailwind (compiled to tailwind.css) provides layout utilities only; every colour, type and component rule
   is defined here once so the product looks the same on every page. */

:root {
  --paper: #ffffff;
  --surface: #fafafa;
  --surface-2: #f3f3f6;
  --line: #e2e2e2;
  --line-2: #eeeef1;
  --line-strong: #cfd2d9;
  --ink: #1a1a2e;
  --ink-2: #475569;
  --ink-3: #64748b;
  --ink-4: #94a3b8;
  --accent: #4f46e5;
  --accent-ink: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.08);
  --pos: #059669;
  --neg: #dc2626;
  --warn: #d97706;
  --bar: #1a1a2e;
  --bar-2: #24243a;
  --bar-line: #2f2f47;
  --bar-ink: #d6d9de;
  --bar-muted: #8b93a3;
  --radius: 3px;
  --shadow-pop: 0 8px 24px rgba(15, 17, 21, 0.08), 0 1px 2px rgba(15, 17, 21, 0.06);
  --focus: 0 0 0 3px rgba(79, 70, 229, 0.2);
  --row-h: 38px;
  --control-h: 32px;
}

/* ------------------------------------------------------------------ base */
[x-cloak] { display: none !important; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
  background: var(--surface);
  color: var(--ink);
  font-family: "Montserrat", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.45;
  font-feature-settings: "cv11", "ss01", "tnum" 0;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
*:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius); }
::selection { background: rgba(79, 70, 229, 0.16); }
hr { border: 0; border-top: 1px solid var(--line); }

h1 { font-family: "Montserrat", sans-serif; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); line-height: 1.25; }
h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.005em; color: var(--ink); line-height: 1.3; }
h3 { font-size: 13px; font-weight: 600; color: var(--ink); }

.muted { color: var(--ink-3); }
.faint { color: var(--ink-4); }
.ink-2 { color: var(--ink-2); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn { color: var(--warn); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; color: var(--ink-2); letter-spacing: 0; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 500; }
.subtitle { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; max-width: 72ch; }
.delta { font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }

/* ------------------------------------------------------------------ page skeleton */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.page-head .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); margin-bottom: 10px; }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--ink); }
.crumbs span { color: var(--ink); }
.crumbs .sep { color: var(--ink-4); }
.section { margin-top: 24px; }

/* ------------------------------------------------------------------ messages */
.alert-strip { border-bottom: 1px solid var(--line); background: var(--paper); }
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 9px 32px; font-size: 12.5px; color: var(--ink); border-left: 2px solid var(--ink); }
.alert.alert-success { border-left-color: var(--pos); }
.alert.alert-error { border-left-color: var(--neg); }
.alert.alert-warning { border-left-color: var(--warn); }
.alert button { color: var(--ink-3); margin-left: auto; font-size: 16px; line-height: 1; }
.alert button:hover { color: var(--ink); }

/* ------------------------------------------------------------------ surfaces */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); min-height: 44px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: -0.003em; }
.card-title .count { font-weight: 400; color: var(--ink-3); margin-left: 6px; font-variant-numeric: tabular-nums; }
.card-meta { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.card-meta a, a.card-meta { color: var(--ink-3); }
.card-meta a:hover, a.card-meta:hover { color: var(--ink); text-decoration: none; }
.card-body { padding: 16px; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
.card-body p + p { margin-top: 10px; }

/* stat strip: one row of numbers divided by hairlines. Cells draw their own right/bottom hairline as a 1px
   box-shadow; the strip clips it on the outer edges, so wrapping to 3 or 2 columns needs no border bookkeeping.
   Columns: 6 by default, .stat-strip-5/-4/-3/-2 override; 3 under 1024px, 2 under 640px. */
.stat-strip { display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: clip; }
.stat-strip > .stat { border: 0; border-radius: 0; box-shadow: 1px 1px 0 0 var(--line-2); background: transparent; }
.stat-strip > .stat:last-child { border-right: 0; }
.stat-strip-5 { --cols: 5; }
.stat-strip-4 { --cols: 4; }
.stat-strip-3 { --cols: 3; }
.stat-strip-2 { --cols: 2; }
.stat-strip-flush { border: 0; border-radius: 0; }
@media (max-width: 1023px) { .stat-strip, .stat-strip-5, .stat-strip-4 { --cols: 3; } }
@media (max-width: 640px) { .stat-strip, .stat-strip-5, .stat-strip-4, .stat-strip-3 { --cols: 2; } }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 13px; min-width: 0; color: inherit; }
a.stat:hover { text-decoration: none; background: var(--surface); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-family: "Montserrat", sans-serif; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.stat-value.text-base { font-size: 15px; letter-spacing: -0.005em; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: 12px; color: var(--ink-3); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub .delta { font-size: 12px; }
.stat-value-lg { font-size: 32px; letter-spacing: -0.025em; }
.stat-value .delta { font-size: 15px; letter-spacing: 0; }
.stat.is-active { box-shadow: inset 0 -2px 0 var(--ink); }

/* price cell: number only (currency lives in the column header), with an optional was/delta line under it */
.price { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-main { font-weight: 500; color: var(--ink); }
.price-sub { font-size: 11.5px; margin-top: 2px; color: var(--ink-3); }
.was { color: var(--ink-4); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.price-none { color: var(--ink-4); }

/* long text (descriptions) with a reading measure and an Alpine "show more" clamp */
.measure { max-width: 65ch; }
.prose-sm { font-size: 12.5px; line-height: 1.6; color: var(--ink-2); }
.prose-sm p + p { margin-top: 8px; }
.clamp { max-height: 10em; overflow: hidden; }
.clamp-toggle { display: inline-block; margin-top: 10px; font-size: 12px; color: var(--ink-3); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.clamp-toggle:hover { color: var(--ink); }

/* key/value lists (detail pages) */
.kv { font-size: 13px; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 16px; border-bottom: 1px solid var(--line-2); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--ink-3); white-space: nowrap; }
.kv dd { text-align: right; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ tables */
.tbl { width: 100%; font-size: 12.5px; border-collapse: separate; border-spacing: 0; }
.tbl thead th {
  position: sticky; top: 0; z-index: 1; background: var(--paper); color: var(--ink-3);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; text-align: left;
  height: 36px; padding: 0 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl thead th:first-child, .tbl tbody td:first-child { padding-left: 16px; }
.tbl thead th:last-child, .tbl tbody td:last-child { padding-right: 16px; }
.tbl tbody td { height: var(--row-h); padding: 6px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; color: var(--ink-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface); }
.tbl tbody tr.is-selected td { background: var(--accent-soft); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.num { color: var(--ink); }
.tbl td.num.muted, .tbl td.num .muted { color: var(--ink-3); }
.tbl a.action, .tbl .row-actions a { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.tbl a.action:hover, .tbl .row-actions a:hover { color: var(--ink); text-decoration: none; }
.tbl .row-actions { display: flex; justify-content: flex-end; gap: 12px; opacity: 0; transition: opacity 0.1s; }
.tbl tr:hover .row-actions { opacity: 1; }
.tbl .empty { padding: 40px 16px; text-align: center; color: var(--ink-3); font-size: 12.5px; height: auto; }
.tbl .empty a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.tbl tfoot td { padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); background: var(--paper); }
.tbl-compact tbody td { height: 32px; padding: 4px 12px; }
.tbl-compact thead th { height: 32px; }
.cell-title { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 500; }
a.cell-title:hover, button.cell-title:hover { color: var(--accent); text-decoration: none; }
.cell-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-meta .mono { font-size: 11px; }
.sort-link { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; font-weight: 500; }
.sort-link:hover { color: var(--ink); text-decoration: none; }
.sort-link.active { color: var(--ink); }
.thumb { width: 32px; height: 32px; flex: 0 0 32px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line-2); border-radius: 2px; background: var(--paper); overflow: hidden; }
.thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.thumb-lg { width: 56px; height: 56px; flex-basis: 56px; }
.thumb-xl { width: 100%; height: auto; aspect-ratio: 1; flex-basis: auto; padding: 24px; }
.thumb-xl img { max-height: 100%; }
.thumb .no-image { font-size: 11px; color: var(--ink-4); }
/* Scrollable table wrapper. The header is sticky to the viewport only when the wrapper is not a scroll
   container, so from 1280px up (where the table is designed to fit) horizontal overflow is clipped instead. */
.tbl-wrap { overflow-x: auto; }
@media (min-width: 1280px) { .tbl-wrap { overflow-x: clip; } }
.tbl th[aria-sort] .sort-link { color: var(--ink); }
.cell-meta .sep { color: var(--ink-4); margin: 0 4px; }
.cell-meta .badge { margin-left: 6px; }

/* ------------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--control-h); padding: 0 12px;
  border-radius: var(--radius); font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer;
  border: 1px solid transparent; transition: background-color 0.1s, border-color 0.1s, color 0.1s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: #2b2b45; border-color: #2b2b45; color: #fff; }
.btn-secondary { background: var(--paper); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--paper); color: var(--neg); border-color: var(--line-strong); }
.btn-danger:hover { background: #fef2f2; border-color: var(--neg); }
.btn-sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn-xs { height: 22px; padding: 0 7px; font-size: 11.5px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn svg, .btn i { width: 14px; height: 14px; stroke-width: 1.5; }
.btn-primary svg, .btn-primary i { color: #fff; }

.input, .select, .auth-input {
  width: 100%; height: var(--control-h); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 0 10px; font-size: 13px; background: var(--paper); color: var(--ink); line-height: 1;
  transition: border-color 0.1s, box-shadow 0.1s;
}
.input::placeholder { color: var(--ink-4); }
.input:focus, .select:focus, .auth-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.select {
  appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
}
textarea.input { height: auto; min-height: 76px; padding: 8px 10px; line-height: 1.45; resize: vertical; }
.auth-input { height: 36px; }
.label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 500; margin-bottom: 5px; }
.help { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--neg); margin-top: 4px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); width: 14px; height: 14px; }

.toolbar, .filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--paper); }
.toolbar .field, .filters .field { min-width: 0; }
.card > .toolbar:last-child, .card > .filters:last-child { border-bottom: 0; }
.toolbar.card, .filters.card { border: 1px solid var(--line); border-radius: var(--radius); }
.toolbar .field-grow, .filters .field-grow { flex: 1 1 220px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; height: var(--control-h); background: var(--paper); }
.seg label, .seg a { display: inline-flex; align-items: center; padding: 0 11px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; border-right: 1px solid var(--line); white-space: nowrap; }
.seg label:last-child, .seg a:last-child { border-right: 0; }
.seg label:hover, .seg a:hover { background: var(--surface); color: var(--ink); text-decoration: none; }
.seg label.on, .seg a.on { background: var(--ink); color: #fff; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); height: var(--control-h); cursor: pointer; }

/* ------------------------------------------------------------------ identity & state */
.store { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--ink); font-size: 12.5px; }
.swatch { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dots { display: inline-flex; align-items: center; gap: 5px; }
.dots .swatch { box-shadow: 0 0 0 1px var(--paper); }
.status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--ink-2); font-size: 12.5px; }
.status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); flex: none; }
.status-completed .dot, .status-in .dot, .status-restocked .dot, .status-ok .dot { background: var(--pos); }
.status-failed .dot, .status-out .dot { background: var(--neg); }
.status-running .dot, .status-partial .dot, .status-stale .dot { background: var(--warn); }
.badge, .tag { display: inline-flex; align-items: center; height: 18px; border: 1px solid var(--line-strong); border-radius: 2px; padding: 0 5px; font-size: 10.5px; line-height: 1; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 500; color: var(--ink-2); white-space: nowrap; vertical-align: middle; background: var(--paper); }
.badge-pos, .tag-pos { color: var(--pos); border-color: rgba(5, 150, 105, 0.4); }
.badge-neg, .tag-neg { color: var(--neg); border-color: rgba(220, 38, 38, 0.4); }
.badge-warn, .tag-warn { color: var(--warn); border-color: rgba(217, 119, 6, 0.45); }
.badge-ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.tag-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 18px; border: 1px solid var(--line-strong); border-radius: 2px; padding: 0 5px; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.avail-in { color: var(--pos); }
.avail-out { color: var(--neg); }
.meter { height: 3px; background: var(--line-2); overflow: hidden; border-radius: 2px; }
.meter > span { display: block; height: 100%; background: var(--ink); }
.meter-pos > span { background: var(--pos); }
.meter-neg > span { background: var(--neg); }

/* ------------------------------------------------------------------ navigation */
.topnav { background: var(--bar); color: var(--bar-ink); border-bottom: 1px solid var(--bar-line); }
.topnav-inner { display: flex; align-items: center; gap: 8px; height: 52px; }
.topnav-link {
  display: inline-flex; align-items: center; gap: 5px; height: 52px; padding: 0 9px; font-size: 13px; font-weight: 500; letter-spacing: -0.005em;
  color: var(--bar-muted); background: transparent; border: 0; border-bottom: 2px solid transparent; border-top: 2px solid transparent;
  cursor: pointer; white-space: nowrap; transition: color 0.1s;
}
.topnav-link:hover { color: #fff; text-decoration: none; }
.topnav-link.on { color: #fff; border-bottom-color: #fff; }
.topnav-link .icon-16 { color: inherit; }
.caret { display: inline-block; width: 0; height: 0; border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; border-top: 4px solid currentColor; opacity: 0.7; margin-top: 1px; }
.topnav-search { width: 100%; height: 32px; background: var(--bar-2); border: 1px solid var(--bar-line); border-radius: var(--radius); padding: 0 10px 0 30px; font-size: 13px; color: #fff; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b93a3' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>"); background-repeat: no-repeat; background-position: 9px center; }
.topnav-search::placeholder { color: var(--bar-muted); }
/* Keep the right cluster inside the bar on tablets and phones (base.html sizes the search by breakpoint) */
@media (max-width: 1180px) { .topnav-org, .topnav-user .truncate { display: none !important; } }
@media (max-width: 1100px) { .topnav-inner > .ml-auto > .relative:first-child { width: 12rem; } }
@media (max-width: 640px) {
  .topnav-inner { gap: 4px; }
  .topnav-inner > .ml-auto { gap: 4px; min-width: 0; }
  .topnav-inner > .ml-auto > .relative:first-child { width: 7rem; flex: 1 1 7rem; min-width: 0; }
  .topnav-search { padding-left: 28px; padding-right: 6px; font-size: 12px; }
  .topnav-user { gap: 4px; }
}
.topnav-search:focus { outline: none; border-color: #4a4a6a; box-shadow: none; }
.topnav-org { font-size: 12.5px; color: var(--bar-muted); white-space: nowrap; }
.avatar-dark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #2f2f47; color: #fff; font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; }
.topnav-user { display: inline-flex; align-items: center; gap: 8px; height: 52px; font-size: 13px; color: var(--bar-ink); background: none; border: 0; cursor: pointer; }
.topnav-user:hover { color: #fff; }
.topnav-badge { position: absolute; top: 10px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #fff; color: var(--bar); font-size: 10px; font-weight: 600; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums; }

.menu { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 0; min-width: 12rem; box-shadow: var(--shadow-pop); }
.menu a, .menu button, .topnav .menu a, .topnav .menu button { display: block; width: 100%; text-align: left; padding: 7px 12px; font-size: 13px; color: var(--ink) !important; background: none; border: 0; cursor: pointer; white-space: nowrap; }
.menu a:hover, .menu button:hover, .topnav .menu a:hover, .topnav .menu button:hover { background: var(--surface); text-decoration: none; }
.menu .menu-head { padding: 7px 12px 6px; font-size: 11.5px; color: var(--ink-3); border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.menu .menu-head .font-medium { color: var(--ink); font-size: 12.5px; }
.menu .menu-section { padding: 8px 12px 3px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-4); }
.menu .menu-foot { border-top: 1px solid var(--line-2); margin-top: 4px; padding-top: 4px; }
.menu .menu-foot button { color: var(--neg) !important; }
.dropdown { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); width: 34rem; max-width: calc(100vw - 32px); left: auto; right: 0; color: var(--ink); box-shadow: var(--shadow-pop); }
.topnav .dropdown a { color: var(--ink) !important; }
.topnav .dropdown a:hover { background: var(--surface); text-decoration: none; }
.dropdown .muted { color: var(--ink-3); }
@media (max-width: 640px) { .dropdown { width: auto; min-width: 0; left: 0; right: 0; } }

/* global search suggestions (inside .dropdown) */
.suggest { max-height: 24rem; overflow-y: auto; padding: 4px 0; font-size: 13px; }
.suggest-head { padding: 8px 12px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-4); font-weight: 500; }
.suggest-item { display: flex; align-items: center; gap: 10px; padding: 6px 12px; color: var(--ink); min-height: 40px; }
.suggest-item:hover, .suggest-item:focus-visible { background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: none; }
.suggest-item .cell-title { font-weight: 400; }
.suggest-item .price { font-size: 12.5px; }
.suggest-foot { display: block; border-top: 1px solid var(--line-2); margin-top: 4px; padding: 8px 12px; font-size: 12px; color: var(--ink-3); }
.suggest-foot:hover { color: var(--ink); background: var(--surface); text-decoration: none; }
.suggest-empty { padding: 12px; color: var(--ink-3); }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding: 10px 16px; font-size: 12.5px; color: var(--ink-3); }
.pager .text-ink { color: var(--ink); }
.pager-info { white-space: nowrap; }
.pager-pages { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.pager-gap { padding: 0 4px; color: var(--ink-4); }
.pg-btn { display: inline-flex; align-items: center; height: 26px; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0 8px; color: var(--ink-2); background: var(--paper); font-size: 12px; font-variant-numeric: tabular-nums; }
.pg-btn:hover { background: var(--surface); color: var(--ink); text-decoration: none; }
.pg-current { background: var(--ink); color: #fff; border-color: var(--ink); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 8px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 11px 12px; font-size: 13px; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab-active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }

/* ------------------------------------------------------------------ misc */
.htmx-indicator { opacity: 0; transition: opacity 0.15s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-request .tbl tbody { opacity: 0.5; transition: opacity 0.15s; }
pre.log { background: var(--bar); color: var(--bar-ink); font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.55; padding: 14px 16px; overflow: auto; border-radius: 0 0 var(--radius) var(--radius); }
.auth-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; }
.icon-14 { width: 14px; height: 14px; stroke-width: 1.5; }
.icon-16 { width: 16px; height: 16px; stroke-width: 1.5; }
.spark { display: block; }
.spark polyline { stroke: var(--ink-2); }
.wrap-anywhere { overflow-wrap: anywhere; }
.footer { font-size: 11.5px; color: var(--ink-4); }
.footer a { color: var(--ink-3); }

/* Wordmark */
.wordmark { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; line-height: 1; }
.wordmark:hover { text-decoration: none; }
.wordmark-dot { width: 8px; height: 8px; border-radius: 50%; background: #4f46e5; flex: none; }
.wordmark-main { font-family: "Montserrat", sans-serif; font-size: 17px; font-weight: 700; letter-spacing: -0.015em; }
.wordmark-hq { font-family: "Montserrat", sans-serif; font-size: 17px; font-weight: 400; letter-spacing: -0.01em; }
.wordmark-light .wordmark-main { color: #fff; }
.wordmark-light .wordmark-hq { color: var(--bar-ink); }
.wordmark-dark .wordmark-main { color: var(--ink); }
.wordmark-dark .wordmark-hq { color: var(--ink-3); }
.wordmark-lg .wordmark-main, .wordmark-lg .wordmark-hq { font-size: 22px; }

/* Charts */
.chart { position: relative; }
.chart-empty { display: flex; height: 100%; align-items: center; justify-content: center; color: var(--ink-3); font-size: 12.5px; }

/* Phone gutter: 16px instead of the 32px page gutter (main/footer/alerts are laid out in base.html) */
@media (max-width: 640px) {
  body > main, body > footer.footer { padding-left: 16px; padding-right: 16px; }
  .alert { padding-left: 16px; padding-right: 16px; }
  .toolbar, .filters { padding: 10px 12px; }
  .toolbar .field, .filters .field { flex: 1 1 calc(50% - 12px); width: auto; }
  .toolbar .field-grow, .filters .field-grow { flex-basis: 100%; }
}

/* Print */
@media print {
  .topnav, .toolbar, .filters, .pager, .btn, footer { display: none !important; }
  body { background: #fff; }
  .card, .stat-strip { border-color: #999; }
}

/* ------------------------------------------------------------------ page components (merged from pages.css) */
/* MarketIntel HQ — page-level components not yet in app.css. Tokens only (see DESIGN.md).
   Loaded by the pages that need it through {% block head %}. Candidates for promotion into app.css. */

/* Stat strips that wrap: the hairline grid stays correct at 2 / 3 / N columns. */
.strip-3, .strip-4, .strip-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.strip-3 > .stat, .strip-4 > .stat, .strip-6 > .stat { border-bottom: 0; border-right: 1px solid var(--line-2); }
.strip-3 > .stat:nth-child(2n), .strip-4 > .stat:nth-child(2n), .strip-6 > .stat:nth-child(2n) { border-right: 0; }
.strip-3 > .stat:nth-child(n+3), .strip-4 > .stat:nth-child(n+3), .strip-6 > .stat:nth-child(n+3) { border-top: 1px solid var(--line-2); }
.strip-3 > .stat:nth-child(3):last-child { grid-column: span 2; border-right: 0; }
@media (min-width: 768px) {
  .strip-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .strip-3 > .stat:nth-child(2n) { border-right: 1px solid var(--line-2); }
  .strip-3 > .stat:nth-child(3n), .strip-3 > .stat:last-child { border-right: 0; }
  .strip-3 > .stat:nth-child(n+3) { border-top: 0; }
  .strip-3 > .stat:nth-child(n+4) { border-top: 1px solid var(--line-2); }
  .strip-3 > .stat:nth-child(3):last-child { grid-column: auto; }
  .strip-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .strip-4 > .stat:nth-child(2n) { border-right: 1px solid var(--line-2); }
  .strip-4 > .stat:nth-child(4n), .strip-4 > .stat:last-child { border-right: 0; }
  .strip-4 > .stat:nth-child(n+3) { border-top: 0; }
  .strip-4 > .stat:nth-child(n+5) { border-top: 1px solid var(--line-2); }
  .strip-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .strip-6 > .stat:nth-child(2n) { border-right: 1px solid var(--line-2); }
  .strip-6 > .stat:nth-child(3n) { border-right: 0; }
  .strip-6 > .stat:nth-child(n+3) { border-top: 0; }
  .strip-6 > .stat:nth-child(n+4) { border-top: 1px solid var(--line-2); }
}
@media (min-width: 1280px) {
  .strip-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .strip-6 > .stat:nth-child(3n) { border-right: 1px solid var(--line-2); }
  .strip-6 > .stat:last-child { border-right: 0; }
  .strip-6 > .stat:nth-child(n+4) { border-top: 0; }
}

/* Segmented controls inside toolbars never shrink below their content. */
.toolbar fieldset.field, .page-head fieldset.field { flex: none; min-width: max-content; }

/* Row actions rendered as <button> inside POST forms (same look as .row-actions a). */
.tbl .row-actions form { display: inline; }
.tbl .row-actions button { font-size: 12px; color: var(--ink-3); background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap; font-family: inherit; }
.tbl .row-actions button:hover { color: var(--ink); }
.tbl .row-actions button.danger:hover, .tbl .row-actions a.danger:hover { color: var(--neg); }

/* Sortable column header buttons (client-side sort). */
button.sort-link { background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; }
.sort-link .caret-s { font-size: 9px; line-height: 1; }

/* Unread marker in the alerts inbox: 6px ink dot before the title. */
.unread-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); margin-right: 7px; vertical-align: middle; position: relative; top: -1px; }
.kind-text { font-size: 11px; color: var(--ink-3); white-space: nowrap; line-height: 1.3; }

/* Form messages: hairline box, no fill. */
.form-alert { border: 1px solid var(--line); border-left: 2px solid var(--neg); border-radius: var(--radius); padding: 9px 12px; font-size: 12.5px; color: var(--neg); line-height: 1.45; }
.form-alert-info { border-left-color: var(--ink); color: var(--ink); }
.form-alert-warn { border-left-color: var(--warn); color: var(--ink); }

/* Checkbox lists inside forms (recipients). */
.check-list { display: flex; flex-direction: column; gap: 2px; }
.check-list .check { height: 28px; }

/* Readable text column in tables (alert titles, details). */
.cell-text { font-size: 12.5px; color: var(--ink-2); white-space: normal; line-height: 1.4; }

/* Auth pages */
.auth-form { margin-top: 20px; display: flex; flex-direction: column; gap: 14px; }
.auth-actions { margin-top: 4px; }
.auth-foot-link { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--ink-3); }
.auth-foot-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

/* ------------------------------------------------------------------ tenant-centred pages (overview, my catalogue, compare) */
/* Tab labels carry a count in ink-4, tabular. */
.tab .count { margin-left: 6px; color: var(--ink-4); font-weight: 400; font-variant-numeric: tabular-nums; }
.tab-active .count { color: var(--ink-3); }
/* Availability as a bare 6px dot inside a meta line (the word is for screen readers / the title). */
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); vertical-align: middle; margin-right: 7px; position: relative; top: -1px; }
.status-dot.is-in { background: var(--pos); }
.status-dot.is-out { background: var(--neg); }
/* Stat values that carry meaning (an undercut count) may take the semantic colours; "—" placeholders are faint. */
.stat-value.neg { color: var(--neg); }
.stat-value.pos { color: var(--pos); }
.stat-value.faint { color: var(--ink-4); }
.form-alert code { font-size: 12px; }
/* The overview scorecard carries a sentence under each number: let it wrap instead of ellipsising. */
.scorecard .stat-sub { white-space: normal; }
