/* 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: 1400px;
  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;
}
.dash2-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.25rem;
  align-items: stretch;
}
.dash2-top > .dash2-hero { min-width: 0; }
.dash2-top > .dash2-donut-card {
  width: 420px;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.1rem;
}
.dash2-top > .dash2-donut-card .dash2-card-head { margin-bottom: 0.6rem; }
.dash2-top > .dash2-donut-card .dash2-donut {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: center;
  flex: 1;
}
.dash2-top > .dash2-donut-card .dash2-donut-svg { width: 130px; height: 130px; }
.dash2-top > .dash2-donut-card .dash2-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.dash2-top > .dash2-donut-card .dash2-donut-legend li {
  font-size: 0.78rem;
  padding: 0.25rem 0.5rem;
  grid-template-columns: 10px 1fr auto;
  gap: 0.45rem;
}
.dash2-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.25rem;
  align-items: stretch;
}
.dash2-main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

/* --- Hero --------------------------------------------------------- */
.dash2-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 1.5rem;
  padding: 2.25rem 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-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);
}
.dash2-title {
  margin: 1rem 0 0.6rem;
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--d2-text);
}
.dash2-title-accent {
  background: linear-gradient(90deg, var(--d2-cyan), var(--d2-violet), var(--d2-pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.dash2-subtitle {
  margin: 0;
  color: var(--d2-muted);
  font-size: 1rem;
  max-width: 44rem;
}
.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: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-self: stretch;
}
.dash2-kpi {
  position: relative;
  overflow: hidden;
  padding: 1rem 1.1rem;
  border-radius: 0.9rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.6rem;
  flex: 1;
  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);
  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.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}
.dash2-kpi-icon { font-size: 1.3rem; }
.dash2-kpi-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--d2-text);
  line-height: 1;
}
/* --- 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;
  top: 0; bottom: 0; left: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--d2-cyan), var(--d2-violet), var(--d2-pink));
}
.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;
}

@media (max-width: 1100px) {
  .dash2-top { grid-template-columns: 1fr; }
  .dash2-top > .dash2-donut-card { width: auto; }
}
@media (max-width: 900px) {
  .dash2-body { grid-template-columns: 1fr; }
  .dash2-kpis {
    flex-direction: row;
    flex-wrap: wrap;
    align-self: auto;
  }
  .dash2-kpi { flex: 1 1 calc(50% - 0.625rem); }
  .dash2-hero { grid-template-columns: 1fr; }
  .dash2-hero-actions { justify-content: flex-start; }
}

/* 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;
  transform: rotate(-90deg);
  transform-origin: 100px 100px;
}
.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;
}
.dash2-legend-name { color: var(--d2-muted); font-size: 0.82rem; }
.dash2-legend-val { font-weight: 700; font-variant-numeric: tabular-nums; }

/* --- Skeletons and fallbacks ------------------------------------- */
.dash2-skeleton {
  border-radius: 0.75rem;
  background: rgba(255,255,255,0.04);
}
.dash2-skeleton-bars    { height: 16rem; }
.dash2-skeleton-donut   { height: 14rem; }
.dash2-empty {
  color: var(--d2-muted);
  text-align: center;
  padding: 2rem 0;
}

/* =====================================================================
   App shell — fixed icon sidebar + top navbar
   ===================================================================== */
.shell {
  display: grid;
  grid-template-columns: 72px 1fr;
  min-height: 100vh;
  background: #05060a;
}
.shell-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.shell-content {
  padding: 1.25rem 1.75rem 2.5rem;
  min-width: 0;
}
.shell-content .container-page { padding: 0; }

/* --- Sidebar ------------------------------------------------------- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 0;
  background: linear-gradient(180deg, rgba(14,20,34,0.9), rgba(8,12,24,0.95));
  border-right: 1px solid rgba(255,255,255,0.05);
  z-index: 5;
}
.sb-brand {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #06b6d4, #8b5cf6);
  box-shadow: 0 8px 22px rgba(139,92,246,0.45);
}
.sb-brand-mark {
  width: 18px; height: 18px;
  border-radius: 5px;
  background: rgba(255,255,255,0.92);
  box-shadow: inset 0 0 0 3px rgba(0,0,0,0.15);
}
.sb-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
  align-items: center;
}
.sb-foot {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
  padding-bottom: 0.25rem;
}
.sb-link { text-decoration: none; }
.sb-item {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: #8b94a7;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.sb-item:hover {
  color: #e6eef6;
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.08);
}
.sb-item-active {
  color: #e6eef6;
  background: linear-gradient(135deg, rgba(6,182,212,0.18), rgba(139,92,246,0.18));
  border-color: rgba(139,92,246,0.35);
  box-shadow: 0 6px 20px rgba(139,92,246,0.25);
}
.sb-item-active::before {
  content: "";
  position: absolute;
  left: -14px; top: 10px; bottom: 10px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, #06b6d4, #8b5cf6);
}
.sb-label {
  position: absolute;
  left: 54px;
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
  color: #e6eef6;
  background: rgba(14,20,34,0.95);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-4px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 10;
}
.sb-item:hover .sb-label {
  opacity: 1;
  transform: translateX(0);
}

/* Icons — simple geometric CSS glyphs using borders */
.sb-icon {
  width: 18px; height: 18px;
  display: inline-block;
  position: relative;
  color: currentColor;
}
.sb-icon-home::before {
  content: "";
  position: absolute; inset: 0;
  border: 2px solid currentColor;
  border-radius: 2px 2px 3px 3px;
  clip-path: polygon(0 40%, 50% 0, 100% 40%, 100% 100%, 0 100%);
}
.sb-icon-home::after {
  content: "";
  position: absolute;
  left: 35%; right: 35%; bottom: 0; top: 55%;
  border: 2px solid currentColor;
  border-bottom: none;
  border-radius: 2px 2px 0 0;
}
.sb-icon-grid::before,
.sb-icon-grid::after {
  content: "";
  position: absolute;
  width: 7px; height: 7px;
  border: 2px solid currentColor;
  border-radius: 1px;
}
.sb-icon-grid::before { top: 0; left: 0; box-shadow: 9px 0 0 -2px currentColor, 0 9px 0 -2px currentColor, 9px 9px 0 -2px currentColor; }
.sb-icon-grid::after  { display: none; }
.sb-icon-doc::before {
  content: "";
  position: absolute; inset: 0 2px 0 2px;
  border: 2px solid currentColor;
  border-radius: 2px;
}
.sb-icon-doc::after {
  content: "";
  position: absolute;
  left: 5px; right: 5px; top: 6px;
  border-top: 2px solid currentColor;
  box-shadow: 0 4px 0 0 currentColor;
}
.sb-icon-cal::before {
  content: "";
  position: absolute; inset: 2px 0 0 0;
  border: 2px solid currentColor;
  border-radius: 3px;
}
.sb-icon-cal::after {
  content: "";
  position: absolute;
  left: 4px; right: 4px; top: 0; height: 4px;
  border-left: 2px solid currentColor;
  border-right: 2px solid currentColor;
  box-shadow: inset 0 4px 0 0 currentColor;
}
.sb-icon-user::before {
  content: "";
  position: absolute;
  top: 0; left: 5px;
  width: 8px; height: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-sizing: border-box;
}
.sb-icon-user::after {
  content: "";
  position: absolute;
  bottom: 0; left: 1px; right: 1px;
  height: 8px;
  border: 2px solid currentColor;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
}
.sb-icon-gear::before {
  content: "";
  position: absolute; inset: 2px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-sizing: border-box;
}
.sb-icon-gear::after {
  content: "";
  position: absolute;
  top: 6px; left: 6px;
  width: 6px; height: 6px;
  border-radius: 50%;
  box-shadow:
    0 -6px 0 -2px currentColor,
    0 6px 0 -2px currentColor,
    -6px 0 0 -2px currentColor,
    6px 0 0 -2px currentColor;
}

/* --- Top navbar ---------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.5rem;
  padding: 0.85rem 1.75rem;
  background: rgba(8,12,24,0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.topbar-title { display: flex; flex-direction: column; gap: 2px; }
.topbar-crumb {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8b94a7;
  font-weight: 600;
}
.topbar-heading {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: #e6eef6;
  letter-spacing: -0.01em;
}
.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
  justify-self: center;
  width: min(520px, 100%);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 0 0.8rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.topbar-search:focus-within {
  border-color: rgba(139,92,246,0.4);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 4px rgba(139,92,246,0.1);
}
.topbar-search-icon {
  color: #8b94a7;
  font-size: 1rem;
  margin-right: 0.5rem;
}
.topbar-search-input {
  flex: 1;
  padding: 0.6rem 0;
  background: transparent;
  color: #e6eef6;
  border: none;
  outline: none;
  font-size: 0.9rem;
  font-family: inherit;
}
.topbar-search-input::placeholder { color: #8b94a7; }
.topbar-kbd {
  font-size: 0.68rem;
  color: #8b94a7;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 2px 6px;
  background: rgba(255,255,255,0.03);
  letter-spacing: 0.05em;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-self: end;
}
.topbar-right .profile-selector {
  margin: 0;
  padding: 0.35rem 0.6rem;
}
.topbar-avatar {
  width: 38px; height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(135deg, #06b6d4, #8b5cf6);
  color: white;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(139,92,246,0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.topbar-avatar:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(139,92,246,0.5);
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 64px 1fr; }
  .topbar { grid-template-columns: auto 1fr auto; gap: 0.75rem; padding: 0.75rem 1rem; }
  .topbar-search { display: none; }
  .shell-content { padding: 1rem; }
}
