/* Nagbird design tokens and shared components ("Warm Tactile Cheeky"). */
:root {
  --bg: #f6f3ec;
  --surface: #fffdf8;
  --field: #f3ede3;
  --ink: #1d1b16;
  --ink-2: #4a443c;
  --muted: #776f63;
  --line: #e7e0d3;

  --coral: #ff5a36;          /* brand: logo, dots, decorative fills */
  --accent: #d63a16;         /* buttons/links: white text passes WCAG AA */
  --accent-hover: #bf3212;
  --coral-soft: #ffe6de;

  --teal: #16796b;           /* appointments */
  --teal-soft: #d8f0eb;

  --overdue: #b4122e;        /* overdue only: crimson, distinct from coral */
  --overdue-soft: #fbe3e7;

  --night: #2b2723;          /* popup card */
  --night-2: #3a3530;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(29, 27, 22, .05), 0 8px 24px rgba(29, 27, 22, .06);
  --shadow-lg: 0 18px 50px rgba(29, 27, 22, .22);

  /* Supporting tones */
  --accent-text: #d63a16;    /* accent used as text (links); lighter in dark mode */
  --inverse: #1d1b16;        /* dark chips, toasts and tooltips on the light page */
  --on-inverse: #ffffff;
  --line-strong: #cfc5b4;
  --faint: #bdb3a3;          /* days outside the month, placeholders */
  --track: #e4dccd;
  --hover: #ece4d6;
  --tint: #f0eadf;           /* weekends, subtle hovers */
  --field-hover: #ebe3d6;
  --field-focus: #ffffff;
  --coral-ink: #9a2a0f;
  --teal-ink: #0f5a50;
  --quiet-soft: #eef0f7;
  --warn-soft: #fff8e8;
  --warn-line: #f0dfb4;
  --warn-ink: #9a6a00;
  --overdue-hover: #8f0e24;

  --font-display: "Outfit", ui-rounded, system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

/* Dark mode: follows the device unless the user picked Light or Dark in Settings
   (theme.js sets data-theme on <html> before the page paints). */
:root[data-theme="dark"] {
  --bg: #141210;
  --surface: #1e1b18;
  --field: #2a2622;
  --ink: #f3eee6;
  --ink-2: #cdc5b9;
  --muted: #9e958a;
  --line: #34302b;

  --coral: #ff6a48;
  --accent: #d63a16;
  --accent-hover: #e8532f;
  --coral-soft: #3b231b;
  --teal: #1f9886;
  --teal-soft: #15302b;
  --overdue: #e2475f;
  --overdue-soft: #3a1b21;
  --night: #2b2723;
  --night-2: #3a3530;

  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .55);

  --accent-text: #ff8a6b;
  --inverse: #f3eee6;
  --on-inverse: #1d1b16;
  --line-strong: #4a443d;
  --faint: #6c645a;
  --track: #34302b;
  --hover: #2c2824;
  --tint: #191714;
  --field-hover: #332e29;
  --field-focus: #24211d;
  --coral-ink: #ffb39f;
  --teal-ink: #7fd8c8;
  --quiet-soft: #22242e;
  --warn-soft: #2f2716;
  --warn-line: #5a4a24;
  --warn-ink: #e9bf5c;
  --overdue-hover: #c23048;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141210;
    --surface: #1e1b18;
    --field: #2a2622;
    --ink: #f3eee6;
    --ink-2: #cdc5b9;
    --muted: #9e958a;
    --line: #34302b;

    --coral: #ff6a48;
    --accent: #d63a16;
    --accent-hover: #e8532f;
    --coral-soft: #3b231b;
    --teal: #1f9886;
    --teal-soft: #15302b;
    --overdue: #e2475f;
    --overdue-soft: #3a1b21;
    --night: #2b2723;
    --night-2: #3a3530;

    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .55);

    --accent-text: #ff8a6b;
    --inverse: #f3eee6;
    --on-inverse: #1d1b16;
    --line-strong: #4a443d;
    --faint: #6c645a;
    --track: #34302b;
    --hover: #2c2824;
    --tint: #191714;
    --field-hover: #332e29;
    --field-focus: #24211d;
    --coral-ink: #ffb39f;
    --teal-ink: #7fd8c8;
    --quiet-soft: #22242e;
    --warn-soft: #2f2716;
    --warn-line: #5a4a24;
    --warn-ink: #e9bf5c;
    --overdue-hover: #c23048;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 999px;
  font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none;
  transition: background-color .15s, transform .05s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(214, 58, 22, .25); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-quiet { background: var(--field); color: var(--ink); }
.btn-quiet:hover:not(:disabled) { background: var(--field-hover); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--field); }
.btn-danger { background: transparent; color: var(--overdue); }
.btn-danger:hover:not(:disabled) { background: var(--overdue-soft); }
.btn-danger.solid { background: var(--overdue); color: #fff; }
.btn-danger.solid:hover:not(:disabled) { background: var(--overdue-hover); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--field); }
.icon { width: 20px; height: 20px; flex: none; }
.icon-sm { width: 16px; height: 16px; flex: none; }

/* Form fields */
.field { display: grid; gap: 6px; }
.field > label, .field-label {
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2);
}
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .icon { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 12px 14px;
  background: var(--field); border: 1.5px solid transparent; border-radius: var(--radius-sm);
  outline: none; transition: border-color .15s, background .15s;
}
.input-wrap > .icon + .input { padding-left: 44px; }
.input:focus { border-color: var(--accent); background: var(--field-focus); }
.input[aria-invalid="true"] { border-color: var(--overdue); }
textarea.input { min-height: 96px; resize: vertical; }
.input-suffix { position: absolute; right: 6px; }
.hint { font-size: 13px; color: var(--muted); }
.error-text { font-size: 13px; color: var(--overdue); font-weight: 600; }

/* Segmented control */
.segmented {
  display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--field);
}
.segmented button {
  border: 0; background: transparent; border-radius: 999px; padding: 8px 16px; min-height: 38px;
  font-weight: 700; font-size: 14px; color: var(--ink-2); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] {
  background: var(--inverse); color: var(--on-inverse);
}
.segmented.accent button[aria-pressed="true"] { background: var(--accent); }
.segmented.block { display: flex; }
.segmented.block button { flex: 1; justify-content: center; }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
  background: var(--field); color: var(--ink-2);
}
.chip.appointment { background: var(--teal-soft); color: var(--teal); }
.chip.high { background: var(--overdue-soft); color: var(--overdue); }
.chip.overdue { background: var(--overdue); color: #fff; }
.chip.accent { background: var(--coral-soft); color: var(--accent-text); }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.brand-tag { display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .75; }

.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 14px; background: var(--field); color: var(--ink-2);
}
.alert.error { background: var(--overdue-soft); color: var(--overdue); font-weight: 600; }
.alert.success { background: var(--teal-soft); color: var(--teal); font-weight: 600; }

/* ⓘ info tooltips: hover, keyboard focus, or tap (toggles .open) */
.info-tip { position: relative; display: inline-flex; vertical-align: middle; margin-left: 4px; }
.info-btn {
  display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0;
  border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: help;
}
.info-btn:hover, .info-tip.open .info-btn { color: var(--accent-text); background: var(--coral-soft); }
.tip-bubble {
  position: absolute; z-index: 70; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  width: max-content; max-width: min(280px, calc(100vw - 32px));
  padding: 10px 12px; border-radius: 12px; background: var(--inverse); color: var(--on-inverse);
  font: 500 13px/1.45 var(--font-body); letter-spacing: 0; text-transform: none; text-align: left;
  box-shadow: var(--shadow-lg); pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity .12s, visibility .12s;
}
.tip-bubble::after {
  content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--inverse);
}
.info-tip:hover .tip-bubble, .info-btn:focus-visible + .tip-bubble, .info-tip.open .tip-bubble { opacity: 1; visibility: visible; }
.info-tip.edge-left .tip-bubble { left: -8px; transform: none; }
.info-tip.edge-left .tip-bubble::after { left: 18px; }
.info-tip.edge-right .tip-bubble { left: auto; right: -8px; transform: none; }
.info-tip.edge-right .tip-bubble::after { left: auto; right: 12px; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
