/* style-a-1030: EdgeClerk design tokens. ONE source for every surface (agent app, admin, Super Admin, Client Portal, side panel).
   Edit here, then run: node scripts/build-styles.mjs [side panel folder]
     -> src/styles/tokens.js (string for the Workers, injected in <head> by list-search.js withListSearch)
     -> <side panel folder>/tokens.css (+ <link> first in sidepanel.html; the panel cannot load server CSS)
   Option A rule: tokens only replace a hard-coded value when it is the SAME value (or imperceptibly close).
   Near-duplicate shades that are visibly different stay hard-coded until option B moves that surface (map below).
   Colorblind rule: color is never the only signal; status = shape + word (src/status-icons.js). */
:root{
  /* colors */
  --ec-c-ink:#1f2328;        /* text, header bar.   near: #212529 #24292f #222 #2b2b2b #1f1f1f */
  --ec-c-muted:#57606a;      /* secondary text.     near: #5f6368 #59636e #555 #5f5f5f #6e7781 */
  --ec-c-line:#d0d7de;       /* borders.            near: #d0d7de #d8dee4 #ccc #ddd #e1e4e8 */
  --ec-c-surface:#ffffff;    /* page / card.        near: #fff #fcfcfc #fefefe */
  --ec-c-subtle:#f6f8fa;     /* table head, zebra.  near: #f6f6f4 #f5f5f5 #f7f7f7 #f3f4f6 */
  --ec-c-brand:#f26b0f;      /* safety orange.      near: #f26b1d #f2711c #ff6a00 */
  --ec-c-brand-text:#b35900; /* orange as text.     near: #b35900 #c2540a #c4540a #cd6600 #b45309 */
  --ec-c-brand-tint:#fff4ec; /* orange wash.        near: #fff7f0 #fff3e8 #fdf0e6 */
  --ec-c-charcoal:#424242;   /* selected tab (keep distinct from inactive tabs / solid actions) */
  --ec-c-tab:#737373;        /* inactive tabs + solid action buttons; white text */
  --ec-c-tab-hover:#5f5f5f;  /* inactive tab / solid action hover */
  --ec-c-danger:#b42318;     /* Fail / delete.      near: #b0171f #b3261e #c13333 #991b1b #a12020 #d33a2c */
  --ec-c-danger-tint:#fef3f2;/*                     near: #fdecea #fff1f0 #fde8e8 */
  --ec-c-good:#1a7f37;       /* Pass.               near: #1e7b34 #15803d #128666 #2da44e */
  --ec-c-good-tint:#e9f7ef;  /*                     near: #e6f4ea #ecfdf3 #dafbe1 */
  --ec-c-warn:#9a6700;       /* Review.             near: #8a6100 #b08800 #9a6700 #a16207 */
  --ec-c-warn-tint:#fff8d6;  /*                     near: #fff8c5 #fff4ce #fef9c3 */
  /* text sizes */
  --ec-t-12:12px;--ec-t-13:13px;--ec-t-14:14px;--ec-t-16:16px;--ec-t-20:20px;
  /* spacing */
  --ec-s-4:4px;--ec-s-8:8px;--ec-s-12:12px;--ec-s-16:16px;--ec-s-24:24px;--ec-s-32:32px;
  /* corner roundness: tables square, buttons/inputs 4px, cards/pop-ups 8px, chips round */
  --ec-r-table:0;--ec-r-btn:4px;--ec-r-card:8px;--ec-r-chip:999px;
  /* shadows (2) */
  --ec-sh-card:0 1px 2px rgba(31,35,40,.08);--ec-sh-modal:0 8px 24px rgba(31,35,40,.24);
  /* buttons: 32px everywhere, 28px in the side panel */
  --ec-btn-h:32px;--ec-btn-h-panel:28px;
}
/* dark values: OPT-IN only (html[data-ec-tokens=dark]). Nothing sets this attribute yet, so option A changes nothing.
   The current dark mode (src/dark-mode.js) reads each element's light colors at run time; it must keep seeing the light values. */
html[data-ec-tokens=dark]{
  --ec-c-ink:#e6edf3;--ec-c-muted:#9da7b3;--ec-c-line:#3d444d;--ec-c-surface:#161b22;--ec-c-subtle:#21262d;
  --ec-c-brand:#f26b0f;--ec-c-brand-text:#ff9a4d;--ec-c-brand-tint:#3a2414;--ec-c-charcoal:#d0d7de;
  --ec-c-danger:#ff7b72;--ec-c-danger-tint:#3c1618;--ec-c-good:#56d364;--ec-c-good-tint:#12261b;--ec-c-warn:#e3b341;--ec-c-warn-tint:#2e2410;
  --ec-sh-card:0 1px 2px rgba(0,0,0,.5);--ec-sh-modal:0 8px 24px rgba(0,0,0,.6);
}

/* style-b-sa-1030: ONE shared set of components, built only from src/styles/tokens.css values.
   Applies only inside class="ec-ui" (a page opts in by adding it to <body>). Today only Super Admin opts in.
   No !important. Base looks (plain button, input, label, table, link) use :where(.ec-ui) so they weigh no more than the bare
   element: a page's own class rule (a special button such as the Support tab or Manage) still wins. Variants (.pri, .ec-btn--danger,
   status chips, cards, tabs) keep the .ec-ui class weight so they win over old page rules.
   Colorblind rules: color is never the only signal. Status chips carry a word AND a shape (filled / outlined / dashed, plus a symbol);
   danger buttons say the action; links are underlined; keyboard focus = 2px orange ring plus 1px dark ring. */

/* ---------- buttons: .ec-btn (and plain <button> inside .ec-ui) ---------- */
:where(.ec-ui) :where(button,.ec-btn){box-sizing:border-box;min-height:var(--ec-btn-h);padding:0 var(--ec-s-16);border:1px solid var(--ec-c-muted);border-radius:var(--ec-r-btn);background:var(--ec-c-surface);color:var(--ec-c-ink);font-family:inherit;font-size:var(--ec-t-13);font-weight:600;line-height:1.2;cursor:pointer;box-shadow:none;opacity:1;text-decoration:none}
:where(.ec-ui) :where(button,.ec-btn):hover{background:var(--ec-c-subtle);opacity:1}
/* primary = the inactive-tab gray; selected tabs keep charcoal */
.ec-ui :is(button.blue,button.ec-pri,.ec-btn--primary){background:var(--ec-c-tab);border-color:var(--ec-c-tab);color:#fff}
.ec-ui :is(button.blue,button.ec-pri,.ec-btn--primary):hover{background:var(--ec-c-tab-hover);border-color:var(--ec-c-tab-hover)}
/* brand = orange, the one main action per screen ("+ Add Brokerage"; old class .pri); dark text 6:1 */
.ec-ui :is(button.pri,button.ec-ok,.ec-btn--brand){background:var(--ec-c-brand);border-color:var(--ec-c-brand);color:var(--ec-c-ink)}
.ec-ui :is(button.pri,button.ec-ok,.ec-btn--brand):hover{background:var(--ec-c-brand-text);border-color:var(--ec-c-brand-text);color:#fff}
/* danger = red, the label always names the action ("Disable brokerage") */
.ec-ui :is(button.ec-danger,.ec-btn--danger){background:var(--ec-c-danger);border-color:var(--ec-c-danger);color:#fff}
.ec-ui :is(button.ec-danger,.ec-btn--danger):hover{background:#912018;border-color:#912018}
/* secondary (ghost) = white with a gray outline, same as the default */
.ec-ui :is(button.ghost,.ec-btn--secondary){background:var(--ec-c-surface);border-color:var(--ec-c-muted);color:var(--ec-c-ink)}
/* link-looking button */
.ec-ui .ec-btn--link{background:none;border-color:transparent;color:var(--ec-c-ink);text-decoration:underline;padding:0 var(--ec-s-4)}
/* small */
.ec-ui :is(button.sm,.ec-btn--sm){min-height:var(--ec-btn-h-panel);padding:0 var(--ec-s-12);font-size:var(--ec-t-12)}
.ec-ui :is(button,.ec-btn):disabled{opacity:.5;cursor:not-allowed}
.ec-ui :is(button,.ec-btn,a,input,select,textarea,summary,[tabindex]):focus-visible{outline:2px solid var(--ec-c-brand);outline-offset:1px;box-shadow:0 0 0 3px var(--ec-c-ink)}

/* ---------- inputs ---------- */
:where(.ec-ui) :where(input:not([type=checkbox]):not([type=radio]):not([type=file]),select,textarea,.ec-input){box-sizing:border-box;min-height:var(--ec-btn-h);padding:var(--ec-s-4) var(--ec-s-8);border:1px solid var(--ec-c-muted);border-radius:var(--ec-r-btn);background:var(--ec-c-surface);color:var(--ec-c-ink);font-family:inherit;font-size:var(--ec-t-13)}
.ec-ui :is(input,select,textarea,.ec-input):focus{border-color:var(--ec-c-ink);outline:2px solid var(--ec-c-brand);outline-offset:0}
:where(.ec-ui) label{color:var(--ec-c-muted);font-size:var(--ec-t-12);font-weight:600}

/* ---------- tables: square ---------- */
.ec-ui :is(.tw,.ec-table-wrap){border:1px solid var(--ec-c-line);border-radius:var(--ec-r-table);background:var(--ec-c-surface)}
:where(.ec-ui) :where(table,.ec-table){border-collapse:collapse;width:100%;font-size:var(--ec-t-13)}
:where(.ec-ui) :where(table,.ec-table) th{background:var(--ec-c-subtle);color:var(--ec-c-ink);font-weight:700;font-size:var(--ec-t-12);text-align:left;padding:var(--ec-s-8);border-bottom:2px solid var(--ec-c-ink);border-radius:var(--ec-r-table)}
:where(.ec-ui) :where(table,.ec-table) td{padding:var(--ec-s-8);border-top:1px solid var(--ec-c-line);vertical-align:top}
.ec-ui :is(table,.ec-table) tr:is([onclick],.ec-click):hover td{background:var(--ec-c-brand-tint)}

/* ---------- cards ---------- */
.ec-ui :is(.panel,.ec-card){background:var(--ec-c-surface);border:1px solid var(--ec-c-line);border-radius:var(--ec-r-card);padding:var(--ec-s-12) var(--ec-s-16)}

/* ---------- pop-ups (dialog / .ec-modal) ---------- */
.ec-ui :is(dialog,.ec-modal){border:1px solid var(--ec-c-line);border-radius:var(--ec-r-card);background:var(--ec-c-surface);color:var(--ec-c-ink);box-shadow:var(--ec-sh-modal);padding:var(--ec-s-16) var(--ec-s-24)}
.ec-ui dialog::backdrop{background:rgba(31,35,40,.45)}

/* ---------- tabs: the same tab row as Admin / Agent / Portal (gray; selected = charcoal, bold, orange top line) ---------- */
.ec-ui :is(.views,.ec-tabs){display:flex;flex-wrap:wrap;gap:3px;border-bottom:1px solid var(--ec-c-muted);background:transparent;padding:0}
.ec-ui :is(.views,.ec-tabs) button{margin:0;min-height:var(--ec-btn-h);padding:6px 14px;border:0;border-radius:var(--ec-r-btn) var(--ec-r-btn) 0 0;background:var(--ec-c-tab);color:#fff;font-size:var(--ec-t-13);font-weight:400;line-height:20px;box-shadow:none}
.ec-ui :is(.views,.ec-tabs) button:hover:not(.on):not([aria-selected=true]){background:var(--ec-c-tab-hover);color:#fff}
.ec-ui :is(.views,.ec-tabs) button:is(.on,[aria-selected=true]){background:var(--ec-c-charcoal);color:#fff;font-weight:700;box-shadow:inset 0 3px 0 var(--ec-c-brand)}

/* ---------- chips (round) ---------- */
.ec-ui :is(.pill,.ec-pill,.ec-chip,.ec-n,.ec-badge){display:inline-block;border-radius:var(--ec-r-chip);font-size:var(--ec-t-12);font-weight:700;line-height:1.4;padding:1px var(--ec-s-8)}

/* ---------- status: word + shape, never color alone ---------- */
.ec-ui :is(.ec-status,.ec-pill,.pill){border:1px solid var(--ec-c-ink);background:var(--ec-c-surface);color:var(--ec-c-ink)}
.ec-ui :is(.ec-status--good,.ec-pill.on,.pill.p-on){background:var(--ec-c-ink);border-color:var(--ec-c-ink);color:#fff}
.ec-ui :is(.ec-status--good,.ec-pill.on,.pill.p-on)::before{content:"\2713\00a0"}
.ec-ui :is(.ec-status--off,.ec-pill.off,.pill.p-off){border-style:dashed;color:var(--ec-c-muted)}
.ec-ui :is(.ec-status--off,.ec-pill.off,.pill.p-off)::before{content:"\2013\00a0"}
.ec-ui :is(.ec-status--warn,.ec-pill.wait){background:var(--ec-c-warn-tint);border-color:var(--ec-c-warn);color:var(--ec-c-ink)}
.ec-ui :is(.ec-status--warn,.ec-pill.wait)::before{content:"!\00a0";font-weight:800}
.ec-ui :is(.ec-status--info,.ec-pill.tr,.pill.p-home){background:var(--ec-c-brand-tint);border-color:var(--ec-c-brand-text);color:var(--ec-c-ink)}

/* ---------- messages ---------- */
.ec-ui :is(.err,.ec-msg--bad){background:var(--ec-c-danger-tint);border:1px solid var(--ec-c-danger);border-left-width:4px;color:var(--ec-c-ink);border-radius:var(--ec-r-btn);padding:var(--ec-s-8) var(--ec-s-12)}
.ec-ui :is(.ok,.ec-msg--good){background:var(--ec-c-good-tint);border:1px solid var(--ec-c-good);border-left-width:4px;color:var(--ec-c-ink);border-radius:var(--ec-r-btn);padding:var(--ec-s-8) var(--ec-s-12)}

/* ---------- links ---------- */
:where(.ec-ui) a{color:var(--ec-c-ink);text-decoration:underline;font-weight:600}

/* ---------- shared pop-ups already on the pages: Manage pop-up (.ecm, src/ec-modal.js) and the Are-you-sure box (src/ec-confirm.js) ---------- */
.ec-ui .ecm{border-radius:var(--ec-r-card);overflow:hidden;box-shadow:var(--ec-sh-modal)}
.ec-ui .ecm-x{border-radius:var(--ec-r-btn)}
.ec-ui #ec-cf-ov>div{border-radius:var(--ec-r-card);box-shadow:var(--ec-sh-modal)}

/* ---------- Settings menu (gear button + panel, src/settings-gear.js): same buttons, rows and pop-up corners ---------- */
.ec-ui #ec-gear{border-radius:var(--ec-r-btn);min-height:var(--ec-btn-h-panel)}
.ec-ui #ec-setp{border-radius:var(--ec-r-card);box-shadow:var(--ec-sh-modal)}
.ec-ui #ec-setp :is(.so,.done){min-height:var(--ec-btn-h);border-radius:var(--ec-r-btn);font-size:var(--ec-t-13);font-weight:600}
.ec-ui #ec-setp .done{font-weight:700}
.ec-ui #ec-setp label{border-radius:var(--ec-r-btn)}
.ec-ui #ec-setp label:hover{background:var(--ec-c-subtle)}
html[data-theme=dark] .ec-ui #ec-setp label:hover{background:#2b2f36}
.ec-ui #ec-setp :is(select,input[type=range]){border-radius:var(--ec-r-btn)}

/* placeholder text follows the field's own text color, so it stays readable at every Light-Dark slider position (dark mode re-colors fields, not placeholders) */
.ec-ui :is(input,textarea)::placeholder{color:currentColor;opacity:.72}
html[data-theme=dark] .ec-ui :is(input,textarea)::placeholder{color:currentColor!important;opacity:.72} /* beats the fixed gray in dark-mode.js, which is unreadable on mid-gray fields at 50% */

/* ---------- dark mode (html[data-theme=dark], set by src/dark-mode.js) ----------
   dark-mode.js swaps light colors for dark ones itself; these rules only fix what it cannot:
   the dark focus halo would vanish on a dark page, and a filled dark "on" chip looks like an outlined one. */
html[data-theme=dark] .ec-ui :is(button,.ec-btn,a,input,select,textarea,summary,[tabindex]):focus-visible{outline-color:#ff9a4d;box-shadow:0 0 0 3px #f0f0f0}
html[data-theme=dark] .ec-ui :is(.ec-status--good,.ec-pill.on,.pill.p-on){border-width:2px;font-weight:800}
html[data-theme=dark] .ec-ui :is(.ec-status--off,.ec-pill.off,.pill.p-off){border-width:2px}

.ec-newsletter{color:var(--ec-c-ink);background:var(--ec-c-brand-tint);border-top:4px solid var(--ec-c-brand);padding:48px 0}
.ec-newsletter .nl-inner{max-width:760px;margin:auto}
.ec-newsletter h2{text-align:left;margin:0 0 12px}
.ec-newsletter .nl-kicker{text-transform:uppercase;letter-spacing:.08em;font-size:13px;font-weight:800;color:var(--ec-c-muted)}
.ec-newsletter .nl-row{display:flex;align-items:end;gap:12px;margin:16px 0}
.ec-newsletter .nl-field{flex:1;min-width:0}
.ec-newsletter label{font-size:15px;display:block;margin:0 0 6px;color:var(--ec-c-ink)}
.ec-newsletter input[type=email]{width:100%;min-height:48px;font-size:16px;border-radius:0;border:2px solid var(--ec-c-ink);padding:10px 12px}
.ec-newsletter button{min-height:48px;font-size:16px;font-weight:800;border-radius:0;padding:12px 20px}
.ec-newsletter .nl-consent{display:flex;gap:10px;align-items:start;font-size:14px;font-weight:400;line-height:1.5}
.ec-newsletter input[type=checkbox]{flex:0 0 auto;width:20px;height:20px;margin:1px 0 0;accent-color:var(--ec-c-ink)}
.ec-newsletter .nl-fine{font-size:14px;color:var(--ec-c-muted)}
.ec-newsletter .nl-status:empty{display:none}
.ec-newsletter .nl-status{padding:12px;border:2px solid var(--ec-c-ink);background:var(--ec-c-surface);margin-top:18px}
.ec-newsletter .nl-hp{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}
@media(max-width:600px){.ec-newsletter .nl-row{flex-direction:column;align-items:stretch}.ec-newsletter .nl-field{width:100%}.nl-page{padding-top:32px}.nl-page .ec-newsletter{padding:20px 16px}.nl-page .nl-details{grid-template-columns:1fr;gap:12px}}
.nl-page [hidden]{display:none!important}
.nl-unsubscribe-link{display:block;overflow-wrap:anywhere;margin-top:12px;min-height:44px}
