/* ═══════════════════════════════════════════════════════════════
   ChillBill shared styles: colours (light + dark), base, header, footer.
   Every page loads this first. Change a colour here and it changes
   everywhere. Page-specific styles live in each page's own <style>.
   ═══════════════════════════════════════════════════════════════ */

/* ── Colours: light ─────────────────────────────────────────── */
:root {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --surface2: #f7f9fc;
  --border: #e2e8f0;
  --border-focus: #0ea5e9;
  --text: #111827;
  --text2: #4b5563;
  --text3: #8a94a6;

  --accent: #0ea5e9;
  --accent-dark: #0284c7;
  --accent-dk: #0284c7;          /* older name for --accent-dark */
  --accent-bg: #e0f2fe;
  --accent-text: #075985;
  --accent-bd: #bae6fd;

  --green: #10b981;
  --green-bg: #d1fae5;
  --green-bd: #a7f3d0;
  --green-text: #065f46;
  --green-dk: #065f46;           /* older name for --green-text */
  --amber: #f59e0b;
  --amber-bg: #fef3c7;
  --amber-bd: #fde68a;
  --amber-text: #92400e;
  --red: #ef4444;
  --danger: #ef4444;
  --red-bg: #fee2e2;
  --red-bd: #fca5a5;
  --red-text: #991b1b;
  --purple: #7c3aed;
  --purple-bg: #f5f3ff;
  --purple-bd: #ddd6fe;
  --purple-text: #5b21b6;

  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
  --nav-h: 58px;
  --on-accent: #ffffff;          /* text on accent-coloured buttons */
  color-scheme: light;
}

/* ── Colours: dark (follows the visitor's device setting) ───── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1621;
    --surface: #1a2233;
    --surface2: #1e2a3a;
    --border: #2a3a52;
    --border-focus: #38bdf8;
    --text: #f1f5f9;
    --text2: #a5b3c7;
    --text3: #6b7a90;

    --accent: #0ea5e9;
    --accent-dark: #38bdf8;
    --accent-dk: #38bdf8;
    --accent-bg: #0c2a3e;
    --accent-text: #7dd3fc;
    --accent-bd: #0e4a6e;

    --green: #34d399;
    --green-bg: #052e1c;
    --green-bd: #166534;
    --green-text: #6ee7b7;
    --green-dk: #6ee7b7;
    --amber: #fbbf24;
    --amber-bg: #2d1f04;
    --amber-bd: #92400e;
    --amber-text: #fcd34d;
    --red: #f87171;
    --danger: #f87171;
    --red-bg: #2a0f12;
    --red-bd: #7f1d1d;
    --red-text: #fca5a5;
    --purple: #a78bfa;
    --purple-bg: #1e1030;
    --purple-bd: #4c1d95;
    --purple-text: #c4b5fd;

    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
/* Same dark values, for a page that forces dark with <html data-theme="dark"> */
:root[data-theme="dark"] {
  --bg: #0f1621; --surface: #1a2233; --surface2: #1e2a3a; --border: #2a3a52; --border-focus: #38bdf8;
  --text: #f1f5f9; --text2: #a5b3c7; --text3: #6b7a90;
  --accent: #0ea5e9; --accent-dark: #38bdf8; --accent-dk: #38bdf8; --accent-bg: #0c2a3e; --accent-text: #7dd3fc; --accent-bd: #0e4a6e;
  --green: #34d399; --green-bg: #052e1c; --green-bd: #166534; --green-text: #6ee7b7; --green-dk: #6ee7b7;
  --amber: #fbbf24; --amber-bg: #2d1f04; --amber-bd: #92400e; --amber-text: #fcd34d;
  --red: #f87171; --danger: #f87171; --red-bg: #2a0f12; --red-bd: #7f1d1d; --red-text: #fca5a5;
  --purple: #a78bfa; --purple-bg: #1e1030; --purple-bd: #4c1d95; --purple-text: #c4b5fd;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  color-scheme: dark;
}

/* ── Base ───────────────────────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
/* Form controls follow the theme instead of staying white in dark mode */
input, select, textarea { color: var(--text); background-color: var(--surface); }
::placeholder { color: var(--text3); opacity: 1; }

/* ── Header ─────────────────────────────────────────────────── */
/* The placeholder is what sticks to the top (and reserves space so the page doesn't jump) */
#cb-header { min-height: var(--nav-h); position: sticky; top: 0; z-index: 60; }
.cb-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-family: 'Inter', system-ui, sans-serif;
}
.cb-header-in {
  max-width: 1120px; margin: 0 auto;
  height: var(--nav-h);
  padding: 0 max(16px, env(safe-area-inset-left, 0px));
  display: flex; align-items: center; gap: 1rem;
}
.cb-brand {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  text-decoration: none; color: var(--text);
  font-family: 'Sora', sans-serif; font-weight: 700; font-size: 16px;
}
.cb-logo {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
/* "nav" is reset here because some pages style every <nav> element */
.cb-header nav.cb-nav {
  position: static; height: auto; background: none; border: 0; padding: 0; margin: 0 0 0 auto;
  display: flex; align-items: center; gap: 2px;
}
.cb-nav a, .cb-drawer a {
  color: var(--text2); text-decoration: none; font-size: 13.5px; font-weight: 500;
  padding: 7px 11px; border-radius: 8px; white-space: nowrap;
  transition: background .12s, color .12s;
}
.cb-nav a:hover, .cb-nav a[aria-current="page"],
.cb-drawer a:hover, .cb-drawer a[aria-current="page"] { background: var(--accent-bg); color: var(--accent-text); }
.cb-cta {
  flex-shrink: 0; background: var(--accent); color: var(--on-accent); text-decoration: none;
  font-size: 13.5px; font-weight: 600; padding: 8px 14px; border-radius: 9px;
  transition: background .15s;
}
.cb-cta:hover { background: var(--accent-dark); color: var(--on-accent); }
.cb-menu-btn {
  display: none; margin-left: auto; flex-shrink: 0;
  width: 40px; height: 40px; border-radius: 9px; cursor: pointer;
  background: none; border: 1px solid var(--border); color: var(--text);
  font-size: 18px; line-height: 1; padding: 0;
}
.cb-drawer {
  display: none; border-top: 1px solid var(--border); background: var(--surface);
  padding: 8px max(16px, env(safe-area-inset-left, 0px)) 14px;
  flex-direction: column; gap: 2px;
}
.cb-drawer a { font-size: 15px; padding: 11px 12px; }
.cb-drawer .cb-cta { margin-top: 8px; text-align: center; padding: 12px; font-size: 15px; }
.cb-header.open .cb-drawer { display: flex; }

@media (max-width: 900px) {
  .cb-header nav.cb-nav, .cb-header-in > .cb-cta { display: none; }
  .cb-menu-btn { display: block; }
}

/* ── Footer ─────────────────────────────────────────────────── */
.cb-footer {
  border-top: 1px solid var(--border); background: var(--surface);
  margin-top: 3rem; font-family: 'Inter', system-ui, sans-serif;
}
.cb-footer-in {
  max-width: 1120px; margin: 0 auto;
  padding: 1.8rem max(16px, env(safe-area-inset-left, 0px)) 1.6rem;
  display: flex; flex-wrap: wrap; gap: 1.2rem 2.5rem; justify-content: space-between;
}
.cb-footer .cb-brand { font-size: 15px; }
.cb-footer-tag { font-size: 13px; color: var(--text3); margin-top: 6px; }
.cb-footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: flex-start; max-width: 620px; }
.cb-footer-links a { font-size: 13px; color: var(--text2); text-decoration: none; }
.cb-footer-links a:hover { color: var(--accent); }
.cb-footer-legal {
  max-width: 1120px; margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-left, 0px)) 1.6rem;
  font-size: 12px; color: var(--text3);
}
