/* Dark theme stylesheet (black background) */
:root{
  --bg: #05060a;         /* page background - near black */
  --surface: #0b1220;    /* primary surfaces/cards */
  --muted: #9aa4b2;      /* muted text */
  --text: #e6eef6;       /* main text */
  --accent: #06b6d4;     /* cyan accent */
  --accent-2: #10b981;   /* green accent */
  --glass: rgba(255,255,255,0.03);
}

html,body{
  height:100%;
  margin:0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}
.p-4{padding:1rem}
.max-w-sm{max-width:24rem}
.mx-auto{margin-left:auto;margin-right:auto}
.flex{display:flex}
.flex-col{flex-direction:column}
.gap-2{gap:0.5rem}
.border{border:1px solid rgba(255,255,255,0.06)}
.rounded{border-radius:0.375rem}
.p-2{padding:0.5rem}
.bg-blue-500{background:var(--accent)}
.text-white{color:#fff}
.hover\:bg-blue-600:hover{background:#2563eb}
.text-red-600{color:#dc2626}

/* Simple form card (will use surface color in dark theme) */
.card{
  background: linear-gradient(180deg, var(--surface), rgba(11,18,32,0.9));
  padding:1.25rem;
  border-radius:0.5rem;
  box-shadow: 0 8px 30px rgba(2,6,23,0.7);
  border: 1px solid rgba(255,255,255,0.03);
}

/* Utilities for buttons */
.btn{
  display:inline-block;
  padding:0.5rem 0.75rem;
  border-radius:0.375rem;
  border:none;
  cursor:pointer;
}

/* small responsive container */
.container{
  max-width:72rem;
  margin:0 auto;
  padding:1rem;
}

/* Additional utilities added to match existing classnames used in components */
.p-6{padding:1.5rem}
.p-10{padding:2.5rem}
.py-16{padding-top:4rem;padding-bottom:4rem}
.px-4{padding-left:1rem;padding-right:1rem}
.py-2{padding-top:0.5rem;padding-bottom:0.5rem}
.mt-4{margin-top:1rem}
.mb-4{margin-bottom:1rem}

.text-2xl{font-size:1.5rem;line-height:1.2}
.text-3xl{font-size:1.875rem;line-height:1.2}
.text-5xl{font-size:3rem;line-height:1.1}
.font-bold{font-weight:700}
.font-semibold{font-weight:600}

.bg-white{background:#ffffff}
.rounded-xl{border-radius:0.75rem}
.rounded-lg{border-radius:0.5rem}
.shadow{box-shadow:0 10px 30px rgba(15,23,42,0.08)}

.items-center{align-items:center}
.justify-between{justify-content:space-between}
.justify-center{justify-content:center}
.w-full{width:100%}

.text-gray-600{color:#4b5563}
.text-gray-500{color:#6b7280}

.emoji-large{font-size:3rem; margin-bottom:1rem}

.bg-green-500{background:#10b981}
.hover\:bg-green-600:hover{background:#059669}

.mt-4{margin-top:1rem}

/* button style for green primary */
.btn-green{background:#10b981;color:#fff;padding:0.5rem 1rem;border-radius:0.5rem;border:none;cursor:pointer}

/* small helpers */
.gap-4{gap:1rem}
.text-center{text-align:center}

/* Add any project-specific overrides here */

/* Semantic component styles to replace utility-heavy classnames */
.container-page {
  padding: 1.5rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
}

.site-nav {
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.site-nav .nav-left,
.site-nav .nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.site-nav .nav-link {
  color: var(--text);
  text-decoration: none;
  opacity: 0.9;
}
.site-nav .nav-link:hover { opacity: 1; }
.site-nav .profile-selector {
  margin-bottom: 0;
  padding: 0.35rem 0.6rem;
  gap: 0.5rem;
}
.site-nav .profile-selector .profile-label { font-size: 0.85rem; opacity: 0.8; }
.site-nav .profile-dropdown { min-width: 140px; padding: 0.35rem 0.5rem; font-size: 0.9rem; }
.site-nav .profile-create-form { margin-left: 0; }
.site-nav .profile-create-form .form-input { min-width: 140px; }

.card {
  background: linear-gradient(180deg, var(--surface), rgba(11,18,32,0.9));
  border-radius: 0.75rem;
  box-shadow: 0 10px 30px rgba(2,6,23,0.7);
  padding: 1.5rem;
  display:flex;
  flex-direction:column;
  gap:0.5rem;
  width:100%;
  border: 1px solid rgba(255,255,255,0.03);
}
.card-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.card-title { color: var(--muted); }
.card-value { font-size: 1.875rem; font-weight:600; color: var(--text); }

.empty-section {
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding-top:4rem;
  padding-bottom:4rem;
  color:var(--muted);
}

.btn { display:inline-block; padding:0.5rem 0.75rem; border-radius:0.5rem; border:none; cursor:pointer; }
.btn-primary { background:var(--accent); color:#071018; }
.btn-create { background:var(--accent-2); color:#071018; }

.form-card { background: linear-gradient(180deg, var(--surface), rgba(11,18,32,0.9)); padding:1rem; border-radius:0.5rem; box-shadow:0 8px 24px rgba(2,6,23,0.6); max-width:24rem; margin:0 auto; border:1px solid rgba(255,255,255,0.03); }
.form { display:flex; flex-direction:column; gap:0.5rem; }
.form-input { padding:0.5rem; border:1px solid rgba(255,255,255,0.06); border-radius:0.375rem; background: rgba(255,255,255,0.01); color:var(--text); }
.form-error { color:#ff7b7b; }

/* Food item card styles */
.food-card {
  /* compact card for grid layout */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: linear-gradient(180deg, var(--surface), rgba(11,18,32,0.85));
  border: 1px solid rgba(255,255,255,0.03);
  box-shadow: 0 6px 16px rgba(2,6,23,0.5);
  width: 230px;
  min-width: 0;
}
.food-card .left {
  width: 100%;
}
.food-card .title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.food-card .brand {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.125rem;
}
.food-card .metrics {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.food-card .metric { display:flex; flex-direction:column; }
.food-card .metric .label { font-size:0.7rem; color:var(--muted); }
.food-card .metric .value { font-weight:600; color:var(--text); }

.food-card .right {
  display:flex;
  align-items:center;
  gap:0.5rem;
  width:100%;
  justify-content: space-between;
}
.food-card .price {
  font-weight:700;
  color: var(--text);
  background: rgba(255,255,255,0.02);
  padding: 0.35rem 0.5rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(255,255,255,0.03);
}

/* action buttons in the card */
.food-card .actions { display:flex; gap:0.5rem; }
.btn-danger {
  background: transparent;
  color: #ff7b7b;
  border: 1px solid rgba(255,255,255,0.04);
  padding: 0.4rem 0.6rem;
  border-radius: 0.45rem;
  cursor: pointer;
}
.btn-danger:hover { background: rgba(255,123,123,0.06); }

/* small icon sizing inside buttons */
.food-card .icon { width: 16px; height: 16px; display:block; }
.food-card .btn svg { vertical-align: middle; }

@media (max-width: 640px) {
  .food-card { width: 100%; }
  .food-card .right { align-self: stretch; width: 100%; display:flex; justify-content:space-between; }
}

/* grid helper to place cards in a responsive grid */
.food-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  align-items: start;
}

/* page actions (right-aligned header buttons) */
.page-actions { display:flex; gap:0.5rem; align-items:center; }

/* Modal for create/edit form */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index: 10000;
}
.modal-panel {
  background: var(--surface);
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  width: 520px;
  max-width: calc(100% - 2rem);
  color: var(--text);
  box-shadow: 0 10px 40px rgba(2,6,23,0.6);
  border: 1px solid rgba(255,255,255,0.04);
}
.modal-panel h2 { margin: 0 0 0.5rem 0; }
.modal-panel label { display:block; margin-top:0.5rem; }
.modal-panel .form-input { width:100%; box-sizing:border-box; }

/* Large meal form modal */
.meal-form-modal .modal-panel {
  width: 95vw;
  max-width: 1400px;
  height: 90vh;
  max-height: 90vh;
  padding: 2rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.meal-form-modal .modal-panel h2 {
  margin: 0 0 1.5rem 0;
  font-size: 1.5rem;
  font-weight: 600;
}

/* notification banners */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
  word-break: break-word;
}
.alert-error {
  background: #dc2626;
  color: #fff;
}

/* dashboard-specific helpers */
.weekly-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
}
.day-card {
  background: var(--surface);
  padding: 0.75rem;
  border-radius: 0.5rem;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.05);
}
.day-header { font-weight: 600; margin-bottom: 0.5rem; }
.day-stats p { margin: 0; }
.text-small { font-size: 0.75rem; color: var(--muted); }

/* nutrition progress card */
.nutrition-card {
  background: var(--surface);
  border-radius: 0.5rem;
  padding: 0.75rem;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 1px solid rgba(255,255,255,0.04);
}
.nutrition-card .card-header-small { display:flex; justify-content:space-between; align-items:center; }
.nutrition-card .progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
}
.nutrition-card .progress-fill {
  height: 100%;
  transition: width 0.3s ease;
}
.progress-normal { background: var(--accent); }
.progress-good { background: var(--accent-2); }
.progress-over { background: #dc2626; }

/* Meal form layout */
.meal-form-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.meal-form-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.meal-form-header label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.meal-form-header .form-input {
  padding: 0.75rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.375rem;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 0.95rem;
}

.meal-form-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  overflow: hidden;
}

.meal-form-food-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.meal-form-food-section h3 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
}

.meal-form-search {
  margin-bottom: 1rem;
}

.meal-form-search .form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.5rem;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 0.95rem;
}

.meal-form-food-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  flex: 1;
  overflow: hidden;
}

.meal-form-food-column {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.meal-form-food-column h4 {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.meal-form-food-list {
  flex: 1;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.5rem;
  background: rgba(255,255,255,0.02);
  padding: 0.75rem;
}

.meal-form-food-item {
  cursor: pointer;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.meal-form-food-item:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.meal-form-food-item:last-child {
  margin-bottom: 0;
}

.meal-form-food-item-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.meal-form-food-item-brand {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.meal-form-food-item-calories {
  font-size: 0.8rem;
  color: var(--accent-2);
  font-weight: 500;
}

.meal-form-selected-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 0.375rem;
}

.meal-form-selected-item:last-child {
  margin-bottom: 0;
}

.meal-form-selected-info {
  flex: 1;
}

.meal-form-selected-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.meal-form-selected-calories {
  font-size: 0.8rem;
  color: var(--muted);
}

.meal-form-amount-input {
  width: 80px;
  padding: 0.5rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.25rem;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  text-align: center;
  font-size: 0.9rem;
}

.meal-form-remove-btn {
  padding: 0.375rem 0.5rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 0.25rem;
  color: #ef4444;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.meal-form-remove-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
}

/* Nutrition panel */
.meal-form-nutrition {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.meal-form-nutrition h3 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
}

.meal-form-nutrition-panel {
  flex: 1;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.5rem;
  background: rgba(255,255,255,0.02);
  padding: 1.25rem;
  overflow-y: auto;
}

.meal-form-nutrition-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.meal-form-nutrition-item:last-child {
  margin-bottom: 0;
  border-bottom: none;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.meal-form-nutrition-label {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}

.meal-form-nutrition-value {
  font-weight: 500;
  color: var(--accent-2);
  font-size: 0.9rem;
}

.meal-form-nutrition-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 1rem 0;
}

.meal-form-nutrition-macro {
  background: rgba(255,255,255,0.02);
  padding: 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid rgba(255,255,255,0.05);
}

.meal-form-nutrition-macro-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.meal-form-nutrition-macro-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

/* Modal footer */
.meal-form-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.meal-form-footer .btn {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 0.375rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.meal-form-footer .btn-cancel {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text);
}

.meal-form-footer .btn-cancel:hover {
  background: rgba(255,255,255,0.1);
}

.meal-form-footer .btn-save {
  background: var(--accent-2);
  color: white;
}

.meal-form-footer .btn-save:hover {
  background: #059669;
  transform: translateY(-1px);
}

/* Modal Styles */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
}

.modal-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  padding: 0;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 101;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.meal-detail-modal {
  min-width: 500px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--accent);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0.25rem;
}

.meal-description {
  padding: 1rem 1.5rem 0 1.5rem;
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

.meal-detail-content {
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.nutrition-section {
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  padding-right: 1rem;
}

.nutrition-section h3 {
  margin-top: 0;
  color: var(--accent);
  font-size: 1.1rem;
}

.nutrition-radar-container {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}

.nutrition-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

.nutrition-value {
  background: rgba(255, 255, 255, 0.02);
  padding: 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
}

.nutrition-value .label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.nutrition-value .value {
  font-weight: 600;
  color: var(--accent-2);
  font-size: 0.95rem;
}

.foods-section h3 {
  margin-top: 0;
  color: var(--accent);
  font-size: 1.1rem;
}

/* Daily Plan Form Styles - mirror of meal form styling */
.dailyplan-form-modal .modal-panel {
  width: 95vw;
  max-width: 1400px;
  height: 90vh;
  max-height: 90vh;
  padding: 2rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dailyplan-form-modal .modal-panel h2 {
  margin: 0 0 1.5rem 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.dailyplan-form-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dailyplan-form-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.dailyplan-form-header label { display:flex; flex-direction:column; gap:0.5rem; }

.dailyplan-form-header .form-input {
  padding: 0.75rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.375rem;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 0.95rem;
}

.dailyplan-form-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  overflow: hidden;
}

.dailyplan-form-food-section { display:flex; flex-direction:column; overflow:hidden; }

.dailyplan-form-food-section h3 { margin:0 0 1rem 0; font-size:1.25rem; font-weight:600; color:var(--accent); }

.dailyplan-form-search { margin-bottom:1rem; }
.dailyplan-form-search .form-input { width:100%; padding:0.75rem 1rem; border:1px solid rgba(255,255,255,0.1); border-radius:0.5rem; background:rgba(255,255,255,0.05); color:var(--text); font-size:0.95rem; }

.dailyplan-form-food-grid { display:grid; grid-template-columns: 1fr 1fr; gap:1rem; flex:1; overflow:hidden; }

.dailyplan-form-food-column { display:flex; flex-direction:column; overflow:hidden; }
.dailyplan-form-food-column h4 { margin:0 0 0.75rem 0; font-size:1rem; font-weight:600; color:var(--text); }

.dailyplan-form-food-list { flex:1; overflow-y:auto; border:1px solid rgba(255,255,255,0.1); border-radius:0.5rem; background:rgba(255,255,255,0.02); padding:0.75rem; }

.dailyplan-form-food-item { cursor:pointer; padding:0.75rem; margin-bottom:0.5rem; background:rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.05); border-radius:0.375rem; transition: all 0.15s ease; }
.dailyplan-form-food-item:hover { background: rgba(255,255,255,0.08); border-color: var(--accent); transform: translateY(-1px); }
.dailyplan-form-food-item:last-child { margin-bottom:0; }

.dailyplan-form-food-item-name { font-weight:600; font-size:0.95rem; color:var(--text); margin-bottom:0.25rem; }
.dailyplan-form-food-item-brand { font-size:0.8rem; color:var(--muted); margin-bottom:0.25rem; }
.dailyplan-form-food-item-calories { font-size:0.8rem; color:var(--accent-2); font-weight:500; }

.dailyplan-form-selected-item { display:flex; align-items:center; gap:0.75rem; margin-bottom:0.75rem; padding:0.75rem; background:rgba(16,185,129,0.06); border:1px solid rgba(16,185,129,0.12); border-radius:0.375rem; }
.dailyplan-form-selected-item:last-child { margin-bottom:0; }
.dailyplan-form-selected-info { flex:1; }
.dailyplan-form-selected-name { font-weight:600; font-size:0.9rem; color:var(--text); margin-bottom:0.25rem; }
.dailyplan-form-selected-calories { font-size:0.8rem; color:var(--muted); }

.dailyplan-form-amount-input { width:80px; padding:0.5rem; border:1px solid rgba(255,255,255,0.1); border-radius:0.25rem; background:rgba(255,255,255,0.05); color:var(--text); text-align:center; font-size:0.9rem; }

.dailyplan-form-remove-btn { padding:0.375rem 0.5rem; background:rgba(239,68,68,0.08); border:1px solid rgba(239,68,68,0.18); border-radius:0.25rem; color:#ef4444; cursor:pointer; font-size:0.9rem; font-weight:600; transition:all 0.15s ease; }
.dailyplan-form-remove-btn:hover { background: rgba(239,68,68,0.18); border-color: #ef4444; }

.dailyplan-form-nutrition { display:flex; flex-direction:column; overflow:hidden; }
.dailyplan-form-nutrition h3 { margin:0 0 1rem 0; font-size:1.25rem; font-weight:600; color:var(--accent); }

.dailyplan-form-nutrition-panel { flex:1; border:1px solid rgba(255,255,255,0.1); border-radius:0.5rem; background:rgba(255,255,255,0.02); padding:1.25rem; overflow-y:auto; }
.dailyplan-form-nutrition-item { display:flex; justify-content:space-between; align-items:center; margin-bottom:0.75rem; padding:0.5rem 0; border-bottom:1px solid rgba(255,255,255,0.05); }
.dailyplan-form-nutrition-item:last-child { margin-bottom:0; border-bottom:none; padding-top:1rem; border-top:1px solid rgba(255,255,255,0.1); }
.dailyplan-form-nutrition-label { font-weight:600; color:var(--text); font-size:0.9rem; }
.dailyplan-form-nutrition-value { font-weight:500; color:var(--accent-2); font-size:0.9rem; }

.dailyplan-form-nutrition-grid { display:grid; grid-template-columns:1fr 1fr; gap:0.5rem; margin:1rem 0; }
.dailyplan-form-nutrition-macro { background:rgba(255,255,255,0.02); padding:0.5rem; border-radius:0.25rem; border:1px solid rgba(255,255,255,0.05); }
.dailyplan-form-nutrition-macro-label { font-size:0.8rem; color:var(--muted); margin-bottom:0.25rem; }
.dailyplan-form-nutrition-macro-value { font-size:0.9rem; font-weight:600; color:var(--text); }

.dailyplan-form-footer { display:flex; gap:0.75rem; justify-content:flex-end; margin-top:1.5rem; padding-top:1rem; border-top:1px solid rgba(255,255,255,0.1); }
.dailyplan-form-footer .btn { padding:0.75rem 1.5rem; font-size:0.95rem; font-weight:500; border-radius:0.375rem; border:none; cursor:pointer; transition:all 0.2s ease; }
.dailyplan-form-footer .btn-cancel { background: rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.1); color:var(--text); }
.dailyplan-form-footer .btn-cancel:hover { background: rgba(255,255,255,0.1); }
.dailyplan-form-footer .btn-save { background: var(--accent-2); color: white; }
.dailyplan-form-footer .btn-save:hover { background: #059669; transform: translateY(-1px); }

@media (max-width: 768px) {
  .dailyplan-form-main { grid-template-columns: 1fr; }
  .dailyplan-form-header { grid-template-columns: 1fr; }
}

.foods-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.food-item {
  background: rgba(255, 255, 255, 0.02);
  padding: 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.food-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.food-header div {
  display: flex;
  flex-direction: column;
}

.food-header h4 {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
}

.food-brand {
  font-size: 0.8rem;
  color: var(--accent-2);
}

.food-amount {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(6, 182, 212, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.food-details {
  font-size: 0.85rem;
  color: var(--muted);
}

.detail {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.detail-label {
  font-weight: 500;
  color: var(--muted);
}

.detail-value {
  color: var(--text);
}

.detail-nutrition {
  display: flex;
  gap: 1rem;
  margin-top: 0.25rem;
  color: var(--accent-2);
  font-weight: 500;
}

.empty-message {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 1rem;
  margin: 0;
}

.cost-section {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: right;
}

.cost-item {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  align-items: center;
}

.cost-item .label {
  color: var(--muted);
  font-weight: 500;
}

.cost-item .value {
  color: var(--accent-2);
  font-weight: 700;
  font-size: 1.1rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
}

.modal-footer .btn {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
  .meal-detail-modal {
    min-width: auto;
    width: 95%;
  }

  .meal-detail-content {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .nutrition-section {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-right: 0;
    padding-bottom: 1rem;
  }

  .nutrition-radar-container svg {
    max-width: 100%;
    height: auto;
  }
}

/* Eye icon button styling (info button) */
.btn-info {
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent);
  padding: 0.5rem;
  margin-right: 0.5rem;
  transition: all 0.2s ease;
}

.btn-info:hover {
  background: rgba(6, 182, 212, 0.2);
  border-color: rgba(6, 182, 212, 0.5);
}
/* Nutrition Pie Chart Styling */
.nutrition-pie-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin: 1rem 0;
}

.nutrition-pie-container svg {
  max-width: 100%;
  height: auto;
}

.pie-slice {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.pie-slice:hover {
  opacity: 0.85;
}

.pie-label {
  pointer-events: none;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}

.pie-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
  max-width: 500px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 0.375rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.legend-label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.legend-value {
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  .nutrition-pie-container {
    margin: 0.5rem 0;
  }

  .pie-legend {
    grid-template-columns: 1fr;
  }
}

/* Profile Selector Styles */
.profile-selector {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
}

.profile-header {
  display: flex;
  align-items: center;
}

.profile-label {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.profile-dropdown {
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.375rem;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
  min-width: 150px;
}

.profile-dropdown:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--accent);
}

.profile-dropdown:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.profile-dropdown option {
  background: var(--surface);
  color: var(--text);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.profile-create-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-left: auto;
}

.profile-create-form .form-input {
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.375rem;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 0.9rem;
  min-width: 150px;
}

.profile-create-form .form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

/* ---------- Dashboard layout ---------- */
.dashboard-page {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}
.dashboard-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2rem 2rem;
  border-radius: 1rem;
  background:
    radial-gradient(1200px 300px at -10% -20%, rgba(6,182,212,0.22), transparent 60%),
    radial-gradient(900px 260px at 110% 120%, rgba(16,185,129,0.18), transparent 55%),
    linear-gradient(180deg, var(--surface), rgba(11,18,32,0.9));
  border: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 20px 60px rgba(2,6,23,0.6);
}
.dashboard-eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
}
.dashboard-title {
  margin: 0.35rem 0 0.5rem 0;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
}
.dashboard-subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 42rem;
  font-size: 0.95rem;
}
.dashboard-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dashboard-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  background: linear-gradient(180deg, var(--surface), rgba(11,18,32,0.9));
  border-radius: 0.75rem;
  border: 1px solid rgba(255,255,255,0.04);
  box-shadow: 0 10px 30px rgba(2,6,23,0.5);
}
.section-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.section-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.section-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.skeleton-block {
  height: 8rem;
  border-radius: 0.5rem;
  background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
.stat-tile-skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  min-height: 7rem;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Library insights ---------- */
.stats-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.stat-tile {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 0.5rem;
  padding: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.stat-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(6, 182, 212, 0.4);
}
.stat-tile-icon { font-size: 1.5rem; }
.stat-tile-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.stat-tile-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rankings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}
.ranking-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 0.5rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.ranking-title {
  margin: 0 0 0.25rem 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}
.ranking-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.ranking-row {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 0.375rem;
  background: rgba(255,255,255,0.02);
  font-size: 0.88rem;
}
.ranking-row:hover { background: rgba(255,255,255,0.05); }
.ranking-rank {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
}
.ranking-name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ranking-brand { color: var(--muted); font-size: 0.75rem; }
.ranking-value {
  color: var(--accent-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}

.empty-cal-list {
  list-style: none;
  margin: 0.5rem 0 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.empty-cal-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 0.375rem;
  font-size: 0.88rem;
}
.empty-cal-name {
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.empty-cal-stats {
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.empty-cal-score {
  color: #f59e0b;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 2.5rem;
  text-align: right;
}

/* =====================================================================
   DASH2 — modern analytics dashboard
   ===================================================================== */

.dash2 {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem;
  --d2-cyan:   #06b6d4;
  --d2-violet: #8b5cf6;
  --d2-pink:   #ec4899;
  --d2-mint:   #10b981;
  --d2-amber:  #f59e0b;
  --d2-rose:   #f43f5e;
  --d2-card:   rgba(14, 20, 34, 0.72);
  --d2-card-2: rgba(22, 28, 44, 0.55);
  --d2-border: rgba(255, 255, 255, 0.06);
  --d2-border-hi: rgba(255, 255, 255, 0.12);
  --d2-text:   #e6eef6;
  --d2-muted:  #8b94a7;
}

/* --- Hero --------------------------------------------------------- */
.dash2-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 1.5rem;
  padding: 2.5rem 2rem;
  border-radius: 1.25rem;
  background:
    linear-gradient(135deg, rgba(8,12,24,0.95), rgba(14,20,34,0.85));
  border: 1px solid var(--d2-border);
  box-shadow:
    0 30px 80px rgba(2,6,23,0.7),
    inset 0 1px 0 rgba(255,255,255,0.04);
  isolation: isolate;
}
.dash2-hero-mesh,
.dash2-hero-grid,
.dash2-hero-orbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.dash2-hero-mesh {
  background:
    radial-gradient(600px 280px at 10% 20%, rgba(6,182,212,0.30), transparent 60%),
    radial-gradient(500px 260px at 85% 90%, rgba(139,92,246,0.28), transparent 60%),
    radial-gradient(700px 320px at 60% 10%, rgba(236,72,153,0.18), transparent 65%);
  filter: blur(12px);
  animation: meshDrift 18s ease-in-out infinite alternate;
}
@keyframes meshDrift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  50%  { transform: translate3d(2%, -1%, 0) scale(1.05); }
  100% { transform: translate3d(-2%, 2%, 0) scale(1.02); }
}
.dash2-hero-grid {
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
  opacity: 0.45;
}
.dash2-orb {
  position: absolute;
  width: 140px; height: 140px;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.55;
}
.dash2-orb-a { background: var(--d2-cyan);   left: 8%;  top: 20%; animation: orbFloat 11s ease-in-out infinite; }
.dash2-orb-b { background: var(--d2-violet); left: 55%; top: 60%; animation: orbFloat 14s ease-in-out infinite reverse; }
.dash2-orb-c { background: var(--d2-pink);   left: 80%; top: 10%; animation: orbFloat 16s ease-in-out infinite; }
@keyframes orbFloat {
  0%,100% { transform: translate(0,0); }
  50%     { transform: translate(24px,-18px); }
}
.dash2-hero-content { position: relative; z-index: 1; max-width: 640px; }
.dash2-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--d2-border-hi);
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(8px);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: #c7d2fe;
  font-weight: 600;
}
.dash2-live-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--d2-mint);
  box-shadow: 0 0 0 0 rgba(16,185,129,0.6);
  animation: pulseDot 1.6s ease-out infinite;
}
@keyframes pulseDot {
  0%   { box-shadow: 0 0 0 0    rgba(16,185,129,0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0    rgba(16,185,129,0); }
}
.dash2-title {
  margin: 1rem 0 0.6rem;
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--d2-text);
  animation: riseIn 0.8s cubic-bezier(.2,.8,.2,1) both;
}
.dash2-title-accent {
  background: linear-gradient(90deg, var(--d2-cyan), var(--d2-violet), var(--d2-pink));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientShift 8s linear infinite;
}
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
.dash2-subtitle {
  margin: 0;
  color: var(--d2-muted);
  font-size: 1rem;
  max-width: 44rem;
  animation: riseIn 0.9s 0.1s cubic-bezier(.2,.8,.2,1) both;
}
.dash2-subtitle b { color: var(--d2-text); font-weight: 700; }
.dash2-hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.dash2-chip {
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--d2-border-hi);
  background: rgba(255,255,255,0.04);
  color: var(--d2-text);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.dash2-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.08);
}
.dash2-chip-primary {
  background: linear-gradient(135deg, var(--d2-cyan), var(--d2-violet));
  border-color: transparent;
  color: white;
  box-shadow: 0 10px 30px rgba(139,92,246,0.35);
}

/* --- KPI strip ---------------------------------------------------- */
.dash2-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
}
.dash2-kpi {
  position: relative;
  overflow: hidden;
  padding: 1.1rem 1.1rem 1.3rem;
  border-radius: 0.9rem;
  background: linear-gradient(180deg, var(--d2-card), var(--d2-card-2));
  border: 1px solid var(--d2-border);
  box-shadow: 0 10px 30px rgba(2,6,23,0.4);
  animation: riseIn 0.7s cubic-bezier(.2,.8,.2,1) both;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.dash2-kpi:hover {
  transform: translateY(-3px);
  border-color: var(--d2-border-hi);
}
.dash2-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--d2-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}
.dash2-kpi-icon { font-size: 1.15rem; }
.dash2-kpi-value {
  margin-top: 0.65rem;
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--d2-text);
  line-height: 1;
}
.dash2-kpi-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(255,255,255,0.05);
  overflow: hidden;
}
.dash2-kpi-bar span {
  display: block;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, transparent, var(--d2-cyan), var(--d2-violet), transparent);
  animation: kpiSweep 3.2s linear infinite;
}
@keyframes kpiSweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* --- Shared card -------------------------------------------------- */
.dash2-card {
  padding: 1.5rem;
  border-radius: 1rem;
  background: linear-gradient(180deg, var(--d2-card), var(--d2-card-2));
  border: 1px solid var(--d2-border);
  box-shadow: 0 20px 50px rgba(2,6,23,0.5);
}
.dash2-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.dash2-card-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--d2-text);
}
.dash2-card-sub {
  margin: 0.25rem 0 0;
  color: var(--d2-muted);
  font-size: 0.85rem;
}

/* --- Tabs --------------------------------------------------------- */
.dash2-tabs {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--d2-border);
  gap: 2px;
}
.dash2-tab {
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--d2-muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 0.15s ease, background 0.2s ease;
}
.dash2-tab:hover { color: var(--d2-text); }
.dash2-tab-active {
  background: linear-gradient(135deg, var(--d2-cyan), var(--d2-violet));
  color: white;
  box-shadow: 0 4px 14px rgba(139,92,246,0.35);
}

/* --- Spectrum bars ----------------------------------------------- */
.dash2-bars { display: flex; flex-direction: column; gap: 0.65rem; }
.dash2-bar-row {
  display: grid;
  grid-template-columns: 2.2rem minmax(140px, 1.1fr) 2.3fr auto;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.88rem;
}
.dash2-bar-rank {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--d2-muted);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
}
.dash2-bar-name {
  color: var(--d2-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash2-bar-brand { color: var(--d2-muted); font-size: 0.78rem; }
.dash2-bar-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  overflow: hidden;
}
.dash2-bar-fill {
  position: absolute;
  inset: 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--d2-cyan), var(--d2-violet), var(--d2-pink));
  box-shadow: 0 0 18px rgba(139,92,246,0.45);
  animation: barGrow 1.1s cubic-bezier(.2,.8,.2,1) forwards;
}
.dash2-bar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: translateX(-100%);
  animation: barShine 2.6s ease-in-out 1.1s infinite;
}
@keyframes barGrow {
  from { width: 0; }
  to   { width: var(--bar-w); }
}
@keyframes barShine {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(150%); }
}
.dash2-bar-val {
  color: var(--d2-text);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.85rem;
  text-align: right;
  min-width: 5.5rem;
}

/* --- Insight row -------------------------------------------------- */
.dash2-insight-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 1.25rem;
}
@media (max-width: 900px) {
  .dash2-insight-row { grid-template-columns: 1fr; }
  .dash2-hero { grid-template-columns: 1fr; }
  .dash2-hero-actions { justify-content: flex-start; }
}

/* Gauge */
.dash2-gauge {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem 0 0.25rem;
}
.dash2-gauge-svg { width: 100%; max-width: 260px; height: auto; }
.dash2-gauge-track {
  fill: none;
  stroke: rgba(255,255,255,0.06);
  stroke-width: 14;
}
.dash2-gauge-fill {
  fill: none;
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dashoffset: var(--gauge-circ);
  filter: drop-shadow(0 0 10px rgba(139,92,246,0.45));
  animation: gaugeFill 1.6s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes gaugeFill { to { stroke-dashoffset: var(--gauge-offset); } }
.dash2-gauge-num {
  font-size: 2.1rem;
  font-weight: 800;
  fill: var(--d2-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.dash2-gauge-label {
  font-size: 0.78rem;
  fill: var(--d2-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/* Donut */
.dash2-donut {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  align-items: center;
}
.dash2-donut-svg { width: 220px; height: 220px; }
.dash2-donut-track {
  fill: none;
  stroke: rgba(255,255,255,0.05);
  stroke-width: 22;
}
.dash2-donut-seg {
  fill: none;
  stroke-width: 22;
  stroke-linecap: butt;
  stroke-dasharray: 0 var(--seg-circ);
  transform: rotate(-90deg);
  transform-origin: 100px 100px;
  animation: donutGrow 1.3s cubic-bezier(.2,.8,.2,1) forwards;
  filter: drop-shadow(0 0 6px currentColor);
}
@keyframes donutGrow {
  to { stroke-dasharray: var(--seg-len) var(--seg-circ); }
}
.dash2-donut-total {
  font-size: 2rem;
  font-weight: 800;
  fill: var(--d2-text);
  font-variant-numeric: tabular-nums;
}
.dash2-donut-sub {
  font-size: 0.72rem;
  fill: var(--d2-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.dash2-donut-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.dash2-donut-legend li {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  color: var(--d2-text);
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--d2-border);
}
.dash2-legend-dot {
  width: 10px; height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 10px currentColor;
}
.dash2-legend-name { color: var(--d2-muted); font-size: 0.82rem; }
.dash2-legend-val { font-weight: 700; font-variant-numeric: tabular-nums; }

/* --- Bubble field ------------------------------------------------- */
.dash2-bubbles-card { overflow: hidden; }
.dash2-bubble-field {
  position: relative;
  height: 280px;
  border-radius: 0.75rem;
  background:
    radial-gradient(600px 240px at 50% 50%, rgba(139,92,246,0.08), transparent 70%),
    linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.0));
  border: 1px solid var(--d2-border);
  overflow: hidden;
}
.dash2-bubble {
  position: absolute;
  width: var(--bubble-size);
  height: var(--bubble-size);
  border-radius: 999px;
  transform: translate(-50%, -50%) scale(0);
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.45), transparent 55%),
    var(--bubble-color);
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow:
    0 0 24px color-mix(in srgb, var(--bubble-color) 55%, transparent),
    inset 0 -8px 14px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px;
  cursor: pointer;
  animation:
    bubblePop 0.7s cubic-bezier(.2,1.4,.4,1) forwards,
    bubbleFloat 7s ease-in-out infinite;
  animation-delay: var(--bubble-delay, 0ms), calc(var(--bubble-delay, 0ms) + 700ms);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.dash2-bubble:hover {
  z-index: 3;
  box-shadow:
    0 0 40px color-mix(in srgb, var(--bubble-color) 80%, transparent),
    inset 0 -8px 14px rgba(0,0,0,0.3);
}
@keyframes bubblePop {
  from { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
@keyframes bubbleFloat {
  0%,100% { margin-top: 0; }
  50%     { margin-top: -8px; }
}
.dash2-bubble-label {
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.05;
  text-shadow: 0 1px 3px rgba(0,0,0,0.55);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  pointer-events: none;
}

/* --- Skeletons and fallbacks ------------------------------------- */
.dash2-skeleton {
  border-radius: 0.75rem;
  background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
.dash2-skeleton-bars    { height: 16rem; }
.dash2-skeleton-gauge   { height: 14rem; }
.dash2-skeleton-donut   { height: 14rem; }
.dash2-skeleton-bubbles { height: 280px; }
.dash2-empty {
  color: var(--d2-muted);
  text-align: center;
  padding: 2rem 0;
}

/* --- shared keyframes -------------------------------------------- */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
