:root {
  --navy: #23358b; --red: #c8102e;
  --ink: #15171c; --muted: #5d6470; --faint: #8a919c; --line: #e3e6eb; --bg: #f4f5f7; --card: #fff;
  --ok: #1d7a3a; --ok-bg: #e8f5ec; --amber: #9a5b00; --amber-bg: #fff4e0; --bad: #b42318; --bad-bg: #fdecea; --info: #23358b; --info-bg: #eaedf8;
  --sealer: #1c1c1e; --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 4px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 15px; margin: 0 0 8px; font-weight: 650; }
small, .muted { color: var(--muted); }
.faint { color: var(--faint); }
button, .btn { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; font-weight: 550; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
button:hover, .btn:hover { border-color: #c9ced6; text-decoration: none; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); border-color: var(--navy); }
.btn-red { background: var(--red); border-color: var(--red); color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-small { padding: 5px 10px; font-size: 13px; }
.btn-link { border: 0; background: none; color: var(--navy); padding: 0; font-weight: 500; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #cfd4db; border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--navy) 35%, transparent); border-color: var(--navy); }
input[type=checkbox], input[type=radio] { width: auto; }
label { display: block; font-weight: 550; font-size: 13px; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.err { color: var(--bad); font-size: 13.5px; margin: 8px 0; }

/* ---- header ---- */
.demo-bar { background: #fff8e1; border-bottom: 1px solid #f0dca0; font-size: 13.5px; padding: 7px 18px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.demo-bar b { font-weight: 650; }
.demo-bar select { width: auto; padding: 3px 6px; font-size: 13px; }
header.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-in { max-width: 1200px; margin: 0 auto; padding: 10px 18px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand img { height: 64px; width: auto; display: block; }
.brand-name { font-weight: 700; font-size: 16px; line-height: 1.1; white-space: nowrap; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.brand-sub b { color: var(--red); font-weight: 650; }
nav.tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
nav.tabs a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 550; white-space: nowrap; position: relative; }
nav.tabs a:hover { background: var(--bg); text-decoration: none; color: var(--ink); }
nav.tabs a.on { color: var(--navy); background: var(--info-bg); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; height: 18px; line-height: 18px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11.5px; text-align: center; font-weight: 700; margin-left: 4px; }
.who { font-size: 13px; color: var(--muted); white-space: nowrap; }
main { max-width: 1200px; margin: 0 auto; padding: 22px 18px 60px; }
@media (max-width: 760px) {
  .top-in { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  nav.tabs { order: 3; flex-basis: 100%; }
  .who { margin-left: auto; }
  main { padding: 16px 12px 50px; }
  .brand img { height: 50px; }
}

/* ---- cards and tiles ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 16px 0 20px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .n { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; }
.tile .l { color: var(--muted); font-size: 13px; }
.tile.bad .n { color: var(--bad); } .tile.warn .n { color: var(--amber); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chipbtn { padding: 6px 12px; border-radius: 999px; font-size: 13.5px; }
.chipbtn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.search { max-width: 260px; }

.tank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 14px; }
a.tank-card { display: block; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; border-left: 5px solid var(--ok); transition: box-shadow .15s; }
a.tank-card:hover { text-decoration: none; box-shadow: 0 4px 16px rgba(20, 30, 60, .08); }
a.tank-card.s-red { border-left-color: var(--bad); } a.tank-card.s-amber { border-left-color: #e08e0b; } a.tank-card.s-blue { border-left-color: #9aa3b5; }
.tc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tc-num { font-size: 22px; font-weight: 800; color: var(--navy); letter-spacing: -0.02em; }
.tc-name { font-weight: 650; margin-top: 2px; }
.tc-cust { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-body { display: flex; align-items: center; gap: 14px; margin: 12px 0 8px; }
.tc-gal { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; line-height: 1; }
.tc-gal small { font-size: 14px; font-weight: 500; }
.tc-of { color: var(--muted); font-size: 13px; margin-top: 4px; }
.bar { height: 6px; background: #eceef2; border-radius: 3px; overflow: hidden; margin-top: 8px; width: 130px; }
.bar i { display: block; height: 100%; background: var(--navy); }
.bar.low i { background: #e08e0b; }
.tc-foot { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.chip.red { background: var(--bad-bg); color: var(--bad); } .chip.amber { background: var(--amber-bg); color: var(--amber); }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.blue { background: var(--info-bg); color: var(--info); } .chip.gray { background: #eef0f3; color: var(--muted); }

/* ---- alerts ---- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; margin-bottom: 8px; }
.alert .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; }
.alert.red { background: var(--bad-bg); border-color: #f5c6c0; } .alert.red .dot { background: var(--bad); }
.alert.amber { background: var(--amber-bg); border-color: #f2d7a6; } .alert.amber .dot { background: #e08e0b; }
.alert.blue { background: var(--info-bg); border-color: #cdd4ee; } .alert.blue .dot { background: var(--navy); }
.alert .t { font-weight: 650; }
.alert .txt { font-size: 14px; }
.alert .acts { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; flex: none; }
@media (max-width: 640px) { .alert { flex-wrap: wrap; } .alert > div:nth-child(2) { flex: 1 1 calc(100% - 30px); min-width: 0; } .alert .acts { margin-left: 22px; } }

/* ---- tank page ---- */
.back { display: inline-block; margin-bottom: 10px; font-size: 14px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.page-head .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.tank-top { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 860px) { .tank-top { grid-template-columns: 1fr; } }
.gauge-card { text-align: center; }
.gauge-card .big { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; margin-top: 8px; }
.gauge-card .big small { font-size: 18px; font-weight: 500; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; text-align: left; font-size: 14px; margin-top: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 550; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 5px 12px; font-size: 13px; }
.seg button.on { background: var(--ink); color: #fff; }
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .tip { position: absolute; top: 6px; pointer-events: none; background: var(--ink); color: #fff; font-size: 12.5px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; transform: translateX(-50%); display: none; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid #f0f1f4; vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; }
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f1f4; }
.events li:last-child { border-bottom: 0; }
.ev-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; font-weight: 800; font-size: 15px; }
.ev-ico.fill { background: var(--ok-bg); color: var(--ok); } .ev-ico.fill.bad { background: var(--bad-bg); color: var(--bad); }
.ev-ico.draw { background: #eef0f3; color: var(--muted); } .ev-ico.lid { background: var(--amber-bg); color: var(--amber); }
.ev-ico.info { background: var(--info-bg); color: var(--navy); } .ev-ico.bad { background: var(--bad-bg); color: var(--bad); }
.ev-main { flex: 1; min-width: 0; } .ev-when { font-size: 12.5px; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } }

/* ---- forms ---- */
.form-card { max-width: 760px; }
.shapes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.shape-opt { border: 2px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; cursor: pointer; font-size: 13px; font-weight: 550; background: #fff; }
.shape-opt input { display: none; }
.shape-opt.on { border-color: var(--navy); background: var(--info-bg); }
.shape-opt svg { width: 72px; height: 52px; display: block; margin: 0 auto 6px; }
.cap-out { background: var(--info-bg); border-radius: 10px; padding: 12px 14px; margin: 4px 0 14px; font-size: 14px; }
.cap-out b { font-size: 20px; }
details.adv summary { cursor: pointer; font-weight: 600; margin: 8px 0 12px; color: var(--navy); }
.form-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.form-acts .right { margin-left: auto; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; font-weight: 450; }
.radio-row label { display: flex; gap: 6px; align-items: center; font-weight: 450; font-size: 14px; }

/* ---- modal, toast ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 20, 35, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 14px; max-width: 560px; width: 100%; padding: 22px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal pre, code.box { background: #f3f4f6; border-radius: 8px; padding: 10px 12px; font-size: 13px; white-space: pre-wrap; word-break: break-all; display: block; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.loading { text-align: center; color: var(--muted); padding: 60px 10px; }

/* ---- sign in ---- */
.auth { max-width: 400px; margin: 8vh auto; padding: 0 16px; }
.auth .card { padding: 26px; }
.auth .logo { text-align: center; margin-bottom: 14px; }
.auth .logo img { height: 120px; }
.auth h1 { text-align: center; font-size: 20px; margin-bottom: 18px; }
.foot { text-align: center; font-size: 12.5px; color: var(--faint); margin-top: 18px; }
.foot b { color: var(--red); }

/* Tank sections on the dashboard: one heading per place the tanks sit */
.tank-group { margin-bottom: 28px; }
.tg-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.tg-head h2 { margin: 0; font-size: 17px; }
.tg-low { color: #b45309; }
