/* ==========================================================================
   Bynix Chat — Design System (from Bynix Brand Guidelines)
   Colors: Deep Charcoal #111113 (base), Electric Red #FF0103 (primary accent),
           Golden Orange #F79F1A (secondary accent), Crisp White #FFFFFF.
   Type:   Tomato Grotesk (headings/CTAs), Urbanist (body), Orbitron (data/tech).
   Rules:  Red leads the eye in small doses, never floods a screen.
           Orange is the glow, never the spotlight (never the primary CTA).
   ========================================================================== */

/* Logo files in this folder come from the Bynix brand guidelines: bynix-logo(.svg, -dark, -white, -black) and
   bynix-icon(.svg, -white, -black). Never stretch, recolour or rearrange them. */

/* Urbanist and Orbitron are open fonts (SIL Open Font License, see /fonts/*-LICENSE.txt), served from this
   server: no request leaves for a font service. One variable file covers every weight. */
@font-face { font-family: "Urbanist"; src: url("/fonts/urbanist-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Urbanist"; src: url("/fonts/urbanist-latin-ext-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Orbitron"; src: url("/fonts/orbitron-latin-wght-normal.woff2") format("woff2"); font-weight: 400 900; font-style: normal; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* Tomato Grotesk (headings in the brand guidelines) is a licensed typeface and its files are not in this repository,
   so headings fall back to Urbanist. Once Bynix has the web licence: put the three files in /public/fonts/ under
   these names and remove the comment marks around the three lines below.
@font-face { font-family: "Tomato Grotesk"; src: url("/fonts/TomatoGrotesk-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Tomato Grotesk"; src: url("/fonts/TomatoGrotesk-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Tomato Grotesk"; src: url("/fonts/TomatoGrotesk-ExtraBold.woff2") format("woff2"); font-weight: 800; font-display: swap; }
*/

:root {
  /* Brand palette (never change) */
  --bx-charcoal: #111113;
  --bx-red: #FF0103;
  --bx-red-ink: #DE0003;   /* Electric Red deepened to 5:1 with white: buttons, badges and red text (WCAG AA) */
  --bx-orange: #F79F1A;
  --bx-white: #FFFFFF;

  /* Type */
  --bx-font-display: "Tomato Grotesk", "Urbanist", system-ui, sans-serif;
  --bx-font-body: "Urbanist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bx-font-tech: "Orbitron", "Urbanist", system-ui, sans-serif;

  /* Radius & spacing */
  --bx-r-sm: 6px; --bx-r: 10px; --bx-r-lg: 16px;
  --bx-s1: 4px; --bx-s2: 8px; --bx-s3: 12px; --bx-s4: 16px; --bx-s5: 24px; --bx-s6: 32px;

  /* Semantic (light theme) */
  --bg: #f5f5f6;
  --surface: #ffffff;
  --surface-2: #f0f0f2;
  --surface-3: #e7e7ea;
  --line: #e1e1e5;
  --fg: #111113;
  --muted: #5f5f68;
  --accent: var(--bx-red);
  --accent-fg: #ffffff;
  --accent-soft: rgba(255, 1, 3, 0.08);
  --glow: #c97a06;           /* Golden Orange tuned for contrast on white */
  --glow-soft: rgba(247, 159, 26, 0.14);
  --ok: #0E7C4D;
  --on-ok: #ffffff;
  --ok-ink: #0A6640;         /* green text on tinted backgrounds */
  --red-text: #C80003;       /* red text that passes 4.5:1, also on light red tints */
  --warn-ink: #8A5300;       /* orange text that passes 4.5:1 on light orange tints */
  --warn: #c97a06;
  --danger: #d10002;
  --bubble-me: #111113;
  --bubble-me-fg: #ffffff;
  --bubble-them: #f0f0f2;
  --note: #fff4df;
  --shadow: 0 8px 28px rgba(17, 17, 19, 0.12);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111113; --surface: #18181b; --surface-2: #202024; --surface-3: #2a2a2f; --line: #2c2c31;
    --fg: #ffffff; --muted: #a2a2ab; --accent-soft: rgba(255, 1, 3, 0.14);
    --glow: #F79F1A; --glow-soft: rgba(247, 159, 26, 0.16); --ok: #3ecf8e; --ok-ink: #3ecf8e; --on-ok: #111113; --red-text: #FF4547; --warn-ink: #F79F1A; --warn: #F79F1A; --danger: #ff4d4f;
    --bubble-me: #DE0003; --bubble-me-fg: #ffffff; --bubble-them: #26262b; --note: #3a2c12;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.45); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111113; --surface: #18181b; --surface-2: #202024; --surface-3: #2a2a2f; --line: #2c2c31;
  --fg: #ffffff; --muted: #a2a2ab; --accent-soft: rgba(255, 1, 3, 0.14);
  --glow: #F79F1A; --glow-soft: rgba(247, 159, 26, 0.16); --ok: #3ecf8e; --ok-ink: #3ecf8e; --on-ok: #111113; --red-text: #FF4547; --warn-ink: #F79F1A; --warn: #F79F1A; --danger: #ff4d4f;
  --bubble-me: #DE0003; --bubble-me-fg: #ffffff; --bubble-them: #26262b; --note: #3a2c12;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45); color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--bx-font-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--bx-font-display); margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; box-shadow: 0 0 0 5px var(--glow-soft, rgba(247, 159, 26, .35)); }
.bx-tech { font-family: var(--bx-font-tech); font-variant-numeric: tabular-nums; }
.bx-muted { color: var(--muted); }
.bx-eyebrow { font-family: var(--bx-font-tech); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

/* Product wordmark (text placeholder until the master logo files are added to /brand) */
.bx-wordmark { font-family: var(--bx-font-display); font-weight: 800; font-size: 20px; letter-spacing: -0.02em; display: inline-flex; align-items: baseline; gap: 6px; }
.bx-wordmark .sub { font-family: var(--bx-font-body); font-weight: 600; font-size: .8em; color: var(--muted); }
/* The Bynix logo (from the brand guidelines): full colour on light, white wordmark on dark */
.bx-logo { display: inline-block; height: 1.2em; aspect-ratio: 800 / 225; background: url("/brand/bynix-logo.svg") left center / contain no-repeat; vertical-align: -0.22em; flex: none; align-self: center; }
.auth-mark .bx-logo { height: 1.7em; vertical-align: -0.45em; }
:root[data-theme="dark"] .bx-logo { background-image: url("/brand/bynix-logo-dark.svg"); }
.bx-reddot { width: 7px; height: 7px; border-radius: 50%; background: var(--bx-red); display: inline-block; }

/* ---------- Buttons ---------- */
.bx-btn { font: 600 14px/1 var(--bx-font-body); border-radius: var(--bx-r); padding: 10px 16px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.bx-btn:hover { background: var(--surface-2); }
.bx-btn:disabled { opacity: .5; cursor: not-allowed; }
.bx-btn-primary { background: var(--bx-red-ink); border-color: var(--bx-red-ink); color: #fff; font-family: var(--bx-font-display); font-weight: 700; }
.bx-btn-primary:hover { background: #C20003; }
.bx-btn-ghost { background: transparent; border-color: transparent; }
.bx-btn-sm { padding: 6px 10px; font-size: 13px; }
.bx-btn-danger { color: var(--danger); }

/* ---------- Forms ---------- */
.bx-field { display: grid; gap: 6px; }
.bx-field > span { font-size: 13px; font-weight: 600; }
.bx-field small { color: var(--muted); font-size: 12px; }
.bx-input, .bx-textarea, .bx-select { width: 100%; font: 14px/1.4 var(--bx-font-body); color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: var(--bx-r); padding: 10px 12px; }
.bx-input:focus, .bx-textarea:focus, .bx-select:focus { outline: none; border-color: var(--fg); }
.bx-textarea { resize: vertical; min-height: 90px; }
.bx-check { display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 14px; }
.bx-check input { accent-color: var(--bx-red); width: 18px; height: 18px; }

/* ---------- Surfaces ---------- */
.bx-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--bx-r-lg); padding: var(--bx-s5); }
.bx-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.bx-pill-red { background: var(--accent-soft); color: var(--red-text); }
.bx-pill-orange { background: var(--glow-soft); color: var(--warn-ink); }
.bx-pill-ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok-ink); }
.bx-online { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.bx-offline { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-3); display: inline-block; }
.bx-badge { min-width: 20px; height: 20px; border-radius: 10px; background: var(--bx-red-ink); color: #fff; font: 700 11px/20px var(--bx-font-body); text-align: center; padding: 0 6px; }

/* ---------- Toast ---------- */
.bx-toast { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--bx-charcoal); color: #fff; padding: 10px 16px; border-radius: var(--bx-r); font-weight: 600; box-shadow: var(--shadow); z-index: 100; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
