:root {
  --page-bg: linear-gradient(180deg,#0B1120 0%,#0E1526 100%);
  --topbar-bg: #0F1626;
  --surface: #131B2E;
  --surface-border: #232D42;
  --card-shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 24px rgba(0,0,0,.3);
  --text: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-tertiary: #64748B;
  --divider: #232D42;
  --input-border: #2E3A54;
  --input-bg: #0F1626;
  --hover-surface: #1B2436;
  --topbar-shadow: 0 1px 0 rgba(0,0,0,.5);
  --auth-glow: radial-gradient(circle at 50% -10%, rgba(124,58,237,.28) 0%, rgba(124,58,237,0) 55%);
  --skel-a: #1B2436;
  --skel-b: #243049;
  --danger-bg: rgba(220,38,38,.14);
  --danger-border: rgba(220,38,38,.4);
  --danger-text: #FCA5A5;
  --info-bg: rgba(59,130,246,.12);
  --info-border: rgba(59,130,246,.35);
  --info-text: #93C5FD;
  --warn-bg: rgba(217,119,6,.14);
  --warn-border: rgba(217,119,6,.4);
  --warn-text: #FCD34D;
  --good-tint: rgba(22,163,74,.16);
}

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

body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--page-bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: #60A5FA; text-decoration: none; }
a:hover { text-decoration: underline; }

input, button, select { font-family: inherit; }
::placeholder { color: var(--text-tertiary); }

/* ── Layout ─────────────────────────────────────────── */

.app-layout {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
}

.app-layout.sidebar-collapsed {
  grid-template-columns: 68px 1fr;
}

/* ── Sidebar ────────────────────────────────────────── */

.sidebar {
  background: #0B1120;
  border-right: 1px solid var(--surface-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 236px;
  z-index: 100;
  transition: width .2s;
}

.sidebar-collapsed .sidebar { width: 68px; }

.sidebar-brand {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--surface-border);
}

.sidebar-brand .logo-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(79,70,229,.35);
}

.sidebar-brand .logo-icon svg { width: 14px; height: 14px; }

.sidebar-brand .brand-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #4F46E5, #A78BFA);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--hover-surface);
  color: var(--text);
}

.nav-item.active {
  background: rgba(79,70,229,.2);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79,70,229,.35);
}

.nav-item .nav-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-item.active .nav-icon {
  background: rgba(255,255,255,.22);
}

.nav-item .nav-icon svg { width: 14px; height: 14px; }

.nav-divider {
  height: 1px;
  background: var(--surface-border);
  margin: 8px 10px;
}

/* ── Main Content ───────────────────────────────────── */

.main-content {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────── */

.topbar {
  height: 54px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--surface-border);
  box-shadow: var(--topbar-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.project-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  max-width: 200px;
  overflow: hidden;
}

.project-switcher span:nth-child(2) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-switcher:hover { border-color: var(--text-tertiary); }

.project-switcher-wrap { position: relative; }

.project-dropdown {
  position: absolute;
  top: 40px;
  left: 0;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.45);
  padding: 6px;
  z-index: 200;
  display: none;
  animation: dropdownIn .12s ease-out;
}

.project-dropdown.show { display: block; }

.project-dropdown-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px 10px 4px;
}

.project-dropdown-divider {
  height: 1px;
  background: var(--divider);
  margin: 4px 6px;
}

.project-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 7px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all .1s;
  position: relative;
}

.project-dropdown-item:hover { background: var(--hover-surface); color: var(--text); }
.project-dropdown-item.active { background: rgba(79,70,229,.12); color: #fff; }
.project-dropdown-item.create { color: #A78BFA; }
.project-dropdown-item.create:hover { background: rgba(139,92,246,.1); }

.project-dropdown-item > svg { margin-left: auto; flex-shrink: 0; }

.project-dropdown-item > div {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-dropdown-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-dropdown-item.active .project-dropdown-name { color: #fff; }

.project-dropdown-domain {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.project-dropdown-item.active .project-dropdown-domain { color: var(--text-secondary); }

.project-delete-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s, color .15s, background .15s;
  z-index: 1;
}
.project-dropdown-item:hover .project-delete-btn { opacity: 1; pointer-events: auto; }
.project-delete-btn:hover { color: #F87171; background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.3); }

.project-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.budget-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
}

.budget-bar {
  width: 16px;
  height: 5px;
  background: var(--divider);
  border-radius: 2px;
  overflow: hidden;
}

.budget-bar-fill {
  height: 100%;
  background: #16A34A;
  border-radius: 2px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.user-menu:hover { background: var(--hover-surface); }

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #1E293B;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

/* ── Page Content ───────────────────────────────────── */

.page-content {
  padding: 20px 24px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Range Selector ─────────────────────────────────── */

.range-selector {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--hover-surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 2px;
}

.range-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
}

.range-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15,23,42,.08);
}

/* ── KPI Tiles ──────────────────────────────────────── */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-tile {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 13px 16px;
}

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

.kpi-label-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.kpi-icon {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon svg { width: 12px; height: 12px; }

.kpi-label {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: -0.02em;
  line-height: 1;
}

.kpi-trend {
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 5px;
}

.kpi-trend.up { color: #16A34A; }
.kpi-trend.down { color: #DC2626; }

.kpi-trend-label {
  color: var(--text-tertiary);
  font-weight: 500;
}

.kpi-sparkline {
  flex-shrink: 0;
}

/* ── Two Column Grid ────────────────────────────────── */

.two-col-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 12px;
}

/* ── Card ───────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

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

.card-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}

.card-link {
  font-size: 12px;
  color: #60A5FA;
}

/* ── Budget ─────────────────────────────────────────── */

.budget-summary {
  font-size: 11.5px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.budget-summary strong {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-secondary);
  font-weight: 600;
}

.budget-row {
  margin-bottom: 11px;
}

.budget-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.budget-row-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.budget-row-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.budget-row-value {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: 'IBM Plex Mono', monospace;
}

.budget-bar-track {
  height: 7px;
  background: var(--divider);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.budget-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s;
}

/* ── Activity Feed ──────────────────────────────────── */

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border-bottom: 1px solid var(--divider);
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon svg { width: 12px; height: 12px; }

.activity-text {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.4;
}

.activity-time {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ── Quick Links ────────────────────────────────────── */

.quick-links-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.quick-link-card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 13px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quick-link-card:hover { border-color: var(--text-tertiary); }

.quick-link-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-link-icon svg { width: 16px; height: 16px; }

.quick-link-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.quick-link-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* ── Auth Pages ─────────────────────────────────────── */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page-bg);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--card-shadow);
  position: relative;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 120px;
  background: var(--auth-glow);
  pointer-events: none;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 32px;
  position: relative;
}

.auth-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(79,70,229,.35);
}

.auth-logo-icon svg { width: 16px; height: 16px; }

.auth-logo-text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.auth-heading {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
}

.auth-subheading {
  font-size: 12.5px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}

.form-input:focus {
  border-color: #4F46E5;
  box-shadow: 0 0 0 2px rgba(79,70,229,.2);
}

.btn-primary {
  width: 100%;
  padding: 11px;
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}

.btn-primary:hover { opacity: .9; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-switch a {
  color: #60A5FA;
  font-weight: 500;
}

.auth-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: none;
}

.auth-error.show { display: block; }

/* ── Empty State ────────────────────────────────────── */

.empty-state {
  max-width: 480px;
  margin: 64px auto 0;
  text-align: center;
}

.empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.empty-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 20px;
}

.empty-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-secondary {
  padding: 9px 16px;
  border-radius: 7px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover { border-color: var(--text-tertiary); }

.btn-ghost {
  padding: 8px 16px;
  border-radius: 7px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.btn:hover { border-color: var(--text-tertiary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-sm {
  padding: 6px 12px;
  font-size: 11px;
}

.btn-primary-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 7px;
  border: none;
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: #fff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
  white-space: nowrap;
}

.btn-primary-sm:hover { opacity: .9; }
.btn-primary-sm:disabled { opacity: .5; cursor: not-allowed; }

/* ── Banner ─────────────────────────────────────────── */

.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12.5px;
  margin-bottom: 12px;
}

.banner.info {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info-text);
}

.banner.danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
}

.banner-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.banner-icon svg { width: 13px; height: 13px; }

.banner-text { flex: 1; padding-top: 2px; }
.banner-text a { color: inherit; font-weight: 600; }

.banner-close {
  background: none;
  border: none;
  color: inherit;
  opacity: .6;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
}

/* ── Skeleton ───────────────────────────────────────── */

@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skel {
  background: linear-gradient(90deg, var(--skel-a) 25%, var(--skel-b) 37%, var(--skel-a) 63%);
  background-size: 400px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
}

/* ── Utilities ──────────────────────────────────────── */

.hidden { display: none !important; }

/* ── User Dropdown ──────────────────────────────────── */

.user-menu-wrap { position: relative; }

.user-dropdown {
  position: absolute;
  top: 44px;
  right: 0;
  width: 200px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.45);
  padding: 6px;
  z-index: 200;
  display: none;
  animation: dropdownIn .12s ease-out;
}

.user-dropdown.show { display: block; }

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 7px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all .1s;
}

.user-dropdown-item:hover {
  background: var(--hover-surface);
  color: var(--text);
}

.user-dropdown-item svg { width: 14px; height: 14px; flex-shrink: 0; }

.user-dropdown-divider {
  height: 1px;
  background: var(--divider);
  margin: 4px 6px;
}

.user-dropdown-item.danger {
  color: #F87171;
}

.user-dropdown-item.danger:hover {
  background: var(--danger-bg);
  color: #FCA5A5;
}

.user-dropdown-header {
  padding: 8px 10px 6px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 4px;
}

.user-dropdown-header .dropdown-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.user-dropdown-header .dropdown-email {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

/* ── Modal ──────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn .12s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 48px rgba(0,0,0,.5);
  animation: modalIn .15s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 0;
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: var(--hover-surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .1s;
}

.modal-close:hover { background: var(--surface-border); color: var(--text); }
.modal-close svg { width: 14px; height: 14px; }

.modal-body { padding: 16px 20px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 20px 16px;
}

.modal-success {
  background: var(--good-tint);
  border: 1px solid rgba(22,163,74,.35);
  color: #86EFAC;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  display: none;
}

.modal-success.show { display: block; }

/* ── Toast Notifications ─────────────────────────────── */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  animation: toastIn .25s ease-out;
  pointer-events: all;
  min-width: 280px;
  max-width: 400px;
}

.toast.success { border-left: 3px solid #16A34A; }
.toast.error { border-left: 3px solid #DC2626; }
.toast.info { border-left: 3px solid #3B82F6; }

.toast-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast.success .toast-icon { background: rgba(22,163,74,.18); color: #4ADE80; }
.toast.error .toast-icon { background: rgba(220,38,38,.18); color: #F87171; }
.toast.info .toast-icon { background: rgba(59,130,246,.18); color: #60A5FA; }

.toast-msg { font-size: 13px; color: var(--text); flex: 1; }
.toast-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 2px;
  display: flex;
  flex-shrink: 0;
}
.toast-close:hover { color: var(--text); }

.toast.removing { animation: toastOut .2s ease-in forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 768px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 200;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .topbar-left { display: flex; align-items: center; gap: 10px; }
  .hamburger {
    display: flex !important;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
  }
  .mobile-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 199;
  }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .range-selector { align-self: flex-start; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .stat-grid { grid-template-columns: 1fr !important; }
  .grid-2 { grid-template-columns: 1fr !important; }
  .grid-3 { grid-template-columns: 1fr !important; }
  .grid-4 { grid-template-columns: repeat(2, 1fr) !important; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 600px; }
  .modal-card { margin: 16px; max-height: calc(100vh - 32px); }
  .project-dropdown { width: calc(100vw - 32px); left: 16px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr !important; }
  .grid-4 { grid-template-columns: 1fr !important; }
}

/* ── Page-specific responsive ─────────────────────── */

@media (max-width: 768px) {
  .page-kw-tracker .grid-2,
  .page-usage-costs .grid-2 { grid-template-columns: 1fr !important; }
  .page-kw-tracker table,
  .page-usage-costs table { min-width: 500px; }
}

/* Settings Tabs */
.settings-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 4px;
  width: fit-content;
}

.settings-tab {
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-tertiary);
  background: none;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: all .15s;
}

.settings-tab:hover { color: var(--text-secondary); background: var(--hover-surface); }
.settings-tab.active { color: var(--text); background: rgba(79,70,229,.12); }

/* Right-side sheet */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn .15s ease;
}
.sheet-panel {
  width: 520px;
  max-width: 90vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--surface-border);
  box-shadow: -8px 0 30px rgba(0,0,0,.4);
  display: flex;
  flex-direction: column;
  animation: slideInRight .2s ease;
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--divider);
}
.sheet-title { font-size: 15px; font-weight: 600; color: var(--text); }
.sheet-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all .15s;
}
.sheet-close:hover { color: var(--text); background: var(--hover-surface); }
.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.sheet-section { margin-bottom: 20px; }
.sheet-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}
.sheet-section-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.sheet-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  margin: 2px 4px 2px 0;
}
.sheet-outline-item {
  padding: 8px 12px;
  background: var(--hover-surface);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text);
  border-left: 3px solid #F59E0B;
}
.sheet-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
}
.sheet-loading-text {
  font-size: 13px;
  color: var(--text-secondary);
}
.sheet-error {
  padding: 20px;
  text-align: center;
  color: var(--danger-text);
  font-size: 13px;
}
.sheet-actions {
  padding: 12px 20px;
  border-top: 1px solid var(--divider);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
