/* Shared design tokens + reset (used by the card and the admin page).
 *
 * Theme: neon turquoise. Light = pale mint + vivid #00e5cc / #00bfa6.
 * Dark = near-black teal + electric #00ffd5 with soft glows.
 * The theme follows the visitor's system setting; assets/js/theme.js adds a toggle that
 * stores an explicit choice ([data-theme="light|dark"] on <html>).
 * Custom colours chosen on the Setup page override these tokens (see brand_css() in api/lib.php).
 */
:root {
  color-scheme: light;

  --brand: #00bfa6;            /* fills: banner gradient, switches */
  --accent: #00e5cc;
  --brand-text: #00796b;       /* headings + links (4.5:1 on white) */
  --on-brand: #fff;            /* text on a --brand-text fill */
  --grad-a: #00bfa6;
  --grad-b: #00e5cc;
  --gradient: linear-gradient(-220deg, var(--grad-a), var(--grad-b));

  --bg-page: linear-gradient(160deg, #e9fcf8, #d6f6ee);
  --surface: #fff;
  --surface-2: #effbf8;
  --surface-hover: #dcf5ef;
  --border: #d3efe9;
  --border-strong: #b5e2d9;
  --text: #17332f;
  --muted: #56736e;

  --shadow: 0 15px 40px rgba(0, 120, 105, .14);
  --shadow-soft: 0 4px 12px rgba(0, 120, 105, .10);
  --glow: rgba(0, 229, 204, .35);
  --photo-bg: #d3f2ec;
  --photo-border: #fff;
  --ico-bg: #fff;
  --ico-fill: #00796b;

  /* "Save to Contacts" button */
  --btn-a: #00bfa6;
  --btn-b: #00e5cc;
  --btn-text: #02312b;
  --btn-shadow: rgba(0, 191, 166, .35);

  --pill-bg: rgba(255, 255, 255, .92);
  --pill-text: #00796b;
  --caption-grad: rgba(0, 24, 21, .78);
  --footer-bg: #f3fcfa;
  --footer-text: #4f6e69;

  --danger: #c0392b;
  --danger-border: #f0c7c1;
  --danger-hover: #fdf0ee;
  --switch-off: #b9d8d2;
  --switch-on: #00a58f;
  --tabs-bg: rgba(255, 255, 255, .7);
  --toast-bg: #0b3a34;
  --toast-text: #fff;
  --warn-bg: #fff4d6;
  --warn-text: #6b4a00;
  --warn-border: #f3dc9a;
  --chip-ok-bg: #d9f7e6;   --chip-ok-text: #146c37;
  --chip-info-bg: #d5f5ef; --chip-info-text: #00695c;
  --chip-warn-bg: #fff1d6; --chip-warn-text: #8a5a00;
  --chip-bad-bg: #fde4e1;  --chip-bad-text: #b0291b;
  --chip-off-bg: #e6eeec;  --chip-off-text: #4d5f5c;
}

/* Dark: the system setting, unless the visitor picked light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --brand: #00ffd5;
    --accent: #00ffd5;
    --brand-text: #00ffd5;
    --on-brand: #00201b;
    --grad-a: #007f6b;
    --grad-b: #00ffd5;

    --bg-page: radial-gradient(900px 520px at 50% -8%, rgba(0, 255, 213, .13), transparent 70%), #030b0a;
    --surface: #081614;
    --surface-2: #0d2320;
    --surface-hover: #123530;
    --border: #12342f;
    --border-strong: #1d4f47;
    --text: #e4fffa;
    --muted: #8db8b0;

    --shadow: 0 0 0 1px #0f2f2a, 0 24px 60px rgba(0, 0, 0, .65), 0 0 70px rgba(0, 255, 213, .10);
    --shadow-soft: 0 0 14px rgba(0, 255, 213, .12);
    --glow: rgba(0, 255, 213, .45);
    --photo-bg: #0d2723;
    --photo-border: #081614;
    --ico-bg: #0a2c27;
    --ico-fill: #00ffd5;

    --btn-a: #00e6c0;
    --btn-b: #00ffd5;
    --btn-text: #00201b;
    --btn-shadow: rgba(0, 255, 213, .42);

    --pill-bg: rgba(3, 16, 14, .72);
    --pill-text: #00ffd5;
    --caption-grad: rgba(0, 10, 9, .85);
    --footer-bg: #061210;
    --footer-text: #7fa8a0;

    --danger: #ff8272;
    --danger-border: #5c2b26;
    --danger-hover: #2a1513;
    --switch-off: #28403c;
    --switch-on: #00c4a7;
    --tabs-bg: rgba(8, 22, 20, .8);
    --toast-bg: #00ffd5;
    --toast-text: #00201b;
    --warn-bg: #2b2208;
    --warn-text: #ffd77a;
    --warn-border: #5a4710;
    --chip-ok-bg: #0e3a2b;   --chip-ok-text: #6df0b0;
    --chip-info-bg: #0b3a36; --chip-info-text: #6df5e0;
    --chip-warn-bg: #3a2c0a; --chip-warn-text: #ffd37a;
    --chip-bad-bg: #3b1512;  --chip-bad-text: #ff9a8d;
    --chip-off-bg: #1a2a27;  --chip-off-text: #9fbab5;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;

  --brand: #00ffd5;
  --accent: #00ffd5;
  --brand-text: #00ffd5;
  --on-brand: #00201b;
  --grad-a: #007f6b;
  --grad-b: #00ffd5;

  --bg-page: radial-gradient(900px 520px at 50% -8%, rgba(0, 255, 213, .13), transparent 70%), #030b0a;
  --surface: #081614;
  --surface-2: #0d2320;
  --surface-hover: #123530;
  --border: #12342f;
  --border-strong: #1d4f47;
  --text: #e4fffa;
  --muted: #8db8b0;

  --shadow: 0 0 0 1px #0f2f2a, 0 24px 60px rgba(0, 0, 0, .65), 0 0 70px rgba(0, 255, 213, .10);
  --shadow-soft: 0 0 14px rgba(0, 255, 213, .12);
  --glow: rgba(0, 255, 213, .45);
  --photo-bg: #0d2723;
  --photo-border: #081614;
  --ico-bg: #0a2c27;
  --ico-fill: #00ffd5;

  --btn-a: #00e6c0;
  --btn-b: #00ffd5;
  --btn-text: #00201b;
  --btn-shadow: rgba(0, 255, 213, .42);

  --pill-bg: rgba(3, 16, 14, .72);
  --pill-text: #00ffd5;
  --caption-grad: rgba(0, 10, 9, .85);
  --footer-bg: #061210;
  --footer-text: #7fa8a0;

  --danger: #ff8272;
  --danger-border: #5c2b26;
  --danger-hover: #2a1513;
  --switch-off: #28403c;
  --switch-on: #00c4a7;
  --tabs-bg: rgba(8, 22, 20, .8);
  --toast-bg: #00ffd5;
  --toast-text: #00201b;
  --warn-bg: #2b2208;
  --warn-text: #ffd77a;
  --warn-border: #5a4710;
  --chip-ok-bg: #0e3a2b;   --chip-ok-text: #6df0b0;
  --chip-info-bg: #0b3a36; --chip-info-text: #6df5e0;
  --chip-warn-bg: #3a2c0a; --chip-warn-text: #ffd37a;
  --chip-bad-bg: #3b1512;  --chip-bad-text: #ff9a8d;
  --chip-off-bg: #1a2a27;  --chip-off-text: #9fbab5;
}

*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Open Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-page);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text);
}

.btn {
  display: block;
  width: 100%;
  padding: 12px;
  border-radius: 50px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  border: 0;
  color: var(--btn-text);
  background: linear-gradient(0deg, var(--btn-a), var(--btn-b));
  box-shadow: 0 8px 20px var(--btn-shadow);
}
.btn-primary:hover { box-shadow: 0 10px 28px var(--btn-shadow); }
.btn-outline {
  color: var(--brand-text);
  background: transparent;
  border: 2px solid var(--brand-text);
}
.btn-outline:hover { box-shadow: 0 0 18px var(--glow); }

/* ---------- Theme toggle (added by assets/js/theme.js) ---------- */
.theme-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 50;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--brand-text);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.theme-toggle:hover { transform: translateY(-2px); box-shadow: 0 0 18px var(--glow); }
.theme-toggle:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.theme-toggle svg { width: 20px; height: 20px; fill: currentColor; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
