/* =========================================================================
   VOLTARA ENERGY — Design System
   Powering a Sustainable Future
   -------------------------------------------------------------------------
   Layer order:
   1. Tokens (color, type, radius, elevation, motion)
   2. Base + typography
   3. Layout shell (sidebar / header / bottom nav)
   4. Components (cards, stats, buttons, forms, tables, timeline, states)
   5. Signature: The Grid (energy flow) + motion utilities
   ========================================================================= */

/* ---------- 1. TOKENS -------------------------------------------------- */
:root {
  /* Brand */
  --green-700: #064420;   /* Dark Green   */
  --green-600: #0B6B2F;   /* Primary      */
  --green-400: #49B848;   /* Secondary    */
  --gold:      #F5B400;   /* Solar        */
  --hydro:     #0C7CD5;   /* Hydro        */

  /* Surfaces */
  --bg:        #F7FAF8;
  --surface:   #FFFFFF;
  --surface-2: #FFFFFF;
  --border:    #E5E7EB;

  /* Text */
  --ink:       #1F2937;
  --ink-soft:  #55606E;
  --ink-mute:  #8A94A2;

  /* Gradients */
  --grad-brand: linear-gradient(135deg, #0B6B2F 0%, #49B848 100%);
  --grad-solar: linear-gradient(135deg, #F5B400 0%, #FFD766 100%);
  --grad-hydro: linear-gradient(135deg, #0C7CD5 0%, #56B7F5 100%);
  --grad-deep:  linear-gradient(150deg, #04331A 0%, #064420 45%, #0B6B2F 100%);
  --grad-panel: linear-gradient(150deg, #FFFFFF 0%, #EEF7F0 55%, #E3F1E6 100%);

  /* Elevation — soft, low-spread, green-tinted */
  --e1: 0 1px 2px rgba(6, 68, 32, .05);
  --e2: 0 4px 16px -4px rgba(6, 68, 32, .10), 0 1px 3px rgba(6, 68, 32, .04);
  --e3: 0 18px 44px -18px rgba(6, 68, 32, .26), 0 2px 8px rgba(6, 68, 32, .05);
  --glow-green: 0 10px 30px -10px rgba(73, 184, 72, .55);

  /* Radius */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;

  /* Motion */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --fast: .18s var(--ease);
  --base: .32s var(--ease);
  --slow: .6s var(--ease);

  --sidebar-w: 268px;
  --sidebar-w-collapsed: 84px;
  --header-h: 72px;
}

html.dark {
  --bg:        #071410;
  --surface:   #0D1F18;
  --surface-2: #102A20;
  --border:    #1E3A2C;
  --ink:       #E9F2EC;
  --ink-soft:  #A9BDB2;
  --ink-mute:  #74897E;
  --grad-panel: linear-gradient(150deg, #102A20 0%, #0D1F18 60%, #0B241B 100%);
  --e1: 0 1px 2px rgba(0,0,0,.4);
  --e2: 0 4px 16px -4px rgba(0,0,0,.5);
  --e3: 0 18px 44px -18px rgba(0,0,0,.7);
}

/* ---------- 2. BASE ---------------------------------------------------- */
* { -webkit-tap-highlight-color: transparent; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: "cv02","cv03","cv04";
  -webkit-font-smoothing: antialiased;
  transition: background .4s var(--ease), color .4s var(--ease);
}

h1, h2, h3, h4, .font-display {
  font-family: 'Poppins', 'Inter', sans-serif;
  letter-spacing: -.022em;
  color: var(--ink);
}

/* Montserrat is the utility/data face: numerals, meters, eyebrows */
.data, .stat-value, .eyebrow, .kpi {
  font-family: 'Montserrat', 'Inter', sans-serif;
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-mute);
}

.muted  { color: var(--ink-soft); }
.mutest { color: var(--ink-mute); }

.gradient-text {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

::selection { background: rgba(73,184,72,.25); }

/* Focus visibility — quality floor, never removed */
:focus-visible {
  outline: 2px solid var(--green-400);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--green-400); background-clip: content-box; }

/* ---------- 3. SHELL ---------------------------------------------------- */
/* MOBILE FIRST. The base layer below IS the phone layout: off-canvas drawer,
   fixed bottom nav, single column, 44px touch targets. Desktop is added back
   in one @media (min-width:1024px) block at the end of this section.        */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  width: min(var(--sidebar-w), 86vw);
  flex: 0 0 auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 50;
  /* phone: a drawer parked off-screen */
  position: fixed; inset: 0 auto 0 0; height: 100dvh;
  transform: translateX(-102%);
  box-shadow: var(--e3);
  transition: width var(--base), flex-basis var(--base), transform var(--base);
}
.is-drawer-open .sidebar { transform: translateX(0); }

.scrim {
  position: fixed; inset: 0; z-index: 45;
  background: rgba(4,20,12,.55);
  backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--base);
}
.is-drawer-open .scrim { opacity: 1; pointer-events: auto; }
.is-drawer-open { overflow: hidden; }
.sidebar__brand { display: flex; align-items: center; gap: 12px; height: var(--header-h); padding: 0 22px; flex: 0 0 auto; }
.sidebar__scroll { overflow-y: auto; overflow-x: hidden; padding: 8px 14px 24px; flex: 1 1 auto; }
.sidebar__group { margin-top: 22px; }
.sidebar__group > .eyebrow { padding: 0 12px 10px; display: block; }

.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; margin-bottom: 2px;
  border-radius: 12px;
  color: var(--ink-soft);
  font-size: 14.5px; font-weight: 500;
  white-space: nowrap; position: relative;
  transition: background var(--fast), color var(--fast), transform var(--fast);
}
.nav-link svg { width: 19px; height: 19px; flex: 0 0 19px; }
.nav-link:hover { background: rgba(73,184,72,.09); color: var(--green-600); }
html.dark .nav-link:hover { color: var(--green-400); }
.nav-link.is-active { background: var(--grad-brand); color: #fff; box-shadow: var(--glow-green); font-weight: 600; }
.nav-link.is-active:hover { color: #fff; }
.nav-link .badge-dot { margin-left: auto; background: var(--gold); color: #3d2c00; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 99px; }

/* Collapsed rail */
.is-collapsed .sidebar { width: var(--sidebar-w-collapsed); flex-basis: var(--sidebar-w-collapsed); }
.is-collapsed .sidebar .nav-link { justify-content: center; padding: 12px; }
.is-collapsed .sidebar .nav-label,
.is-collapsed .sidebar .sidebar__group > .eyebrow,
.is-collapsed .sidebar .brand-word,
.is-collapsed .sidebar .badge-dot,
.is-collapsed .sidebar .sidebar__cta { display: none; }
.is-collapsed .sidebar__brand { justify-content: center; padding: 0; }

/* Header — 60px on phones, taller once there is room */
.topbar {
  height: 60px;
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.icon-btn {
  width: 44px; height: 44px; border-radius: 13px;   /* 44px = minimum comfortable thumb target */
  display: grid; place-items: center;
  color: var(--ink-soft);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all var(--fast);
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { color: var(--green-600); border-color: var(--green-400); transform: translateY(-1px); }
html.dark .icon-btn:hover { color: var(--green-400); }

.searchbar {
  display: flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 14px; flex: 1 1 auto; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; color: var(--ink-mute);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.searchbar:focus-within { border-color: var(--green-400); box-shadow: 0 0 0 4px rgba(73,184,72,.12); }
.searchbar input { background: transparent; border: 0; outline: 0; width: 100%; font-size: 14px; color: var(--ink); }
.searchbar kbd {
  font-family: 'Montserrat', sans-serif; font-size: 10px; font-weight: 700;
  border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; color: var(--ink-mute);
}

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
/* Phone padding first; the clamp only starts growing once there is width to spare.
   The bottom padding clears the fixed nav bar plus the home indicator.        */
.page { padding: 16px 14px calc(104px + env(safe-area-inset-bottom)); max-width: 1500px; width: 100%; margin: 0 auto; }

/* Bottom nav — the primary navigation on a phone, hidden on desktop */
.bottomnav {
  display: grid;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-top: 1px solid var(--border);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(5, 1fr);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600; color: var(--ink-mute);
  padding: 6px 0; border-radius: 12px; transition: color var(--fast);
}
.bottomnav a svg { width: 21px; height: 21px; }
.bottomnav a.is-active { color: var(--green-600); }
html.dark .bottomnav a.is-active { color: var(--green-400); }
.bottomnav a.is-active svg { filter: drop-shadow(0 4px 8px rgba(73,184,72,.45)); }

/* --- Tablet: more air, wider gutters ---------------------------------- */
@media (min-width: 640px) {
  .topbar { height: 68px; padding: 0 22px; gap: 14px; }
  .page   { padding: 22px 22px calc(112px + env(safe-area-inset-bottom)); }
}

/* --- Desktop: the sidebar comes out of the drawer and stays out -------- */
@media (min-width: 1024px) {
  .bottomnav { display: none; }
  .scrim     { display: none; }

  .sidebar {
    position: sticky; top: 0; height: 100vh;
    inset: auto;
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    transform: none;
    box-shadow: none;
  }
  .is-drawer-open { overflow: auto; }

  .topbar { height: var(--header-h); padding: 0 clamp(22px, 3vw, 32px); }
  .page   { padding: clamp(24px, 3vw, 34px); padding-bottom: 60px; }
  .icon-btn { width: 40px; height: 40px; border-radius: 12px; }
}

/* ---------- 4. COMPONENTS ---------------------------------------------- */

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--e2);
  transition: transform var(--base), box-shadow var(--base), border-color var(--base);
}
.card--pad { padding: clamp(18px, 2.2vw, 26px); }
.card--hover:hover { transform: translateY(-4px); box-shadow: var(--e3); border-color: rgba(73,184,72,.4); }

.glass {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}

/* Section head */
.sec-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sec-head h2 { font-size: clamp(19px, 2vw, 23px); font-weight: 650; }
.sec-head p { font-size: 13.5px; color: var(--ink-mute); margin-top: 2px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 48px; padding: 0 22px;              /* touch first: 48px on a phone */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  border-radius: 14px;
  font-weight: 600; font-size: 14.5px;
  transition: transform var(--fast), box-shadow var(--fast), background var(--fast), color var(--fast), border-color var(--fast);
  cursor: pointer; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(.975); }
.btn--primary { background: var(--grad-brand); color: #fff; box-shadow: var(--glow-green); }
.btn--primary:hover { box-shadow: 0 14px 34px -10px rgba(73,184,72,.7); transform: translateY(-2px); }
.btn--solar { background: var(--grad-solar); color: #3D2C00; box-shadow: 0 10px 30px -10px rgba(245,180,0,.6); }
.btn--solar:hover { transform: translateY(-2px); }
.btn--ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--border); }
.btn--ghost:hover { border-color: var(--green-400); color: var(--green-600); transform: translateY(-2px); }
html.dark .btn--ghost:hover { color: var(--green-400); }
.btn--dark { background: var(--green-700); color: #fff; }
.btn--dark:hover { background: var(--green-600); transform: translateY(-2px); }
.btn--sm { height: 42px; padding: 0 16px; font-size: 13.5px; border-radius: 12px; }
@media (min-width: 1024px) {
  .btn     { height: 46px; }
  .btn--sm { height: 38px; font-size: 13px; border-radius: 11px; }
}
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* Pills / chips / status */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
  background: rgba(11,107,47,.08); color: var(--green-600);
  border: 1px solid rgba(11,107,47,.14);
}
html.dark .chip { background: rgba(73,184,72,.13); color: var(--green-400); border-color: rgba(73,184,72,.25); }
.chip--solar { background: rgba(245,180,0,.12); color: #A97800; border-color: rgba(245,180,0,.28); }
.chip--hydro { background: rgba(12,124,213,.10); color: var(--hydro); border-color: rgba(12,124,213,.22); }
.chip--wind  { background: rgba(12,124,213,.07); color: #2C6E9B; border-color: rgba(12,124,213,.16); }
.chip--grey  { background: rgba(31,41,55,.06); color: var(--ink-soft); border-color: var(--border); }
.chip--danger{ background: rgba(220,38,38,.09); color: #DC2626; border-color: rgba(220,38,38,.2); }
html.dark .chip--solar { color: #F5C542; }
html.dark .chip--grey { background: rgba(255,255,255,.06); }

.dot { width: 7px; height: 7px; border-radius: 99px; background: currentColor; }
.dot--live { box-shadow: 0 0 0 0 rgba(73,184,72,.6); animation: pulse-dot 1.8s infinite; }
@keyframes pulse-dot {
  0%   { box-shadow: 0 0 0 0 rgba(73,184,72,.55); }
  70%  { box-shadow: 0 0 0 8px rgba(73,184,72,0); }
  100% { box-shadow: 0 0 0 0 rgba(73,184,72,0); }
}

/* Stat card */
.stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px;
  box-shadow: var(--e2);
  transition: transform var(--base), box-shadow var(--base);
}
.stat:hover { transform: translateY(-4px); box-shadow: var(--e3); }
.stat__icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: #fff; }
.stat__icon svg { width: 20px; height: 20px; }
.stat-value { font-size: clamp(22px, 2.4vw, 28px); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat__spark { position: absolute; right: 0; bottom: 0; width: 120px; height: 46px; opacity: .5; pointer-events: none; }

.i-green { background: var(--grad-brand); }
.i-solar { background: var(--grad-solar); color: #3D2C00 !important; }
.i-hydro { background: var(--grad-hydro); }
.i-dark  { background: var(--green-700); }

/* Meter / progress */
.meter { height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; }
.meter__fill { height: 100%; width: 0; border-radius: 99px; background: var(--grad-brand); transition: width 1.4s var(--ease); }
.meter__fill--solar { background: var(--grad-solar); }
.meter__fill--hydro { background: var(--grad-hydro); }

/* Forms */
.field { margin-bottom: 16px; }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 7px; }
.input, .select, .textarea {
  width: 100%; height: 52px; padding: 0 15px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 14px;
  font-size: 16px;  /* iOS Safari zooms the whole page if this drops below 16px */
  outline: 0;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
@media (min-width: 1024px) { .input, .select, .textarea { height: 50px; font-size: 14.5px; } }
.textarea { height: auto; padding: 14px 15px; min-height: 120px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--ink-mute); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--green-400); box-shadow: 0 0 0 4px rgba(73,184,72,.13); }
.input-group { position: relative; }
.input-group .input { padding-left: 46px; }
.input-group__icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--ink-mute); width: 18px; height: 18px; }
.input-group__action { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-mute); padding: 6px; border-radius: 8px; }
.input-group__action:hover { color: var(--green-600); }
.hint { font-size: 12px; color: var(--ink-mute); margin-top: 6px; }
.hint--error { color: #DC2626; }

.checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--ink-soft); cursor: pointer; }
.checkbox input { appearance: none; width: 19px; height: 19px; flex: 0 0 19px; border: 1.5px solid var(--border); border-radius: 6px; margin-top: 1px; transition: all var(--fast); position: relative; }
.checkbox input:checked { background: var(--grad-brand); border-color: transparent; }
.checkbox input:checked::after { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/13px no-repeat; }

/* Password strength */
.strength { display: flex; gap: 5px; margin-top: 9px; }
.strength span { height: 5px; flex: 1; border-radius: 99px; background: var(--border); transition: background var(--base); }

/* Segmented control */
.seg {
  display: flex; padding: 4px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 13px; gap: 3px;
  max-width: 100%; overflow-x: auto; scrollbar-width: none;   /* swipe the tabs on a phone */
  -webkit-overflow-scrolling: touch;
}
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 0 0 auto; min-height: 40px; padding: 8px 15px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--ink-mute); transition: all var(--fast); white-space: nowrap; }
@media (min-width: 1024px) { .seg { display: inline-flex; } .seg button { min-height: 0; font-size: 13px; } }
.seg button.is-active { background: var(--grad-brand); color: #fff; box-shadow: var(--e1); }

/* Table */
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-mute); padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 15px 16px; font-size: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background var(--fast); }
.table tbody tr:hover { background: rgba(73,184,72,.05); }
.table tbody tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.table th, .table td { white-space: nowrap; }
.table th:first-child, .table td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
@media (min-width: 1024px) { .table th:first-child, .table td:first-child { position: static; } }

/* Avatar */
.avatar { border-radius: 14px; background: var(--grad-brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-family: 'Montserrat', sans-serif; flex: 0 0 auto; }

/* Timeline */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 26px; }
.tl-item::before {
  content: ""; position: absolute; left: -25px; top: 4px;
  width: 12px; height: 12px; border-radius: 99px;
  background: var(--surface); border: 2px solid var(--border);
}
.tl-item.is-done::before { background: var(--green-400); border-color: var(--green-400); box-shadow: 0 0 0 4px rgba(73,184,72,.16); }
.tl-item.is-current::before { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 0 4px rgba(245,180,0,.2); animation: pulse-dot 2s infinite; }

/* Accordion */
.acc { border-bottom: 1px solid var(--border); }
.acc__btn { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 4px; text-align: left; font-weight: 600; font-size: 15.5px; font-family: 'Poppins', sans-serif; }
.acc__btn svg { transition: transform var(--base); color: var(--ink-mute); flex: 0 0 auto; }
.acc.is-open .acc__btn svg { transform: rotate(180deg); color: var(--green-600); }
.acc__body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--base); }
.acc.is-open .acc__body { grid-template-rows: 1fr; }
.acc__body > div { overflow: hidden; }
.acc__body p { padding: 0 4px 20px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.7; }

/* Empty / states */
.state { text-align: center; padding: 56px 20px; }
.state__icon { width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center; margin: 0 auto 18px; background: rgba(73,184,72,.1); color: var(--green-600); }
.state__icon svg { width: 30px; height: 30px; }
html.dark .state__icon { color: var(--green-400); }
.state h3 { font-size: 18px; margin-bottom: 6px; }
.state p { color: var(--ink-mute); font-size: 14px; max-width: 380px; margin: 0 auto 20px; }

/* Skeleton */
.skeleton { position: relative; overflow: hidden; background: var(--border); border-radius: 10px; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: shimmer 1.4s infinite;
}
html.dark .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.07), transparent); }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* Toast */
/* Toasts land above the thumb bar on a phone, bottom-right on desktop */
.toast-wrap { position: fixed; z-index: 200; left: 12px; right: 12px; bottom: calc(96px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 1024px) { .toast-wrap { left: auto; right: 20px; bottom: 20px; width: 380px; } }
.toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--green-400);
  padding: 14px 18px; border-radius: 14px; box-shadow: var(--e3);
  font-size: 14px; font-weight: 500;
  animation: toast-in .4s var(--ease);
}
.toast--error { border-left-color: #DC2626; }
.toast--solar { border-left-color: var(--gold); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }

/* Modal */
/* On a phone a dialog is a bottom sheet — it opens where the thumb already is.
   From 640px up it becomes a centred modal.                                   */
.modal { position: fixed; inset: 0; z-index: 150; display: none; place-items: end center; padding: 0; }
.modal.is-open { display: grid; }
.modal__scrim { position: absolute; inset: 0; background: rgba(4,20,12,.6); backdrop-filter: blur(4px); animation: fade .3s var(--ease); }
.modal__panel {
  position: relative; width: 100%; max-width: 470px;
  max-height: 92dvh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: var(--e3);
  animation: sheet-in .4s var(--ease);
}
.modal__panel::before {
  content: ""; display: block; width: 40px; height: 4px; border-radius: 99px;
  background: var(--border); margin: -8px auto 16px;
}
@media (min-width: 640px) {
  .modal { place-items: center; padding: 20px; }
  .modal__panel { border-radius: var(--r-xl); padding: 28px; animation: modal-in .4s var(--ease); }
  .modal__panel::before { display: none; }
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(100%); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(24px) scale(.96); } }
@keyframes fade { from { opacity: 0; } }

/* Floating action buttons */
/* FABs sit above the bottom nav on phones, drop to the corner on desktop */
.fabs { position: fixed; right: 14px; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 70; display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 1024px) { .fabs { right: 20px; bottom: 24px; } }
.fab {
  width: 54px; height: 54px; border-radius: 18px;
  display: grid; place-items: center; color: #fff;
  box-shadow: var(--e3);
  transition: transform var(--base), box-shadow var(--base);
  position: relative;
}
.fab:hover { transform: translateY(-3px) scale(1.04); }
.fab svg { width: 24px; height: 24px; }
.fab--wa { background: linear-gradient(135deg, #25D366, #128C7E); }
.fab--chat { background: var(--grad-deep); }
.fab::after {
  content: attr(data-label);
  position: absolute; right: 66px; top: 50%; transform: translateY(-50%) translateX(6px);
  background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 600;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: all var(--fast);
}
.fab:hover::after { opacity: 1; transform: translateY(-50%) translateX(0); }

/* Project card */
.project { overflow: hidden; position: relative; }
.project__media { position: relative; height: 190px; overflow: hidden; }
.project__media img, .project__media svg { width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease); display: block; }
.project:hover .project__media img, .project:hover .project__media svg { transform: scale(1.07); }
.project__veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(4,20,12,0) 40%, rgba(4,20,12,.72)); }
.project__tags { position: absolute; left: 14px; top: 14px; display: flex; gap: 8px; }
.project__fav {
  position: absolute; right: 14px; top: 14px;
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3);
  backdrop-filter: blur(10px); color: #fff; transition: all var(--fast);
}
.project__fav:hover { background: rgba(255,255,255,.3); }
.project__fav.is-fav { background: #fff; color: #E11D48; border-color: #fff; }
.project__fav.is-fav svg { fill: currentColor; }
.project__title { position: absolute; left: 16px; right: 16px; bottom: 12px; color: #fff; }

/* Hero utilities (marketing pages) */
.hero-deep { background: var(--grad-deep); color: #fff; position: relative; overflow: hidden; }
.hero-deep h1, .hero-deep h2, .hero-deep h3 { color: #fff; }
.mesh::before, .mesh::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(90px); pointer-events: none;
}
.mesh::before { width: 460px; height: 460px; background: rgba(73,184,72,.34); top: -140px; right: -80px; animation: float-a 16s ease-in-out infinite; }
.mesh::after  { width: 380px; height: 380px; background: rgba(245,180,0,.20); bottom: -150px; left: -60px; animation: float-b 20s ease-in-out infinite; }
@keyframes float-a { 50% { transform: translate(-40px, 50px) scale(1.12); } }
@keyframes float-b { 50% { transform: translate(50px, -40px) scale(1.08); } }

/* ---------- 5. SIGNATURE: THE GRID ------------------------------------- */
/* Live energy-flow diagram: sources -> grid node -> homes.
   Particles travel the SVG paths; this is the element the product is
   remembered by, so everything around it stays quiet. */
.gridflow { position: relative; }
.gridflow svg { width: 100%; height: auto; display: block; overflow: visible; }
.flow-path { fill: none; stroke-width: 2; stroke-linecap: round; opacity: .28; }
.flow-particle { animation: dash 2.4s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -220; } }
.node-pulse { transform-origin: center; animation: node-breathe 3s ease-in-out infinite; }
@keyframes node-breathe { 50% { opacity: .35; transform: scale(1.35); } }

/* Chart primitives (charts.js draws into these) */
.chart { width: 100%; display: block; overflow: visible; }
.chart-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 5; }
.chart-label { font-family: 'Montserrat', sans-serif; font-size: 10px; font-weight: 600; fill: var(--ink-mute); }
.chart-bar { transition: opacity var(--fast); }
.chart-bar:hover { opacity: .78; }
.draw-in { stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: draw 1.8s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.rise { transform-origin: bottom; animation: rise .9s var(--ease) backwards; }
@keyframes rise { from { transform: scaleY(0); } }

/* ---------- MOTION UTILITIES ------------------------------------------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

.page-enter { animation: page-in .5s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } }

.float-y { animation: float-y 6s ease-in-out infinite; }
@keyframes float-y { 50% { transform: translateY(-14px); } }

.spin-slow { animation: spin 14s linear infinite; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }

.marquee { display: flex; gap: 48px; animation: marquee 32s linear infinite; width: max-content; }
@keyframes marquee { to { transform: translateX(-50%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* Print (reports / certificate) */
@media print {
  .sidebar, .topbar, .bottomnav, .fabs, .no-print { display: none !important; }
  .page { padding: 0; }
  .card { box-shadow: none; border-color: #ddd; }
}

/* ---------- 8. APP-HOME PATTERNS (dashboard) ---------------------------- */
/* Hero banner — full-bleed on a phone, framed once there is room */
.hero-shot {
  position: relative; overflow: hidden;
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  margin: -16px -14px 0;                 /* bleed past .page padding on mobile */
  height: 210px;
}
.hero-shot img { width: 100%; height: 100%; object-fit: cover; }
.hero-shot__veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(4,20,12,.15) 0%, rgba(4,20,12,.35) 55%, rgba(4,20,12,.82) 100%);
}
.hero-shot__copy { position: absolute; left: 18px; right: 18px; bottom: 16px; color: #fff; }
@media (min-width: 640px) {
  .hero-shot { margin: 0; border-radius: var(--r-xl); height: 260px; }
  .hero-shot__copy { left: 26px; right: 26px; bottom: 22px; }
}
@media (min-width: 1024px) { .hero-shot { height: 300px; } }

/* Announcement ticker */
.ticker {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--e1);
  padding: 11px 14px; overflow: hidden;
}
.ticker__icon { color: var(--gold); flex: 0 0 auto; display: grid; place-items: center; }
.ticker__win { overflow: hidden; flex: 1 1 auto; }
.ticker__track {
  display: inline-flex; gap: 48px; white-space: nowrap;
  font-size: 13.5px; font-weight: 500; color: var(--ink-soft);
  animation: ticker 26s linear infinite;
}
.ticker:hover .ticker__track { animation-play-state: paused; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* Action tile grid — the 4-across launcher */
.tiles {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  background: var(--grad-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--e2);
  padding: 14px 8px;
}
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 10px 4px; border-radius: 14px;
  transition: transform var(--fast), background var(--fast);
  -webkit-tap-highlight-color: transparent;
}
.tile:active { transform: scale(.94); }
.tile:hover { background: rgba(73,184,72,.08); }
.tile__ico {
  width: 46px; height: 46px; border-radius: 15px;
  display: grid; place-items: center;
  color: #fff;                       /* .i-solar overrides this to dark ink */
  box-shadow: var(--e1);
}
.tile__ico svg { width: 22px; height: 22px; }
.tile__label { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); text-align: center; line-height: 1.2; }
@media (min-width: 640px) {
  .tiles { grid-template-columns: repeat(8, 1fr); gap: 8px; padding: 18px 12px; }
  .tile__ico { width: 52px; height: 52px; }
  .tile__label { font-size: 12.5px; }
}

/* Promo strip (New user zone) */
.promo {
  color: #fff;
  position: relative; overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--grad-deep);
  padding: 22px 20px;
  min-height: 132px;
  display: flex; align-items: center;
}
.promo__art { position: absolute; right: -6px; bottom: -10px; width: 132px; opacity: .95; pointer-events: none; }
@media (min-width: 640px) { .promo__art { width: 168px; right: 10px; } }

/* ---------- 9. MOBILE SAFETY NET ---------------------------------------- */
/* Nothing may push the page sideways on a phone. Wide content (tables, code,
   long wallet addresses) scrolls inside its own box, never the document.     */
html, body { max-width: 100%; overflow-x: hidden; }
img, svg, video { max-width: 100%; height: auto; }
.table-wrap { max-width: 100%; }
.data, .break-all { overflow-wrap: anywhere; }

/* ---------- 10. HOME v2 (carousel / light launcher / rails) -------------- */

/* Swipeable banner carousel. Native scroll-snap does the work — no library,
   and it keeps momentum scrolling on iOS.                                   */
.carousel { position: relative; }
.carousel__track {
  display: flex; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-padding: 0;
}
.carousel__track::-webkit-scrollbar { display: none; }
.slide {
  flex: 0 0 100%; scroll-snap-align: center;
  position: relative; overflow: hidden;
  border-radius: var(--r-lg);
  min-height: 190px;
  padding: 22px;
  display: flex; flex-direction: column; justify-content: center;
  color: #fff;
}
.slide__art {
  position: absolute; right: -8%; top: 0; bottom: 0; width: 52%;
  object-fit: cover; opacity: .9;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 38%);
          mask-image: linear-gradient(90deg, transparent, #000 38%);
}
.slide__body { position: relative; max-width: 68%; }
@media (min-width: 640px) { .slide { min-height: 230px; padding: 30px; } .slide__body { max-width: 60%; } }

.dots { display: flex; gap: 6px; justify-content: center; margin-top: 12px; }
.dots button {
  width: 7px; height: 7px; border-radius: 99px;
  background: var(--border); transition: all var(--base);
}
.dots button.is-on { width: 22px; background: var(--green-500); }

/* Light action launcher — soft tinted tiles, tinted glyph, label under.
   Reads calmer than the gradient chips, and lets the banner carry the colour. */
.qgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.qtile {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 14px 6px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: transform var(--fast), box-shadow var(--fast), border-color var(--fast);
  -webkit-tap-highlight-color: transparent;
}
.qtile:active { transform: scale(.95); }
.qtile:hover { border-color: var(--green-400); box-shadow: var(--e2); }
.qtile__ico { display: grid; place-items: center; width: 30px; height: 30px; color: var(--green-600); }
.qtile__ico svg { width: 26px; height: 26px; stroke-width: 1.6; }
.qtile__label { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); text-align: center; line-height: 1.25; }
@media (min-width: 640px) { .qtile__label { font-size: 12.5px; } }

/* Horizontal card rail (Recommended for you) */
.rail {
  display: flex; gap: 14px;
  overflow-x: auto; scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
  margin: 0 -14px; padding-inline: 14px;   /* bleed to the screen edge, so cards peek */
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { flex: 0 0 76%; scroll-snap-align: start; max-width: 300px; }
@media (min-width: 640px) { .rail { margin: 0; padding-inline: 0; } .rail > * { flex: 0 0 280px; } }

/* Trust strip */
.trust {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px 6px;
}
.trust__item { text-align: center; padding: 0 4px; position: relative; }
.trust__item + .trust__item::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 1px; background: var(--border);
}
.trust__item i { color: var(--green-600); }
.trust__item p { font-size: 10.5px; font-weight: 600; color: var(--ink-soft); margin-top: 7px; line-height: 1.3; }
@media (min-width: 640px) { .trust__item p { font-size: 12px; } }

/* Rating row */
.rating { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; }
.rating i { color: var(--gold); }
