/* Eulerian Bots Pump IoT dashboard. Palette taken from the Eulerian Bots logo: red #F03A28 (brand/accent), off-white surfaces, charcoal text. Status colours are semantic only. */
:root {
  --red: #F03A28; --red-dark: #C72A1A; --red-soft: #FDECEA;
  --ink: #23272B; --ink-2: #4A5258; --ink-3: #7B848B; --line: #E3E1DD;
  --bg: #F6F5F2; --surface: #FFFFFF; --charcoal: #23272B; --charcoal-2: #30363B;
  --ok: #2F8F68; --ok-soft: #E6F4EE; --warn: #B7791F; --warn-soft: #FDF3DD; --bad: #D9301F; --bad-soft: #FDECEA; --info: #3B6EA8; --info-soft: #E8F0F9; --mute-soft: #EEEDEA;
  --radius: 10px; --shadow: 0 1px 2px rgba(35,39,43,.08), 0 4px 14px rgba(35,39,43,.06);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
button, input, select { font: inherit; color: inherit; }
h1 { font-size: 1.45rem; margin: 0 0 .2rem; } h2 { font-size: 1.1rem; margin: 0 0 .6rem; } h3 { font-size: .95rem; margin: 0 0 .4rem; }
.muted { color: var(--ink-3); } .small { font-size: .82rem; } .mono { font-family: Consolas, 'Courier New', monospace; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--charcoal); color: #E9EAEB; padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; border-bottom: 1px solid #3a4146; margin-bottom: 8px; }
.brand img { width: 34px; height: 38px; object-fit: contain; }
.brand b { display: block; font-size: .95rem; letter-spacing: .01em; } .brand span { font-size: .72rem; color: #AAB1B6; }
.nav button { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; color: #D3D7DA; padding: 10px 12px; border-radius: 8px; cursor: pointer; text-align: left; }
.nav button:hover { background: var(--charcoal-2); } .nav button.active { background: var(--red); color: #fff; font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: none; }
.side .foot { margin-top: auto; font-size: .75rem; color: #98A0A6; padding: 8px; }
.main { padding: 18px 22px 40px; min-width: 0; overflow-x: hidden; }
.topbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: end; margin-bottom: 12px; }

/* ---------- components ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); } .g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); } .g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.kpi .label { font-size: .78rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.kpi .value { font-size: 1.75rem; font-weight: 650; line-height: 1.15; margin-top: 2px; }
.kpi .sub { font-size: .8rem; color: var(--ink-3); margin-top: 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--mute-soft); color: var(--ink-2); white-space: nowrap; }
.chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.warn { background: var(--warn-soft); color: var(--warn); } .chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); } .chip.off { background: var(--mute-soft); color: var(--ink-3); } .chip.crit { background: var(--bad); color: #fff; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: #c9c6c0; } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; } .btn.primary:hover { background: var(--red-dark); }
.btn.dark { background: var(--charcoal); border-color: var(--charcoal); color: #fff; } .btn.danger { background: #fff; border-color: var(--bad); color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: .82rem; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.banner { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; display: flex; gap: 10px; align-items: center; border: 1px solid; }
.banner.bad { background: var(--bad-soft); border-color: #f2b8b0; color: #8a1f14; } .banner.warn { background: var(--warn-soft); border-color: #ecd49a; color: #7a5212; }
.banner.info { background: var(--info-soft); border-color: #bcd2ea; color: #264d78; } .banner.ok { background: var(--ok-soft); border-color: #b5dccb; color: #1d6247; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid #efede9; vertical-align: top; } tr:last-child td { border-bottom: 0; }
.tablewrap { overflow-x: auto; }
.stale .value, .stale .num { color: var(--ink-3) !important; text-decoration: line-through; text-decoration-color: #c7c3bb; }
.num { font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { background: none; border: 0; padding: 9px 14px; cursor: pointer; border-bottom: 3px solid transparent; color: var(--ink-2); font-weight: 600; }
.tabs button.active { border-bottom-color: var(--red); color: var(--ink); }
.field { display: grid; grid-template-columns: minmax(150px, 240px) 1fr; gap: 6px 14px; padding: 9px 0; border-bottom: 1px solid #efede9; align-items: center; }
.field:last-child { border-bottom: 0; } .field label { font-weight: 600; } .field .hint { grid-column: 2; font-size: .78rem; color: var(--ink-3); }
.field.changed { background: #FFFBEF; } .field .err { grid-column: 2; color: var(--bad); font-size: .82rem; }
input[type=text], input[type=password], input[type=number], input[type=file], select { width: 100%; max-width: 360px; padding: 8px 10px; border: 1px solid #cfcbc4; border-radius: 8px; background: #fff; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }
input[readonly] { background: #f3f2ef; color: var(--ink-2); }
.bar { height: 10px; background: #ebe9e5; border-radius: 99px; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--red); border-radius: 99px; transition: width .3s; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; } .step { padding: 4px 10px; border-radius: 99px; background: var(--mute-soft); font-size: .8rem; } .step.done { background: var(--ok-soft); color: var(--ok); } .step.cur { background: var(--red-soft); color: var(--red-dark); font-weight: 600; }
.sev { display: inline-block; min-width: 82px; text-align: center; padding: 2px 8px; border-radius: 6px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; }
.sev.INFO { background: var(--info-soft); color: var(--info); } .sev.WARNING { background: var(--warn-soft); color: var(--warn); } .sev.DEGRADED { background: #FBE6D0; color: #9A4D0B; }
.sev.FAULT { background: var(--bad-soft); color: var(--bad); } .sev.CRITICAL { background: var(--bad); color: #fff; }
.fault { border-left: 4px solid var(--line); padding: 8px 12px; margin-bottom: 8px; background: #fbfaf8; border-radius: 0 8px 8px 0; }
.fault.INFO { border-color: var(--info); } .fault.WARNING { border-color: var(--warn); } .fault.DEGRADED { border-color: #D9771E; } .fault.FAULT, .fault.CRITICAL { border-color: var(--bad); }

/* tank + charts */
.tank { width: 120px; height: 170px; margin: 0 auto; position: relative; border: 3px solid var(--charcoal); border-radius: 8px 8px 14px 14px; background: #fff; overflow: hidden; }
.tank .water { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(#5aa0d8, #3a7cb8); transition: height .5s; }
.tank.off { border-style: dashed; border-color: var(--ink-3); } .tank.off .water { display: none; }
.tank .mark { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--red); font-size: .65rem; color: var(--red-dark); text-align: right; padding-right: 3px; }
.tank .big { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 1.15rem; text-shadow: 0 0 4px #fff; text-align: center; }
svg.chart { width: 100%; height: 150px; display: block; } svg.chart text { font-size: 10px; fill: var(--ink-3); }

/* login */
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 430px; } .login .logo { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; } .login .logo img { width: 46px; }
.login .field { grid-template-columns: 1fr; } .login input { max-width: none; }
.pill-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; } .pill-switch button { border: 0; background: #fff; padding: 8px 14px; cursor: pointer; font-weight: 600; } .pill-switch button.on { background: var(--charcoal); color: #fff; }

/* modal + toast */
.modal-bg { position: fixed; inset: 0; background: rgba(35,39,43,.55); display: grid; place-items: center; z-index: 50; padding: 14px; }
.modal { background: #fff; border-radius: 12px; max-width: 560px; width: 100%; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); max-height: 90vh; overflow: auto; }
.modal h2 { color: var(--ink); } .modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
#toasts { position: fixed; right: 14px; bottom: 14px; display: grid; gap: 8px; z-index: 60; max-width: min(420px, 92vw); }
.toast { background: var(--charcoal); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); font-size: .9rem; } .toast.bad { background: var(--bad); } .toast.ok { background: var(--ok); }

/* responsive */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px; gap: 4px; }
  .brand { border: 0; padding: 0 8px 0 4px; margin: 0; } .brand span, .side .foot { display: none; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; } .nav button { width: auto; padding: 8px 10px; font-size: .85rem; } .nav svg { display: none; }
  .main { padding: 12px 12px 36px; } .field { grid-template-columns: 1fr; } .field .hint, .field .err { grid-column: 1; }
}
@media print { .side, .topbar, #toasts { display: none; } .shell { display: block; } }
