/* Suhavi area colours 1.0 — one soft accent per menu area, the same meaning in every app (CRM, Billing, Receivables, Price Engine, WhatsApp, Login).
   Load AFTER brand.css. area.js sets body[data-sx-area] from the screen you are on and tags the menu items.
   Subtle on purpose: a 3px line in the header, a dot in the menu, a faint wash under the bar, header-row underline and input focus.
   The black+gold header, logo and 5-item menu are untouched. Status colours (--sx-ok/-warn/-bad/-info) mean the same thing everywhere. */

:root {
  /* areas */
  --sx-a-sales: #2563eb;     /* selling: pipeline, bills, orders, send */
  --sx-a-customers: #be185d; /* people we talk to: contacts, helpdesk, replies */
  --sx-a-products: #6d28d9;  /* catalogue, prices, matching */
  --sx-a-stock: #c2410c;     /* stock, buying, delivery */
  --sx-a-money: #0f766e;     /* accounts, remittances, outstanding */
  --sx-a-market: #a16207;    /* competitors */
  --sx-a-admin: #4338ca;     /* people & access (Login) */
  --sx-a-insight: #475569;   /* dashboard, reports, settings, anything unlisted */
  /* status (same everywhere) */
  --sx-ok: #15803d;   --sx-ok-soft: #dcfce7;
  --sx-warn: #b45309; --sx-warn-soft: #fef3c7;
  --sx-bad: #b91c1c;  --sx-bad-soft: #fee2e2;
  --sx-info: #0369a1; --sx-info-soft: #e0f2fe;
  /* the current area (default = insight) */
  --sx-area: var(--sx-a-insight);
}
body[data-sx-area="sales"]     { --sx-area: var(--sx-a-sales); }
body[data-sx-area="customers"] { --sx-area: var(--sx-a-customers); }
body[data-sx-area="products"]  { --sx-area: var(--sx-a-products); }
body[data-sx-area="stock"]     { --sx-area: var(--sx-a-stock); }
body[data-sx-area="money"]     { --sx-area: var(--sx-a-money); }
body[data-sx-area="market"]    { --sx-area: var(--sx-a-market); }
body[data-sx-area="admin"]     { --sx-area: var(--sx-a-admin); }
body[data-sx-area="insight"]   { --sx-area: var(--sx-a-insight); }
body { --sx-area-soft: color-mix(in srgb, var(--sx-area) 12%, transparent); --sx-area-line: color-mix(in srgb, var(--sx-area) 40%, transparent); --sx-area-wash: color-mix(in srgb, var(--sx-area) 6%, transparent); }

/* 1. the line under the header (inside the bar, so layout does not move) */
body[data-sx-area] header.top, body[data-sx-area] header.nav, body[data-sx-area] > header { box-shadow: inset 0 -3px 0 var(--sx-area); transition: box-shadow .2s; }

/* 2. a small dot in front of every menu item, in its own area colour */
.sxm-btn[data-sx-area]::before, header nav > a[data-sx-area]::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; display: inline-block; margin-right: 6px;
  background: var(--sx-dot, var(--sx-a-insight)); box-shadow: 0 0 0 1px rgba(255, 255, 255, .25);
}
header nav > a[data-sx-area] { display: inline-flex; align-items: center; }
[data-sx-area="sales"]     { --sx-dot: var(--sx-a-sales); }
[data-sx-area="customers"] { --sx-dot: var(--sx-a-customers); }
[data-sx-area="products"]  { --sx-dot: var(--sx-a-products); }
[data-sx-area="stock"]     { --sx-dot: var(--sx-a-stock); }
[data-sx-area="money"]     { --sx-dot: var(--sx-a-money); }
[data-sx-area="market"]    { --sx-dot: var(--sx-a-market); }
[data-sx-area="admin"]     { --sx-dot: var(--sx-a-admin); }
[data-sx-area="insight"]   { --sx-dot: var(--sx-a-insight); }
/* drop-down rows too */
.sxm-menu a[data-sx-area]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--sx-dot); flex: 0 0 auto; }
/* body also carries data-sx-area, so keep the dot rule off it */
body[data-sx-area]::before { content: none; }

/* 3. a faint wash at the top of the page and a coloured underline on table headings */
body[data-sx-area] main { background-image: linear-gradient(var(--sx-area-wash), transparent 160px); background-repeat: no-repeat; }
body[data-sx-area] main table thead th, body[data-sx-area] main table > tr:first-child > th { box-shadow: inset 0 -2px 0 var(--sx-area-line); }

/* 4. input focus follows the area */
body[data-sx-area] main input:focus, body[data-sx-area] main select:focus, body[data-sx-area] main textarea:focus {
  border-color: var(--sx-area) !important; box-shadow: 0 0 0 3px var(--sx-area-soft) !important; outline: none;
}
body[data-sx-area] main a:focus-visible, body[data-sx-area] main button:focus-visible { outline: 2px solid var(--sx-area); outline-offset: 2px; }

/* 5. optional helpers for new screens: status pills + area chip (use these instead of ad-hoc colours) */
.sx-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; }
.sx-pill.ok   { color: var(--sx-ok);   background: var(--sx-ok-soft); }
.sx-pill.warn { color: var(--sx-warn); background: var(--sx-warn-soft); }
.sx-pill.bad  { color: var(--sx-bad);  background: var(--sx-bad-soft); }
.sx-pill.info { color: var(--sx-info); background: var(--sx-info-soft); }
.sx-pill.ok::before   { content: "✓"; } .sx-pill.warn::before { content: "!"; } .sx-pill.bad::before { content: "✕"; } .sx-pill.info::before { content: "i"; }
.sx-chip { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--sx-area); background: var(--sx-area-soft); border: 1px solid var(--sx-area-line); }

@media (prefers-reduced-motion: reduce) { body[data-sx-area] header { transition: none; } }
@media print { body[data-sx-area] header, body[data-sx-area] main { box-shadow: none !important; background-image: none !important; } }
