:root {
  --paper: #f2f4f1;
  --surface: #ffffff;
  --ink: #1b2733;
  --muted: #56636f;
  --line: #d3d9d4;
  --panel: #1f3a33;      /* generator meter housing */
  --digit-bg: #0e201b;
  --digit: #f1f6ef;
  --tag: #f2c230;        /* hazard-tag yellow, used once per page */
  --over: #b23a2a;
  --ok: #2b7a4b;
  --focus: #2b6cb0;
  --font: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11191d; --surface: #182227; --ink: #e6ece9; --muted: #9eabb4; --line: #2c3a40;
    --panel: #1f3a33; --digit-bg: #0a1714; --over: #ef7a66; --ok: #6fcf97; --focus: #8ab4f8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #11191d; --surface: #182227; --ink: #e6ece9; --muted: #9eabb4; --line: #2c3a40;
  --panel: #1f3a33; --digit-bg: #0a1714; --over: #ef7a66; --ok: #6fcf97; --focus: #8ab4f8;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--font);
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top, main, footer { max-width: 44rem; margin-inline: auto; padding-inline: 16px; }
.top { display: flex; justify-content: space-between; align-items: baseline; padding-block: 20px 0; }
.brand { font-weight: 700; font-size: 1.25rem; text-decoration: none; }
.lang { color: var(--muted); }

h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); line-height: 1.2; font-weight: 700; margin: 0 0 20px; letter-spacing: -0.01em; }
h2 { font-size: 1.375rem; line-height: 1.3; font-weight: 700; margin: 0 0 8px; }
section { padding-block: 40px; border-block-start: 1px solid var(--line); }
section.hero { border: 0; padding-block: 32px 40px; }

/* ---- the meter: the one bold element on the page ---- */
.panel {
  background: var(--panel);
  border-radius: 14px;
  padding: 22px 22px 16px;
  color: var(--digit);
  position: relative;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.06);
  border: 1px solid color-mix(in srgb, var(--panel) 70%, #fff 8%);
}
.panel::before {           /* the yellow tag riveted to every generator meter */
  content: '';
  position: absolute; inset-block-end: 18px; inset-inline-end: 18px;
  width: 26px; height: 10px; border-radius: 2px; background: var(--tag);
}
.meter { display: flex; gap: 5px; align-items: flex-end; justify-content: flex-start; }
[dir="rtl"] .meter { justify-content: flex-end; }
.digit {
  display: inline-grid; place-items: center;
  width: clamp(2.3rem, 11vw, 3.6rem); height: clamp(3.2rem, 15vw, 5rem);
  background: var(--digit-bg);
  border-radius: 6px;
  font-size: clamp(2rem, 9.5vw, 3.3rem); font-weight: 600; line-height: 1;
  box-shadow: inset 0 -12px 18px rgba(255,255,255,.05), inset 0 2px 0 rgba(0,0,0,.4);
}
.sep { font-size: clamp(1.6rem, 7vw, 2.6rem); opacity: .5; padding-inline: 1px; }
.unit { margin: 12px 0 0; font-size: 1rem; opacity: .85; }
.change { margin: 14px 0 0; font-weight: 600; }
.change.up { color: var(--over); }
.change.down { color: var(--ok); }
.facts { list-style: none; padding: 0; margin: 12px 0 0; color: var(--muted); }
.facts li { padding-block: 3px; }
.older { background: var(--surface); border-inline-start: 4px solid var(--tag); padding: 10px 14px; margin: 0 0 20px; }

/* ---- bill checker, set like the paper ishtirak receipt ---- */
.receipt {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 20px;
  margin-top: 16px;
  display: grid; gap: 16px;
  /* torn bottom edge */
  -webkit-mask: linear-gradient(#000 0 0) top/100% calc(100% - 10px) no-repeat,
                conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom/16px 10px repeat-x;
          mask: linear-gradient(#000 0 0) top/100% calc(100% - 10px) no-repeat,
                conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom/16px 10px repeat-x;
  padding-bottom: 30px;
}
label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
input[type=number], select {
  font: inherit; font-weight: 400; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 12px; width: 100%; min-height: 46px;
}
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
legend { font-weight: 600; font-size: .95rem; margin-bottom: 6px; padding: 0; }
.radio { display: flex; gap: 10px; align-items: center; font-weight: 400; }
.radio input { width: 18px; height: 18px; accent-color: var(--panel); }
.lines { margin: 4px 0 0; border-block-start: 2px dashed var(--line); padding-top: 12px; }
.lines div { display: flex; justify-content: space-between; gap: 12px; padding-block: 4px; }
.lines dt { color: var(--muted); }
.lines dd { margin: 0; text-align: end; }
.lines .total { border-block-start: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 1.15rem; }
.lines .total dt { color: var(--ink); }
.lines small { display: block; font-weight: 400; font-size: .85rem; color: var(--muted); }
.verdict { margin: 0; padding: 12px 14px; border-radius: 6px; font-weight: 600; }
.verdict.over { background: color-mix(in srgb, var(--over) 14%, transparent); color: var(--over); }
.verdict.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.note { color: var(--muted); font-size: .95rem; margin-top: 18px; }

/* ---- history ---- */
.chart { margin: 20px 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 12px var(--font); }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 2.25; stroke-linejoin: round; }
.chart .pt { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.chart .pt.last { fill: var(--tag); stroke: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: .975rem; }
th, td { padding: 9px 4px; border-block-end: 1px solid var(--line); text-align: start; }
td { text-align: end; }
thead th { color: var(--muted); font-weight: 600; font-size: .9rem; }
thead th:not(:first-child) { text-align: end; }
tbody th { font-weight: 400; }

/* ---- faq ---- */
details { border-block-end: 1px solid var(--line); padding-block: 12px; }
summary { cursor: pointer; font-weight: 600; list-style-position: outside; }
details p { margin: 8px 0 4px; color: var(--muted); }

.operators { margin-block: 8px 40px; padding: 20px; border-radius: 14px; background: var(--panel); color: var(--digit); }
.operators h2 { font-size: 1.15rem; }
.operators p { margin: 0; opacity: .88; }

footer { color: var(--muted); font-size: .9rem; padding-block: 24px 48px; border-block-start: 1px solid var(--line); }
footer p { margin: 0 0 6px; }

@media (prefers-reduced-motion: no-preference) {
  .digit { animation: roll .7s cubic-bezier(.2,.7,.2,1) both; }
  .digit:nth-child(2) { animation-delay: .05s } .digit:nth-child(3) { animation-delay: .1s }
  .digit:nth-child(4) { animation-delay: .15s } .digit:nth-child(5) { animation-delay: .2s }
  .digit:nth-child(6) { animation-delay: .25s } .digit:nth-child(7) { animation-delay: .3s }
  @keyframes roll { from { transform: translateY(-30%); opacity: 0; } }
}
