:root {
  --bg: #f5f9ff;
  --bg-2: #e8f1ff;
  --panel: #ffffff;
  --panel-light: #f1f6ff;
  --accent: #3a9fd6;
  --accent-2: #2ea87a;
  --text: #0b1b2e;
  --muted: #5a6b83;
  --border: #d7e2f0;
  --shadow: 0 12px 40px rgba(12, 33, 68, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 15% 20%, rgba(34, 184, 238, 0.18), transparent 35%),
              radial-gradient(circle at 85% 0%, rgba(16, 185, 129, 0.15), transparent 35%),
              linear-gradient(135deg, #f6fbff, #eef5ff 50%, #e8f1ff);
}

a {
  color: inherit;
}

.app {
  display: flex;
  min-height: 100vh;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), transparent 30%);
}

.app.is-hidden {
  display: none;
}

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #eef4ff 0%, #e3ecff 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  gap: 16px;
  box-shadow: 8px 0 24px rgba(12, 33, 68, 0.08);
}

.logo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
}

.logo-image {
  width: 128px;
  max-width: 100%;
  height: auto;
  display: block;
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu + .sidebar-glucose-card {
  margin-top: auto;
}

.theme-switcher + .sidebar-glucose-card {
  margin-top: auto;
}

.theme-switcher {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
}

.theme-switcher-label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #607896;
}

.theme-switcher-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.theme-option {
  border: 1px solid #c3d4ea;
  background: #f6f9fd;
  color: #21344f;
  border-radius: 11px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.theme-option:hover {
  border-color: #8cb2d8;
  background: #edf4fb;
}

.theme-option.active {
  border-color: rgba(58, 159, 214, 0.7);
  background: linear-gradient(90deg, rgba(58, 159, 214, 0.18), rgba(46, 168, 122, 0.14));
  color: #10324f;
  box-shadow: 0 8px 16px rgba(32, 105, 150, 0.14);
}

body.theme-dark .theme-switcher {
  background: rgba(9, 15, 27, 0.82);
  border-color: #2a3d5e;
}

body.theme-dark .theme-switcher-label {
  color: #7f94b4;
}

body.theme-dark .theme-option {
  background: rgba(255, 255, 255, 0.04);
  border-color: #2f4568;
  color: #dce8fb;
}

body.theme-dark .theme-option:hover {
  background: rgba(58, 159, 214, 0.12);
  border-color: #4d93b8;
  color: #f1f7ff;
}

body.theme-dark .theme-option.active {
  border-color: rgba(67, 151, 190, 0.85);
  background: linear-gradient(90deg, rgba(58, 159, 214, 0.26), rgba(46, 168, 122, 0.2));
  color: #f2f7ff;
  box-shadow: 0 8px 18px rgba(25, 86, 112, 0.28);
}

.menu-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-group-title {
  margin: 0 0 2px;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5d7496;
}

.menu-group-secondary .menu-group-title {
  color: #7b8da8;
}

.menu-divider {
  height: 1px;
  background: linear-gradient(90deg, rgba(133, 160, 194, 0), rgba(133, 160, 194, 0.7), rgba(133, 160, 194, 0));
  margin: 6px 0;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 14px;
  text-align: left;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  padding-left: 34px;
}

.menu-item::before {
  content: '';
  position: absolute;
  left: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(34, 184, 238, 0.9);
  box-shadow: 0 0 0 2px rgba(34, 184, 238, 0.18);
}

.menu-item:hover {
  background: rgba(34, 184, 238, 0.12);
  box-shadow: 0 10px 28px rgba(34, 184, 238, 0.18);
  transform: translateX(2px);
}

.menu-item.active {
  background: linear-gradient(90deg, rgba(34, 184, 238, 0.18), rgba(16, 185, 129, 0.12));
  border-color: rgba(34, 184, 238, 0.6);
  color: #0b1b2e;
  box-shadow: 0 12px 30px rgba(12, 33, 68, 0.12);
}

.menu-group-secondary .menu-item {
  background: rgba(255, 255, 255, 0.72);
  color: #31445f;
  border-color: #cdd9e8;
}

.menu-group-secondary .menu-item::before {
  background: transparent;
  border: 1.8px solid #8aa1be;
  box-shadow: none;
}

.menu-group-secondary .menu-item:hover {
  background: rgba(133, 160, 194, 0.14);
  box-shadow: 0 8px 20px rgba(80, 108, 142, 0.16);
}

.menu-group-secondary .menu-item.active {
  background: rgba(133, 160, 194, 0.2);
  border-color: rgba(133, 160, 194, 0.55);
  box-shadow: 0 8px 18px rgba(80, 108, 142, 0.12);
}

.menu-icon {
  font-size: 16px;
}

.panel-section {
  display: none;
}

.panel-section.active {
  display: block;
}

.panel-section[data-section="Planificacion"] {
  display: none !important;
}

.panel-section.active[data-section="Inicio"] {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.content {
  flex: 1;
  padding: 32px 40px 40px;
}

.content-header {
  text-align: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  margin-bottom: 22px;
}

.subtitle {
  margin: 0 0 8px;
  color: var(--muted);
  letter-spacing: 0.01em;
  font-weight: 500;
}

h1 {
  margin: 0;
  font-size: 30px;
}

.content-body {
  background: linear-gradient(145deg, var(--panel), var(--panel-light));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.content-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: center;
}

.tagline {
  font-size: 13px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin: 0 0 10px;
}

.hero h2 {
  margin: 0 0 8px;
  font-size: 26px;
}

.hero-chart .mini-chart-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--muted);
}

.mini-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  color: #0f172a;
}

#home-mini-live-value.is-in-range {
  color: #16a34a;
}

#home-mini-live-value.is-low {
  color: #dc2626;
}

#home-mini-live-value.is-high {
  color: #d97706;
}

.mini-live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: #22c55e;
  box-shadow: 0 0 0 rgba(34, 197, 94, 0.5);
  animation: miniPulse 1.4s ease-in-out infinite;
}

@keyframes miniPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45);
    opacity: 0.9;
  }
  70% {
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    opacity: 1;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    opacity: 0.9;
  }
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.primary-btn,
.ghost-btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primary-btn {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #0a1220;
  box-shadow: 0 10px 24px rgba(34, 211, 238, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.primary-btn:hover {
  transform: translateY(-1px);
}

.ghost-btn {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.ghost-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hero-chart {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.hero-chart svg {
  display: block;
  width: 100%;
  height: 140px;
}

.home-greeting {
  padding: 4px 0 20px;
  text-align: left;
}

.home-greeting-text {
  margin: 0 0 4px;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.home-greeting-sub {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 400;
}

.home-mini-empty {
  border: 1px dashed #c3d8ef;
  border-radius: 12px;
  padding: 12px;
  margin-top: 6px;
  background: #f8fbff;
  display: grid;
  gap: 10px;
  justify-items: start;
}

#home-mini-caption {
  margin-top: 8px;
}

.home-summary-panel {
  display: grid;
  gap: 14px;
}

.home-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

.home-summary-card {
  background: linear-gradient(145deg, var(--panel), var(--panel-light));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
  min-height: 132px;
}

.home-current-value,
.home-day-tir-value {
  margin: 6px 0 4px;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}

.home-current-value.is-in-range {
  color: #0f9d6b;
}

.home-current-value.is-low {
  color: #dc2626;
}

.home-current-value.is-high {
  color: #ea8a00;
}

.home-trend-arrow {
  margin: 6px 0 4px;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  color: #2b6cb0;
}

.home-summary-status {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.home-dynamic-message {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  font-weight: 600;
}

.home-quick-actions {
  margin-top: 0;
}

.home-profile-module {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.home-profile-first-time {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(46, 167, 234, 0.15), rgba(32, 201, 151, 0.1));
}

.home-profile-lead {
  margin: 0;
  font-weight: 700;
  color: #1f3049;
}

.home-profile-summary-card,
.home-profile-form-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  background: linear-gradient(145deg, #ffffff, #f6fbff);
  box-shadow: 0 14px 34px rgba(50, 90, 130, 0.1);
}

.home-profile-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.home-profile-summary-card h3 {
  margin: 0 0 4px;
}

.home-profile-form-card h3 {
  margin: 0 0 4px;
}

.home-sensor-setup {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  background: linear-gradient(145deg, #f8fcff, #eef7ff);
  box-shadow: 0 10px 20px rgba(38, 95, 149, 0.08);
}

.home-sensor-picker {
  margin-top: 10px;
}

.home-sensor-steps {
  margin: 12px 0 0;
}

#home-sensor-selected {
  font-weight: 700;
  color: #1f3049;
}

#home-sensor-feedback {
  margin: 8px 0 0;
}

.home-wizard-progress {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.home-wizard-progress-head {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.home-wizard-progress-head span {
  font-size: 13px;
  font-weight: 700;
  color: #3b5d8a;
}

.home-wizard-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e7f0fb;
  overflow: hidden;
}

#home-wizard-progress-bar {
  display: block;
  width: 12.5%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2ea7ea, #20c997);
  transition: width 0.25s ease;
}

.home-wizard-question-wrap {
  border: 1px solid #d8e5f4;
  border-radius: 14px;
  background: #ffffff;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.home-wizard-question-wrap h3 {
  margin: 0;
  color: #13243f;
  font-size: 24px;
  line-height: 1.25;
}

.home-wizard-body {
  display: grid;
  gap: 12px;
}

.home-wizard-field {
  display: grid;
  gap: 6px;
}

.home-wizard-field label {
  font-size: 13px;
  font-weight: 700;
  color: #486487;
}

.home-wizard-field input,
.home-wizard-field select {
  border: 1px solid #c8d9ee;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 15px;
  background: #f8fbff;
}

.home-wizard-field small {
  color: #6b7f98;
  font-size: 12px;
}

.home-smartpen-info {
  border: 1px solid #cfe0f2;
  border-radius: 12px;
  background: linear-gradient(145deg, #f8fcff, #eef8ff);
  padding: 10px 12px;
}

.home-smartpen-info summary {
  cursor: pointer;
  font-weight: 700;
  color: #173b66;
}

.home-smartpen-info p {
  margin: 8px 0 0;
  color: #3d5b7f;
  font-size: 14px;
  line-height: 1.5;
}

.home-wizard-grid.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.home-wizard-options {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.home-wizard-option {
  position: relative;
  border: 1px solid #cfe0f2;
  border-radius: 14px;
  background: #f9fcff;
  padding: 12px 12px 12px 42px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  min-height: 72px;
  transition: all 0.18s ease;
  color: #163154;
  font-weight: 600;
}

.home-wizard-option-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.home-wizard-option-text {
  min-width: 0;
  display: block;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.home-wizard-option:hover {
  border-color: #84c9f5;
  background: #eef8ff;
}

.home-wizard-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.home-wizard-option::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid #9eb8d8;
  border-radius: 50%;
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
}

.home-wizard-option:has(input:checked) {
  border-color: #20c997;
  background: linear-gradient(145deg, rgba(46, 167, 234, 0.15), rgba(32, 201, 151, 0.15));
  color: #0f2f42;
}

.home-wizard-option:has(input:checked)::before {
  border-color: #20c997;
  background: radial-gradient(circle, #20c997 45%, #fff 48%);
}

.home-wizard-option-icon {
  margin-right: 0;
  font-size: 19px;
  flex: 0 0 auto;
}

.home-wizard-agp-pick {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.home-wizard-agp-card {
  border: 1px solid #cfe0f2;
  border-radius: 14px;
  padding: 14px;
  background: #f8fcff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.home-wizard-agp-card h4 {
  margin: 0 0 4px;
}

.home-wizard-agp-card p {
  margin: 0;
  font-size: 14px;
}

.home-wizard-agp-card.active {
  border-color: #20c997;
  background: linear-gradient(145deg, rgba(46, 167, 234, 0.16), rgba(32, 201, 151, 0.16));
}

.home-agp-dropzone {
  border: 1.5px dashed #8fc0e8;
  border-radius: 14px;
  padding: 16px;
  background: #f9fcff;
  display: grid;
  gap: 10px;
}

.home-agp-dropzone input[type="file"] {
  border: 1px solid #c8d9ee;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.home-agp-preview {
  border: 1px solid #d5e4f5;
  border-radius: 12px;
  padding: 12px;
  background: #ffffff;
  display: grid;
  gap: 10px;
}

.home-agp-manual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.home-agp-interpretation {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: #34577d;
}

#home-profile-feedback,
#home-wizard-status {
  margin: 0;
}

#home-dashboard-main.is-hidden {
  display: none !important;
}

#home-dashboard-main,
#home-dashboard-followup {
  margin-bottom: 0;
}

.home-wizard-actions {
  align-items: center;
  justify-content: space-between;
}

@supports not selector(:has(*)) {
  .home-wizard-option input:checked + .home-wizard-option-label {
    font-weight: 700;
  }
}

@media (max-width: 920px) {
  .home-wizard-grid.two-col,
  .home-agp-manual-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 740px) {
  .home-wizard-question-wrap h3 {
    font-size: 21px;
  }
  .home-wizard-option {
    min-height: 52px;
  }
  .serenity-tools-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.home-tir-coaching {
  margin: 10px 0 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  background: #f8fbff;
  font-weight: 700;
  color: #22324a;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.mi-diabetes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.mi-diabetes-grid.single {
  display: flex;
  justify-content: center;
}

.mi-diabetes-grid.single .card-slab {
  width: min(980px, 100%);
}

.card-slab {
  background: linear-gradient(145deg, var(--panel), var(--panel-light));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slab-header h3 {
  margin: 0 0 4px;
}

.slab-header .small {
  font-size: 13px;
}

.form-grid.two-cols {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

.fsi-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

#fsi-totals {
  margin: 4px 0 0;
}

.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

.fsi-actions {
  display: flex;
  justify-content: flex-end;
}

.full-width {
  width: 100%;
  justify-content: center;
}

.is-hidden {
  display: none !important;
}

.tool-card {
  background: linear-gradient(145deg, var(--panel), var(--panel-light));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tool-head h4 {
  margin: 0;
}

.form-grid.compact {
  gap: 8px;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.tool-result {
  background: #eaf7ff;
  border: 1px solid rgba(34, 184, 238, 0.6);
  color: var(--text);
  border-radius: 10px;
  padding: 10px;
  min-height: 42px;
  font-size: 14px;
  font-weight: 600;
}

.disclaimer {
  margin: 0;
  color: #c7d5ec;
  font-size: 12px;
}

.chip.tiny {
  font-size: 11px;
  padding: 4px 8px;
}

.card-grid {
  display: flex;
  gap: 14px;
  margin: 16px 0;
  overflow-x: auto;
  padding-bottom: 6px;
}

.info-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-auto-rows: auto;
  gap: 8px 10px;
  align-items: start;
  background: linear-gradient(145deg, var(--panel), var(--panel-light));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px 16px 12px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
  position: relative;
  min-height: 100px;
  min-width: 210px;
}

.info-card.wide {
  min-width: 240px;
}

.info-card:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 211, 238, 0.35);
}

.info-card h3 {
  margin: 0 0 4px;
}

.info-card p {
  margin: 0;
  color: var(--muted);
}

.serenity-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.serenity-tools-card h3 {
  margin: 0 0 10px;
}

.serenity-tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.serenity-tool-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(145deg, #ffffff, #f5faff);
  display: grid;
  gap: 6px;
}

.serenity-tool-item h4 {
  margin: 0;
  color: #14345a;
}

.serenity-tool-item p {
  margin: 0;
}

.serenity-path {
  display: grid;
  gap: 12px;
}

.serenity-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.serenity-step-title h3 {
  margin: 4px 0 0;
}

.serenity-step-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.serenity-progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #eef5ff;
  overflow: hidden;
}

.serenity-progress span {
  display: block;
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.2s ease;
}

.serenity-ask-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
}

.serenity-ask-box {
  display: grid;
  gap: 8px;
}

.serenity-ask-box textarea {
  width: 100%;
  resize: vertical;
  min-height: 90px;
  background: var(--panel-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  font-family: inherit;
}

.serenity-ask-box textarea:focus {
  outline: 1px solid rgba(34, 184, 238, 0.6);
}

.serenity-reminders {
  display: grid;
  gap: 10px;
}

.serenity-reminder {
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #f8fbff;
}

.icon-badge {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.3);
}

.pill {
  position: static;
  grid-column: 1 / -1;
  justify-self: end;
  margin-top: 8px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: #eef5ff;
  color: var(--text);
}

.pill.ok {
  border-color: rgba(16, 185, 129, 0.6);
  background: rgba(16, 185, 129, 0.15);
  color: #0a8c61;
}
.pill.warn {
  border-color: rgba(251, 191, 36, 0.7);
  background: rgba(251, 191, 36, 0.18);
  color: #c27c00;
}
.pill.alert {
  border-color: rgba(248, 113, 113, 0.7);
  background: rgba(248, 113, 113, 0.18);
  color: #c43248;
}

.stats-section {
  display: none;
  background: linear-gradient(145deg, var(--panel), var(--panel-light));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
  margin-top: 16px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.stats-heading h2 {
  margin: 0 0 14px;
  font-size: 22px;
  letter-spacing: 0.01em;
}

.stats-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.stats-grid {
  display: flex;
  gap: 18px;
  margin-top: 28px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px 18px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  min-width: 230px;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(34, 211, 238, 0.4);
  box-shadow: 0 12px 28px rgba(34, 211, 238, 0.15);
}

.stat-card.ok { border-color: rgba(16, 185, 129, 0.35); }
.stat-card.warn { border-color: rgba(251, 191, 36, 0.35); }
.stat-card.alert { border-color: rgba(248, 113, 113, 0.35); }

.stat-card.wide {
  min-width: 260px;
}

.stat-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.stat-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.25);
  font-size: 14px;
}

.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.stat-value {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.mini-bar {
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
  height: 8px;
}

.mini-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.mini-line {
  margin-top: 10px;
  position: relative;
  height: 30px;
}

.mini-line span {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.15), rgba(34, 211, 238, 0.05));
  border-radius: 10px;
}

.stats-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.stats-live-strip {
  border: 1px solid var(--border);
  background: #f8fbff;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.stats-live-value {
  margin: 4px 0 0;
  font-size: 34px;
  line-height: 1;
  font-weight: 700;
  color: var(--text);
}

.stats-live-value.is-in-range {
  color: #0f9d6b;
}

.stats-live-value.is-low {
  color: #dc2626;
}

.stats-live-value.is-high {
  color: #ea8a00;
}

.stats-live-trend {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #2b6cb0;
}

.news-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.news-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.news-tab {
  cursor: pointer;
}

.news-tab.active {
  background: linear-gradient(90deg, #22b8ee, #10b981);
  border-color: rgba(34, 184, 238, 0.9);
  color: #0a1220;
  box-shadow: 0 8px 20px rgba(34, 184, 238, 0.25);
}

.news-explain {
  margin-top: 6px;
  border: 1px solid rgba(34, 184, 238, 0.3);
  background: #e8f7ff;
  color: #0b1b2e;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.news-explain:hover {
  border-color: rgba(34, 184, 238, 0.8);
  box-shadow: 0 6px 16px rgba(34, 184, 238, 0.2);
}

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

.news-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--panel-light);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.news-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.news-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  margin-top: 4px;
}

.news-link:hover {
  text-decoration: underline;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #0f766e;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.45);
  animation: live-pulse 1.2s ease-out infinite;
}

@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.updates-changelog {
  display: grid;
  gap: 12px;
}

.updates-list {
  display: grid;
  gap: 10px;
}

.update-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--panel-light);
  box-shadow: var(--shadow);
  display: grid;
  gap: 6px;
}

.update-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.update-date {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.update-item h3 {
  margin: 0;
}

.update-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.update-badge.new {
  color: #0f766e;
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.45);
}

.update-badge.improve {
  color: #0f3b67;
  background: rgba(34, 184, 238, 0.14);
  border-color: rgba(34, 184, 238, 0.5);
}

.update-badge.fix {
  color: #b45309;
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.45);
}

.update-badge.science {
  color: #1f4f7c;
  background: rgba(58, 132, 190, 0.15);
  border-color: rgba(58, 132, 190, 0.42);
}

.assistant-chat {
  display: none;
  margin-top: 18px;
  background: transparent;
  border: none;
  border-radius: 18px;
  padding: 0;
  box-shadow: none;
  gap: 12px;
}

.assistant-chat.show {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  row-gap: 12px;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  padding: 8px 10px 4px;
  gap: 10px;
  flex-wrap: wrap;
}

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

.chat-header-title {
  margin: 0;
  font-weight: 700;
  color: var(--text);
}

.chat-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-modes .chip {
  border: 1px solid #c8d3e4;
  background: #f7f9fc;
  color: #22324a;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: all 0.18s ease;
}

.chat-modes .chip:hover {
  border-color: #8fb4de;
  background: #eef4fc;
  transform: translateY(-1px);
}

.chat-modes .chip:focus-visible {
  outline: 2px solid rgba(47, 128, 237, 0.4);
  outline-offset: 1px;
}

.chat-topic.active {
  background: linear-gradient(90deg, #1f8fe8, #20c997);
  color: #fff;
  border-color: #1f8fe8;
  box-shadow: 0 8px 18px rgba(31, 143, 232, 0.28);
}

.chat-topic {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chat-topic-icon {
  font-size: 15px;
  line-height: 1;
}

.chat-topic.active[data-topic='general'] {
  background: #d8ebff;
  border-color: #8ebef0;
  color: #0f3f70;
  box-shadow: 0 8px 18px rgba(53, 129, 214, 0.22);
}

.chat-topic.active[data-topic='nutrition'] {
  background: #dff5e8;
  border-color: #99d4ae;
  color: #14532d;
  box-shadow: 0 8px 18px rgba(22, 163, 74, 0.18);
}

.chat-topic.active[data-topic='sport_aerobic'] {
  background: #ffe9cc;
  border-color: #f5bf84;
  color: #7a3f00;
  box-shadow: 0 8px 18px rgba(234, 136, 0, 0.2);
}

.chat-topic.active[data-topic='sport_anaerobic'] {
  background: #efe4ff;
  border-color: #c8a7f8;
  color: #5b21b6;
  box-shadow: 0 8px 18px rgba(109, 40, 217, 0.2);
}

.chat-glucose-banner {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 14px;
  font-size: 13px;
  color: #30445f;
}

.chat-glucose-banner-value {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.chat-glucose-banner-value.is-in-range {
  color: #16a34a;
}

.chat-glucose-banner-value.is-low {
  color: #dc2626;
}

.chat-glucose-banner-value.is-high {
  color: #ea8a00;
}

.chat-glucose-banner-trend {
  font-weight: 600;
}

.chat-glucose-banner-note {
  color: #5a6f89;
}

.chat-mode-detected {
  margin: 0;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
  padding-left: 4px;
}

#chat-load-day,
#chat-load-week {
  background: #ffffff;
  border-color: #b9cbe3;
}

#chat-load-day:hover,
#chat-load-week:hover {
  background: #f3f8ff;
}

.chat-messages {
  min-height: 280px;
  max-height: 52vh;
  overflow-y: auto;
  background: transparent;
  border: none;
  border-radius: 14px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
}

.chat-empty-state {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(145deg, #ffffff, #edf6ff);
  padding: 12px 14px;
  display: grid;
  gap: 10px;
  box-shadow: 0 10px 24px rgba(19, 58, 107, 0.12);
}

.chat-empty-state.is-hidden {
  display: none;
}

.chat-empty-welcome-wrap {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: start;
}

.chat-empty-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
  color: #05213a;
  background: linear-gradient(135deg, #20c997, #2ea7ea);
  box-shadow: 0 8px 16px rgba(32, 167, 234, 0.25);
}

.chat-empty-welcome {
  margin: 0;
  color: #1f3049;
  font-weight: 600;
  line-height: 1.55;
}

.chat-suggestion-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.chat-suggestion-row::-webkit-scrollbar {
  display: none;
}

.chat-suggestion-btn {
  border: 1px solid #c8d3e4;
  background: #fff;
  color: #22324a;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-suggestion-btn:hover {
  border-color: #8fb4de;
  background: #eef4fc;
}

.chat-message {
  position: relative;
  align-self: flex-end;
  background: #dff4ff;
  border: 1px solid #bde8f8;
  color: var(--text);
  padding: 16px 18px 16px 48px;
  border-radius: 20px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 72%;
  box-shadow: 0 6px 16px rgba(18, 49, 90, 0.14);
}

.chat-message.user {
  background: #ddf4ef;
  border-color: #b9e8dc;
  border-bottom-right-radius: 10px;
}

.chat-message.ai {
  align-self: flex-start;
  background: #f8fbff;
  border-color: #d7e4f2;
  border-bottom-left-radius: 10px;
  white-space: normal;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 85%;
}
.chat-message.ai p { margin: 0 0 16px; }
.chat-message.ai p:last-child { margin-bottom: 0; }
.chat-message.ai ul,
.chat-message.ai ol { margin: 0.25em 0 0.5em 1.2em; padding: 0; }
.chat-message.ai li { margin-bottom: 0.2em; }
.chat-message.ai strong { font-weight: 600; }
.chat-message.ai em { font-style: italic; }
.chat-message.ai table {
  border-collapse: collapse;
  width: 100%;
  margin: 6px 0;
  font-size: 0.85em;
}
.chat-message.ai th,
.chat-message.ai td {
  border: 1px solid #c8d8ec;
  padding: 5px 10px;
  text-align: left;
}
.chat-message.ai th {
  background: #e3edf8;
  font-weight: 600;
}
.chat-message.ai tr:nth-child(even) td { background: #f0f6fd; }
.chat-message.ai code {
  background: #edf2f8;
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 0.9em;
  font-family: monospace;
}
.chat-message.ai hr {
  border: none;
  border-top: 1px solid rgba(0,0,0,0.1);
  margin: 14px 0;
}
.chat-message.ai p.gluco-dosis-total {
  font-weight: 700;
}
.chat-message.ai h1,
.chat-message.ai h2,
.chat-message.ai h3 {
  font-size: 1em;
  font-weight: 600;
  margin: 0.4em 0 0.2em;
}

.chat-message::before {
  content: attr(data-avatar);
  position: absolute;
  left: 12px;
  top: 12px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: #edf6ff;
  border: 1px solid #cfdeef;
  border-radius: 50%;
  font-size: 12px;
  color: var(--text);
}

.chat-message.ai::before {
  background: #eaf2fd;
}

.chat-message.typing {
  color: #5b6f88;
}

.chat-message.typing::after {
  content: ' ...';
  display: inline-block;
  animation: typing-dots 1.2s steps(3, end) infinite;
}

.chat-inline-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chat-inline-option-btn {
  border: 1px solid #c8d3e4;
  background: #fff;
  color: #22324a;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-inline-option-btn:hover {
  border-color: #8fb4de;
  background: #eef4fc;
}

.chat-semaforo-message {
  max-width: 78%;
}

.chat-semaforo-card {
  display: grid;
  gap: 10px;
}

.chat-semaforo-title {
  margin: 0;
  font-weight: 700;
  color: #183455;
}

.chat-semaforo-zones {
  display: grid;
  gap: 8px;
}

.chat-semaforo-zone {
  border-radius: 12px;
  padding: 9px 11px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
}

.chat-semaforo-zone.zone-high {
  background: rgba(249, 115, 22, 0.14);
  color: #8a4108;
  border-color: rgba(249, 115, 22, 0.28);
}

.chat-semaforo-zone.zone-borderline {
  background: rgba(245, 158, 11, 0.14);
  color: #8a4a00;
  border-color: rgba(245, 158, 11, 0.28);
}

.chat-semaforo-zone.zone-ideal {
  background: rgba(16, 185, 129, 0.14);
  color: #0f5a43;
  border-color: rgba(16, 185, 129, 0.28);
}

.chat-semaforo-zone.zone-low {
  background: rgba(239, 68, 68, 0.13);
  color: #8a1f1f;
  border-color: rgba(239, 68, 68, 0.28);
}

.chat-semaforo-zone.zone-very-high {
  background: rgba(153, 27, 27, 0.16);
  color: #7f1d1d;
  border-color: rgba(153, 27, 27, 0.3);
}

.chat-semaforo-zone.active {
  box-shadow: inset 0 0 0 1px rgba(21, 46, 76, 0.08), 0 4px 12px rgba(24, 52, 86, 0.12);
}

.chat-semaforo-current {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 800;
}

.chat-semaforo-current.is-in-range {
  color: #198754;
}

.chat-semaforo-current.is-low {
  color: #dc2626;
}

.chat-semaforo-current.is-high {
  color: #ea580c;
}

.chat-semaforo-note {
  margin: 0;
  font-size: 13px;
  color: #4d6380;
}

.chat-preexercise-source {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #6b7f9a;
}

.chat-preexercise-strategy {
  display: grid;
  gap: 6px;
  border: 1px solid #d9e3f2;
  border-radius: 10px;
  padding: 10px;
  background: rgba(248, 252, 255, 0.75);
}

.chat-preexercise-strategy-title {
  margin: 0;
  font-weight: 700;
  color: #183455;
}

.chat-preexercise-strategy-list {
  margin: 0;
  padding-left: 18px;
  color: #3f5674;
  font-size: 12px;
  display: grid;
  gap: 4px;
}

@keyframes typing-dots {
  0% { opacity: 0.2; }
  50% { opacity: 1; }
  100% { opacity: 0.2; }
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 0;
}

.chat-input input {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  font-size: 14px;
}

.chat-input input:focus {
  outline: 1px solid rgba(34, 211, 238, 0.6);
}

.chat-input button {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #0b1220;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chat-input button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(34, 211, 238, 0.25);
}

.dexcom-embed {
  margin-top: 14px;
  background: var(--panel-light);
  border: 2px solid #b7d4f5;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 16px 32px rgba(15, 71, 136, 0.16);
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}

.dexcom-embed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.dexcom-embed button {
  background: var(--accent);
  color: #0b1220;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dexcom-embed button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(34, 211, 238, 0.25);
}

.dexcom-frame-wrapper {
  position: relative;
  height: 160px !important;
  max-height: 160px !important;
  overflow: hidden !important;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f7fbff;
}

.dexcom-frame-wrapper iframe {
  width: 100%;
  height: 100%;
  min-height: 440px;
  border: none;
  display: block;
  background: #f7fbff;
}

.range-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.range-pill {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.range-low {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.5);
  color: #b91c1c;
}

.range-in {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.55);
  color: #0f766e;
}

.range-high {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.55);
  color: #b45309;
}

.logo-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.logo-mark {
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.4);
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 700;
  color: var(--accent);
}

.form-card .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 12px 0 14px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  background: var(--panel-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  color: var(--text);
}

.double-input {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.history-card {
  background: var(--panel-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}

.activity-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--panel-light);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.settings-grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.switch {
  width: 48px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-light);
  position: relative;
}

.switch span {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  top: 1px;
  left: 2px;
}

.chip.small {
  padding: 4px 8px;
  font-size: 11px;
}

.mi-diabetes-grid.dual {
  display: grid;
  gap: 16px;
}

.pen-mode-selector {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #f8fbff;
}

.pen-mode-selector label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.pen-mode-tiles {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 10px;
}

.pen-option {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #f8fbff;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pen-option .title {
  font-weight: 700;
  color: var(--text);
}

.pen-option .subtitle {
  color: var(--muted);
  font-size: 13px;
}

.pen-option .hint {
  color: var(--muted);
  font-size: 12px;
}

.pen-option.active {
  border-color: #22d3ee;
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.2);
  background: #e7fcff;
}

.smart-section {
  margin-top: 8px;
  margin-bottom: 12px;
}

.smart-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(135deg, #e8f8ff, #f6fffb);
}

.device-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.device-chip {
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
}

.device-chip.active {
  border-color: #0bbf73;
  background: #e8f9f0;
  color: #0a9c55;
}

.smart-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.smart-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.smart-metrics {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-bottom: 6px;
}

.stat-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.stat-block strong {
  font-size: 18px;
}

.stat-block.wide {
  grid-column: span 2;
}

.smart-dose {
  margin-top: 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #f7fbff;
}

.smart-dose-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  align-items: end;
}

.smart-dose h4 {
  margin: 0 0 8px;
}

.primary-btn.small {
  padding: 10px 12px;
  font-size: 14px;
}

.manual-panel {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.manual-panel.disabled {
  opacity: 0.7;
}

.manual-panel.disabled input,
.manual-panel.disabled button {
  pointer-events: none;
}

.manual-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.actions-row {
  margin: 10px 0;
}

.iob-manual {
  margin-top: 16px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: #f8f9fb;
}

.form-grid.two {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.disclaimer {
  margin-top: 10px;
  text-align: center;
  font-size: 12px;
}

.carb-card {
  gap: 10px;
}

.carb-steps {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.5;
  display: grid;
  gap: 6px;
}

.carb-table-wrap {
  overflow-x: auto;
}

.carb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.carb-table th,
.carb-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

.carb-table th {
  background: #f4f8ff;
  color: var(--text);
}

.sensor-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.sensor-group {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fbff;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.sensor-group h4 {
  margin: 0 0 4px;
}

.sensor-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.assistant-summary {
  margin: 0;
}

.assistant-priority-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 10px;
}

.assistant-priority-card {
  border: 1px solid rgba(142, 167, 196, 0.45);
  border-radius: 14px;
  background: #f8fbff;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.assistant-priority-card h4 {
  margin: 0;
  font-size: 15px;
  color: #1f3552;
}

.assistant-list {
  margin: 0;
  color: var(--muted);
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.assistant-list li {
  line-height: 1.5;
}

.stats-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 10px;
}

.stats-view-btn.active {
  background: linear-gradient(90deg, #22b8ee, #10b981);
  border-color: rgba(34, 184, 238, 0.9);
  color: #0a1220;
}

.stats-patterns {
  margin-top: 14px;
}

.stats-auto-patterns {
  margin-top: 14px;
}

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

.auto-pattern-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #f8fbff;
  display: grid;
  gap: 6px;
}

.auto-pattern-item h4 {
  margin: 0;
}

.auto-pattern-count {
  font-size: 13px;
  font-weight: 700;
  color: #0f3b67;
}

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

.pattern-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: #f8fbff;
}

.pattern-item h4 {
  margin: 0 0 6px;
  text-transform: capitalize;
}

.planning-card {
  gap: 14px;
}

.planning-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.planning-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.planning-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
}

.planning-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fbff;
  color: var(--muted);
  font-size: 13px;
}

.planning-step strong {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(90deg, #22b8ee, #10b981);
  color: #0a1220;
  font-size: 12px;
}

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

.planning-quick-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.plan-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.plan-inline input {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
  color: var(--text);
}

.planning-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.planning-advanced {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fbff;
}

.planning-advanced summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid transparent;
}

.planning-advanced[open] summary {
  border-bottom-color: var(--border);
}

.planning-advanced .planning-table-wrap {
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
}

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

.planning-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.planning-grid input,
.planning-grid select {
  background: var(--panel-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  color: var(--text);
}

.planning-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fbff;
}

.planning-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.planning-table th,
.planning-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px;
  text-align: left;
  vertical-align: middle;
}

.planning-table th {
  background: #edf4ff;
  font-size: 13px;
  white-space: nowrap;
}

.planning-table td:first-child {
  font-weight: 700;
  white-space: nowrap;
  min-width: 120px;
}

.planning-table input {
  width: 100%;
  min-width: 92px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--text);
  font-size: 13px;
}

.plan-cell-stack {
  display: grid;
  gap: 6px;
}

.plan-cell-stack input::placeholder {
  color: #8aa0bd;
}

.planning-summary {
  display: grid;
  gap: 8px;
}

.planning-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fbff;
}

.planning-row p {
  margin: 2px 0 0;
}

.plan-meta-notes-input {
  width: 100%;
  margin-top: 6px;
  background: var(--panel-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  color: var(--text);
  font-family: inherit;
  resize: vertical;
}

.planning-layout {
  display: grid;
  gap: 14px;
}

.planning-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
  gap: 14px;
}

.planning-main-col,
.planning-side-col {
  display: grid;
  gap: 12px;
  align-content: start;
}

.planning-block {
  display: grid;
  gap: 10px;
}

.planning-week-grid {
  min-width: 760px;
}

.planning-week-grid td:first-child {
  font-weight: 700;
  width: 110px;
}

.plan-schedule-cell {
  width: 100%;
  min-width: 145px;
  border: 1px solid #c9d9ed;
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  color: #18324f;
}

.plan-inline.triple {
  grid-template-columns: 0.8fr 0.8fr 1.2fr;
}

.toggle-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #5f7391;
  font-size: 13px;
}

#plan-meals-optional-fields.is-hidden {
  display: none;
}

.training-list {
  display: grid;
  gap: 8px;
}

.training-row {
  display: grid;
  grid-template-columns: 1fr 1fr 0.8fr 0.8fr;
  gap: 8px;
}

.training-field {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 9px;
  background: #fff;
  color: var(--text);
}

#plan-day-override-notes {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  resize: vertical;
  min-height: 110px;
  font-family: inherit;
}

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

.goals-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.goal-target-card {
  border-radius: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  background: #f8fbff;
  display: grid;
  gap: 10px;
}

.goal-target-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.goal-target-head h3 {
  margin: 0;
  font-size: 18px;
}

.goal-target-head span {
  color: #5f7391;
  font-size: 13px;
}

.goal-target-field {
  display: grid;
  gap: 6px;
}

.goal-target-label {
  font-size: 13px;
  color: #5f7391;
}

.goal-target-input,
.goal-target-note {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: #fff;
}

.goal-target-note {
  min-height: 76px;
  resize: vertical;
}

.goals-range-summary {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.goal-range-item {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 4px;
}

.goal-range-item.is-ok {
  border-color: rgba(16, 185, 129, 0.45);
  background: #ecfdf5;
}

.goal-range-item.is-mid {
  border-color: rgba(245, 158, 11, 0.45);
  background: #fff9ed;
}

.goal-range-item.is-low {
  border-color: rgba(239, 68, 68, 0.45);
  background: #fff1f2;
}

.goal-range-item h4 {
  margin: 0;
  font-size: 16px;
}

.goal-range-item .value {
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
}

.goal-range-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.goal-range-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22b8ee, #10b981);
}

.goal-range-bar > span.is-ok {
  background: linear-gradient(90deg, #16a34a, #10b981);
}

.goal-range-bar > span.is-mid {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.goal-range-bar > span.is-low {
  background: linear-gradient(90deg, #ef4444, #f97316);
}

.goal-interpretation {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 600;
}

.goal-item {
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--border);
}

.goal-item.ok {
  background: #e8fbf2;
  border-color: rgba(16, 185, 129, 0.5);
}

.goal-item.warn {
  background: #fff7ea;
  border-color: rgba(245, 158, 11, 0.5);
}

.goal-item h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.metabolic-tests-layout {
  display: grid;
  gap: 14px;
}

.metabolic-tests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  align-items: stretch;
}

.metabolic-test-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: #f8fbff;
  display: grid;
  gap: 12px;
  grid-template-rows: minmax(56px, auto) minmax(64px, auto) auto;
  min-height: 190px;
}

.metabolic-test-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  min-height: 56px;
}

.metabolic-test-card .muted {
  margin: 0;
}

.metabolic-test-card .primary-btn {
  width: 100%;
  align-self: end;
}

#metabolic-basal-auto-suggestion[data-level='ok'] {
  color: #0f766e;
}

#metabolic-basal-auto-suggestion[data-level='warn'] {
  color: #9a6700;
}

.metabolic-test-runner,
.metabolic-test-result,
.metabolic-test-history {
  display: grid;
  gap: 10px;
}

.metabolic-test-runner-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.metabolic-test-runner h3 {
  margin: 0;
}

.metabolic-test-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.metabolic-test-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.metabolic-test-field input,
.metabolic-test-field select,
.metabolic-test-field textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}

.metabolic-test-result-status {
  margin: 0;
  font-weight: 700;
  font-size: 18px;
  color: #163557;
}

.metabolic-history-list {
  display: grid;
  gap: 8px;
}

.metabolic-history-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #f8fbff;
  display: grid;
  gap: 4px;
}

.metabolic-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.metabolic-history-badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.metabolic-history-badge.ok {
  color: #0f766e;
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.45);
}

.metabolic-history-badge.mid {
  color: #9a6700;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.45);
}

.metabolic-history-badge.alert {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.45);
}

.sidebar-glucose-card {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.78);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 4px;
}

.sidebar-glucose-value {
  margin: 0;
  font-size: 26px;
  line-height: 1;
  font-weight: 700;
}

.sidebar-glucose-value.is-in-range {
  color: #0f9d6b;
}

.sidebar-glucose-value.is-low {
  color: #dc2626;
}

.sidebar-glucose-value.is-high {
  color: #ea8a00;
}

.sidebar-glucose-trend {
  margin: 0;
  color: #22324a;
  font-weight: 600;
  font-size: 13px;
}

.tiny {
  font-size: 12px;
}

.onboarding {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(8, 13, 20, 0.78);
  padding: 20px;
}

.onboarding-card {
  width: min(760px, 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(145deg, var(--panel), var(--panel-light));
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 14px;
}

.onboarding-card h2 {
  margin: 0;
}

.onboarding-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.onboarding-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.45);
  transition: transform 0.18s ease, background 0.18s ease;
}

.onboarding-dot.active {
  transform: scale(1.2);
  background: var(--accent);
}

.onboarding-dot.done {
  background: rgba(14, 165, 233, 0.55);
}

.onboarding-choices-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.onboarding-choice {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.onboarding-choice:hover {
  transform: translateY(-1px);
}

.onboarding-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.onboarding-choice:has(input:checked) {
  border-color: rgba(14, 165, 233, 0.75);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.18) inset;
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.12), rgba(16, 185, 129, 0.1));
}

.onboarding-name-field {
  display: grid;
  gap: 8px;
}

.onboarding-name-field > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.onboarding-name-field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 16px;
}

.onboarding-finish {
  text-align: center;
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 6px 0 2px;
}

.onboarding-celebration {
  font-size: 18px;
  letter-spacing: 4px;
  color: var(--accent);
  animation: onboardingPulse 1.6s ease-in-out infinite;
}

@keyframes onboardingPulse {
  0%, 100% {
    opacity: 0.35;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.06);
  }
}

.onboarding-actions {
  justify-content: space-between;
  align-items: center;
}

.onboarding-step .content-body {
  margin: 0;
}

.onboarding-actions .is-hidden {
  display: none !important;
}

/* Splash */
#splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #16233d 0%, #0a0f1e 62%);
  z-index: 9999;
  opacity: 0;
  animation: splashOpacity 1700ms ease-in-out forwards;
}

.splash-logo-image {
  display: none;
}

.splash-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  text-align: center;
  animation: splashRise 1100ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.splash-welcome {
  margin: 0;
  color: #9fb0cc;
  font-size: clamp(13px, 2vw, 18px);
  font-weight: 400;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  padding-left: 0.42em;
}

.splash-line {
  display: block;
  width: 56px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #2ea87a, #38bdf8);
}

.splash-wordmark {
  margin: 6px 0 0;
  color: #f1f5f9;
  font-size: clamp(30px, 6.4vw, 64px);
  line-height: 1.1;
  letter-spacing: 0.01em;
  font-weight: 600;
}

.splash-submark {
  margin: 0;
  background: linear-gradient(90deg, #2ea87a, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: clamp(26px, 5vw, 52px);
  line-height: 1;
  letter-spacing: 0.14em;
  font-weight: 600;
}

@keyframes splashRise {
  0% { opacity: 0; transform: translateY(14px); }
  100% { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .splash-brand { animation: none; }
}

@keyframes splashOpacity {
  0% {
    opacity: 0;
  }
  17.65% {
    opacity: 1;
  }
  88.24% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* Responsive */
@media (max-width: 960px) {
  .app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .menu {
    display: flex;
    max-height: 0;
    opacity: 0;
    transform: translateY(-8px);
    overflow: hidden;
    pointer-events: none;
    transition: max-height 0.28s ease, opacity 0.22s ease, transform 0.22s ease;
  }

  .menu.open {
    max-height: 640px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .content {
    padding: 20px;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .home-summary-grid {
    grid-template-columns: 1fr;
  }

  .planning-main-grid {
    grid-template-columns: 1fr;
  }

  .planning-side-col {
    order: -1;
  }

  .training-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .serenity-ask-grid {
    grid-template-columns: 1fr;
  }

  .chat-message {
    max-width: 92%;
  }

  .assistant-priority-grid {
    grid-template-columns: 1fr;
  }

  .plan-inline.triple {
    grid-template-columns: 1fr;
  }

  .training-row {
    grid-template-columns: 1fr;
  }
}

/* =========================================
   Fitness-inspired GLUCO AI visual skin
   (same data, same structure, only aesthetic)
   ========================================= */
/* Dark theme overrides (toggle with body.theme-dark) */
body.theme-dark{
  --bg: #03060d;
  --bg-2: #0a1220;
  --panel: #0c1524;
  --panel-light: #121e32;
  --accent: #3a9fd6;
  --accent-2: #2ea87a;
  --text: #ecf3ff;
  --muted: #97a9c6;
  --border: #273955;
  --shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
}body.theme-dark{
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(58, 159, 214, 0.2), transparent 38%),
    radial-gradient(circle at 88% 0%, rgba(46, 168, 122, 0.16), transparent 34%),
    linear-gradient(160deg, #02050b 0%, #050a14 48%, #0b1321 100%);
}body.theme-dark .app{
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
}body.theme-dark .sidebar{
  background: linear-gradient(180deg, rgba(9, 15, 27, 0.98) 0%, rgba(7, 12, 22, 0.98) 100%);
  border-right: 1px solid #1f2f49;
  box-shadow: 10px 0 26px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
}body.theme-dark .logo{
  color: #73c9ff;
}body.theme-dark .menu-group-title{
  color: #7f94b4;
}body.theme-dark .menu-group-secondary .menu-group-title{
  color: #6f86a7;
}body.theme-dark .menu-divider{
  background: linear-gradient(90deg, rgba(103, 133, 171, 0), rgba(103, 133, 171, 0.65), rgba(103, 133, 171, 0));
}body.theme-dark .menu-item{
  background: rgba(255, 255, 255, 0.04);
  border-color: #2a3c5d;
  color: #deebff;
}body.theme-dark .menu-item::before{
  background: rgba(91, 156, 186, 0.88);
  box-shadow: 0 0 0 2px rgba(91, 156, 186, 0.2);
}body.theme-dark .menu-item:hover{
  background: rgba(58, 159, 214, 0.16);
  box-shadow: 0 10px 26px rgba(10, 58, 109, 0.35);
}body.theme-dark .menu-item.active{
  background: linear-gradient(90deg, rgba(58, 159, 214, 0.24), rgba(46, 168, 122, 0.2));
  border-color: rgba(84, 151, 182, 0.7);
  color: #f4f8ff;
}body.theme-dark .menu-group-secondary .menu-item{
  background: rgba(255, 255, 255, 0.03);
  border-color: #2a3a57;
  color: #c8d8ef;
}body.theme-dark .menu-group-secondary .menu-item::before{
  border-color: #6a84a9;
}body.theme-dark .menu-group-secondary .menu-item:hover{
  background: rgba(114, 146, 192, 0.16);
}body.theme-dark .menu-group-secondary .menu-item.active{
  background: rgba(83, 113, 160, 0.26);
  border-color: rgba(112, 147, 199, 0.62);
}body.theme-dark .sidebar-glucose-card{
  background: rgba(10, 18, 31, 0.86);
  border-color: #294064;
}body.theme-dark .sidebar-glucose-trend{
  color: #cad8ee;
}body.theme-dark .content-header{
  border-bottom-color: #1f2f49;
}body.theme-dark .subtitle{
  color: #8aa1c5;
}body.theme-dark .content-body,
body.theme-dark .home-summary-card,
body.theme-dark .home-profile-summary-card,
body.theme-dark .home-profile-form-card,
body.theme-dark .home-wizard-question-wrap,
body.theme-dark .home-wizard-option,
body.theme-dark .home-wizard-agp-card,
body.theme-dark .home-agp-dropzone,
body.theme-dark .home-agp-preview,
body.theme-dark .card-slab,
body.theme-dark .tool-card,
body.theme-dark .info-card,
body.theme-dark .stats-section,
body.theme-dark .stat-card,
body.theme-dark .stats-live-strip,
body.theme-dark .news-card,
body.theme-dark .update-item,
body.theme-dark .chat-empty-state,
body.theme-dark .chat-message.ai,
body.theme-dark .chat-message.user,
body.theme-dark .dexcom-embed,
body.theme-dark .sensor-group,
body.theme-dark .assistant-priority-card,
body.theme-dark .auto-pattern-item,
body.theme-dark .pattern-item,
body.theme-dark .goal-target-card,
body.theme-dark .goal-range-item,
body.theme-dark .metabolic-test-card,
body.theme-dark .metabolic-history-item,
body.theme-dark .serenity-tool-item,
body.theme-dark .serenity-reminder,
body.theme-dark .planning-step,
body.theme-dark .planning-advanced,
body.theme-dark .planning-table-wrap,
body.theme-dark .planning-row,
body.theme-dark .onboarding-card{
  background: linear-gradient(160deg, rgba(16, 27, 44, 0.95), rgba(12, 21, 35, 0.95));
  border-color: #273955;
  box-shadow: var(--shadow);
}body.theme-dark .home-profile-first-time,
body.theme-dark .home-smartpen-info,
body.theme-dark .home-sensor-setup,
body.theme-dark .smart-panel{
  background: linear-gradient(145deg, rgba(58, 159, 214, 0.14), rgba(46, 168, 122, 0.1));
  border-color: #2f507d;
}body.theme-dark .home-profile-lead,
body.theme-dark .home-wizard-question-wrap h3,
body.theme-dark .home-profile-summary-card h3,
body.theme-dark .home-profile-form-card h3,
body.theme-dark .home-wizard-progress-head span,
body.theme-dark .home-smartpen-info summary{
  color: #eaf3ff;
}body.theme-dark .home-wizard-progress-track,
body.theme-dark .serenity-progress{
  background: #1a2a45;
}body.theme-dark #home-wizard-progress-bar,
body.theme-dark .serenity-progress span,
body.theme-dark .planning-step strong,
body.theme-dark .goal-range-bar > span,
body.theme-dark .mini-bar span,
body.theme-dark .primary-btn,
body.theme-dark .chat-input button,
body.theme-dark .stats-view-btn.active,
body.theme-dark .news-tab.active,
body.theme-dark .chat-topic.active{
  background: linear-gradient(90deg, #3a9fd6, #2ea87a);
}body.theme-dark .primary-btn,
body.theme-dark .chat-input button{
  color: #06111f;
  box-shadow: 0 12px 24px rgba(42, 122, 168, 0.28);
}body.theme-dark .ghost-btn,
body.theme-dark .news-explain,
body.theme-dark .chat-suggestion-btn,
body.theme-dark .chat-inline-option-btn,
body.theme-dark .chat-modes .chip,
body.theme-dark #chat-load-day,
body.theme-dark #chat-load-week,
body.theme-dark .device-chip,
body.theme-dark .pen-option{
  background: rgba(255, 255, 255, 0.04);
  border-color: #2f4568;
  color: #dce8fb;
}
body.theme-dark .chat-message.ai th { background: #1e3255; }
body.theme-dark .chat-message.ai th,
body.theme-dark .chat-message.ai td { border-color: #2f4568; }
body.theme-dark .chat-message.ai tr:nth-child(even) td { background: #162845; }
body.theme-dark .chat-message.ai code { background: #1a2e4a; }body.theme-dark .ghost-btn:hover,
body.theme-dark .news-explain:hover,
body.theme-dark .chat-suggestion-btn:hover,
body.theme-dark .chat-inline-option-btn:hover,
body.theme-dark .chat-modes .chip:hover,
body.theme-dark #chat-load-day:hover,
body.theme-dark #chat-load-week:hover,
body.theme-dark .device-chip:hover,
body.theme-dark .pen-option:hover{
  background: rgba(58, 159, 214, 0.14);
  border-color: #4d93b8;
  color: #f1f7ff;
}body.theme-dark .chat-modes .chip{
  border-radius: 999px;
}body.theme-dark .chat-topic.active[data-topic='general'],
body.theme-dark .chat-topic.active[data-topic='nutrition'],
body.theme-dark .chat-topic.active[data-topic='sport_aerobic'],
body.theme-dark .chat-topic.active[data-topic='sport_anaerobic']{
  color: #f2f7ff;
  border-color: rgba(67, 151, 190, 0.85);
  box-shadow: 0 8px 18px rgba(25, 86, 112, 0.28);
}body.theme-dark .chat-glucose-banner{
  background: rgba(10, 18, 31, 0.9);
  border-color: #2e456a;
  color: #d5e5ff;
}body.theme-dark .chat-empty-state{
  background: linear-gradient(155deg, rgba(21, 34, 55, 0.95), rgba(16, 26, 42, 0.95));
}body.theme-dark .chat-empty-welcome{
  color: #ddeafb;
}body.theme-dark .chat-empty-avatar{
  background: linear-gradient(135deg, #3a9fd6, #2ea87a);
  color: #031328;
}body.theme-dark .chat-message{
  border-radius: 22px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.36);
}body.theme-dark .chat-message.user{
  background: linear-gradient(145deg, rgba(44, 129, 177, 0.22), rgba(35, 112, 84, 0.18));
  border-color: rgba(94, 166, 144, 0.48);
}body.theme-dark .chat-message.ai{
  background: linear-gradient(145deg, rgba(19, 30, 48, 0.95), rgba(13, 22, 37, 0.95));
  border-color: #2a3f61;
}body.theme-dark .chat-message::before{
  background: rgba(9, 18, 32, 0.9);
  border-color: #37507b;
  color: #d9e8ff;
}body.theme-dark .chat-input input,
body.theme-dark .home-wizard-field input,
body.theme-dark .home-wizard-field select,
body.theme-dark .form-grid input,
body.theme-dark .form-grid select,
body.theme-dark .form-grid textarea,
body.theme-dark .planning-grid input,
body.theme-dark .planning-grid select,
body.theme-dark .plan-inline input,
body.theme-dark .training-field,
body.theme-dark .goal-target-input,
body.theme-dark .goal-target-note,
body.theme-dark .metabolic-test-field input,
body.theme-dark .metabolic-test-field select,
body.theme-dark .metabolic-test-field textarea,
body.theme-dark .home-agp-dropzone input[type="file"],
body.theme-dark .plan-schedule-cell,
body.theme-dark #plan-day-override-notes{
  background: rgba(10, 17, 30, 0.9);
  border-color: #2e456a;
  color: #e9f2ff;
}body.theme-dark .home-wizard-field input::placeholder,
body.theme-dark .home-wizard-field select::placeholder,
body.theme-dark .chat-input input::placeholder,
body.theme-dark .form-grid input::placeholder,
body.theme-dark .goal-target-note::placeholder{
  color: #7489aa;
}body.theme-dark .home-wizard-option{
  min-height: 72px;
}body.theme-dark .home-wizard-option::before{
  border-color: #5c78a0;
  background: #0b1628;
}body.theme-dark .home-wizard-option:has(input:checked){
  border-color: #4f96be;
  background: linear-gradient(145deg, rgba(58, 159, 214, 0.18), rgba(46, 168, 122, 0.18));
  color: #ecf4ff;
}body.theme-dark .home-wizard-option:has(input:checked)::before{
  border-color: #5597ba;
  background: radial-gradient(circle, #5597ba 45%, #0b1628 48%);
}body.theme-dark .home-wizard-option-text{
  color: inherit;
}body.theme-dark .tagline{
  color: #72c8ff;
}body.theme-dark .mini-live-badge{
  color: #f2f7ff;
}body.theme-dark .hero-chart{
  background: linear-gradient(160deg, rgba(16, 27, 44, 0.95), rgba(12, 20, 33, 0.95));
}body.theme-dark .home-mini-empty{
  background: rgba(11, 18, 31, 0.8);
  border-color: #2e4569;
}body.theme-dark .home-dynamic-message,
body.theme-dark .home-tir-coaching{
  background: rgba(10, 18, 31, 0.82);
  border-color: #2e456b;
  color: #dbe8fb;
}body.theme-dark .pill,
body.theme-dark .range-pill,
body.theme-dark .metabolic-history-badge,
body.theme-dark .update-badge,
body.theme-dark .device-chip.active,
body.theme-dark .pen-option.active{
  border-radius: 999px;
}body.theme-dark .range-low{
  background: rgba(239, 68, 68, 0.18);
  color: #ff7c7c;
}body.theme-dark .range-in{
  background: rgba(59, 130, 246, 0.2);
  color: #73bbff;
  border-color: rgba(59, 130, 246, 0.48);
}body.theme-dark .range-high{
  background: rgba(249, 115, 22, 0.2);
  color: #ffb36a;
}body.theme-dark .stats-live-strip{
  background: rgba(10, 18, 31, 0.88);
}body.theme-dark .stats-live-trend{
  color: #7cc2ff;
}body.theme-dark .live-indicator{
  color: #89c7ff;
}body.theme-dark .news-link{
  color: #7ec5ff;
}body.theme-dark .news-explain{
  background: rgba(58, 159, 214, 0.12);
}body.theme-dark .update-badge.improve{
  color: #94d0ff;
  background: rgba(58, 159, 214, 0.16);
  border-color: rgba(58, 159, 214, 0.5);
}body.theme-dark .goal-range-item.is-ok,
body.theme-dark .goal-item.ok{
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(96, 165, 250, 0.5);
}body.theme-dark .goal-range-item.is-mid,
body.theme-dark .goal-item.warn{
  background: rgba(249, 115, 22, 0.14);
  border-color: rgba(251, 146, 60, 0.5);
}body.theme-dark .goal-range-item.is-low{
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(248, 113, 113, 0.5);
}body.theme-dark .onboarding{
  background: radial-gradient(circle at 50% -10%, rgba(46, 168, 122, 0.25), rgba(3, 7, 14, 0.9) 46%),
    rgba(3, 7, 14, 0.95);
}body.theme-dark #splash{
  background: #0a0f1e;
}@media (max-width: 960px){body.theme-dark .sidebar{
    border-right: 0;
    border-bottom: 1px solid #1f2f49;
  }}

/* =========================================
   New primary navigation (Apple Fitness-inspired)
   ========================================= */
body.theme-dark {
  --bg: #0a0f1e;
  --panel: #111827;
  --panel-light: #111827;
  --border: #1e3a5f;
  --text: #f1f5f9;
  --muted: #9fb3ce;
  --accent: #38bdf8;
  --accent-2: #10b981;
}

body {
  background: #0a0f1e;
}

body.theme-light {
  --bg: #F0F6FF;
  --bg-2: #E4EFFF;
  --panel: #ffffff;
  --panel-light: #F8FBFF;
  --border: #DBEAFE;
  --text: #0F172A;
  --muted: #475569;
  --accent: #0EA5E9;
  --shadow: 0 2px 12px rgba(14, 165, 233, 0.08);
  background: #F0F6FF;
}

.sidebar {
  display: none !important;
}

.content {
  padding: 18px 20px 120px;
  max-width: 1180px;
  margin: 0 auto;
}

.content-header {
  display: none;
}

.global-glucose-header {
  position: sticky;
  top: 12px;
  z-index: 24;
  margin-bottom: 14px;
}

.global-glucose-pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #1e3a5f;
  background: rgba(10, 15, 30, 0.84);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 20px rgba(2, 6, 23, 0.35);
}

.global-glucose-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0ea5e9;
  animation: pulseDot 1.8s ease-in-out infinite;
}

#global-glucose-value {
  font-size: 15px;
  color: #e6f6ff;
}

#global-glucose-value.is-in-range,
.fitness-current-value.is-in-range {
  color: #10b981;
}

#global-glucose-value.is-low,
.fitness-current-value.is-low {
  color: #ef4444;
}

#global-glucose-value.is-high,
.fitness-current-value.is-high {
  color: #f59e0b;
}

#global-glucose-trend {
  color: #9fb3ce;
  font-size: 13px;
  font-weight: 500;
}

.top-subnav {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  margin: 4px 0 16px;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.top-subnav::-webkit-scrollbar {
  display: none;
}

.subnav-pill {
  border: 1px solid #1e3a5f;
  background: rgba(17, 24, 39, 0.72);
  color: #9fb3ce;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.subnav-pill.active {
  color: #e8f7ff;
  border-color: rgba(14, 165, 233, 0.7);
  background: rgba(14, 165, 233, 0.2);
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.2) inset;
}

.fitness-home-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.fitness-home-main-card,
.fitness-metric-card,
.fitness-session-card {
  background: #111827;
  border: 1px solid #1e3a5f;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.25);
}

.fitness-home-main-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.fitness-current-value {
  margin: 6px 0;
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 700;
}

.glucose-panel-card {
  position: relative;
  display: grid;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.glucose-panel-card:hover {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 18px 30px rgba(2, 6, 23, 0.3);
}

.glucose-panel-card:focus-visible {
  outline: 2px solid rgba(14, 165, 233, 0.7);
  outline-offset: 3px;
}

.glucose-panel-head {
  display: grid;
  gap: 4px;
}

.glucose-panel-current-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.glucose-panel-card .fitness-current-value {
  margin: 0;
  font-family: 'Inter', 'SF Pro Display', 'Segoe UI', sans-serif;
  font-size: clamp(48px, 7vw, 72px);
  line-height: 0.92;
  letter-spacing: -0.04em;
}

.glucose-panel-trend-arrow {
  font-size: 24px;
  line-height: 1;
  color: #9fb3ce;
  transition: color 0.16s ease, transform 0.16s ease;
}

.glucose-panel-trend-arrow.trend-up-fast,
.glucose-panel-trend-arrow.trend-down-fast {
  animation: trendPulse 1.15s ease-in-out infinite;
}

.glucose-panel-trend-arrow.trend-up-fast,
.glucose-panel-trend-arrow.trend-up {
  color: #f59e0b;
}

.glucose-panel-trend-arrow.trend-down-fast,
.glucose-panel-trend-arrow.trend-down {
  color: #ef4444;
}

.glucose-panel-trend-label {
  margin: 0;
  color: #dbeafe;
  font-size: 16px;
  font-weight: 600;
}

.glucose-panel-delta {
  margin: 0;
  color: #9fb3ce;
  font-size: 14px;
}

.glucose-panel-predictions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.glucose-panel-predictions p {
  margin: 0;
  color: #9fb3ce;
  font-size: 14px;
  font-weight: 500;
}

.glucose-panel-predict-warning {
  margin: 0;
  color: #fbbf24;
  font-size: 13px;
  font-weight: 600;
}

.glucose-panel-mini-wrap {
  position: relative;
  height: 80px;
  border-radius: 12px;
  border: 1px solid rgba(30, 58, 95, 0.85);
  overflow: hidden;
  background: rgba(8, 15, 30, 0.45);
}

#glucose-panel-mini-svg {
  width: 100%;
  height: 100%;
  display: block;
}

#glucose-panel-mini-svg.is-hidden {
  display: none;
}

.glucose-panel-mini-current-pulse {
  transform-origin: center;
  animation: pulseDot 1.2s ease-in-out infinite;
}

.glucose-panel-mini-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.glucose-panel-context {
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
  color: #9fb3ce;
  font-size: 13px;
}

.glucose-panel-context span {
  white-space: nowrap;
}

.glucose-panel-hidden-tir {
  display: none;
}

.glucose-panel-alert {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
}

.glucose-panel-alert.alert-yellow {
  color: #fcd57c;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.45);
}

.glucose-panel-alert.alert-orange {
  color: #fdba74;
  background: rgba(251, 146, 60, 0.15);
  border-color: rgba(251, 146, 60, 0.45);
}

.glucose-panel-alert.alert-green {
  color: #86efac;
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.45);
}

.glucose-panel-alert.alert-gray {
  color: #d1d5db;
  background: rgba(71, 85, 105, 0.26);
  border-color: rgba(100, 116, 139, 0.5);
}

.fitness-current-value.glucose-level-critical {
  color: #ef4444;
  animation: glucoseCriticalPulse 0.9s ease-in-out infinite;
}

.fitness-current-value.glucose-level-low,
.fitness-current-value.glucose-level-very-high {
  color: #ef4444;
}

.fitness-current-value.glucose-level-low-normal {
  color: #fbbf24;
}

.fitness-current-value.glucose-level-in-range {
  color: #10b981;
}

.fitness-current-value.glucose-level-high {
  color: #f59e0b;
}

.glucose-panel-card.glucose-urgent {
  border-color: rgba(239, 68, 68, 0.75);
  box-shadow:
    0 0 0 1px rgba(239, 68, 68, 0.45),
    0 0 28px rgba(239, 68, 68, 0.24);
}

.fitness-home-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.fitness-metric-card strong {
  margin-top: 6px;
  display: block;
  font-size: 18px;
  color: #edf5ff;
}

.fitness-session-card strong {
  color: #edf5ff;
}

.gci-section {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 12px;
  margin: 0 0 14px;
}

.gci-main-card,
.gci-history-card {
  border-radius: 16px;
  border: 1px solid #1e3a5f;
  background: #111827;
  padding: 14px;
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.24);
}

.gci-main-card {
  --gci-accent: #10b981;
  display: grid;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.gci-main-card:hover {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.5);
}

.gci-main-card:focus-visible {
  outline: 2px solid rgba(14, 165, 233, 0.75);
  outline-offset: 3px;
}

.gci-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.gci-date-label {
  font-size: 12px;
  color: #9fb3ce;
}

.gci-ring-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 2px auto 4px;
}

.gci-ring {
  width: 140px;
  height: 140px;
  transform: rotate(-90deg);
}

.gci-ring-track {
  fill: none;
  stroke: rgba(148, 163, 184, 0.28);
  stroke-width: 10;
}

.gci-ring-progress {
  fill: none;
  stroke: var(--gci-accent);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 0 999;
  transition: stroke-dasharray 0.4s ease, stroke 0.28s ease;
}

.gci-ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
}

.gci-ring-center strong {
  font-size: 44px;
  line-height: 0.95;
  color: #edf6ff;
}

.gci-ring-center span {
  font-size: 13px;
  color: #9fb3ce;
  font-weight: 600;
}

.gci-score-label {
  margin: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--gci-accent);
}

.gci-score-message {
  margin: 0;
  text-align: center;
  line-height: 1.35;
}

.gci-score-metrics {
  margin: 0;
  text-align: center;
  color: #b7c8dd;
  font-size: 13px;
}

.gci-main-card.gci-state-excellent {
  --gci-accent: #0ea5e9;
}

.gci-main-card.gci-state-very-good {
  --gci-accent: #10b981;
}

.gci-main-card.gci-state-good {
  --gci-accent: #4ade80;
}

.gci-main-card.gci-state-improvable {
  --gci-accent: #f59e0b;
}

.gci-main-card.gci-state-difficult {
  --gci-accent: #fb923c;
}

.gci-main-card.gci-state-hard-day {
  --gci-accent: #f87171;
}

.gci-history-card {
  display: grid;
  gap: 10px;
}

.gci-history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.gci-history-summary {
  margin: 4px 0 0;
  color: #e7f4ff;
  font-weight: 600;
}

.gci-history-trend-label {
  font-size: 12px;
  color: #9fb3ce;
}

.gci-history-chart {
  position: relative;
  border-radius: 12px;
  border: 1px solid rgba(30, 58, 95, 0.85);
  background: rgba(10, 15, 30, 0.58);
  padding: 10px 10px 8px;
  min-height: 142px;
}

.gci-history-bars {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  align-items: end;
  gap: 5px;
  height: 120px;
}

.gci-history-bar {
  border: 0;
  width: 100%;
  border-radius: 8px 8px 4px 4px;
  height: calc(var(--score, 0) * 1%);
  min-height: 6px;
  background: #475569;
  opacity: 0.9;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.gci-history-bar:hover {
  transform: translateY(-1px);
  opacity: 1;
}

.gci-history-bar.gci-state-excellent {
  background: #0ea5e9;
}

.gci-history-bar.gci-state-very-good {
  background: #10b981;
}

.gci-history-bar.gci-state-good {
  background: #4ade80;
}

.gci-history-bar.gci-state-improvable {
  background: #f59e0b;
}

.gci-history-bar.gci-state-difficult {
  background: #fb923c;
}

.gci-history-bar.gci-state-hard-day {
  background: #f87171;
}

.gci-history-bar.empty {
  background: rgba(148, 163, 184, 0.22);
  cursor: default;
}

.gci-history-trend {
  position: absolute;
  inset: 10px 10px 8px;
  width: calc(100% - 20px);
  height: calc(100% - 18px);
  pointer-events: none;
}

.gci-history-trend path {
  fill: none;
  stroke: rgba(125, 211, 252, 0.78);
  stroke-width: 2;
}

.gci-history-foot {
  margin: 0;
}

.challenges-section {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 12px;
  margin: 0 0 14px;
}

.challenges-week-card,
.challenges-badges-card {
  border-radius: 16px;
  border: 1px solid #1e3a5f;
  background: #111827;
  padding: 14px;
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.24);
}

.challenges-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.challenges-head h3 {
  margin: 4px 0 0;
  color: #eaf5ff;
  font-size: 20px;
}

.challenges-week-status {
  font-size: 12px;
  font-weight: 700;
  color: #9fd5f8;
  background: rgba(14, 165, 233, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.36);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.challenges-list {
  display: grid;
  gap: 10px;
}

.challenge-item {
  border: 1px solid rgba(30, 58, 95, 0.95);
  border-radius: 12px;
  padding: 10px;
  background: rgba(15, 23, 42, 0.48);
}

.challenge-item.challenge-complete {
  border-color: rgba(16, 185, 129, 0.62);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2) inset;
}

.challenge-tier {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.challenge-tier.easy {
  color: #93c5fd;
}

.challenge-tier.medium {
  color: #34d399;
}

.challenge-tier.hard {
  color: #f59e0b;
}

.challenge-title {
  margin: 4px 0 6px;
  color: #edf6ff;
  font-size: 16px;
  font-weight: 700;
}

.challenge-progress-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #a5bbd4;
  margin-bottom: 6px;
}

.challenge-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.challenge-progress-fill {
  height: 100%;
  border-radius: 999px;
  width: var(--challenge-progress, 0%);
  transition: width 0.25s ease;
  background: linear-gradient(90deg, #38bdf8, #0ea5e9);
}

.challenge-item[data-tier="medium"] .challenge-progress-fill {
  background: linear-gradient(90deg, #34d399, #10b981);
}

.challenge-item[data-tier="hard"] .challenge-progress-fill {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.challenge-caption {
  margin: 8px 0 0;
  font-size: 12px;
  color: #a9c1d8;
  line-height: 1.35;
}

.challenges-feedback {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.4;
}

.challenges-feedback.positive {
  color: #86efac;
}

.challenges-feedback.caution {
  color: #fcd34d;
}

.challenges-badges-list,
.profile-badges-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.challenge-badge-chip {
  border-radius: 10px;
  border: 1px solid rgba(59, 130, 246, 0.34);
  background: rgba(30, 58, 95, 0.36);
  padding: 8px;
}

.challenge-badge-chip h4 {
  margin: 0 0 4px;
  color: #e9f5ff;
  font-size: 14px;
}

.challenge-badge-chip p {
  margin: 0;
  color: #a5bdd6;
  font-size: 12px;
  line-height: 1.3;
}

.challenge-badge-chip .unlock-date {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  color: #8db0d1;
}

.challenge-celebration-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
}

.challenge-confetti-piece {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 14px;
  border-radius: 999px;
  opacity: 0;
  animation: challengeConfettiDrop 1.8s ease forwards;
}

@keyframes challengeConfettiDrop {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.95;
  }
  100% {
    transform: translateY(105vh) rotate(500deg);
    opacity: 0;
  }
}

.weekly-report-preview {
  border-radius: 16px;
  border: 1px solid #1e3a5f;
  background: #111827;
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.24);
  padding: 14px;
  margin: 0 0 14px;
  display: grid;
  gap: 10px;
}

.weekly-report-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.weekly-report-preview-head h3 {
  margin: 4px 0 0;
  color: #eaf5ff;
  font-size: 20px;
}

.weekly-report-status-pill {
  font-size: 12px;
  font-weight: 700;
  color: #9fd5f8;
  background: rgba(14, 165, 233, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.36);
  border-radius: 999px;
  padding: 4px 10px;
}

.weekly-report-status-pill.is-good {
  color: #bbf7d0;
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.4);
}

.weekly-report-headline {
  margin: 0;
  color: #c2d8ee;
  font-size: 14px;
  line-height: 1.45;
}

.weekly-report-modal {
  position: fixed;
  inset: 0;
  z-index: 115;
  display: grid;
  place-items: center;
  padding: 18px;
}

.weekly-report-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(5px);
}

.weekly-report-card {
  position: relative;
  z-index: 2;
  width: min(760px, 100%);
  border-radius: 20px;
  border: 1px solid #1e3a5f;
  background: #0a0f1e;
  box-shadow: 0 26px 48px rgba(2, 6, 23, 0.5);
  padding: 16px;
  display: grid;
  gap: 12px;
  animation: cardSlideUp 180ms ease;
}

.weekly-report-close {
  position: absolute;
  right: 12px;
  top: 9px;
  border: 0;
  background: transparent;
  color: #9fb3ce;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.weekly-report-topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding-right: 24px;
}

.weekly-report-topbar h3 {
  margin: 0;
  color: #eaf5ff;
}

.weekly-report-slides {
  max-height: min(74vh, 700px);
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  display: grid;
  gap: 12px;
  padding-right: 4px;
}

.weekly-story-slide {
  min-height: 520px;
  border-radius: 18px;
  border: 1px solid rgba(30, 58, 95, 0.8);
  background: linear-gradient(180deg, rgba(14, 36, 63, 0.9), rgba(9, 20, 37, 0.95));
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 12px;
  color: #f1f5f9;
  scroll-snap-align: start;
}

.weekly-story-slide h4 {
  margin: 0;
  font-size: clamp(26px, 4.2vw, 34px);
  line-height: 1.1;
}

.weekly-story-slide p {
  margin: 0;
  color: #d5e6f7;
  font-size: 17px;
  line-height: 1.45;
}

.weekly-story-kicker {
  margin: 0;
  color: #7dd3fc;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  font-size: 12px;
}

.weekly-story-cover {
  text-align: center;
  justify-items: center;
}

.weekly-story-ring {
  width: 190px;
  height: 190px;
  border-radius: 999px;
  background: conic-gradient(#0ea5e9 var(--weekly-ring, 0deg), rgba(148, 163, 184, 0.3) 0deg);
  display: grid;
  place-items: center;
  margin-top: 8px;
  animation: weeklyRingFill 550ms ease;
}

.weekly-story-ring::after {
  content: "";
  width: 146px;
  height: 146px;
  border-radius: 999px;
  background: #0a0f1e;
  border: 1px solid rgba(56, 189, 248, 0.35);
  position: absolute;
}

.weekly-story-ring strong,
.weekly-story-ring span {
  position: relative;
  z-index: 2;
}

.weekly-story-ring strong {
  font-size: 40px;
  line-height: 1;
}

.weekly-story-ring span {
  color: #b6d8f4;
  font-size: 13px;
}

.weekly-story-duo,
.weekly-story-grid {
  display: grid;
  gap: 10px;
}

.weekly-story-duo {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.weekly-story-duo > div,
.weekly-story-grid p {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 10px;
  background: rgba(15, 23, 42, 0.5);
}

.weekly-story-duo strong,
.weekly-story-grid strong {
  color: #eff7ff;
  font-size: 15px;
}

.weekly-story-duo p,
.weekly-story-grid span {
  font-size: 13px;
  color: #9ec4e8;
}

.weekly-story-grid p {
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.weekly-story-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: #d3e6f9;
}

@keyframes weeklyRingFill {
  from {
    transform: scale(0.92);
    opacity: 0.6;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.profile-achievements-body {
  margin-top: 12px;
}

.profile-achievements-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.profile-achievements-head h3 {
  margin: 0;
}

.gci-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 20px;
}

.gci-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(4px);
}

.gci-detail-card {
  position: relative;
  z-index: 2;
  width: min(760px, 100%);
  border-radius: 16px;
  border: 1px solid #1e3a5f;
  background: #111827;
  box-shadow: 0 24px 44px rgba(2, 6, 23, 0.45);
  padding: 18px;
  display: grid;
  gap: 12px;
  animation: cardSlideUp 180ms ease;
}

.gci-detail-close {
  position: absolute;
  right: 12px;
  top: 10px;
  border: 0;
  background: transparent;
  color: #9fb3ce;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.gci-detail-card h3 {
  margin: 0;
}

.gci-detail-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.gci-detail-columns h4 {
  margin: 0 0 6px;
}

.gci-detail-list {
  margin: 0;
  padding-left: 18px;
  color: #c9d9eb;
  display: grid;
  gap: 4px;
}

.gci-detail-compare {
  border: 1px dashed rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  padding: 10px 12px;
  color: #b8cbe2;
}

.gci-detail-compare p {
  margin: 0;
}

.profile-setting-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-weight: 600;
}

.profile-setting-toggle input {
  accent-color: #0ea5e9;
}

.tir-ring-wrap {
  position: relative;
  width: 120px;
  height: 120px;
}

.tir-ring {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}

.tir-ring-track {
  fill: none;
  stroke: rgba(148, 163, 184, 0.25);
  stroke-width: 10;
}

.tir-ring-progress {
  fill: none;
  stroke: #0ea5e9;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 0 999;
  transition: stroke-dasharray 0.35s ease;
}

.tir-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.tir-ring-text strong {
  font-size: 24px;
  color: #e8f7ff;
}

.tir-ring-text span {
  font-size: 12px;
  color: #9fb3ce;
}

.profile-panel-view {
  display: none;
}

.profile-panel-view.active {
  display: block;
}

.profile-summary-body {
  display: grid;
  gap: 12px;
}

.profile-summary-body h2,
.profile-summary-body h3 {
  margin: 0;
}

.profile-inline-form {
  display: grid;
  gap: 20px;
}

.profile-inline-form.is-hidden {
  display: none;
}

.profile-form-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.profile-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.profile-form-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
}

.profile-form-label--full {
  grid-column: 1 / -1;
}

.profile-form-input {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.profile-form-input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.8);
}

.profile-form-select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235a6b83'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}

.profile-form-textarea {
  resize: vertical;
  min-height: 80px;
}

.profile-form-char-hint {
  font-weight: 400;
  color: var(--muted);
}

.profile-form-char-counter {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: right;
}

.profile-form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.profile-form-feedback {
  font-size: 0.82rem;
  color: var(--muted);
  min-height: 1.2em;
  text-align: right;
}

@media (max-width: 600px) {
  .profile-form-grid {
    grid-template-columns: 1fr;
  }
  .profile-form-label--full {
    grid-column: 1;
  }
}

.profile-theme-selector {
  display: grid;
  gap: 10px;
}

.profile-theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.theme-preview-option {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 16px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 8px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.theme-preview-option:hover {
  transform: translateY(-1px);
}

.theme-preview-option.active {
  border-color: rgba(14, 165, 233, 0.7);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.16) inset;
}

.theme-preview-canvas {
  height: 96px;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 9px;
  display: grid;
  gap: 7px;
}

.theme-preview-canvas .theme-preview-top {
  height: 12px;
  border-radius: 999px;
}

.theme-preview-canvas .theme-preview-main {
  height: 34px;
  border-radius: 8px;
}

.theme-preview-canvas .theme-preview-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.theme-preview-canvas .theme-preview-cards span {
  height: 24px;
  border-radius: 7px;
}

.preview-light {
  background: #ffffff;
  border-color: #bfdbfe;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.08);
}

.preview-light .theme-preview-top {
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.09);
}

.preview-light .theme-preview-main,
.preview-light .theme-preview-cards span {
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
}

.preview-auto {
  background: linear-gradient(90deg, #ffffff 0 50%, #0a0f1e 50% 100%);
  border-color: #7ba4d8;
  box-shadow: 0 7px 14px rgba(15, 23, 42, 0.16);
}

.preview-auto .theme-preview-top {
  background: linear-gradient(90deg, #ffffff 0 50%, rgba(10, 15, 30, 0.9) 50% 100%);
  border: 1px solid #7ba4d8;
}

.preview-auto .theme-preview-main {
  background: linear-gradient(90deg, #f0f7ff 0 50%, #111827 50% 100%);
  border: 1px solid #7ba4d8;
}

.preview-auto .theme-preview-cards span {
  border: 1px solid #7ba4d8;
  background: linear-gradient(90deg, #f0f7ff 0 50%, #111827 50% 100%);
}

.preview-dark {
  background: #0a0f1e;
  border-color: #1e3a5f;
  box-shadow: 0 8px 16px rgba(2, 6, 23, 0.4);
}

.preview-dark .theme-preview-top {
  background: rgba(10, 15, 30, 0.88);
  border: 1px solid #1e3a5f;
}

.preview-dark .theme-preview-main,
.preview-dark .theme-preview-cards span {
  background: #111827;
  border: 1px solid #1e3a5f;
}

.theme-preview-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.theme-preview-copy {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.assistant-chat .chat-header .chat-modes[aria-label="Elige especialidad de la IA"],
.stats-filters {
  display: none;
}

.panel-section[data-section="Inicio"][data-home-active-view="hoy"] #home-profile-module,
.panel-section[data-section="Inicio"][data-home-active-view="hoy"] #home-dashboard-followup {
  display: none;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 12px;
  width: min(780px, calc(100% - 24px));
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(3, 8, 18, 0.86);
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 36px rgba(2, 6, 23, 0.45);
}

.bottom-nav-item {
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #8ba4c4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 6px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.bottom-nav-icon {
  font-size: 17px;
}

.bottom-nav-label {
  font-size: 11px;
  font-weight: 600;
}

.bottom-nav-item.active {
  color: #0ea5e9;
  background: rgba(14, 165, 233, 0.14);
}

.bottom-nav-item:not(.active):hover {
  color: #b8c9de;
  background: rgba(255, 255, 255, 0.04);
}

.main-action-fab {
  position: fixed;
  left: 50%;
  bottom: 86px;
  transform: translateX(-50%);
  z-index: 65;
  border: 0;
  border-radius: 999px;
  background: #0ea5e9;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 14px 24px;
  min-width: 220px;
  box-shadow: 0 14px 30px rgba(14, 165, 233, 0.35);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.main-action-fab:hover {
  transform: translateX(-50%) translateY(-1px);
  box-shadow: 0 18px 36px rgba(14, 165, 233, 0.42);
  filter: saturate(1.05);
}

.main-action-fab:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.75);
  outline-offset: 2px;
}

.main-action-fab.is-chat-open {
  bottom: 96px;
}

.main-action-quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.main-action-quick-btn {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(17, 24, 39, 0.08);
  color: var(--text);
  font-weight: 600;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.main-action-quick-btn:hover {
  background: rgba(14, 165, 233, 0.14);
  border-color: rgba(14, 165, 233, 0.48);
}

.panel-section {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.panel-section.active {
  opacity: 1;
  transform: translateY(0);
  animation: panelFade 150ms ease;
}

.content-body,
.fitness-home-main-card,
.fitness-metric-card,
.fitness-session-card,
.chat-message {
  animation: cardSlideUp 200ms ease;
}

body.theme-light .global-glucose-pill {
  background: #ffffff;
  border-color: #bfdbfe;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
  backdrop-filter: none;
}

body.theme-light #global-glucose-value {
  color: #0b1b2e;
}

body.theme-light #global-glucose-trend {
  color: #4d6280;
}

body.theme-light .subnav-pill {
  background: #f0f7ff;
  border-color: #bfdbfe;
  color: #5d7394;
}

body.theme-light .subnav-pill.active {
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(14, 165, 233, 0.45);
  color: #0EA5E9;
}

body.theme-light .fitness-home-main-card,
body.theme-light .fitness-metric-card,
body.theme-light .fitness-session-card {
  background: #f0f7ff;
  border-color: #bfdbfe;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

body.theme-light .glucose-panel-card {
  background: #111827;
  border-color: #1e3a5f;
  box-shadow: 0 14px 24px rgba(2, 6, 23, 0.28);
  border-radius: 16px;
}

body.theme-light .content {
  background: #F0F6FF;
}

body.theme-light .glucose-panel-card .muted,
body.theme-light .glucose-panel-card .tiny,
body.theme-light .glucose-panel-card .small {
  color: #9fb3ce;
}

body.theme-light .glucose-panel-trend-label {
  color: #e6f6ff;
}

body.theme-light .glucose-panel-context {
  color: #9fb3ce;
}

body.theme-light .glucose-panel-delta,
body.theme-light .glucose-panel-predictions p {
  color: #9fb3ce;
}

body.theme-light .fitness-current-value,
body.theme-light .fitness-metric-card strong,
body.theme-light .fitness-session-card strong,
body.theme-light .tir-ring-text strong {
  color: #0b1b2e;
}

body.theme-light .glucose-panel-card .fitness-current-value.glucose-level-critical,
body.theme-light .glucose-panel-card .fitness-current-value.glucose-level-low,
body.theme-light .glucose-panel-card .fitness-current-value.glucose-level-very-high {
  color: #ef4444;
}

body.theme-light .glucose-panel-card .fitness-current-value.glucose-level-low-normal {
  color: #fbbf24;
}

body.theme-light .glucose-panel-card .fitness-current-value.glucose-level-in-range {
  color: #10b981;
}

body.theme-light .glucose-panel-card .fitness-current-value.glucose-level-high {
  color: #f59e0b;
}

body.theme-light .tir-ring-track {
  stroke: rgba(148, 163, 184, 0.35);
}

body.theme-light .app {
  background: transparent;
}

body.theme-light .bottom-nav {
  background: #ffffff;
  border-color: #DBEAFE;
  box-shadow: 0 -2px 12px rgba(14, 165, 233, 0.07);
}

body.theme-light .bottom-nav-item {
  color: #64748B;
}

body.theme-light .bottom-nav-item.active {
  color: #0EA5E9;
  background: rgba(14, 165, 233, 0.1);
}

body.theme-light .main-action-fab {
  background: #0ea5e9;
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(14, 165, 233, 0.28);
}

body.theme-light .main-action-quick-btn {
  background: #ffffff;
  border-color: #bfdbfe;
  color: #0f172a;
}

body.theme-light .main-action-quick-btn:hover {
  background: #eaf6ff;
  border-color: #7dd3fc;
}

body.theme-light .home-greeting-text {
  color: #0F172A;
}

body.theme-light .home-greeting-sub {
  color: #64748B;
}

body.theme-light .gci-main-card,
body.theme-light .gci-history-card,
body.theme-light .gci-detail-card {
  background: #f0f7ff;
  border-color: #bfdbfe;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

body.theme-light .challenges-week-card,
body.theme-light .challenges-badges-card {
  background: #f0f7ff;
  border-color: #bfdbfe;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

body.theme-light .challenges-head h3,
body.theme-light .challenge-title,
body.theme-light .challenge-badge-chip h4 {
  color: #10253f;
}

body.theme-light .challenge-item {
  background: #f8fbff;
  border-color: rgba(191, 219, 254, 0.95);
}

body.theme-light .challenge-progress-line,
body.theme-light .challenge-caption,
body.theme-light .challenge-badge-chip p,
body.theme-light .challenge-badge-chip .unlock-date,
body.theme-light .profile-badges-list .muted {
  color: #5a7494;
}

body.theme-light .challenge-badge-chip {
  background: #f8fbff;
  border-color: rgba(14, 165, 233, 0.3);
}

body.theme-light .weekly-report-preview,
body.theme-light .weekly-report-card {
  background: #f0f7ff;
  border-color: #bfdbfe;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

body.theme-light .weekly-report-preview-head h3,
body.theme-light .weekly-report-topbar h3,
body.theme-light .weekly-story-slide h4 {
  color: #10253f;
}

body.theme-light .weekly-report-headline,
body.theme-light .weekly-story-slide p,
body.theme-light .weekly-story-list,
body.theme-light .weekly-story-duo p,
body.theme-light .weekly-story-grid span {
  color: #4e6a89;
}

body.theme-light .weekly-report-backdrop {
  background: rgba(15, 23, 42, 0.35);
}

body.theme-light .weekly-story-slide {
  background: linear-gradient(180deg, #ffffff, #eff7ff);
  border-color: rgba(191, 219, 254, 0.95);
}

body.theme-light .weekly-story-ring::after {
  background: #f6fbff;
  border-color: rgba(14, 165, 233, 0.28);
}

body.theme-light .weekly-story-duo > div,
body.theme-light .weekly-story-grid p {
  background: #f8fbff;
  border-color: rgba(191, 219, 254, 0.95);
}

body.theme-light .gci-ring-center strong,
body.theme-light .gci-history-summary,
body.theme-light .gci-detail-card h3 {
  color: #10253f;
}

body.theme-light .gci-date-label,
body.theme-light .gci-ring-center span,
body.theme-light .gci-history-trend-label,
body.theme-light .gci-score-metrics,
body.theme-light .gci-detail-list,
body.theme-light .gci-detail-compare {
  color: #5a7494;
}

body.theme-light .gci-history-chart {
  background: #f8fbff;
  border-color: rgba(191, 219, 254, 0.95);
}

body.theme-light .gci-detail-backdrop {
  background: rgba(15, 23, 42, 0.35);
}

body.theme-light .profile-setting-toggle {
  background: #ffffff;
  border-color: #bfdbfe;
}

.stats-agp-view {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.stats-agp-view.agp-enter {
  animation: agpViewEnter 300ms ease;
}

.stats-agp-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.stats-agp-periods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.agp-period-btn.active {
  border-color: rgba(56, 189, 248, 0.72);
  background: rgba(14, 165, 233, 0.2);
  color: #e2f4ff;
}

.stats-agp-chart-card {
  background: #111827;
  border: 1px solid #1e3a5f;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 18px 30px rgba(2, 6, 23, 0.34);
}

.stats-agp-chart-wrap {
  position: relative;
  width: 100%;
  height: 280px;
  border-radius: 12px;
  overflow: hidden;
  background: #0a0f1e;
  border: 1px solid rgba(56, 189, 248, 0.16);
}

#stats-agp-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#glucose-chart {
  max-height: 220px;
  width: 100% !important;
}

.stats-container, #stats-view {
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  overflow-y: auto;
  height: calc(100vh - 120px);
}

@media (min-width: 768px) {
  #glucose-chart {
    max-height: 300px;
  }
}

@media (min-width: 1024px) {
  #glucose-chart {
    max-height: 350px;
  }
}

.stats-agp-tooltip {
  position: absolute;
  z-index: 5;
  width: min(220px, calc(100% - 16px));
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.38);
  background: rgba(15, 23, 42, 0.94);
  color: #e2edf8;
  box-shadow: 0 16px 24px rgba(2, 6, 23, 0.4);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.stats-agp-tooltip .hour {
  margin: 0 0 6px;
  font-weight: 700;
  color: #7dd3fc;
}

.stats-agp-tooltip p {
  margin: 0 0 4px;
  font-size: 12px;
  line-height: 1.35;
}

.stats-agp-tooltip .events {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(148, 163, 184, 0.45);
}

.stats-agp-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stats-agp-metrics-row.secondary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats-agp-metric-card,
.stats-agp-secondary-card {
  border-radius: 14px;
  border: 1px solid #1e3a5f;
  background: #111827;
  color: #d5e4f5;
  padding: 12px;
}

.stats-agp-metric-card {
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.stats-agp-metric-card:hover {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.56);
  box-shadow: 0 8px 18px rgba(14, 165, 233, 0.2);
}

.stats-agp-metric-card .label {
  display: block;
  color: #8fb0d3;
  font-size: 12px;
}

.stats-agp-metric-card strong {
  display: block;
  margin-top: 4px;
  font-size: 28px;
  line-height: 1;
}

.stats-agp-metric-card .unit {
  margin-top: 4px;
  font-size: 12px;
  color: #8fb0d3;
}

.stats-agp-metric-card .bar {
  margin-top: 10px;
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.24);
  overflow: hidden;
}

.stats-agp-metric-card .bar span {
  display: block;
  height: 100%;
  width: 0;
  transition: width 0.26s ease;
  background: linear-gradient(90deg, #0ea5e9, #10b981);
}

.stats-agp-metric-card.warn .bar span {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.stats-agp-metric-card.ok .bar span {
  background: linear-gradient(90deg, #10b981, #22c55e);
}

.stats-agp-secondary-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stats-agp-secondary-card span {
  font-size: 12px;
  color: #8fb0d3;
}

.stats-agp-secondary-card strong {
  font-size: 26px;
  line-height: 1.1;
}

.stats-agp-distribution-card {
  border: 1px solid #1e3a5f;
  border-radius: 14px;
  background: #111827;
  padding: 12px;
}

.stats-agp-distribution-track {
  display: flex;
  width: 100%;
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.18);
}

.stats-agp-distribution-track .seg {
  width: 0;
  transition: width 0.3s ease;
}

.stats-agp-distribution-track .seg.low {
  background: #ef4444;
}

.stats-agp-distribution-track .seg.in {
  background: #10b981;
}

.stats-agp-distribution-track .seg.high {
  background: #f59e0b;
}

.stats-agp-distribution-labels {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #a5bfd9;
  font-size: 12px;
}

.stats-agp-compare-row {
  border: 1px solid #1e3a5f;
  border-radius: 14px;
  background: #111827;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.agp-change-line {
  margin: 0;
  font-size: 13px;
  color: #a5bfd9;
}

.agp-change-line.good {
  color: #34d399;
}

.agp-change-line.warn {
  color: #f59e0b;
}

.agp-change-line.neutral {
  color: #94a3b8;
}

.stats-agp-analysis-card {
  border: 1px solid rgba(14, 165, 233, 0.4);
  border-radius: 14px;
  background: linear-gradient(140deg, #0f172a, #0b1f3a);
  padding: 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.stats-agp-analysis-card h3 {
  margin: 0 0 6px;
  color: #e7f3ff;
}

.stats-agp-analysis-card p {
  margin: 0;
  color: #bdd1e9;
}

.stats-agp-explainer {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed rgba(148, 163, 184, 0.38);
  border-radius: 12px;
}

body.theme-light .agp-period-btn.active {
  color: #0d4f71;
}

body.theme-light .stats-agp-chart-card,
body.theme-light .stats-agp-metric-card,
body.theme-light .stats-agp-secondary-card,
body.theme-light .stats-agp-distribution-card,
body.theme-light .stats-agp-compare-row {
  background: #f0f7ff;
  border-color: #bfdbfe;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  color: #10253f;
}

body.theme-light .stats-agp-chart-wrap {
  background: #f8fbff;
  border-color: rgba(191, 219, 254, 0.9);
}

body.theme-light .stats-agp-tooltip {
  background: rgba(255, 255, 255, 0.96);
  border-color: #93c5fd;
  color: #1e293b;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.16);
}

body.theme-light .stats-agp-tooltip .hour {
  color: #0369a1;
}

body.theme-light .stats-agp-metric-card .label,
body.theme-light .stats-agp-metric-card .unit,
body.theme-light .stats-agp-secondary-card span,
body.theme-light .stats-agp-distribution-labels,
body.theme-light .agp-change-line.neutral {
  color: #516a89;
}

body.theme-light .stats-agp-analysis-card {
  background: linear-gradient(140deg, #e0f2fe, #eef9ff);
  border-color: rgba(14, 165, 233, 0.34);
}

body.theme-light .stats-agp-analysis-card h3 {
  color: #0f172a;
}

body.theme-light .stats-agp-analysis-card p {
  color: #335273;
}

body.theme-light .stats-agp-explainer {
  border-color: rgba(100, 116, 139, 0.3);
}

.stats-exercise-view {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.stats-exercise-view.agp-enter {
  animation: agpViewEnter 300ms ease;
}

.stats-exercise-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.stats-exercise-insight-card {
  margin: 0;
  border: 1px solid rgba(56, 189, 248, 0.42);
  border-radius: 14px;
  background: linear-gradient(140deg, #0f172a, #0b1f3a);
  color: #d7e8f9;
  padding: 12px;
  line-height: 1.45;
  font-size: 14px;
}

.stats-exercise-list {
  display: grid;
  gap: 10px;
}

.stats-exercise-card {
  border-radius: 14px;
  border: 1px solid #1e3a5f;
  background: #111827;
  color: #dce9f7;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.stats-exercise-title {
  margin: 0;
  font-weight: 700;
  font-size: 15px;
}

.stats-exercise-date {
  margin: 0;
  font-size: 12px;
  color: #90abc7;
}

.stats-exercise-before,
.stats-exercise-meta {
  margin: 0;
  font-size: 13px;
  color: #bfd3e9;
}

.stats-exercise-mini-wrap {
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  background: #0a0f1e;
  padding: 6px;
}

.stats-exercise-mini-svg {
  display: block;
  width: 100%;
  height: 62px;
}

.stats-exercise-mini-empty,
.stats-exercise-empty {
  border-radius: 10px;
  border: 1px dashed rgba(148, 163, 184, 0.42);
  padding: 12px;
  color: #9eb2c7;
  font-size: 13px;
}

body.theme-light .stats-exercise-insight-card {
  background: linear-gradient(140deg, #e0f2fe, #eef9ff);
  color: #1f3551;
  border-color: rgba(14, 165, 233, 0.32);
}

body.theme-light .stats-exercise-card {
  background: #f0f7ff;
  border-color: #bfdbfe;
  color: #19324d;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

body.theme-light .stats-exercise-date {
  color: #597695;
}

body.theme-light .stats-exercise-before,
body.theme-light .stats-exercise-meta {
  color: #395978;
}

body.theme-light .stats-exercise-mini-wrap {
  background: #f8fbff;
  border-color: rgba(191, 219, 254, 0.9);
}

body.theme-light .stats-exercise-mini-empty,
body.theme-light .stats-exercise-empty {
  color: #5d7897;
  border-color: rgba(100, 116, 139, 0.3);
}

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

  .challenges-section {
    grid-template-columns: 1fr;
  }

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

  .stats-agp-metrics-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-agp-metrics-row.secondary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats-agp-compare-row {
    grid-template-columns: 1fr;
  }

  .stats-agp-analysis-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-theme-grid {
    grid-template-columns: 1fr;
  }

  .fitness-home-cards {
    grid-template-columns: 1fr;
  }

  .fitness-home-main-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .tir-ring-wrap {
    align-self: center;
  }

  .weekly-report-topbar {
    flex-direction: column;
    align-items: flex-start;
    padding-right: 0;
  }

  .weekly-story-duo {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .gci-detail-modal {
    padding: 10px;
  }

  .gci-detail-card {
    padding: 14px;
  }

  .weekly-report-modal {
    padding: 10px;
  }

  .weekly-report-card {
    padding: 12px;
  }

  .weekly-report-slides {
    max-height: 72vh;
  }

  .weekly-story-slide {
    min-height: 480px;
    padding: 14px;
  }

  .stats-agp-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-agp-periods {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-agp-chart-wrap {
    height: 320px;
  }

  .stats-agp-metrics-row,
  .stats-agp-metrics-row.secondary {
    grid-template-columns: 1fr;
  }

  .challenges-badges-list,
  .profile-badges-list {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 14px 12px 110px;
  }

  .bottom-nav {
    width: calc(100% - 14px);
    bottom: 8px;
    border-radius: 14px;
  }

  .main-action-fab {
    width: calc(100% - 26px);
    max-width: 360px;
    min-width: 0;
    bottom: 76px;
    padding: 13px 18px;
  }

  .main-action-fab.is-chat-open {
    bottom: 86px;
  }

  .main-action-quick-row {
    gap: 6px;
  }

  .bottom-nav-label {
    font-size: 10px;
  }
}

@keyframes cardSlideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes panelFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes agpViewEnter {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulseDot {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.3);
    opacity: 1;
  }
}

@keyframes glucoseCriticalPulse {
  0%,
  100% {
    opacity: 1;
    text-shadow: 0 0 0 rgba(239, 68, 68, 0);
  }
  50% {
    opacity: 0.78;
    text-shadow: 0 0 14px rgba(239, 68, 68, 0.42);
  }
}

@keyframes trendPulse {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

/* ===== INICIO: HOME REDESIGN (Oura / Apple Health / Whoop) ===== */

/* Glucose hero — full width, all content centered */
.home-glucose-hero.glucose-panel-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 44px 24px 36px;
  gap: 0;
}

.home-glucose-label {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  font-weight: 600;
  margin: 0 0 14px;
  text-align: center;
}

/* Number: 72 px minimum, centered */
.home-glucose-hero .home-glucose-number {
  font-size: clamp(72px, 20vw, 96px) !important;
  font-weight: 800 !important;
  letter-spacing: -0.05em !important;
  line-height: 1 !important;
  text-align: center;
  margin: 0 0 16px !important;
}

/* Trend row centered below the number */
.home-glucose-trend-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

.home-glucose-trend-row .glucose-panel-trend-arrow {
  font-size: 26px;
}

.home-glucose-trend-row .glucose-panel-trend-label {
  font-size: 17px;
  font-weight: 600;
}

.home-glucose-status {
  text-align: center;
  margin: 0 0 4px !important;
}

/* Mini chart stretches full width inside the card */
.home-glucose-mini {
  width: 100%;
  margin-top: 24px;
}

/* Action buttons — stacked column, 24 px lateral margins, 12 px gap */
.home-actions-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 24px;
  margin-top: 18px;
}

/* Primary: Calcular insulina */
.home-btn-primary.primary-btn {
  width: 100%;
  height: 56px;
  background: #0ea5e9 !important;
  background-image: none !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 16px !important;
  font-size: 16px;
  font-weight: 700;
  justify-content: center;
  padding: 0 24px;
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.32);
}

.home-btn-primary.primary-btn:hover {
  background: #0284c7 !important;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(14, 165, 233, 0.45);
}

/* Secondary: Pregunta a GluCo */
.home-btn-secondary.ghost-btn {
  width: 100%;
  height: 56px;
  background: #EFF6FF !important;
  border: 1.5px solid #BFDBFE !important;
  color: #1E40AF !important;
  border-radius: 16px !important;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
}

.home-btn-secondary.ghost-btn:hover {
  background: rgba(14, 165, 233, 0.08) !important;
  border-color: rgba(14, 165, 233, 0.55) !important;
  color: #0ea5e9 !important;
}

/* Dark mode: secondary button */
body.theme-dark .home-btn-secondary.ghost-btn {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(148, 163, 184, 0.22) !important;
  color: #e2eaf5 !important;
}

body.theme-dark .home-btn-secondary.ghost-btn:hover {
  background: rgba(14, 165, 233, 0.1) !important;
  border-color: rgba(14, 165, 233, 0.45) !important;
  color: #7dd3fc !important;
}

/* ── Insulinas Panel ─────────────────────────────────────── */
.insulin-settings-body {
  padding: 16px 0;
}

.insulin-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 10px 0;
}

.insulin-view-section {
  margin-bottom: 20px;
}

.insulin-view-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.insulin-view-row {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--card-bg, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 10px 14px;
}

.insulin-meal-label {
  flex: 1 1 0;
  min-width: 0;
  font-size: 14px;
  color: var(--text-primary, #1e293b);
}

.insulin-view-val {
  flex-shrink: 0;
  width: 90px;
  text-align: right;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent, #0ea5e9);
}

.insulin-edit-btn {
  width: 100%;
  margin-top: 8px;
}

.ratio-stat-badge {
  flex-shrink: 0;
  width: 28px;
  text-align: right;
  font-size: 15px;
  margin-left: 10px;
  cursor: default;
  font-weight: 500;
}
.ratio-stat-badge.stat-ok         { color: #16a34a; }
.ratio-stat-badge.stat-none       { color: #9ca3af; }
.ratio-stat-badge.stat-bad        { color: #dc2626; }
.ratio-stat-badge.stat-placeholder{ visibility: hidden; }

.insulin-combo-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.insulin-fields-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.insulin-field-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  color: var(--text-primary, #1e293b);
}

.insulin-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  font-size: 15px;
  background: var(--card-bg, #f8fafc);
  color: var(--text-primary, #1e293b);
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}

.insulin-input:focus {
  border-color: var(--accent, #0ea5e9);
}

.insulin-select {
  appearance: none;
  cursor: pointer;
}

.insulin-edit-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.insulin-edit-actions .ghost-btn,
.insulin-edit-actions .primary-btn {
  flex: 1;
}

.insulin-save-msg {
  margin-top: 10px;
  font-size: 13px;
  text-align: center;
  color: #22c55e;
}

.insulin-save-msg.error {
  color: #ef4444;
}

body.theme-dark .insulin-view-row {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}

body.theme-dark .insulin-input {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
  color: #e2eaf5;
}

body.theme-dark .insulin-meal-label,
body.theme-dark .insulin-field-label {
  color: #e2eaf5;
}

body.theme-dark .insulin-section-title {
  color: #94a3b8;
}

/* === Macros section === */
.profile-macros-body h3 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
}

.macros-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.macro-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-light);
}

.macro-card--cal {
  grid-column: span 2;
  background: linear-gradient(135deg, var(--accent, #0EA5E9) 0%, #38bdf8 100%);
  border-color: transparent;
}

.macro-card--cal .macro-card-value,
.macro-card--cal .macro-card-label {
  color: #ffffff;
}

.macro-card-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.macro-card-label {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.macros-note {
  margin: 6px 0 0;
  line-height: 1.5;
}

.macros-note--warning {
  margin-top: 4px;
}

/* === Macros section — header row, toggle, modal === */
.macros-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.macros-header-row h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.macros-info-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #BFDBFE;
  background: #EFF6FF;
  color: #1E40AF;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.macros-info-btn:hover {
  background: #DBEAFE;
}

body.theme-dark .macros-info-btn {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.25);
  color: #7dd3fc;
}

body.theme-dark .macros-info-btn:hover {
  background: rgba(56, 189, 248, 0.18);
}

.macros-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.macros-toggle-btn:hover,
.macros-toggle-btn--open {
  background: var(--panel-light, #f8fbff);
  color: var(--text);
  border-style: solid;
  border-color: var(--accent, #0EA5E9);
}

.macros-toggle-arrow {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.6;
}

.macros-collapsible {
  margin-top: 12px;
  animation: cardSlideUp 200ms ease;
}

/* === Macros info modal === */
.macros-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 8px;
  animation: fadeInBackdrop 150ms ease;
}

@keyframes fadeInBackdrop {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.macros-modal {
  background: var(--panel, #fff);
  border-radius: 20px 20px 16px 16px;
  width: 100%;
  max-width: 540px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px 22px 28px;
  box-shadow: 0 -4px 32px rgba(0,0,0,0.18);
  animation: slideUpModal 220ms ease;
}

@keyframes slideUpModal {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.macros-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.macros-modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.macros-modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--bg-2, #e8f1ff);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.macros-modal-close:hover {
  background: var(--border);
}

.macros-modal-body > p {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.macros-edu-item {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  align-items: flex-start;
}

.macros-edu-icon {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 2px;
}

.macros-edu-item strong {
  display: block;
  font-size: 14px;
  margin-bottom: 3px;
  color: var(--text);
}

.macros-edu-item p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.macros-edu-formula {
  background: var(--panel-light, #f8fbff);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 4px 0 12px !important;
  text-align: center;
}

body.theme-dark .macros-modal {
  background: #111827;
  border-color: #1e3a5f;
}

body.theme-dark .macros-edu-formula {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}

/* =============================================
   Calculadora de insulina — modal
   ============================================= */
.calc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9998;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 8px;
  animation: fadeInBackdrop 160ms ease;
}

.calc-modal {
  background: #111827;
  border: 1px solid #1e3a5f;
  border-radius: 22px 22px 16px 16px;
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 26px 22px 28px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.45);
  animation: slideUpModal 230ms ease;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.calc-modal-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: #f1f5f9;
}

.calc-modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #9fb3ce;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.calc-modal-close:hover {
  background: rgba(255, 255, 255, 0.14);
}

.calc-food-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid #0EA5E9;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  color: #f1f5f9;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.55;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.calc-food-input::placeholder {
  color: #4a6280;
}

.calc-food-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.calc-ig-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.calc-ig-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.calc-ig-badge--verde {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.calc-ig-badge--naranja {
  background: rgba(251, 146, 60, 0.12);
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.25);
}

.calc-ig-badge--rojo {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.calc-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calc-field-label {
  font-size: 12px;
  font-weight: 600;
  color: #7ea8c9;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.calc-optional {
  font-weight: 400;
  text-transform: none;
  color: #4a6280;
  font-size: 11px;
}

.calc-field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calc-ratio-info {
  font-size: 13px;
  color: #4a6280;
  margin: 0;
  padding: 6px 0;
}

.calc-field-prefix,
.calc-field-suffix {
  font-size: 14px;
  color: #7ea8c9;
  white-space: nowrap;
  flex-shrink: 0;
}

.calc-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid #1e3a5f;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 16px;
  font-weight: 600;
  color: #f1f5f9;
  font-family: inherit;
  outline: none;
  min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.calc-input--ratio  { width: 80px; }
.calc-input--glucose { width: 90px; }
.calc-input--iob    { width: 80px; }

.calc-input::placeholder {
  color: #3d5570;
  font-weight: 400;
}

.calc-input:focus {
  border-color: #0EA5E9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

/* Remove spinner arrows on number inputs */
.calc-input::-webkit-outer-spin-button,
.calc-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.calc-input[type=number] { -moz-appearance: textfield; }

.calc-submit-btn {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #0EA5E9, #0284c7);
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: opacity 0.15s, transform 0.12s;
  margin-top: 4px;
}

.calc-submit-btn:hover  { opacity: 0.92; transform: translateY(-1px); }
.calc-submit-btn:active { opacity: 1;    transform: translateY(0);    }

/* === Calc modal — IOB toggle & details === */
.calc-iob-toggle {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.calc-tog-btn {
  flex: 1;
  padding: 9px 0;
  border-radius: 10px;
  border: 1.5px solid #1e3a5f;
  background: rgba(255,255,255,0.04);
  color: #7ea8c9;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.calc-tog-btn--active {
  background: rgba(14,165,233,0.15);
  border-color: #0EA5E9;
  color: #38bdf8;
}

.calc-iob-details {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: cardSlideUp 160ms ease;
}

.calc-iob-subfields {
  display: flex;
  gap: 12px;
}

.calc-iob-subfield {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.calc-iob-sublabel {
  font-size: 11px;
  font-weight: 600;
  color: #7ea8c9;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calc-input--time-part,
.calc-input--units {
  width: 100%;
  box-sizing: border-box;
}

.calc-iob-time-fields {
  display: flex;
  align-items: center;
  gap: 4px;
}

.calc-iob-time-fields .calc-input--time-part {
  width: 52px;
  text-align: center;
  flex-shrink: 0;
}

.calc-time-sep {
  font-size: 12px;
  color: #7ea8c9;
  font-weight: 600;
  user-select: none;
}

.calc-iob-estimate {
  margin: 0;
  font-size: 13px;
  color: #7ea8c9;
  background: rgba(14,165,233,0.08);
  border: 1px solid rgba(14,165,233,0.2);
  border-radius: 8px;
  padding: 8px 12px;
}

.calc-iob-estimate strong {
  color: #38bdf8;
}

.calc-result {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(56,189,248,0.2);
  border-radius: 14px;
  padding: 16px;
  animation: slideUpModal 180ms ease;
}

.calc-res-row {
  font-size: 13px;
  color: #c8dff0;
  line-height: 1.5;
}

.calc-res-row b {
  color: #f1f5f9;
}

.calc-res-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 4px;
}

.calc-res-table th {
  text-align: left;
  color: #7ea8c9;
  font-weight: 600;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.calc-res-table td {
  color: #c8dff0;
  padding: 5px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}

.calc-res-muted {
  color: #4a6280;
  font-size: 11px;
}

.calc-res-dose {
  font-size: 12px;
  color: #7ea8c9;
  margin-top: 4px;
  padding-left: 2px;
}

.calc-res-total {
  font-size: 14px;
  color: #f1f5f9;
  background: rgba(56,189,248,0.1);
  border: 1px solid rgba(56,189,248,0.25);
  border-radius: 10px;
  padding: 10px 14px;
}

.calc-res-timing {
  font-size: 13px;
  color: #4ade80;
  font-weight: 600;
}

.calc-res-disclaimer {
  margin: 0;
  font-size: 11px;
  color: #4a6280;
}

.calc-res-chat-btn {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1.5px solid rgba(56,189,248,0.4);
  border-radius: 12px;
  color: #38bdf8;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.calc-res-chat-btn:hover {
  background: rgba(56,189,248,0.1);
}

/* ── Test Basal ──────────────────────────────────────────────────────────── */
.stats-basal-view {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}
.stats-basal-view.agp-enter { animation: agpViewEnter 300ms ease; }

.stats-basal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}
.stats-basal-toolbar h3 { margin: 0 0 2px; font-size: 16px; }

.stats-basal-disclaimer {
  margin: 0;
  padding: 8px 12px;
  border-left: 3px solid #eab308;
  background: rgba(234,179,8,0.08);
  border-radius: 0 8px 8px 0;
}

.stats-basal-list { display: grid; gap: 12px; }

.stats-basal-card {
  border-radius: 14px;
  border: 1px solid #1e3a5f;
  background: #111827;
  color: #dce9f7;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.stats-basal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.stats-basal-window-label {
  margin: 0;
  font-weight: 700;
  font-size: 15px;
}
.stats-basal-time {
  font-weight: 400;
  font-size: 13px;
  color: #90abc7;
}
.stats-basal-days-note { margin: 2px 0 0; }

.stats-basal-badge-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.basal-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.basal-badge-stable  { background: rgba(34,197,94,0.18); color: #86efac; border: 1px solid rgba(34,197,94,0.4); }
.basal-badge-rising  { background: rgba(239,68,68,0.18);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.4); }
.basal-badge-falling { background: rgba(234,179,8,0.18);  color: #fde68a; border: 1px solid rgba(234,179,8,0.4); }
.basal-badge-empty   { background: rgba(100,116,139,0.15); color: #94a3b8; border: 1px solid rgba(100,116,139,0.3); }

.basal-variation {
  font-size: 13px;
  font-weight: 600;
  color: #90abc7;
}

.stats-basal-chart-wrap {
  border-radius: 10px;
  border: 1px solid rgba(56,189,248,0.15);
  background: #0a0f1e;
  padding: 8px 6px 4px;
  height: 130px;
  position: relative;
}
.stats-basal-canvas { display: block; width: 100% !important; height: 100% !important; }

.stats-basal-values {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 2px 0;
}
.basal-hour-val {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 36px;
}
.basal-hour-label { font-size: 10px; color: #64748b; }
.basal-hour-avg   { font-size: 13px; font-weight: 600; color: #b0c9e4; }

.basal-observation {
  margin: 0;
  font-size: 13px;
  color: #94a3b8;
  border-left: 3px solid rgba(148,163,184,0.3);
  padding-left: 10px;
}

.basal-edu-text {
  margin: 0;
  font-size: 12px;
  color: #4a7096;
  line-height: 1.5;
  font-style: italic;
}

.stats-basal-empty { margin: 8px 0; font-size: 13px; }

/* Light theme overrides */
body.theme-light .stats-basal-card {
  background: #f0f6ff;
  border-color: #c8d8ec;
  color: #1e3a5f;
}
body.theme-light .stats-basal-chart-wrap {
  background: #f8fbff;
  border-color: rgba(56,189,248,0.25);
}
body.theme-light .basal-hour-avg  { color: #1e4a7a; }
body.theme-light .basal-hour-label { color: #7090b0; }
body.theme-light .basal-edu-text  { color: #6b8fb5; }
body.theme-light .basal-observation { color: #4a6a8a; border-left-color: rgba(74,106,138,0.3); }
body.theme-light .stats-basal-days-note { color: #6b8fb5; }

/* ─── Correction modal ──────────────────────────────────────────────────────── */
.corr-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9998;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 8px;
  animation: fadeInBackdrop 160ms ease;
}
.corr-modal {
  background: #111827;
  border: 1px solid #1e3a5f;
  border-radius: 22px 22px 16px 16px;
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 26px 22px 28px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.45);
  animation: slideUpModal 230ms ease;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.corr-fsi-info {
  font-size: 13px;
  color: #7B8BA7;
  margin: 0;
}
.corr-result {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid #1e3a5f;
  border-radius: 12px;
  padding: 16px;
  font-size: 14px;
  color: #e2e8f0;
  line-height: 1.7;
  white-space: pre-wrap;
  font-family: inherit;
}
.corr-send-btn {
  width: 100%;
}

@media (min-width: 768px) {
  #stats-view .stats-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
  }

  #stats-view .dexcom-frame-wrapper {
    height: 100% !important;
    min-height: 200px !important;
    max-height: none !important;
  }

  #stats-view .stats-grid {
    grid-column: 2;
  }
}

@media (min-width: 1100px) {
  .dexcom-embed {
    display: grid;
    grid-template-columns: 1fr 320px;
    grid-template-rows: auto auto auto 1fr;
    gap: 0 16px;
    align-items: start;
  }

  .dexcom-embed-header { grid-column: 1; }
  .range-legend { grid-column: 1; }
  #dexcom-status { grid-column: 1; }
  .dexcom-frame-wrapper {
    grid-column: 1;
    height: 200px !important;
  }
  .stats-live-strip {
    grid-column: 2;
    grid-row: 1 / 5;
  }
}

@media (min-width: 900px) {
  .stats-grid.stats-standard-only {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.chat-suggestion-row {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg, #f0f4f8);
  padding: 8px 12px;
}
