/* PlugPrice website styles. No external fonts or CDNs (strict Content-Security-Policy). */
:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-2: #eef2f1;
  --text: #13201d;
  --muted: #5b6b67;
  --border: #dce3e1;
  --accent: #0f766e;
  --accent-contrast: #ffffff;
  --cheap: #15803d;
  --normal: #2563eb;
  --pricey: #dc2626;
  --cheap-bg: #dcfce7;
  --normal-bg: #dbeafe;
  --pricey-bg: #fee2e2;
  --shadow: 0 1px 2px rgb(16 24 22 / 6%), 0 4px 16px rgb(16 24 22 / 6%);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1412;
    --surface: #15201d;
    --surface-2: #1c2926;
    --text: #e6efec;
    --muted: #94a7a2;
    --border: #2a3a36;
    --accent: #2dd4bf;
    --accent-contrast: #062421;
    --cheap: #4ade80;
    --normal: #60a5fa;
    --pricey: #f87171;
    --cheap-bg: #12331f;
    --normal-bg: #13284a;
    --pricey-bg: #3b1515;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 1.05rem; }
h3 { font-size: 1rem; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); font-size: .875rem; margin: .25rem 0 0; }
.spacer { flex: 1; }

/* Top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar-inner { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.brand svg { color: var(--accent); }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Controls */
.btn, .select, input[type="text"], input[type="number"], input[type="time"] {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; min-height: 40px;
}
.btn { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.btn:hover { background: var(--surface-2); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn.icon { padding: 6px 10px; min-height: 36px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.controls { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 12px; }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 3px; }
.seg { font: inherit; font-weight: 600; font-size: .9rem; border: 0; background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 9px; cursor: pointer; }
.seg.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented.small .seg { padding: 5px 10px; font-size: .82rem; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.hero { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.hero-price { font-size: clamp(2.6rem, 8vw, 4rem); font-weight: 800; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero-price .unit { font-size: 1.1rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.hero-sub { color: var(--muted); margin-top: 4px; }
.hero-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; text-align: right; }
.next { color: var(--muted); font-size: .95rem; }
.next strong { color: var(--text); }
.badge { font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.badge.cheap { color: var(--cheap); background: var(--cheap-bg); }
.badge.normal { color: var(--normal); background: var(--normal-bg); }
.badge.pricey { color: var(--pricey); background: var(--pricey-bg); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 12px 0; }
.stat-value { font-size: 1.6rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--muted); font-size: .85rem; }

.chart-card { margin-bottom: 12px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.chart-box { position: relative; height: 320px; }
.hint { color: var(--muted); font-size: .82rem; margin: 8px 0 0; }
.pinned { margin-top: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; font-size: .92rem; }
.pinned table { border-collapse: collapse; margin-top: 4px; }
.pinned td { padding: 1px 12px 1px 0; font-variant-numeric: tabular-nums; }
.pinned td:last-child { text-align: right; }
.notice { color: var(--muted); font-size: .92rem; margin-bottom: 12px; }

.footer { color: var(--muted); font-size: .82rem; padding-bottom: 32px; }

/* Settings dialog */
.dialog { border: 0; padding: 0; border-radius: 18px; width: min(680px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgb(0 0 0 / 30%); }
.dialog::backdrop { background: rgb(5 12 10 / 55%); }
.dialog-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.dialog-head, .dialog-foot { display: flex; align-items: center; gap: 8px; }
.dialog-head { justify-content: space-between; }
.dialog-foot { position: sticky; bottom: 0; background: var(--surface); padding: 12px 0; margin-bottom: -18px; border-top: 1px solid var(--border); }
fieldset { border: 0; margin: 0; padding: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 label, .fee-grid label, .fee-schedule label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.grid2 input, .grid2 select, .fee-grid input, .fee-schedule input { width: 100%; }
.checks { display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; padding-bottom: 4px; }
.grid2 .check, .check { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; font-size: .9rem; color: var(--text); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.fees { display: flex; flex-direction: column; gap: 10px; }
.fee { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.fee-row { display: flex; align-items: center; gap: 8px; }
.wrap-row { flex-wrap: wrap; gap: 16px; }
.fee-name { flex: 1; font-weight: 600; }
.fee-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fee-schedule { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.windows { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.window { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 8px; border: 1px dashed var(--border); border-radius: 10px; }
.window label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.days { display: flex; gap: 4px; flex-wrap: wrap; flex-basis: 100%; }
.day { font: inherit; font-size: .8rem; font-weight: 700; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 8px; padding: 4px 8px; cursor: pointer; }
.day.on { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.fees-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 1.15rem; }
  .hero-side { align-items: flex-start; text-align: left; }
  .grid2 { grid-template-columns: 1fr; }
  .fee-grid { grid-template-columns: 1fr 1fr; }
  .chart-box { height: 260px; }
  .topbar-actions .btn span { display: none; }
}
