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

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #020617;
  color: #e5e7eb;
}

/* -------- Header -------- */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: #030712;
  border-bottom: 1px solid #1f2937;
  flex-wrap: wrap;
  row-gap: 4px;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-stack {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-stack-logo {
  gap: 3px;
}

.brand-logo-img {
  display: block;
  width: auto;
  height: 50px;
  max-width: 170px;
  object-fit: contain;
}

.brand-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: #e5e7eb;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: #9ca3af;
  padding-left: 6px;
}

.logo-dot {
  display: none;
}

.app-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-pill {
  background: var(--pillBg);
  color: var(--pillText);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
}

/* -------- Nav -------- */

.app-nav {
  display: flex;
  gap: 6px;
  padding: 6px 12px 4px;
  background: #020617;
  border-bottom: 1px solid #111827;
  overflow-x: auto;
}

.nav-link {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  text-decoration: none;
  color: #9ca3af;
  white-space: nowrap;
  font-weight: 700;
}

.nav-link.active {
  background: #1f2937;
  color: #f9fafb;
}

/* -------- Main layout -------- */

.app-main {
  max-width: 840px;
  margin: 12px auto 24px;
  padding: 0 12px;
}

.app-main-wide {
  max-width: 1240px;
}

/* -------- Cards -------- */

.card {
  background: #020617;
  border-radius: 18px;
  border: 1px solid #111827;
  padding: 16px 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  margin-bottom: 14px;
}

h1 {
  font-size: 1.2rem;
  margin: 0 0 6px;
}

h2 {
  font-size: 1rem;
  margin: 0 0 4px;
}

h3 {
  font-size: 0.95rem;
  margin: 10px 0 4px;
}

.small-note {
  font-size: 0.8rem;
  color: #9ca3af;
}

/* -------- Buttons -------- */

.btn-primary,
.btn-secondary,
.btn-link {
  border: none;
  cursor: pointer;
  font: inherit;
}

.btn-primary {
  background: var(--primary);
  color: var(--primaryText);
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 600;
  text-decoration: none;
  font-size: 0.9rem;
}

.btn-secondary {
  background: #111827;
  color: #e5e7eb;
  border-radius: 999px;
  padding: 8px 18px;
  text-decoration: none;
  font-size: 0.9rem;
}

.btn-link {
  background: transparent;
  color: var(--text);
  text-decoration: underline;
  padding: 4px 6px;
  font-size: 0.8rem;
}

.landing-actions,
.dashboard-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* -------- Forms / inputs -------- */

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.profile-grid label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.profile-form input,
.profile-form select {
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #4b5563;
  background: #020617;
  color: #e5e7eb;
}

.role-fieldset {
  border: 1px solid #374151;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
}

.error-text {
  color: #f97373;
  font-size: 0.85rem;
}

.success-text {
  color: #a7f3d0;
  font-size: 0.85rem;
}

/* -------- Glucose form -------- */

.glucose-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-top: 8px;
}

.glucose-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.glucose-form input,
.glucose-form select {
  margin-top: 4px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #4b5563;
  background: #020617;
  color: #e5e7eb;
}

/* -------- Table -------- */

.glucose-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 6px;
}

.glucose-table th,
.glucose-table td {
  border-bottom: 1px solid #1f2937;
  padding: 4px 6px;
  text-align: left;
}

/* -------- Chat -------- */

.chat-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.chat-frey-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.12);
}

.chat-box {
  max-height: 360px;
  overflow-y: auto;
  margin-top: 10px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid #1f2937;
  background: #020617;
}

.chat-message {
  margin-bottom: 8px;
}

.chat-author {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-bottom: 2px;
}

.chat-bubble {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 0.9rem;
}

.chat-message-frey .chat-bubble {
  background: #1f2937;
}

.chat-message-user .chat-bubble {
  background: #22c55e;
  color: #020617;
}

.chat-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.chat-form input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #4b5563;
  background: #020617;
  color: #e5e7eb;
}

/* -------- Tips -------- */

.tips-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.tip-item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #1f2937;
  background: #020617;
}

.tip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.favorite-btn {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #facc15;
}

/* -------- Recipes -------- */

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.recipe-card {
  padding: 0;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--card-solid);
  box-shadow: var(--shadow);
}

.recipe-card-rich {
  display: flex;
  flex-direction: column;
}

.recipe-card-image-link {
  display: block;
  text-decoration: none;
}

.recipe-card-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 18px 18px 0 0;
}

.recipe-card-body {
  padding: 14px;
}

.recipe-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.recipe-card-title {
  margin: 0;
}

.recipe-card-subtitle {
  margin: 6px 0 0;
  line-height: 1.55;
}

.recipe-view-btn {
  padding: 7px 14px;
  font-size: 0.85rem;
  flex: 0 0 auto;
}

.recipe-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.recipe-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(91,92,226,0.08);
  border: 1px solid rgba(91,92,226,0.12);
  color: var(--text);
  font-size: 0.78rem;
}

.recipe-stat strong {
  font-weight: 800;
}

.recipe-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.recipe-tag {
  background: rgba(15,23,42,0.08);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--muted);
}

html[data-theme="dark"] .recipe-tag {
  background: rgba(15,23,42,0.70);
}

.recipe-detail-card {
  overflow: hidden;
}

.recipe-detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(220px, 0.9fr);
  gap: 18px;
  align-items: start;
  margin-top: 10px;
}

.recipe-detail-title {
  margin-bottom: 6px;
}

.recipe-detail-subtitle {
  line-height: 1.6;
  margin-bottom: 0;
}

.recipe-stats-detail {
  margin-top: 14px;
}

.recipe-detail-tags {
  margin-top: 12px;
}

.recipe-detail-image-wrap {
  align-self: start;
}

.recipe-detail-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.recipe-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}

.recipe-detail-box {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(15,23,42,0.05);
}

html[data-theme="dark"] .recipe-detail-box {
  background: rgba(2,6,23,0.72);
}

.recipe-detail-box h2 {
  margin-bottom: 10px;
}

.recipe-detail-box ul,
.recipe-detail-box ol {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

.recipe-detail-box li + li {
  margin-top: 8px;
}

/* ---- Chat readability ---- */
.chat-bubble { white-space: pre-wrap; line-height: 1.55; }
.chat-p { margin: 0 0 8px 0; }
.chat-list { margin: 0 0 8px 18px; padding: 0; }
.chat-spacer { height: 6px; }

/* -------- Responsive tweaks -------- */

@media (max-width: 820px) {
  .glucose-form {
    flex-direction: column;
    align-items: stretch;
  }
  .glucose-form button {
    width: 100%;
  }
  .recipe-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .app-header {
    padding: 8px 10px;
  }

  .app-main {
    padding: 0 8px;
  }

  .card {
    padding: 14px 14px;
  }

  h1 {
    font-size: 1.1rem;
  }

  /* Mobile: keep chat input usable */
  .chat-form {
    flex-direction: column;
    align-items: stretch;
  }
  .chat-form .btn-primary {
    width: 100%;
  }

  /* Mobile: allow tables to scroll instead of breaking layout */
  .glucose-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* =====================
   Frey bubble companion
   ===================== */
.frey-bubble {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(15, 20, 35, 0.9);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  padding: 0;
  cursor: pointer;
  z-index: 9999;
}

.frey-bubble img {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  object-fit: cover;
  display: block;
}

.frey-bubble-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.35);
  display: none;
}

.frey-bubble-dot.show { display: block; }

.frey-panel {
  position: fixed;
  right: 18px;
  bottom: 86px;
  width: 360px;
  max-width: calc(100vw - 36px);
  height: 520px;
  max-height: calc(100vh - 140px);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(9, 12, 24, 0.98);
  box-shadow: 0 18px 60px rgba(0,0,0,0.45);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
}

.frey-panel.open { display: flex; }

.frey-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.frey-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.frey-panel-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.12);
}

.frey-panel-name {
  font-weight: 700;
}

.frey-panel-sub {
  font-size: 12px;
  opacity: 0.72;
  margin-top: 1px;
}

.frey-panel-messages {
  padding: 12px;
  overflow: auto;
  flex: 1;
}

.frey-msg { margin-bottom: 10px; }

.frey-msg-label {
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 4px;
}

.frey-msg-bubble {
  border-radius: 12px;
  padding: 10px 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  white-space: pre-wrap;
  word-break: break-word;
}

.frey-msg.user .frey-msg-bubble {
  background: rgba(34,197,94,0.14);
  border-color: rgba(34,197,94,0.18);
}

.frey-panel-quick {
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.frey-quick-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.frey-quick {
  border-radius: 999px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: inherit;
  cursor: pointer;
  font-size: 12px;
}

.frey-quick:hover { background: rgba(255,255,255,0.08); }

.frey-panel-form {
  display: flex;
  gap: 10px;
  padding: 12px;
}

.frey-panel-form input {
  flex: 1;
}

@media (max-width: 600px) {
  .frey-panel {
    right: 14px;
    bottom: 78px;
    width: min(340px, calc(100vw - 28px));
    height: min(460px, 52dvh);
    max-height: min(460px, 52dvh);
    border-radius: 20px;
    box-shadow: 0 22px 50px rgba(0,0,0,0.42);
  }
  .frey-panel-messages {
    padding: 10px;
  }
  .frey-panel-quick {
    padding: 8px 10px;
  }
  .frey-panel-form {
    padding: 10px;
  }
  .frey-panel-form button {
    flex: 0 0 auto;
  }
  .frey-bubble {
    right: 12px;
    bottom: 12px;
  }
}

/* ------------------------------
   Wealthfront-inspired refresh
   (Overrides only — keeps existing structure)
------------------------------ */

:root {
  /* Wealthfront-ish palette */
  --wf-purple: #5b5ce2;
  --wf-purple-2: #6d5ef3;
  --wf-teal: #2dd4bf;
  --bg: radial-gradient(1200px 800px at 10% 0%, rgba(91,92,226,0.22), transparent 55%),
        radial-gradient(1200px 800px at 90% 20%, rgba(45,212,191,0.14), transparent 55%),
        #020617;
  --surface: rgba(15, 23, 42, 0.55);
  --card: rgba(17, 24, 39, 0.60);
  --card-solid: #0b1220;
  --text: #e5e7eb;
  --muted: rgba(229,231,235,0.65);
  --border: rgba(148,163,184,0.18);
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --radius: 18px;
  --radius-lg: 22px;
  --primary: var(--wf-purple);
  --primary-2: var(--wf-purple-2);
  --primaryText: #ffffff;
  --pillBg: rgba(15,23,42,0.85);
  --pillText: #e5e7eb;
}


html[data-theme="light"] {
  --bg: radial-gradient(1100px 700px at 10% 0%, rgba(91,92,226,0.14), transparent 55%),
        radial-gradient(1100px 700px at 90% 20%, rgba(45,212,191,0.10), transparent 55%),
        #f7fafc;
  --surface: rgba(255,255,255,0.78);
  --card: rgba(255,255,255,0.90);
  --card-solid: #ffffff;
  --text: #0f172a;
  --muted: rgba(15,23,42,0.65);
  --border: rgba(15,23,42,0.10);
  --shadow: 0 10px 25px rgba(15,23,42,0.10);
  --pillBg: rgba(15,23,42,0.10);
  --pillText: #0f172a;
}


html.large-text { font-size: 112%; }

body {
  background: var(--bg) !important;
  color: var(--text) !important;
}

.app-header {
  background: var(--surface) !important;
  border-bottom: 1px solid var(--border) !important;
  backdrop-filter: blur(10px);
}

.brand-title { color: var(--text) !important; font-weight: 850; }
.brand-subtitle { color: var(--muted) !important; }

.app-nav {
  justify-content: center !important;
  gap: 14px !important;
  border-bottom: 1px solid var(--border) !important;
  background: transparent !important;
}

.nav-link {
  padding: 10px 14px !important;
  border-radius: 999px !important;
  border: 1px solid transparent;
}

.nav-link.active {
  background: rgba(2,6,23,0.30) !important;
  border-color: var(--border) !important;
}

html[data-theme="light"] .nav-link.active {
  background: rgba(91,92,226,0.12) !important;
}

/* Wealthfront-like top nav in light mode: purple bar + high contrast */
html[data-theme="light"] .app-nav {
  background: linear-gradient(90deg, var(--wf-purple), var(--wf-purple-2)) !important;
  border-bottom: none !important;
  padding: 10px 12px 8px !important;
}

html[data-theme="light"] .nav-link {
  color: rgba(255,255,255,0.92) !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .nav-link:hover {
  color: #ffffff !important;
  background: rgba(255,255,255,0.14) !important;
}

html[data-theme="light"] .nav-link.active {
  background: rgba(255,255,255,0.20) !important;
  border-color: rgba(255,255,255,0.18) !important;
}

.app-main { padding-bottom: 110px !important; }

.card,
.panel,
.login-card,
.chat-card,
.tips-card {
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow) !important;
}

.btn-primary {
  background: linear-gradient(90deg, var(--primary), var(--primary-2)) !important;
  color: var(--primaryText) !important;
  border: none !important;
  border-radius: 999px !important;
  font-weight: 800 !important;
}

.btn-secondary {
  background: rgba(2,6,23,0.30) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: 999px !important;
  font-weight: 700 !important;
}

.muted { color: var(--muted) !important; }

/* Options dropdown */
.options-btn { border: 1px solid var(--border) !important; border-radius: 999px !important; }
.options-menu {
  position: absolute;
  right: 0;
  top: 34px;
  min-width: 220px;
  padding: 8px;
  z-index: 50;
  background: var(--card-solid) !important;
  border: 1px solid var(--border) !important;
  border-radius: 14px !important;
  box-shadow: var(--shadow) !important;
}
.options-menu[aria-hidden="true"]{ display:none; }
.options-menu[aria-hidden="false"]{ display:block; }

.options-item:hover { background: rgba(148,163,184,0.12) !important; }

/* Settings */
.settings-grid { display: grid; gap: 12px; margin-top: 14px; }
.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(2,6,23,0.18);
}

/* Light mode polish */
html[data-theme="light"] .settings-item { background: rgba(255,255,255,0.70); }
.settings-label { font-weight: 800; }
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* History */
.history-head { display:flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.history-actions { display:flex; gap: 10px; }
.history-filters { display:flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.segmented { display:flex; gap: 8px; padding: 6px; border:1px solid var(--border); border-radius: 999px; background: rgba(2,6,23,0.16); }
.seg-btn { text-decoration:none; padding: 8px 12px; border-radius: 999px; color: var(--muted); border:1px solid transparent; }
.seg-btn.active { background: rgba(2,6,23,0.30); color: var(--text); border-color: var(--border); }
.range-form { display:flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.range-form input[type="date"] { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: rgba(2,6,23,0.18); color: var(--text); }

html[data-theme="light"] .segmented { background: rgba(255,255,255,0.70); }
html[data-theme="light"] .seg-btn.active { background: rgba(91,92,226,0.12); }
html[data-theme="light"] .range-form input[type="date"] { background: rgba(255,255,255,0.85); }
.table-wrap { overflow-x: auto; margin-top: 12px; border-radius: var(--radius); border: 1px solid var(--border); }

/* History row highlighting
   Green = in range, Blue = low, Red = high */
.row-green td { background: rgba(34,197,94,0.12); }
.row-blue td  { background: rgba(59,130,246,0.12); }
.row-red td   { background: rgba(239,68,68,0.12); }

.row-green td:first-child { box-shadow: inset 4px 0 0 rgba(34,197,94,0.9); }
.row-blue td:first-child  { box-shadow: inset 4px 0 0 rgba(96,165,250,0.95); }
.row-red td:first-child   { box-shadow: inset 4px 0 0 rgba(248,113,113,0.95); }

.row-green td strong,
.row-green td:first-child { color: #86efac; }
.row-blue td strong,
.row-blue td:first-child  { color: #93c5fd; }
.row-red td strong,
.row-red td:first-child   { color: #fca5a5; }

html[data-theme="light"] .row-green td { background: rgba(34,197,94,0.16); }
html[data-theme="light"] .row-blue td  { background: rgba(59,130,246,0.16); }
html[data-theme="light"] .row-red td   { background: rgba(239,68,68,0.16); }

html[data-theme="light"] .row-green td strong,
html[data-theme="light"] .row-green td:first-child { color: #166534; }
html[data-theme="light"] .row-blue td strong,
html[data-theme="light"] .row-blue td:first-child  { color: #1d4ed8; }
html[data-theme="light"] .row-red td strong,
html[data-theme="light"] .row-red td:first-child   { color: #b91c1c; }

html:not([data-theme="light"]) .row-green td { background: rgba(34,197,94,0.26); }
html:not([data-theme="light"]) .row-blue td  { background: rgba(59,130,246,0.30); }
html:not([data-theme="light"]) .row-red td   { background: rgba(239,68,68,0.28); }

@media (max-width: 820px) {
  .history-head { flex-direction: column; }
  .history-actions { width: 100%; }
  .history-actions a { flex: 1; text-align: center; }
}


.demo-chart-shell {
  height: 260px;
  margin-top: 12px;
  padding: 12px 12px 4px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.06);
}

html[data-theme="light"] .demo-chart-shell {
  background: linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.72));
}

.btn-primary:hover{ filter: brightness(0.97); }

.options{ position: relative; }

.options-item{ display:block; width:100%; text-align:left; padding:10px 10px; border-radius:10px; background: transparent; border: none; color: var(--text); font: inherit; cursor:pointer; text-decoration:none; }

.select{ background: var(--surface); border:1px solid var(--border); color: var(--text); border-radius: 12px; padding:10px 12px; min-width: 220px; }
.select:focus{ outline:none; box-shadow: 0 0 0 3px rgba(91,92,226,0.25); }
.settings-actions{ margin-top: 14px; }
.section-title{ margin-top: 6px; font-size: 1.05rem; }


/* Settings switches */
.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;
}

.ui-switch {
  position: relative;
  width: 164px;
  min-width: 164px;
  height: 64px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
}

.ui-switch-track {
  position: relative;
  display: block;
  width: 164px;
  height: 64px;
  border-radius: 999px;
  background: #cfcfd4;
  border: 2px solid rgba(15, 23, 42, 0.06);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
  transition: background 0.22s ease, border-color 0.22s ease;
}

.ui-switch-thumb {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 50px;
  height: 50px;
  border-radius: 999px;
  background: #f8fafc;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
  transition: transform 0.22s ease;
}

.ui-switch.is-on .ui-switch-track {
  background: #9dc15a;
  border-color: rgba(124, 157, 54, 0.22);
}

.ui-switch.is-on .ui-switch-thumb {
  transform: translateX(100px);
}

.ui-switch:focus-visible {
  outline: none;
}

.ui-switch:focus-visible .ui-switch-track {
  box-shadow: 0 0 0 4px rgba(91, 92, 226, 0.18), inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

html[data-theme="dark"] .ui-switch-track {
  background: #6b7280;
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .ui-switch.is-on .ui-switch-track {
  background: #8db44a;
}

@media (max-width: 700px) {
  .settings-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .ui-switch {
    width: 136px;
    min-width: 136px;
    height: 52px;
  }

  .ui-switch-track {
    width: 136px;
    height: 52px;
  }

  .ui-switch-thumb {
    width: 40px;
    height: 40px;
    top: 4px;
    left: 4px;
  }

  .ui-switch.is-on .ui-switch-thumb {
    transform: translateX(84px);
  }
}


/* (removed old body.light overrides — theme is html[data-theme]) */


/* ------------------------------
   Targeted UI fixes after feedback
------------------------------ */

/* Header / menu visibility */
.app-header-right .btn-link,
.app-header-right .options-btn,
.app-header-right form .btn-link {
  color: var(--text) !important;
  text-decoration: none !important;
  font-weight: 700;
}

.app-header-right .btn-link:hover,
.app-header-right .options-btn:hover {
  opacity: 0.82;
}

.app-nav {
  background: linear-gradient(90deg, var(--wf-purple), var(--wf-purple-2)) !important;
  border-bottom: none !important;
  padding: 10px 12px 8px !important;
  justify-content: center !important;
  gap: 14px !important;
}

.nav-link {
  color: rgba(255,255,255,0.92) !important;
  font-weight: 800 !important;
  border: 1px solid transparent !important;
}

.nav-link:hover {
  color: #ffffff !important;
  background: rgba(255,255,255,0.14) !important;
}

.nav-link.active {
  background: rgba(255,255,255,0.20) !important;
  color: #ffffff !important;
  border-color: rgba(255,255,255,0.18) !important;
}

html[data-theme="light"] .app-nav {
  background: linear-gradient(90deg, var(--wf-purple), var(--wf-purple-2)) !important;
}

/* Chat readability */
.chat-box {
  background: rgba(2, 6, 23, 0.72) !important;
  border: 1px solid var(--border) !important;
  padding: 14px !important;
}

.chat-author {
  color: var(--muted) !important;
  font-weight: 700;
  margin-bottom: 6px !important;
}

.chat-bubble {
  max-width: 100%;
  padding: 14px 16px !important;
  border-radius: 18px !important;
  line-height: 1.65 !important;
  word-break: break-word;
}

.chat-message-frey .chat-bubble {
  background: rgba(30, 41, 59, 0.96) !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255,255,255,0.08);
  display: block;
}

.chat-message-user .chat-bubble {
  background: linear-gradient(90deg, var(--wf-purple), var(--wf-purple-2)) !important;
  color: #ffffff !important;
}

.chat-form input {
  background: rgba(2, 6, 23, 0.96) !important;
  color: #f8fafc !important;
  border: 1px solid var(--border) !important;
}

html[data-theme="light"] .chat-box {
  background: rgba(232, 237, 248, 0.95) !important;
}

html[data-theme="light"] .chat-message-frey .chat-bubble {
  background: #e8edf8 !important;
  color: #0f172a !important;
  border: 1px solid rgba(15,23,42,0.08);
}

html[data-theme="light"] .chat-form input {
  background: #ffffff !important;
  color: #0f172a !important;
}

/* Frey floating agent readability */
.frey-panel {
  background: var(--card-solid) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}

.frey-msg-label {
  color: var(--muted) !important;
  font-weight: 700;
}

.frey-msg-bubble {
  background: rgba(148,163,184,0.12) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  line-height: 1.6;
}

.frey-msg.user .frey-msg-bubble {
  background: rgba(91,92,226,0.16) !important;
  border-color: rgba(91,92,226,0.24) !important;
}

.frey-panel-form input,
.frey-quick {
  background: rgba(2,6,23,0.20) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px;
}

html[data-theme="light"] .frey-panel {
  background: #ffffff !important;
}

html[data-theme="light"] .frey-panel-messages {
  background: linear-gradient(180deg, rgba(91,92,226,0.03), rgba(45,212,191,0.02));
}

html[data-theme="light"] .frey-msg.frey .frey-msg-bubble {
  background: rgba(91,92,226,0.08) !important;
  border-color: rgba(91,92,226,0.16) !important;
}

html[data-theme="light"] .frey-panel-form input,
html[data-theme="light"] .frey-quick {
  background: rgba(91,92,226,0.06) !important;
}


/* ------------------------------
   Dashboard uplift / more "umpf"
------------------------------ */
.hero-card,
.section-card {
  position: relative;
  overflow: hidden;
}

.hero-card {
  padding: 24px 24px 22px !important;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(320px 160px at 100% 0%, rgba(109, 94, 243, 0.16), transparent 60%),
    radial-gradient(280px 140px at 0% 100%, rgba(45, 212, 191, 0.10), transparent 60%);
  pointer-events: none;
}

.hero-card > * {
  position: relative;
  z-index: 1;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(91, 92, 226, 0.12);
  color: var(--primary);
  border: 1px solid rgba(91, 92, 226, 0.16);
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 10px;
  letter-spacing: 0.01em;
}

.hero-title {
  font-size: clamp(1.8rem, 2.6vw, 2.35rem) !important;
  line-height: 1.05;
  margin-bottom: 10px !important;
}

.hero-copy {
  font-size: 1.02rem;
  line-height: 1.6;
  max-width: 760px;
  margin: 0 0 14px 0;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

html[data-theme="dark"] .meta-chip {
  background: rgba(15,23,42,0.62);
}

.hero-actions .btn-primary,
.hero-actions .btn-secondary,
.section-card .btn-secondary {
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.section-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(91,92,226,0.95), rgba(45,212,191,0.9));
  opacity: 0.9;
}

.support-card::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -60px;
  top: -80px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(91,92,226,0.08), transparent 68%);
  pointer-events: none;
}

.section-headline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.section-headline h2 {
  margin: 0 !important;
}

.section-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(91,92,226,0.10);
  border: 1px solid rgba(91,92,226,0.14);
  font-size: 1rem;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.05);
}

.glucose-form,
.glucose-table,
canvas#glucoseChart {
  position: relative;
  z-index: 1;
}

canvas#glucoseChart {
  margin-top: 10px;
  background: rgba(255,255,255,0.44);
  border-radius: 18px;
  border: 1px solid var(--border);
  padding: 10px;
}

html[data-theme="dark"] canvas#glucoseChart {
  background: rgba(15,23,42,0.42);
}

@media (max-width: 700px) {
  .hero-card {
    padding: 20px 18px 18px !important;
  }

  .hero-title {
    font-size: 1.7rem !important;
  }

  .hero-copy {
    font-size: 0.98rem;
  }

  .section-card::before {
    left: 14px;
    right: 14px;
  }
}

/* ------------------------------
   Frey brand touches
------------------------------ */
.frey-inline-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(91, 92, 226, 0.12);
  color: var(--primary);
  border: 1px solid rgba(91, 92, 226, 0.16);
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.frey-signature {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(91,92,226,0.08);
  border: 1px solid rgba(91,92,226,0.14);
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 800;
}

.frey-section-headline {
  align-items: center;
}

.frey-chat-card {
  position: relative;
  overflow: hidden;
}

.frey-chat-card::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  top: -72px;
  right: -72px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(91,92,226,0.12), transparent 70%);
  pointer-events: none;
}

.recipe-hero-card {
  position: relative;
  overflow: hidden;
}

.recipe-hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(260px 160px at 95% 10%, rgba(91,92,226,0.14), transparent 62%),
    radial-gradient(260px 180px at 0% 100%, rgba(45,212,191,0.09), transparent 62%);
  pointer-events: none;
}

.recipe-hero-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.recipe-hero-copy {
  max-width: 620px;
}

.recipe-hero-note {
  margin-bottom: 10px;
}

.recipe-hero-text {
  margin: 0;
  line-height: 1.65;
}

.recipe-hero-mascot {
  position: relative;
  flex: 0 0 122px;
  width: 122px;
  height: 122px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.recipe-hero-glow {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(91,92,226,0.22), rgba(45,212,191,0.10) 55%, transparent 72%);
}

.recipe-hero-mascot img,
.recipe-empty-avatar {
  position: relative;
  z-index: 1;
  width: 92px;
  height: 92px;
  border-radius: 999px;
  object-fit: cover;
  border: 3px solid rgba(255,255,255,0.75);
  box-shadow: 0 10px 30px rgba(15,23,42,0.12);
}

.recipe-empty-state {
  text-align: center;
  padding: 28px 18px 22px;
  border-radius: 20px;
  border: 1px dashed var(--border);
  background: rgba(91,92,226,0.04);
}

.recipe-empty-state h2 {
  margin-top: 14px;
  margin-bottom: 8px;
}

.recipe-card {
  position: relative;
  overflow: hidden;
}

.recipe-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(91,92,226,0.95), rgba(45,212,191,0.85));
  opacity: 0.9;
}

.frey-panel {
  overflow: hidden;
}

.frey-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 78px;
  background: linear-gradient(135deg, rgba(91,92,226,0.18), rgba(45,212,191,0.08));
  pointer-events: none;
}

.frey-panel-header {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 10px;
}

.frey-panel-brand-line {
  display: flex;
  justify-content: flex-start;
}

.frey-panel-header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.frey-panel-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--primary);
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(255,255,255,0.60);
  box-shadow: 0 6px 18px rgba(15,23,42,0.08);
}

html[data-theme="dark"] .frey-panel-chip {
  background: rgba(15,23,42,0.82);
  border-color: rgba(255,255,255,0.10);
}

html[data-theme="light"] .recipe-empty-state {
  background: rgba(91,92,226,0.05);
}

@media (max-width: 700px) {
  .frey-signature {
    margin-left: 0;
  }

  .section-headline.frey-section-headline {
    flex-wrap: wrap;
  }

  .recipe-hero-wrap {
    flex-direction: column;
    align-items: flex-start;
  }

  .recipe-hero-mascot {
    align-self: center;
  }

  .recipe-detail-header {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .recipe-card-top {
    flex-direction: column;
  }

  .recipe-view-btn {
    width: 100%;
    text-align: center;
  }
}

/* ------------------------------
   Admin
------------------------------ */
.admin-shell {
  max-width: 1180px;
  margin: 0 auto;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.admin-stat-card {
  margin-bottom: 0;
}

.admin-stat-number {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin: 8px 0;
}

.admin-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.admin-table-wide {
  min-width: 980px;
}

.admin-inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: capitalize;
  border: 1px solid var(--border);
}

.status-active { background: rgba(34,197,94,0.16); color: #bbf7d0; }
.status-part_used { background: rgba(59,130,246,0.16); color: #bfdbfe; }
.status-used_up { background: rgba(245,158,11,0.16); color: #fde68a; }
.status-expired,
.status-ended { background: rgba(239,68,68,0.16); color: #fecaca; }

html[data-theme="light"] .status-active { color: #166534; }
html[data-theme="light"] .status-part_used { color: #1d4ed8; }
html[data-theme="light"] .status-used_up { color: #92400e; }
html[data-theme="light"] .status-expired,
html[data-theme="light"] .status-ended { color: #b91c1c; }

@media (max-width: 900px) {
  .admin-split {
    grid-template-columns: 1fr;
  }
}


@media (max-width: 600px) {
  .history-actions {
    flex-direction: column;
  }

  .history-actions a {
    width: 100%;
  }

  .range-form {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .range-form label {
    min-width: 0;
  }

  .range-form button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .recipe-card-top {
    flex-direction: column;
    align-items: stretch;
  }

  .recipe-view-btn {
    width: 100%;
    text-align: center;
  }

  .recipe-stat {
    font-size: 0.74rem;
  }
}

.public-header-cta,
.nav-link-cta {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
}

.landing-hero-card,
.landing-story-card,
.landing-beta-card {
  position: relative;
  overflow: hidden;
}

.landing-hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: center;
}

.landing-hero-title {
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1.05;
  margin: 0 0 14px;
}

.landing-hero-copy,
.landing-story-copy {
  font-size: 1.08rem;
  line-height: 1.8;
  color: var(--text);
}

.landing-note {
  max-width: 720px;
}

.btn-xl {
  padding: 16px 24px;
  font-size: 1.02rem;
}

.landing-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.landing-preview-card {
  display: flex;
  justify-content: center;
}

.landing-preview-window {
  width: min(100%, 460px);
  border-radius: 30px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(11,18,46,0.98), rgba(6,10,30,0.98));
  box-shadow: 0 20px 60px rgba(0,0,0,0.28);
  overflow: hidden;
}

.landing-preview-top {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.landing-preview-top span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.28);
}

.landing-preview-body {
  padding: 18px;
}

.landing-preview-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
}

.landing-preview-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.landing-preview-overline {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.landing-preview-header strong {
  font-size: 1.35rem;
}

.landing-preview-header p {
  margin: 0;
  color: var(--text-muted);
}

.landing-preview-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.landing-preview-pill {
  border-radius: 18px;
  padding: 12px 12px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
}

.landing-preview-pill span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.landing-preview-pill strong {
  font-size: 1.05rem;
}

.landing-preview-chart-card {
  border-radius: 24px;
  padding: 16px;
  margin-bottom: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.025));
  border: 1px solid rgba(255,255,255,0.06);
}

.landing-preview-chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.landing-preview-chart-head strong {
  font-size: 1rem;
}

.landing-preview-chart-head span {
  color: var(--text-muted);
  font-size: 0.86rem;
}

.landing-preview-chart {
  border-radius: 24px;
  background: rgba(255,255,255,0.03);
  position: relative;
  margin-bottom: 18px;
  overflow: hidden;
  padding: 10px 12px 12px;
}

.landing-preview-ylabels {
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 36px;
  width: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: rgba(226,232,240,0.72);
  font-size: 0.72rem;
}

.landing-preview-plot {
  position: relative;
  margin-left: 34px;
  height: 160px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  overflow: hidden;
}

.plot-grid {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255,255,255,0.08);
}

.plot-grid.g1 { top: 24%; }
.plot-grid.g2 { top: 50%; }
.plot-grid.g3 { top: 76%; }

.landing-preview-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.landing-preview-xlabels {
  margin-left: 34px;
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  color: rgba(226,232,240,0.72);
  font-size: 0.72rem;
}

.landing-preview-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.landing-preview-mini {
  border-radius: 20px;
  padding: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  min-height: 118px;
}

.landing-preview-mini strong {
  display: block;
  margin-bottom: 6px;
}

.landing-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 18px 0;
}

.landing-feature-card h3 {
  margin-top: 12px;
  margin-bottom: 10px;
}

.demo-preview-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(124,112,255,0.1);
}

.demo-preview-banner strong {
  color: var(--accent);
  white-space: nowrap;
}

.demo-disabled-form input,
.demo-disabled-form select,
.demo-disabled-form textarea {
  cursor: not-allowed;
  opacity: 0.82;
}

html[data-theme="light"] .landing-preview-window {
  background: linear-gradient(180deg, #f8f7ff, #eef2ff);
  box-shadow: 0 20px 60px rgba(38, 40, 72, 0.12);
}

html[data-theme="light"] .landing-preview-top {
  border-bottom-color: rgba(35, 39, 66, 0.08);
}

html[data-theme="light"] .landing-preview-top span {
  background: rgba(35,39,66,0.18);
}

html[data-theme="light"] .landing-preview-pill,
html[data-theme="light"] .landing-preview-chart,
html[data-theme="light"] .landing-preview-chart-card {
  background: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.1);
}

html[data-theme="light"] .landing-preview-mini {
  background: rgba(99, 102, 241, 0.05);
  border-color: rgba(99, 102, 241, 0.1);
}

html[data-theme="light"] .landing-preview-dot {
  border-color: rgba(248,247,255,0.95);
}

@media (max-width: 900px) {
  .landing-hero-grid,
  .landing-feature-grid,
  .landing-preview-cards {
    grid-template-columns: 1fr;
  }

  .landing-preview-card {
    justify-content: flex-start;
  }
}

@media (max-width: 600px) {
  .landing-hero-title {
    font-size: 2.4rem;
  }

  .landing-preview-stats-row {
    grid-template-columns: 1fr;
  }

  .landing-actions {
    flex-direction: column;
  }

  .landing-actions .btn-primary,
  .landing-actions .btn-secondary,
  .landing-actions .btn-link {
    width: 100%;
    text-align: center;
  }

  .app-header-right {
    gap: 8px;
  }

  .public-header-cta {
    padding-inline: 12px;
  }
}


@media (max-width: 640px) {
  .brand-logo-img {
    height: 42px;
    max-width: 145px;
  }
  .brand-subtitle {
    font-size: 0.68rem;
    padding-left: 4px;
  }
}
