/* WattGuard prototype — single-file styles. No build step. */

:root {
  --bg: #0b1220;
  --bg-elev: #131c30;
  --bg-card: #1a2440;
  --bg-card-2: #20294a;
  --border: #2a3458;
  --text: #e7ecf7;
  --text-dim: #97a3c0;
  --accent: #f0b400;
  --accent-2: #ff8a3d;
  --good: #34d399;
  --bad: #f87171;
  --link: #82b1ff;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #0a1020 0%, #0b1424 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font: inherit;
  background: var(--bg-card-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s ease;
}
button:hover { background: #2a3458; border-color: #3a4570; }
button.primary {
  background: var(--accent);
  color: #1a1300;
  border-color: var(--accent);
  font-weight: 600;
}
button.primary:hover { background: #ffc832; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(11, 18, 32, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  font-size: 28px;
  filter: drop-shadow(0 0 8px rgba(240, 180, 0, 0.6));
}
.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.4px;
}
.brand-tag {
  font-size: 12px;
  color: var(--text-dim);
}

.topbar-pills { display: flex; gap: 10px; flex-wrap: wrap; }
.pill {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.pill-live {
  border-color: var(--accent);
  color: var(--accent);
  text-transform: uppercase;
  font-weight: 600;
}
.pill-savings {
  border-color: var(--good);
  color: var(--good);
  font-weight: 600;
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.rail {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.rail-title {
  margin: 0 0 4px 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
}
.rail-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0 0 14px 0;
}

.rail-list { list-style: none; padding: 0; margin: 0 0 16px 0; }
.rail-item {
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card-2);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.rail-item:hover { border-color: var(--accent); }
.rail-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.rail-item-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.rail-item-meta {
  font-size: 12px;
  color: var(--text-dim);
}
.rail-item-iso {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--accent);
  border: 1px solid var(--border);
}

.rail-card {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-dim);
}
.rail-card-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  font-size: 13px;
}

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

.persona-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.persona-card h1 {
  margin: 0 0 6px 0;
  font-size: 20px;
}
.persona-card p {
  margin: 0;
  color: var(--text-dim);
}
.persona-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
}
.persona-stats > div {
  display: flex;
  flex-direction: column;
  padding: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.stat-value {
  font-size: 18px;
  font-weight: 700;
  margin-top: 2px;
}
.stat-value.up { color: var(--bad); }
.stat-value.down { color: var(--good); }

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.panel-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}
.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #1a1300;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.panel-header h2 {
  margin: 0;
  font-size: 17px;
}
.panel-header p {
  margin: 4px 0 0 0;
  font-size: 13px;
  color: var(--text-dim);
}

/* Decoder */
.decoder-body {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
}
.decoder-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bar-row {
  cursor: pointer;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.12s ease;
}
.bar-row:hover { border-color: var(--accent); }
.bar-row.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.bar-top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}
.bar-name { font-weight: 600; }
.bar-amount { color: var(--text-dim); }
.bar-track {
  height: 8px;
  background: #20294a;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
}
.bar-fill-base { background: var(--accent); height: 100%; }
.bar-fill-dc   { background: var(--bad); height: 100%; }
.bar-legend {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 5px;
  display: flex;
  justify-content: space-between;
}

.decoder-sidecar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kpi {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}
.kpi-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.kpi-value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--accent);
}
.hint {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
}
.explainer {
  background: var(--bg-card-2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  color: var(--text);
  min-height: 80px;
}

/* Shop */
.shop-note {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}
.shop-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.shop-table th {
  text-align: left;
  padding: 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.shop-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.shop-table tr.best td {
  background: linear-gradient(90deg, rgba(52, 211, 153, 0.08), transparent);
}
.shop-table tr.warn td {
  background: linear-gradient(90deg, rgba(248, 113, 113, 0.08), transparent);
}
.savings-good { color: var(--good); font-weight: 600; }
.savings-bad  { color: var(--bad);  font-weight: 600; }
.supplier-note {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 3px;
}
.tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  margin-left: 6px;
  vertical-align: middle;
}
.tag.best { color: var(--good); border-color: var(--good); }

/* Shifter */
.shift-body {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
}
.shift-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.shift-controls label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}
.shift-controls input[type=range] {
  width: 100%;
  accent-color: var(--accent);
}
.shift-controls output {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}
.rate-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.rate-pair > div {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
}
.rate-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.rate-value {
  font-size: 16px;
  font-weight: 700;
  margin-top: 2px;
}

.shift-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Voice */
.voice-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.voice-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.voice-meta > div {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
}
.voice-points {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}
.voice-points ul {
  margin: 8px 0 0 18px;
  padding: 0;
}
.voice-points li {
  margin-bottom: 6px;
  font-size: 13px;
}
#voiceLetter {
  width: 100%;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-family: ui-monospace, "Cascadia Code", "Fira Code", Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  resize: vertical;
}
.voice-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.foot {
  text-align: center;
  padding: 24px 20px;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  margin-top: 20px;
}
.foot-evidence { margin-top: 4px; }
code {
  background: var(--bg-elev);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11.5px;
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .rail { position: static; max-height: none; }
  .decoder-body, .shift-body { grid-template-columns: 1fr; }
  .persona-stats { grid-template-columns: repeat(2, 1fr); }
  .voice-meta { grid-template-columns: 1fr; }
}
