/* =====================================================
   Microhousing Dashboard — Premium UI
   Inspired by image_eee548.jpg
   ===================================================== */

/* ---------- 1. Design tokens ---------- */
:root {
  /* Surfaces */
  --bg: #EEF1F7;
  --bg-soft: #F4F6FA;
  --card: #FFFFFF;
  --card-soft: #F8FAFD;

  /* Text */
  --ink: #0F172A;
  --ink-2: #1F2937;
  --ink-3: #475569;
  --muted: #64748B;
  --muted-2: #94A3B8;
  --line: #E5EAF3;
  --line-soft: #EEF2F7;

  /* Brand accents */
  --blue: #2563EB;
  --blue-2: #1D4ED8;
  --blue-soft: #EEF4FF;
  --blue-tint: #DBE7FF;

  --green: #10B981;
  --green-2: #059669;
  --green-soft: #ECFDF5;
  --green-tint: #D1FAE5;

  --purple: #7C3AED;
  --purple-2: #6D28D9;
  --purple-soft: #F3EEFF;
  --purple-tint: #E9DDFE;

  --amber: #F59E0B;
  --amber-soft: #FEF6E0;
  --amber-tint: #FDE9B7;

  --red: #EF4444;
  --red-2: #DC2626;
  --red-soft: #FEF2F2;
  --red-tint: #FEE2E2;

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 16px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.10), 0 4px 8px rgba(15, 23, 42, 0.05);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ---------- 2. Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* App-like shell: the document body IS the device viewport. It never scrolls;
   only the inner main region scrolls as a fallback on very short screens. */
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1100px 600px at 100% -10%, #DCE7FF 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #D9F6E5 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;          /* fallback for browsers without dvh */
  height: 100dvh;         /* true visible viewport, ignores address-bar flux */
  overflow: hidden;       /* the root viewport must never scroll */
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  overscroll-behavior: none;
  touch-action: manipulation; /* removes the 300ms double-tap-to-zoom delay */
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
  touch-action: manipulation;
}

ul {
  list-style: none;
}

/* ---------- 3. View visibility ---------- */
/* Each view fills the remaining body height and arranges its children
   vertically. Only one view is active at a time. */
.view {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

.view.is-active {
  display: flex;
}

/* =====================================================
   AUTH VIEW
   ===================================================== */
.auth-view.is-active {
  align-items: center;
  justify-content: center;
  overflow-y: auto; /* fallback: tall form on a short phone can still be reached */
  padding: 20px 16px;
  padding: max(16px, env(safe-area-inset-top)) env(safe-area-inset-right, 16px) max(16px, env(safe-area-inset-bottom)) env(safe-area-inset-left, 16px);
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 28px 20px 24px;
  position: relative;
  overflow: hidden;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--purple) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-name {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.auth-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 7.5vw, 32px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.auth-hero h1 .dot {
  color: var(--blue);
}

.auth-hero p {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.55;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0; /* allow inputs to shrink inside grid columns (prevents overflow) */
}

.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}

.field input[type="text"] {
  width: 100%;
  min-width: 0;
  height: 48px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--bg-soft);
  padding: 0 14px;
  font-size: 16px;
  font-weight: 500;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.field input[type="text"]::placeholder {
  color: var(--muted-2);
  font-weight: 400;
}

.field input[type="text"]:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.gender-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gender-fieldset legend {
  padding: 0;
}

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

.chip {
  position: relative;
  cursor: pointer;
}

.chip input[type="radio"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.chip-body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 48px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--bg-soft);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
  transition: all .15s ease;
  -webkit-tap-highlight-color: transparent;
}

.chip-emoji {
  font-size: 16px;
  color: var(--muted);
  transition: color .15s ease;
}

.chip:hover .chip-body {
  border-color: #C7D0E0;
  background: #fff;
}

.chip input[type="radio"]:checked + .chip-body {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-2);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

.chip input[type="radio"]:checked + .chip-body .chip-emoji {
  color: var(--blue);
}

.chip input[type="radio"]:focus-visible + .chip-body {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.btn-primary {
  margin-top: 6px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-2) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-primary svg {
  width: 18px;
  height: 18px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.auth-foot {
  margin: 4px 0 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

.auth-foot a {
  color: var(--blue);
  font-weight: 600;
}

.auth-illustration {
  position: absolute;
  inset: auto 0 -2px 0;
  height: 80px;
  pointer-events: none;
  opacity: 0.7;
}

.auth-illustration svg {
  width: 100%;
  height: 100%;
}

/* =====================================================
   DASHBOARD VIEW — fixed app shell (header / main / nav)
   ===================================================== */
.dashboard-view.is-active {
  /* fills body height; centers the shell horizontally on wide screens */
  justify-content: center;
}

.dashboard-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  height: 100%;
  min-height: 0;
  background: transparent;
  /* horizontal + safe-area padding lives on the shell; the header and main
     manage their own vertical rhythm so the three regions stack cleanly. */
  padding: max(6px, env(safe-area-inset-top)) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
}

/* ---------- MAIN region: the only place that may scroll ---------- */
.app-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 4px 14px 8px;
}

/* ---------- Header ---------- */
.dash-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 18px 10px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0; /* let the greeting text truncate instead of pushing the icons */
}

.avatar {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FCD7C2 0%, #F8B79A 100%);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.avatar[data-gender="male"] {
  background: linear-gradient(135deg, #BBD6FF 0%, #7FA9F1 100%);
  color: #1E3A8A;
}

.avatar[data-gender="other"] {
  background: linear-gradient(135deg, #E9DDFE 0%, #C5A8F5 100%);
  color: #4C1D95;
}

.avatar-initials {
  text-transform: uppercase;
  font-weight: 700;
}

.avatar-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  border: 2.5px solid var(--bg);
  box-sizing: content-box;
}

.header-text { min-width: 0; flex: 1 1 auto; }

.greeting {
  margin: 0;
  font-size: clamp(15.5px, 4.6vw, 20px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.greeting #greeting-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.sun {
  display: inline-flex;
  width: 20px;
  height: 20px;
}

.sub-greeting {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto; /* never shrink or get pushed off-screen */
}

.icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--card);
  display: grid;
  place-items: center;
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, background .12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.icon-btn:active {
  background: var(--bg-soft);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

.dot-badge {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 2px var(--card);
}

/* ---------- Quick nav ---------- */
.quick-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 11px 8px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 11px;
}

.quick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  border-radius: 14px;
  text-align: center;
  transition: background .15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.quick-item:active { background: var(--bg-soft); }

.quick-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
}

.quick-item[data-theme="amber"] .quick-icon { color: var(--amber); background: var(--amber-soft); }
.quick-item[data-theme="green"] .quick-icon { color: var(--green); background: var(--green-soft); }
.quick-item[data-theme="purple"] .quick-icon { color: var(--purple); background: var(--purple-soft); }

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

.quick-text { display: flex; flex-direction: column; line-height: 1.15; }
.quick-title { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.quick-sub { font-size: 10.5px; color: var(--muted); font-weight: 500; margin-top: 1px; }

/* ---------- Card grid ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

/* HOME dashboard: the 4 core cards form a 2×2 grid that fills the available
   height. minmax(0,…) lets cells shrink below their content; each card clips
   or scrolls its own overflow rather than pushing the page. */
.grid:not(.grid--single) {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 9px;
  padding-bottom: 2px;
}

.grid:not(.grid--single) > .card {
  min-height: 0;
  overflow: hidden;
}

/* Single-card tabs (chat / events / profile) fill the main region and let the
   inner main area scroll as the fallback if their content is tall. */
.grid--single {
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: 1fr;
  align-content: start;
}

/* =====================================================
   COMPACT MODE — HOME 4-card app grid
   These overrides only apply to the home dashboard (the non-single grid),
   shrinking each card so all four fit the viewport simultaneously. Each
   card distributes its content with space-between and clips/scrolls
   internally rather than pushing the page.
   ===================================================== */
.grid:not(.grid--single) > .card {
  padding: 9px 12px;
  gap: 3px;
  justify-content: space-between;
}
.grid:not(.grid--single) .card-head { align-items: center; }
.grid:not(.grid--single) .card-title { font-size: clamp(12.5px, 3.6vw, 14px); }
.grid:not(.grid--single) .card-sub { margin-top: 0; font-size: clamp(9.5px, 2.8vw, 11px); }

/* Hide the supplementary insight banners in compact mode to reclaim height */
.grid:not(.grid--single) .insight { display: none; }

/* Card bodies flex to fill the row and centre their content */
.grid:not(.grid--single) .card-body {
  flex: 1 1 auto;
  min-height: 0;
  gap: 4px;
  justify-content: center;
}

/* Gauges scale to the (narrow) card width instead of a fixed pixel size */
.grid:not(.grid--single) .arc-wrap {
  max-width: min(86%, 150px);
  max-height: 100%;
  margin: 0 auto;
}
.grid:not(.grid--single) .arc-pct { font-size: clamp(19px, 5.4vw, 26px); }
.grid:not(.grid--single) .arc-cap { font-size: 9.5px; margin-top: 1px; }
.grid:not(.grid--single) .bolt { width: 17px; height: 17px; margin-bottom: 0; }
.grid:not(.grid--single) .energy-stats { margin-top: 0; gap: 6px; grid-template-columns: 1fr 1fr; }
.grid:not(.grid--single) .stat { padding: 0; }
.grid:not(.grid--single) .stat-val { font-size: clamp(11px, 3.2vw, 13px); }
.grid:not(.grid--single) .stat-label { font-size: 9.5px; margin-top: 0; }

/* Energy & Capital: gauge on top, stats below (cards are narrow but tall) */
.grid:not(.grid--single) .energy-body,
.grid:not(.grid--single) .capital-body {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.grid:not(.grid--single) .slider-wrap {
  margin-top: 2px;
  padding: 6px 9px;
  gap: 3px;
}
.grid:not(.grid--single) .slider-head { font-size: 10.5px; }
.grid:not(.grid--single) .slider-labels { font-size: 9.5px; }
.grid:not(.grid--single) .slider { height: 7px; }

/* Social Credit: smaller hex + value, jobs scroll inside the card */
.grid:not(.grid--single) .credit-top { gap: 10px; padding: 0; }
.grid:not(.grid--single) .hex { width: 42px; height: 42px; }
.grid:not(.grid--single) .credit-value { font-size: clamp(22px, 6.5vw, 30px); }
.grid:not(.grid--single) .credit-label { font-size: 10px; margin-top: 0; }
.grid:not(.grid--single) .jobs-grid {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  gap: 4px;
  margin-top: 2px;
  /* fade the bottom edge so an overflowing list reads as "scroll for more" */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 14px), transparent);
  scrollbar-width: none;
}
.grid:not(.grid--single) .jobs-grid::-webkit-scrollbar { display: none; }
.grid:not(.grid--single) .job-btn { padding: 7px 9px; }
.grid:not(.grid--single) .job-name { font-size: 11px; }
.grid:not(.grid--single) .job-pts { font-size: 12px; padding: 1px 6px; }
.grid:not(.grid--single) .credit-trend { margin-top: 4px; font-size: 10px; padding: 2px 7px 2px 5px; }
.grid:not(.grid--single) .jobs-head { margin-top: 5px; font-size: 10px; }
.grid:not(.grid--single) .jobs-hint { font-size: 9px; }

/* Home Energy compact: keep the chart prominent, trim the chrome */
.grid:not(.grid--single) .energy-body { justify-content: flex-start; gap: 7px; }
.grid:not(.grid--single) .energy-chart { min-height: 40px; }
.grid:not(.grid--single) .energy-status { font-size: 10px; padding: 2px 7px; }
.grid:not(.grid--single) .energy-of { font-size: 11.5px; }
.grid:not(.grid--single) .energy-pill { font-size: 12px; padding: 3px 8px; }

/* Capital compact: smaller gauge so the milestones + slider all fit */
.grid:not(.grid--single) .card--capital .arc-wrap { max-width: min(74%, 130px); }
/* Keep the percentage compact and baseline-anchored so the arc reads above it */
.grid:not(.grid--single) .card--capital .arc-pct { font-size: clamp(15px, 4.3vw, 19px); }
.grid:not(.grid--single) .card--capital .arc-cap { font-size: 9px; margin-top: 0; }
.grid:not(.grid--single) .milestones { padding: 0 2px; }
.grid:not(.grid--single) .milestone-track { margin: 0 8px 14px; height: 5px; }
.grid:not(.grid--single) .milestone-dot { width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; }
.grid:not(.grid--single) .milestone-dot b { font-size: 8px; top: 11px; }

.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 14px 14px 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 9px;
  border: 1px solid var(--line-soft);
  transition: transform .15s ease, box-shadow .15s ease;
}

.card:hover { box-shadow: var(--shadow-md); }

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

.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.card-title .num {
  color: var(--blue);
  font-weight: 700;
}

.card--credit .card-title .num { color: var(--green); }
.card--capital .card-title .num { color: var(--purple); }
.card--community .card-title .num { color: var(--amber); }

.card-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #B45309;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ai-badge svg { width: 12px; height: 12px; }

/* ---------- Card 1 / 3: Arc wrap ---------- */
.card-body { display: flex; flex-direction: column; gap: 8px; }

.arc-wrap {
  position: relative;
  width: 100%;
  max-width: 210px;
  margin: 0 auto;
  aspect-ratio: 200 / 122;
  display: grid;
  place-items: center;
}

.arc {
  width: 100%;
  height: 100%;
  display: block;
}

.arc-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Anchor the readout to the gauge baseline so the arc sits clearly above
     the percentage instead of the number riding up into the arc. */
  justify-content: flex-end;
  padding-bottom: 2px;
  pointer-events: none;
}

.bolt {
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
}

.arc-pct {
  font-size: clamp(26px, 7.5vw, 32px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--blue-2);
  line-height: 1;
}

.arc-pct--purple { color: var(--purple-2); }

.arc-cap {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 500;
}

/* Energy stats */
.energy-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: -6px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4px 0;
}

.stat-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.stat-label {
  font-size: 11.5px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  font-weight: 500;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
}

.dot--blue { background: var(--blue); }
.dot--gray { background: #CBD5E1; }
.dot--green { background: var(--green); }
.dot--purple { background: var(--purple); }
.dot--lightpurple { background: #D8B4FE; }

/* Insight banners */
.insight {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 12.5px;
  font-weight: 500;
}

.insight--blue { background: var(--blue-soft); color: #1E3A8A; }
.insight--green { background: var(--green-soft); color: #065F46; }
.insight--purple { background: var(--purple-soft); color: #4C1D95; }

.insight-icon {
  display: inline-flex;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}

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

.insight-text { flex: 1; line-height: 1.35; }

.insight-arrow {
  font-size: 18px;
  font-weight: 500;
  opacity: 0.55;
}

/* ---------- Card 1: Home Energy ---------- */
.energy-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-2);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.energy-pill-ico { width: 13px; height: 13px; }

.energy-body { gap: 8px; }

.energy-readout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.energy-figure { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.energy-used {
  font-size: clamp(24px, 7vw, 32px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.energy-of { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.energy-status {
  font-size: 11px;
  font-weight: 700;
  color: var(--green-2);
  background: var(--green-soft);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Weekly mini bar-chart */
.energy-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 5px;
  flex: 1 1 auto;
  min-height: 38px;
}
.ebar { display: flex; flex-direction: column; align-items: center; gap: 3px; height: 100%; min-height: 0; }
.ebar-col { display: flex; align-items: flex-end; width: 100%; flex: 1 1 auto; min-height: 0; }
.ebar-fill {
  width: 100%;
  border-radius: 5px 5px 3px 3px;
  background: linear-gradient(180deg, #60A5FA 0%, var(--blue-2) 100%);
  min-height: 4px;
}
.ebar-fill--over { background: linear-gradient(180deg, #FB923C 0%, var(--red) 100%); }
.ebar-day { font-size: 9px; font-weight: 600; color: var(--muted-2); line-height: 1; }

/* Used-vs-target progress bar */
.energy-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.energy-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #60A5FA 0%, var(--blue-2) 100%);
  transition: width .5s ease;
}

/* Caution (approaching target) + Warning (over target) card states */
.card--energy.card--caution {
  border-color: var(--amber-tint);
  background: linear-gradient(180deg, #FFFBF2 0%, var(--card) 60%);
}
.card--energy.card--caution .energy-pill,
.card--energy.card--caution .energy-status { color: #B45309; background: var(--amber-soft); }
.card--energy.card--caution .energy-bar-fill { background: linear-gradient(90deg, var(--amber) 0%, #D97706 100%); }

.card--energy.card--warning {
  border-color: var(--red);
  background: linear-gradient(180deg, var(--red-soft) 0%, var(--card) 72%);
  box-shadow: 0 0 0 1px var(--red-tint), var(--shadow-sm);
}
.card--energy.card--warning .card-title .num { color: var(--red); }
.card--energy.card--warning .energy-pill,
.card--energy.card--warning .energy-status { color: #fff; background: var(--red); }
.card--energy.card--warning .energy-used { color: var(--red-2); }
.card--energy.card--warning .energy-bar-fill { background: linear-gradient(90deg, #F87171 0%, var(--red-2) 100%); }

/* ---------- Card 2: Social Credit ---------- */
.credit-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 2px 4px;
}

.hex {
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 6px 12px rgba(16, 185, 129, 0.30));
  flex-shrink: 0;
}

.credit-num {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.credit-value {
  font-size: clamp(30px, 9vw, 40px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--green-2);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.credit-label {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 500;
}

.credit-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-2);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  align-self: flex-start;
}
.credit-trend svg { width: 12px; height: 12px; }

.jobs-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.jobs-hint {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted-2);
  text-transform: none;
  letter-spacing: 0;
}

.jobs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 6px;
  margin-top: 4px;
}

.job-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 10px;
  border-radius: 10px;
  background: var(--amber-soft);
  color: #92400E;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  text-align: left;
  line-height: 1.2;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background .12s ease, transform .12s ease;
}

.job-btn:active {
  background: var(--amber-tint);
}

.job-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.job-btn--claimed {
  background: var(--green-soft);
  color: #065F46;
}

.job-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-pts {
  font-size: 14px;
  font-weight: 800;
  color: var(--green-2);
  background: rgba(255,255,255,0.55);
  padding: 2px 8px;
  border-radius: 8px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.action-btn {
  flex: 1 1 calc(50% - 3px);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 10px;
  border-radius: 10px;
  background: var(--green-soft);
  color: #065F46;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background .12s ease, transform .12s ease, border-color .12s ease;
  text-align: left;
  line-height: 1.2;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.action-btn span:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-btn:active {
  background: var(--green-tint);
}

.action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.action-pts {
  font-weight: 700;
  color: var(--green-2);
  background: rgba(255, 255, 255, 0.55);
  padding: 2px 6px;
  border-radius: 6px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ---------- Card 3: Slider ---------- */
.slider-wrap {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--purple-soft);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: #4C1D95;
}

.slider-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--purple-2);
  background: rgba(255, 255, 255, 0.7);
  padding: 2px 8px;
  border-radius: 8px;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--blue) 50%, var(--purple) 50%, var(--purple) 100%);
  outline: none;
  cursor: pointer;
  touch-action: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--purple);
  box-shadow: 0 3px 12px rgba(124, 58, 237, 0.40);
  cursor: grab;
  transition: transform .12s ease;
}

.slider::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.15); }

.slider::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--purple);
  box-shadow: 0 3px 12px rgba(124, 58, 237, 0.40);
  cursor: grab;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 600;
}

.slider-labels span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- Card 3: Capital milestone markers ---------- */
.milestones { padding: 2px 4px 0; }
.milestone-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--purple-tint);
  margin: 0 8px 16px;
}
.milestone-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--purple) 0%, var(--purple-2) 100%);
  transition: width .5s ease;
}
.milestone-dot {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--purple-tint);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  transition: background .25s ease, border-color .25s ease;
}
.milestone-dot b {
  position: absolute;
  top: 13px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.milestone-dot[data-at="100"] b { left: auto; right: 0; transform: none; }
.milestone-dot.is-reached { background: var(--purple); border-color: var(--purple); }
.milestone-dot.is-reached b { color: var(--purple-2); }

/* =====================================================
   CHAT TAB — fills the main region: chat card on top,
   group switcher in the space below.
   ===================================================== */
.chat-tab {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-card {
  flex: 1 1 auto;
  min-height: 0;
}

.chat-card .card-body {
  flex: 1 1 auto;
  min-height: 0;
}

/* The feed expands to fill the card; the composer stays pinned at the bottom */
.chat-card .feed {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.group-switcher {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.group-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1.5px solid var(--line-soft);
  box-shadow: var(--shadow-sm);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: transform .12s ease, border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.group-emoji {
  font-size: 21px;
  line-height: 1;
}

.group-btn:active { transform: scale(0.96); }

.group-btn.is-active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-2);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10), var(--shadow-sm);
}

/* ---------- Card 4: Community Hub ---------- */
.feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 2px;
  margin: 0 -2px 4px 0;
}

.feed::-webkit-scrollbar { width: 4px; }
.feed::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px;
  background: var(--bg-soft);
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  animation: feedIn .25s ease;
}

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

.feed-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #BBD6FF 0%, #7FA9F1 100%);
  color: #1E3A8A;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}

.feed-avatar[data-gender="female"] { background: linear-gradient(135deg, #FCD7C2 0%, #F8B79A 100%); color: #7C2D12; }
.feed-avatar[data-gender="other"] { background: linear-gradient(135deg, #E9DDFE 0%, #C5A8F5 100%); color: #4C1D95; }

.feed-content { flex: 1; min-width: 0; }
.feed-name { font-size: 12px; font-weight: 700; color: var(--ink); }
.feed-msg { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; word-wrap: break-word; margin-top: 1px; }
.feed-time { font-size: 10.5px; color: var(--muted-2); margin-top: 3px; font-weight: 500; }

.composer {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.composer input {
  flex: 1;
  height: 44px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 16px;
  background: var(--bg-soft);
  outline: none;
  transition: border-color .15s ease, background .15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.composer input::placeholder { color: var(--muted-2); }

.composer input:focus {
  border-color: var(--amber);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--amber) 0%, #D97706 100%);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.30);
  transition: transform .12s ease;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.send-btn:active { transform: translateY(-1px); }
.send-btn svg { width: 18px; height: 18px; }

/* ---------- Events tab ---------- */
.event-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-textarea {
  width: 100%;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--bg-soft);
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 500;
  outline: none;
  resize: vertical;
  min-height: 52px;
  font-family: inherit;
  color: inherit;
  transition: border-color .15s ease, background .15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.field-textarea:focus {
  border-color: var(--purple);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

.field-input {
  width: 100%;
  height: 46px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--bg-soft);
  padding: 0 12px;
  font-size: 16px;
  font-weight: 500;
  outline: none;
  transition: border-color .15s ease, background .15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.field-input:focus {
  border-color: var(--purple);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

.events-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.event-card {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  animation: feedIn .25s ease;
}

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

.event-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.event-card-desc {
  font-size: 12.5px;
  color: var(--ink-3);
  margin: 4px 0;
  line-height: 1.4;
}

.event-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11.5px;
  color: var(--muted);
  margin: 6px 0 8px;
}

.event-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.event-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 2px;
}

.event-card-attendees {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}

.event-card-attendees strong {
  color: var(--ink);
  font-weight: 700;
}

.join-btn {
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  transition: opacity .12s ease, transform .12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.join-btn:active {
  opacity: 0.8;
  transform: scale(0.96);
}

.join-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.join-btn--joined {
  background: var(--muted-2);
}

/* ---------- Footer banner ---------- */
.foot-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  margin-top: 11px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line-soft);
}

.foot-text { display: flex; gap: 12px; align-items: center; }

.foot-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green-2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.foot-icon svg { width: 18px; height: 18px; }

.foot-title { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.foot-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

.city {
  width: 110px;
  height: 48px;
  flex-shrink: 0;
  opacity: 0.7;
}

/* ---------- Bottom nav (fixed bottom region of the shell) ---------- */
.bottom-nav {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 6px 6px;
  padding: 6px env(safe-area-inset-right, 6px) calc(6px + env(safe-area-inset-bottom, 0px)) env(safe-area-inset-left, 6px);
  margin: 0 8px;
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08);
  border: 1px solid var(--line-soft);
  border-bottom: none;
  z-index: 50;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  border-radius: 12px;
  transition: color .15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

.nav-item.is-active { color: var(--blue); }
.nav-item:active { color: var(--ink); }

.nav-item--center {
  position: relative;
  height: 100%;
  display: grid;
  place-items: center;
}

.nav-center-circle {
  position: absolute;
  top: -22px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-2) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.40);
  border: 4px solid var(--bg);
  transition: transform .12s ease;
}

.nav-center-circle:active { transform: translateY(-2px); }
.nav-center-circle svg { width: 24px; height: 24px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  padding: 14px 22px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 100;
  max-width: calc(100vw - 48px);
  text-align: center;
  width: auto;
}

.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast--success { background: linear-gradient(135deg, #10B981 0%, #059669 100%); }
.toast--error   { background: linear-gradient(135deg, #EF4444 0%, #B91C1C 100%); }

/* ---------- Responsive / adaptive ----------
   The fixed app shell already adapts via flex + dvh. These rules fine-tune the
   extremes: tiny phones, large phones, tablets, and short landscape screens. */

/* Very small / short phones (iPhone SE, older Androids) */
@media (max-width: 360px) {
  .app-main { padding: 4px 10px 6px; }
  .dash-header { padding: 8px 12px; gap: 8px; }
  .header-left { gap: 9px; }
  .header-right { gap: 6px; }
  .icon-btn { width: 40px; height: 40px; }
  .auth-card { padding: 22px 16px 18px; }
}

/* Hide the decorative sun on narrow screens so the user's name has room */
@media (max-width: 400px) {
  .sun { display: none; }
}

/* Short viewports (small phones in portrait, or any landscape) — give the
   main region a tighter header/footer so the 4 cards keep their room. */
@media (max-height: 680px) {
  .auth-brand { margin-bottom: 16px; }
  .auth-hero p { margin-bottom: 18px; }
  .grid:not(.grid--single) .insight { display: none; }
}

/* Large phones / phablets — a touch more width */
@media (min-width: 430px) {
  .dashboard-shell,
  .auth-card { max-width: 480px; }
}

/* Landscape phones (wide but short): 2×2 card grid so all four still fit */
@media (orientation: landscape) and (max-height: 560px) {
  .dashboard-shell { max-width: 760px; }
  .grid:not(.grid--single) {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
  .grid:not(.grid--single) .energy-body,
  .grid:not(.grid--single) .capital-body { gap: 10px; }
}

/* Tablets and up — center a comfortably wide shell; keep app-like fit */
@media (min-width: 720px) {
  .dashboard-shell { max-width: 560px; }
  .app-main { padding: 6px 18px 10px; }
}

/* Subtle entrance animations */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card { animation: cardIn .35s ease both; }
.card:nth-child(1) { animation-delay: 0.02s; }
.card:nth-child(2) { animation-delay: 0.08s; }
.card:nth-child(3) { animation-delay: 0.14s; }
.card:nth-child(4) { animation-delay: 0.20s; }
