:root {
  --green: #43b749;
  --green-dark: #2f8f34;
  --bg: #f4f6f4;
  --card: #fff;
  --text: #1d2a1e;
  --muted: #6b776c;
  --line: #e1e6e1;
  --warn-bg: #fff6e0;
  --warn: #8a5a00;
  --err-bg: #fdecec;
  --err: #b42318;
  --ok-bg: #e9f7ea;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
}
.top {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand img { height: 30px; }
nav { display: flex; gap: 4px; }
nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 15px;
}
nav a.on { background: var(--ok-bg); color: var(--green-dark); font-weight: 600; }
main { max-width: 680px; margin: 0 auto; padding: 16px; }
main.wide { max-width: 1000px; }
h1 { font-size: 22px; margin: 4px 0 12px; }
h2 { font-size: 18px; margin: 0 0 8px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
input, select {
  font: inherit;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #c9d1c9;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--green); outline-offset: 0; border-color: var(--green); }
input.big { font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
button {
  font: inherit;
  border: 0;
  border-radius: 8px;
  padding: 11px 18px;
  cursor: pointer;
  background: var(--green);
  color: #fff;
  font-weight: 600;
}
button:hover { background: var(--green-dark); }
button:disabled { background: #b7c4b8; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--green-dark); border: 1px solid var(--line); }
button.ghost:hover { background: var(--ok-bg); }
button.danger { background: transparent; color: var(--err); border: 1px solid #f1c6c2; padding: 4px 10px; font-size: 13px; font-weight: 500; }
button.danger:hover { background: var(--err-bg); }
button.block { width: 100%; padding: 14px; font-size: 17px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1 1 140px; background: #fff; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.seg button.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 160px; }
.meter-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.serial { font-size: 14px; color: var(--muted); }
.serial.missing { color: var(--warn); }
.last { background: var(--bg); border-radius: 8px; padding: 8px 10px; margin: 8px 0 10px; font-size: 15px; }
.last b { font-variant-numeric: tabular-nums; }
.calc { margin-top: 10px; display: grid; gap: 6px; }
.diff { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.note { border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.err { background: var(--err-bg); color: var(--err); }
.note.ok { background: var(--ok-bg); color: var(--green-dark); }
.rules { font-size: 14px; color: var(--muted); margin: 0; padding-left: 18px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-size: 13px; color: var(--muted); font-weight: 600; vertical-align: bottom; }
td .cons { color: var(--green-dark); font-weight: 600; }
.pin-box { max-width: 320px; margin: 40px auto; }
.pin-box input { text-align: center; font-size: 28px; letter-spacing: 8px; }
.meter-edit { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 15px; z-index: 10; }
@media (max-width: 480px) {
  .brand span { font-size: 15px; }
  nav a { padding: 6px 8px; font-size: 14px; }
}
