/* Hite Labs HQ — editorial dark interface (contrast refinement pass) */

:root {
  /* Surfaces — clearer step between canvas, card, elevated */
  --bg: #0a0a0b;
  --bg-elev: #17181c;      /* card surface — noticeably lifted off canvas */
  --bg-elev-2: #1f2026;    /* inputs, elevated sheet interior */
  --bg-elev-3: #26272e;    /* hover / pressed on cards */

  /* Borders — visible, not ghostly */
  --border: #52535d;       /* ~3.1:1 on bg-elev — meets AA UI-component contrast */
  --border-strong: #6b6c77; /* ~4.6:1 on bg-elev — distinct emphasis */

  /* Text — AAA primary, AA+ muted */
  --text: #f6f7f8;         /* ~18:1 on bg, ~15.5:1 on bg-elev */
  --text-dim: #c9cad1;     /* ~9.3:1 on bg-elev — AAA */
  --text-faint: #aaacb6;   /* ~6.6:1 on bg-elev — comfortably AA on every surface */

  /* Accent — lime, tuned for tangibility */
  --accent: #c8f557;       /* ~13.8:1 on bg, ~11.6:1 on bg-elev */
  --accent-hover: #d4ff6a;
  --accent-ink: #0a0a0b;
  --accent-soft: rgba(200, 245, 87, 0.18);

  /* Status — vivid, not muddy */
  --warn: #ffc04d;         /* amber ~11:1 on bg */
  --warn-bg: rgba(255, 192, 77, 0.16);
  --warn-border: rgba(255, 192, 77, 0.55);
  --danger: #ff7a7a;       /* ~8.1:1 on bg */
  --danger-bg: rgba(255, 122, 122, 0.18);
  --danger-border: rgba(255, 122, 122, 0.55);
  --success: #6ee895;      /* ~12:1 on bg */
  --success-bg: rgba(110, 232, 149, 0.14);
  --info: #8fd9ff;         /* ~12.5:1 on bg */
  --info-bg: rgba(143, 217, 255, 0.14);
  --purple: #b9a5ff;
  --purple-bg: rgba(185, 165, 255, 0.14);

  --radius: 12px;
  --radius-lg: 20px;
  --tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-sys: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sys);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
}

textarea, input, select {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.45;
  width: 100%;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea::placeholder,
input::placeholder {
  color: #a0a2ac;           /* ~5.6:1 on bg-elev-2 — AA */
  opacity: 1;
}
textarea:hover, input:hover, select:hover { border-color: var(--border-strong); }
textarea:focus, input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { min-height: 88px; resize: vertical; }

/* Global focus-visible ring — obvious, lime, with offset */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
button:focus-visible,
.tab-btn:focus-visible,
.seg-btn:focus-visible,
.icon-btn:focus-visible,
.chat-send:focus-visible,
.fab:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ========== App layout ========== */

.app {
  padding: calc(var(--safe-top) + 20px) 16px calc(var(--tabbar-h) + var(--safe-bottom) + 32px);
  max-width: 720px;
  margin: 0 auto;
}

.tab-section { display: none; }
.tab-section.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.section-header { margin-bottom: 22px; }
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0;
  color: var(--text);
}
.big-date {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
  margin: 0 0 14px;
  color: var(--text);
}

.focus-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.focus-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-dim);
}
.focus-value {
  font-weight: 600;
  font-size: 15px;
  color: var(--accent);
  flex: 1;
  min-width: 0;
}
.focus-value[data-empty]:empty::before {
  content: attr(data-empty);
  color: var(--text-faint);
  font-weight: 500;
}

/* ========== Cards ========== */

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.card-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 14px;
}
.stack > * + * { margin-top: 10px; }

.record-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.record-card:active { transform: scale(0.99); }
.record-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-elev-3);
}
.record-card.overdue {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  border-left: 3px solid var(--danger);
}
.record-card.soon {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  border-left: 3px solid var(--warn);
}

.record-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.record-name {
  font-weight: 650;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
}
.record-sub {
  color: var(--text-dim);
  font-size: 13.5px;
  margin-top: 4px;
  line-height: 1.4;
}
.record-preview {
  color: var(--text-dim);
  font-size: 13.5px;
  margin-top: 10px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.record-meta {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-faint);
  flex-wrap: wrap;
  font-weight: 500;
}

/* ========== Badges ========== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  white-space: nowrap;
  line-height: 1.4;
}
.badge[data-status="New"] {
  background: var(--info-bg);
  color: var(--info);
  border-color: rgba(143, 217, 255, 0.5);
}
.badge[data-status="Contacted"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(200, 245, 87, 0.5);
}
.badge[data-status="Qualifying"] {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: var(--warn-border);
}
.badge[data-status="Proposal"] {
  background: var(--purple-bg);
  color: var(--purple);
  border-color: rgba(185, 165, 255, 0.5);
}
.badge[data-status="Won"],
.badge[data-status="Completed"] {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(110, 232, 149, 0.5);
}
.badge[data-status="Lost - Not Now"],
.badge[data-status="Lost"] {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}
.badge.overdue {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}
button.meridian-status {
  cursor: pointer;
  font: inherit;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
  transition: transform 0.1s ease, filter 0.15s ease;
}
button.meridian-status:hover { filter: brightness(1.15); }
button.meridian-status:active { transform: scale(0.97); }
button.meridian-status:disabled { opacity: 0.6; cursor: wait; }
.badge[data-status="Locked"] {
  background: var(--bg-elev-2);
  color: var(--text-faint);
  border-color: var(--border-strong);
}
.badge[data-status="To Do"] {
  background: var(--info-bg);
  color: var(--info);
  border-color: rgba(143, 217, 255, 0.5);
}
.badge[data-status="In Progress"] {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: var(--warn-border);
}
.badge[data-status="Done"] {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(110, 232, 149, 0.5);
}

/* ========== Quick tasks ========== */

.quicktasks-add {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.quicktasks-add input {
  flex: 1;
  padding: 10px 12px;
  font-size: 14px;
}
.quicktasks-add button {
  flex: 0 0 auto;
  width: auto;
  padding: 10px 16px;
  margin: 0;
}
.quicktasks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.qt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
}
.qt-row.pinned { border-color: var(--warn-border); }
.qt-check {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg-elev-3);
  border: 1px solid var(--border-strong);
  color: var(--accent-ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.qt-check.done {
  background: var(--accent);
  border-color: var(--accent);
}
.qt-label {
  flex: 1;
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}
.qt-label.done {
  color: var(--text-faint);
  text-decoration: line-through;
  text-decoration-color: var(--text-faint);
}
.qt-pin {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: color 0.15s ease, transform 0.15s ease;
}
.qt-pin:hover { color: var(--text); }
.qt-pin.pinned { color: var(--warn); }

/* ========== Checklist ========== */

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--border);
  min-height: 48px;
  cursor: pointer;
  user-select: none;
}
.checklist li:last-child { border-bottom: none; }
.checklist .box {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--bg);
  transition: all 0.15s ease;
}
.checklist li:hover .box { border-color: var(--text-faint); }
.checklist li[data-checked="true"] .box {
  background: var(--accent);
  border-color: var(--accent);
}
.checklist li[data-checked="true"] .box::after {
  content: "";
  width: 6px;
  height: 11px;
  border-right: 2.5px solid var(--accent-ink);
  border-bottom: 2.5px solid var(--accent-ink);
  transform: rotate(45deg) translate(-1px, -1px);
}
.checklist li[data-checked="true"] .label {
  color: var(--text-faint);
  text-decoration: line-through;
  text-decoration-color: var(--text-faint);
}
.label {
  font-size: 15.5px;
  line-height: 1.4;
  color: var(--text);
}

.field-status {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 8px;
  text-align: right;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

/* ========== Tab bar ========== */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  background: rgba(10, 10, 11, 0.94);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + var(--safe-bottom));
  z-index: 50;
  min-height: calc(var(--tabbar-h) + var(--safe-bottom));
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px;
  min-height: 44px;
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 0.15s ease;
}
.tab-btn .tab-glyph { font-size: 18px; line-height: 1; }
.tab-btn .tab-label {
  text-transform: uppercase;
  font-weight: 700;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); }

/* ========== FAB ========== */

.fab {
  position: fixed;
  right: 20px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 18px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(200, 245, 87, 0.35), 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  z-index: 45;
  transition: transform 0.1s ease, background 0.15s ease;
}
.fab:hover { background: var(--accent-hover); }
.fab:active { transform: scale(0.94); }
body[data-tab="crm"] .fab[data-fab="crm"],
body[data-tab="focus"] .fab[data-fab="focus"] { display: flex; }

/* ========== Sheet ========== */

.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.sheet-backdrop.visible { opacity: 1; }
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 80vh;
  max-height: 80dvh;
  background: var(--bg-elev-2);
  border-top: 1px solid var(--border-strong);
  border-radius: 20px 20px 0 0;
  z-index: 100;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
  overflow: hidden;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
}
.sheet.visible { transform: translateY(0); }
.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 10px auto 6px;
  flex: 0 0 auto;
}
.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.sheet-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--text);
}
.sheet-body {
  overflow-y: auto;
  padding: 18px 20px 32px;
  flex: 1;
}
.icon-btn {
  background: var(--bg-elev-3);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  min-height: 32px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover {
  background: var(--border);
  border-color: var(--text-faint);
}

.form-field { margin-bottom: 16px; }
.form-field label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 10px;
  padding: 14px 20px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.01em;
  width: 100%;
  min-height: 48px;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s ease;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.99); }

.btn-secondary {
  background: var(--bg-elev-3);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px;
  font-weight: 600;
  font-size: 14px;
  width: 100%;
  min-height: 44px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-secondary:hover {
  background: var(--border);
  border-color: var(--text-faint);
}

/* ========== Segmented control ========== */

.segmented {
  display: flex;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  margin-top: 14px;
}
.seg-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  transition: all 0.15s ease;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: var(--bg-elev-3);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.focus-view { display: none; }
.focus-view.active { display: block; }

.filter-bar, .filter-bar-stack {
  display: flex;
  gap: 6px;
  margin: 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.filter-bar-stack { flex-direction: column; overflow-x: visible; gap: 6px; }
.filter-bar-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.filter-bar::-webkit-scrollbar,
.filter-bar-row::-webkit-scrollbar { display: none; }
.filter-bar-label {
  flex-shrink: 0;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-faint);
  align-self: center;
  padding-right: 4px;
}
.filter-chip {
  flex-shrink: 0;
  background: var(--bg-elev);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.filter-chip:hover { color: var(--text); border-color: var(--border-strong); }
.filter-chip.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.group-header {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-dim);
  margin: 22px 0 10px;
  padding-left: 4px;
}
.group-header:first-child { margin-top: 0; }

/* ========== Chat ========== */

#tab-chat.active {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--tabbar-h) - var(--safe-bottom) - 40px);
}
.chat-header { margin-bottom: 14px; }
.chat-sub {
  color: var(--text-dim);
  font-size: 14.5px;
  margin: 6px 0 0;
  line-height: 1.5;
}
.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0 16px;
  overflow-y: auto;
}
.msg {
  max-width: 82%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-ink);
  border-bottom-right-radius: 4px;
  font-weight: 500;
}
.msg.agent {
  align-self: flex-start;
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg.typing {
  color: var(--text-faint);
  font-style: italic;
}
.chat-input-row {
  position: sticky;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  display: flex;
  gap: 8px;
  padding: 10px 0;
  background: linear-gradient(to top, var(--bg) 60%, transparent);
}
.chat-input {
  flex: 1;
  border-radius: 999px;
  padding: 12px 18px;
}
.chat-send {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 999px;
  padding: 0 22px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  min-width: 72px;
  min-height: 44px;
  transition: background 0.15s ease;
}
.chat-send:hover { background: var(--accent-hover); }

/* ========== Skeleton ========== */

.skeleton {
  height: 78px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--bg-elev) 0%, var(--bg-elev-3) 50%, var(--bg-elev) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border: 1px solid var(--border);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.empty {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-dim);
  font-size: 14.5px;
  line-height: 1.5;
}

/* ========== Toast ========== */

.toast {
  position: fixed;
  top: calc(var(--safe-top) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--bg-elev-2);
  border: 1px solid var(--danger);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  z-index: 200;
  transition: all 0.25s ease;
  max-width: 90vw;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========== Tablet / Desktop — sidebar ========== */

@media (min-width: 768px) {
  body { display: grid; grid-template-columns: 240px 1fr; }
  .tabbar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    right: auto;
    width: 240px;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 80px 12px 20px;
    border-top: none;
    border-right: 1px solid var(--border);
    gap: 4px;
    min-height: 100vh;
    background: rgba(10, 10, 11, 0.96);
  }
  .tabbar::before {
    content: "Hite Labs HQ";
    position: absolute;
    top: 28px; left: 20px;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
  }
  .tab-btn {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    color: var(--text-dim);
  }
  .tab-btn:hover {
    background: var(--bg-elev);
    color: var(--text);
  }
  .tab-btn .tab-glyph { font-size: 16px; }
  .tab-btn .tab-label {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
  }
  .tab-btn.active {
    background: var(--bg-elev);
    color: var(--accent);
    border: 1px solid var(--border);
  }

  .app {
    grid-column: 2;
    padding: 44px 44px 60px;
    max-width: 820px;
  }
  .section-title { font-size: 42px; }
  .big-date { font-size: 38px; }
  .fab { right: 40px; bottom: 40px; }
  .sheet { left: 240px; right: 0; }
  .chat-input-row { bottom: 0; }
}

/* Error banner — in-tab actionable error */
.error-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  background: var(--warn-bg);
  border: 1px solid var(--warn);
  border-left-width: 3px;
  border-radius: 12px;
  color: var(--text);
}
.error-banner .eb-icon { font-size: 20px; line-height: 1; flex-shrink: 0; }
.error-banner .eb-body { flex: 1; min-width: 0; }
.error-banner .eb-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.error-banner .eb-msg { color: var(--text-dim); font-size: 14px; line-height: 1.5; }
.error-banner .eb-retry {
  margin-top: 10px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  min-height: 36px;
}
.error-banner .eb-retry:hover { background: var(--bg-elev-3); }

/* Health banner — top-of-app status */
.health-banner {
  position: sticky; top: 0; z-index: 50;
  display: flex; gap: 10px; align-items: center;
  padding: 10px 16px;
  background: var(--danger-bg);
  border-bottom: 1px solid var(--danger);
  color: var(--text);
  font-size: 14px;
}
.health-banner .hb-msg { flex: 1; font-weight: 600; }
.health-banner .hb-toggle,
.health-banner .hb-dismiss {
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--text); padding: 4px 10px; border-radius: 6px;
  font: inherit; font-size: 13px; cursor: pointer; min-height: 30px;
}
.health-banner[data-open="true"] { flex-wrap: wrap; }
.health-banner ul { width: 100%; margin-top: 10px; padding-left: 18px; color: var(--text-dim); font-size: 13px; line-height: 1.6; }
.health-banner[data-open="false"] ul { display: none; }
