  /* Page-specific rules only. Shared chrome (design tokens, body/.wrap,
     .brand*, .title/.subtitle, .back-link, .icon-btn*, .header-actions,
     .conn-pill*, .page-nav/.page-tab and shared mobile overrides) lives
     in /static/common.css. Loaded via <link> BEFORE this block, so
     inline rules here still win on tie-breaks.

     Details keeps its card layout and JetBrains Mono subtitle;
     page and card backgrounds come from common.css. */

  /* Palette overrides — details.html keeps its saturated accents.
     The `body` background gradients and `.title`/`.subtitle` colour
     come from common.css + these overrides. */
  :root {
    --border: rgba(255, 255, 255, 0.06);
    --grid: #60a5fa;
    --solar: #fbbf24;
    --battery: #34d399;
    --load: #fb923c;
    --danger: #f87171;
    --ok: #22c55e;
  }
  /* details.html-specific resets: a universal margin/padding zero
     (stronger than common.css's `* { box-sizing: border-box }`) and
     fixed 100% body height so the dashboard fills the viewport. */
  * { margin: 0; padding: 0; }
  html, body { min-height: 100%; min-height: -webkit-fill-available; background-color: var(--bg); }
  body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    min-height: 100vh;
    font-feature-settings: "tnum" 1, "cv11" 1;
    -webkit-font-smoothing: antialiased;
  }
  /* Header: mirrors flow.html + control.html — brand-mark + title + subtitle
     on the left, action cluster on the right. Keeps the three pages feeling
     like one app. */
  header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 28px; gap: 24px;
  }
  /* Details-specific subtitle override: mono instead of Inter. */
  .subtitle { font-family: 'JetBrains Mono', monospace; }
  .status { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-dim); }
  .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim);
         box-shadow: 0 0 12px currentColor; }
  .dot.ok { background: var(--ok); color: var(--ok); }
  .dot.stale { background: var(--danger); color: var(--danger); }

  .grid {
    display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px;
  }
  .card {
    grid-column: span 4;
    border: 1px solid var(--card-edge);
    border-radius: 18px;
    padding: 22px 22px 24px;
    position: relative;
    overflow: hidden;
  }
  .card-head {
    display: flex; align-items: center; gap: 10px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--text-dim); margin-bottom: 14px;
  }

  .metric { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
  .metric .v { font-size: 44px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
  .metric .u { font-size: 15px; color: var(--text-dim); font-weight: 500; }
  .metric.small .v { font-size: 24px; font-weight: 500; }
  .metric.small .u { font-size: 13px; }
  .sub { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

  .row-sep { border-top: 1px solid var(--border); margin: 16px 0 14px; }
  /* Two-column grid: label takes remaining space, value gets its natural
     width. `minmax(0, 1fr)` is load-bearing — without it the label column
     refuses to shrink below intrinsic content size, which on narrow
     viewports pushes the value off-column and makes long labels appear
     to overlap the value (the original complaint on mobile). */
  .row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 14px;
    align-items: baseline;
    padding: 4px 0;
    font-size: 14px;
  }
  .row .k {
    color: var(--text-dim);
    min-width: 0;
    overflow-wrap: anywhere;
  }
  /* Value is always right-aligned; nowrap keeps "680.985 kWh" together
     rather than breaking between number and unit. Values are short
     enough that this never forces the label to overflow — the label
     column wraps first. */
  .row .v {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
  }

  .bar-wrap { margin-top: 14px; }
  .bar-label { display: flex; justify-content: space-between; font-size: 12px;
               color: var(--text-dim); margin-bottom: 6px; }
  .bar { height: 8px; background: rgba(255,255,255,0.05); border-radius: 999px; overflow: hidden; }
  .bar > span {
    display: block; height: 100%; border-radius: inherit;
    transition: width 700ms cubic-bezier(.2,.7,.2,1);
  }
  .bar.battery > span { background: linear-gradient(90deg, #10b981, #34d399); }
  .bar.load > span { background: linear-gradient(90deg, #f97316, #fb923c); }

  .card.span6 { grid-column: span 6; }
  .card.span12 { grid-column: span 12; }
  .card-head .right {
    margin-left: auto; font-size: 11px; font-weight: 400; letter-spacing: 0.1em;
    color: var(--text-dim);
  }
  .availability-note {
    color: var(--text-dim);
    font-size: 12px;
    line-height: 1.45;
    margin: -4px 0 14px;
  }
  .is-hidden { display: none !important; }

  .totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .total-cell { }
  .total-cell .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
                        color: var(--text-dim); margin-bottom: 4px; }
  .total-cell .val { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .total-cell .unit { font-size: 12px; color: var(--text-dim); margin-left: 4px; font-weight: 400; }

  .flag {
    font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
    padding: 3px 8px; border-radius: 4px; font-weight: 600;
    background: rgba(52, 211, 153, 0.12); color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.3);
  }
  .flag.neg { background: rgba(251, 146, 60, 0.12); color: #fb923c;
              border-color: rgba(251, 146, 60, 0.3); }
  .flag.zero { background: rgba(136, 146, 168, 0.12); color: var(--text-dim);
               border-color: rgba(136, 146, 168, 0.2); }

  @media (max-width: 960px) {
    .card { grid-column: span 6; }
    .card.span6, .card.span12 { grid-column: span 12; }
    .totals { grid-template-columns: repeat(2, 1fr); }
  }
  .pulse {
    animation: pulse 320ms ease-out;
  }
  @keyframes pulse {
    0% { background-color: rgba(96,165,250,0.08); }
    100% { background-color: transparent; }
  }

  /* Inverter-params inline banner */
  .inline-label { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 4px; }
  .inline-val { font-size: 22px; font-weight: 600; }
  .inline-u { font-size: 14px; color: var(--text-dim); margin-left: 4px; }
  .inline-mono { font-size: 14px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }

  /* Important Parameters grid */
  .key-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
  @media (max-width: 960px) { .key-grid { grid-template-columns: repeat(2, 1fr); } }
  .kv {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
  }
  .kv-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 6px; }
  .kv-val { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .kv-u { font-size: 13px; color: var(--text-dim); margin-left: 4px; font-weight: 500; }

  .mono-hint { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-dim); margin-left: 8px; }
  .mono { font-family: 'JetBrains Mono', monospace; font-size: 13px; }

  .row .v.mono { font-size: 13px; }
  .row .v.strong { font-weight: 600; color: var(--grid); }


  .two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 48px;
  }
  @media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }

  .hint { margin-left: 8px; font-size: 11px; color: var(--text-dim); font-weight: 400; }

  .header-actions { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

  /* `.back-link`, `.icon-btn*`, `.conn-pill*`, `.page-nav`, `.page-tab`
     are defined in /static/common.css. Details-specific dot pulse
     animation for the legacy `.dot` status indicator stays below. */

  .dot.connecting, .dot.disconnecting {
    background: #fbbf24; color: #fbbf24;
    animation: dotPulse 1s ease-in-out infinite;
  }
  @keyframes dotPulse {
    0%, 100% { box-shadow: 0 0 8px currentColor; }
    50% { box-shadow: 0 0 18px currentColor; }
  }
  .dot.disconnected { background: #64748b; color: #64748b; }

  /* ---------- Mobile overrides ---------- (last in the stylesheet so
     they outweigh base rules defined later in source order. Breakpoint
     matches flow.html and control.html so the three pages feel identical.
     Shared chrome mobile tweaks live in common.css.) */
  @media (max-width: 640px) {
    .card { grid-column: span 12; padding: 18px; }
    .metric .v { font-size: 36px; }
    /* Header: brand + dot + power-btn fit in one row now that navigation
       lives in the `.page-nav` segmented control below. */
    header { gap: 12px; margin-bottom: 14px; align-items: center; }
      .key-grid { gap: 10px; }
    .kv { padding: 10px 12px; }
    .kv-val { font-size: 20px; }
    .totals { gap: 10px; }
    .total-cell .val { font-size: 20px; }
  }

#dp_serial { overflow-wrap: anywhere; min-width: 0; }

/* No status badge when battery current is unavailable. */
#batt_flag:empty { display: none; }
