/* AiO Cockpit: one light theme, quiet surfaces, one accent (Aquis blue). Fixed heights for inputs and buttons so
   that nothing moves while typing; transitions only on hover, focus and page changes. */
:root {
  --bg: #f3f5f8; --panel: #fff; --panel-2: #f8fafc; --hover: #f1f5f9;
  --text: #0f172a; --text-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --line: #e3e8ef; --line-2: #cfd7e2;
  --accent: #0a6ebd; --accent-2: #085a9b; --accent-weak: #e7f1fb; --ring: rgba(10, 110, 189, .22);
  --ok: #15803d; --okbg: #ecfdf3; --okline: #b7e4c7;
  --bad: #b42318; --badbg: #fef3f2; --badline: #f6c9c4;
  --warn: #a15c07; --warnbg: #fffaeb; --warnline: #f5dfa6;
  --r-sm: 6px; --r: 10px; --r-lg: 14px;
  --sh-1: 0 1px 2px rgba(15, 23, 42, .05);
  --sh-2: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 16px rgba(15, 23, 42, .07);
  --ctl: 36px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body { margin: 0; font: 14px/1.5 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 { color: var(--text); letter-spacing: -.01em; }
h2 { font-size: 22px; font-weight: 650; margin: 28px 0 14px; line-height: 1.25; }
h3 { font-size: 15px; font-weight: 650; margin: 22px 0 10px; }
h4 { font-size: 14px; font-weight: 650; margin: 16px 0 8px; }
p { margin: 8px 0; }
ul { padding-left: 20px; }

/* ---- top bar ---- */
.topbar { position: sticky; top: 0; z-index: 1000; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.6) blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1320px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, #2b8fe0 0%, #0a6ebd 55%, #07508a 100%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); position: relative; }
.brand-mark::after { content: ""; position: absolute; left: 8px; top: 6px; width: 10px; height: 13px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: rgba(255, 255, 255, .92); transform: rotate(0deg); clip-path: polygon(50% 0, 100% 62%, 92% 85%, 50% 100%, 8% 85%, 0 62%); }
.env { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); background: var(--accent-weak); border-radius: 999px; padding: 2px 8px; }
nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
nav a { position: relative; height: 60px; display: inline-flex; align-items: center; padding: 0 12px; color: var(--muted); font-weight: 550; white-space: nowrap; transition: color .15s; }
nav a:hover { color: var(--text); text-decoration: none; }
nav a.active { color: var(--text); }
nav a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
#who { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-weak); color: var(--accent); font-weight: 700; font-size: 12px; text-transform: uppercase; }
.who-text { display: flex; flex-direction: column; line-height: 1.2; }
.who-name { font-weight: 600; font-size: 13px; }
.who-role { font-size: 12px; color: var(--muted); }
.progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--accent); opacity: 0; transition: opacity .2s; }
.progress.on { opacity: 1; animation: progress 1.4s ease-out forwards; }
@keyframes progress { from { width: 0; } to { width: 85%; } }

/* ---- page ---- */
main { max-width: 1320px; margin: 0 auto; padding: 8px 24px 64px; }
main.page-enter { animation: page-in .18s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.crumb { margin: 20px 0 -12px; font-size: 13px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.head { justify-content: space-between; margin: 28px 0 16px; gap: 12px 20px; }
.row.head h2 { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
p.small, div.small { margin: 4px 0 8px; }
.warn { color: var(--warn); }
.pad { padding: 14px 16px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- surfaces ---- */
.card, .tile, form.box, .chart, .machine { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card { padding: 16px 18px; }
.card > h3:first-child, .card > h4:first-child { margin-top: 0; }
.card.click { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.card.click:hover { border-color: var(--line-2); box-shadow: var(--sh-2); }
.card.alert { box-shadow: inset 3px 0 0 var(--bad), var(--sh-1); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.cols form.box { max-width: none; }
h3.section { margin: 40px 0 6px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 18px; }
h2 + h3.section { margin-top: 4px; padding-top: 0; border-top: 0; }

/* ---- key figures ---- */
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; }
@media (max-width: 1000px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { padding: 14px 16px; }
.tile-v { font-size: 26px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tile-l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tile.good .tile-v { color: var(--ok); }
.tile.bad { border-color: var(--badline); } .tile.bad .tile-v { color: var(--bad); }
.tile.warn .tile-v { color: var(--warn); }

/* ---- lists of key and value ---- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv.top { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---- badges, tags, dots ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap; vertical-align: middle; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.on { background: var(--okbg); color: var(--ok); }
.off { background: var(--badbg); color: var(--bad); }
.wait { background: var(--warnbg); color: var(--warn); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-sm); font-size: 12px; font-weight: 550; color: var(--text-2); background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); } .dot.off { background: var(--faint); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.legend > span { display: inline-flex; align-items: center; white-space: nowrap; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

/* ---- messages ---- */
.msg { display: block; padding: 10px 14px; border-radius: var(--r); border: 1px solid transparent; font-size: 13.5px; margin: 8px 0; }
.msg.err { background: var(--badbg); color: var(--bad); border-color: var(--badline); }
.msg.ok { background: var(--okbg); color: var(--ok); border-color: var(--okline); }
.msg.wait { background: var(--warnbg); color: var(--warn); border-color: var(--warnline); }
.msg a { color: inherit; font-weight: 600; text-decoration: underline; }
.problem { margin: 8px 0; padding: 6px 10px; border-radius: var(--r-sm); background: var(--badbg); color: var(--bad); font-size: 12.5px; font-weight: 600; }
.fine { margin: 8px 0; font-size: 12.5px; color: var(--ok); font-weight: 600; }
.form-msg { font-size: 13px; min-width: 0; }
.form-msg.ok { color: var(--ok); } .form-msg.err { color: var(--bad); }

/* ---- forms: fixed heights, focus without movement ---- */
form.box { padding: 18px; display: grid; gap: 12px; max-width: 560px; }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 550; color: var(--text-2); }
label.inline, .row > label { display: inline-flex; align-items: center; gap: 8px; }
label.check, .checks label { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; color: var(--text); }
label.check input { margin-top: 3px; }
input, select, textarea { font: inherit; font-size: 14px; color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-sm); transition: border-color .15s, box-shadow .15s; }
input, select { height: var(--ctl); padding: 0 10px; }
textarea { padding: 8px 10px; }
input[type=checkbox], input[type=radio] { height: auto; width: 16px; height: 16px; padding: 0; accent-color: var(--accent); }
input[type=file] { height: auto; padding: 6px; }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input::placeholder { color: var(--faint); }
input:disabled, select:disabled { background: var(--panel-2); color: var(--muted); }
.search { width: 300px; max-width: 100%; padding-left: 34px; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3.5 3.5'/%3E%3C/svg%3E") no-repeat 11px center; }
.checks { display: grid; gap: 6px; max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; background: var(--panel); }
progress { width: 120px; height: 8px; vertical-align: middle; accent-color: var(--accent); }

button { font: inherit; font-size: 13.5px; font-weight: 600; height: var(--ctl); padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; white-space: nowrap; transition: background-color .15s, border-color .15s, box-shadow .15s, color .15s; }
button:hover { background: var(--accent-2); border-color: var(--accent-2); }
button:active { transform: translateY(.5px); }
button.secondary { background: var(--panel); color: var(--text-2); border-color: var(--line-2); box-shadow: var(--sh-1); }
button.secondary:hover { background: var(--hover); border-color: var(--faint); color: var(--text); }
button.danger { background: var(--panel); color: var(--bad); border-color: var(--badline); }
button.danger:hover { background: var(--badbg); border-color: var(--bad); }
button:disabled { opacity: .5; cursor: default; transform: none; }
button.link { height: auto; background: none; border: 0; box-shadow: none; padding: 4px 0; color: var(--accent); font-weight: 550; font-size: 13px; }
button.link:hover { background: none; text-decoration: underline; color: var(--accent-2); }

/* ---- tables ---- */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; font-size: 13.5px; box-shadow: var(--sh-1); margin: 4px 0 8px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--panel-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--panel-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.warnrow td { background: var(--badbg); }
tr.warnrow:hover td { background: #fde8e6; }
table.params td { padding-top: 5px; padding-bottom: 5px; }

/* ---- folding sections ---- */
details > summary { cursor: pointer; list-style: none; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 8px; user-select: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(-45deg); transition: transform .15s; flex: none; margin: 0 2px; }
details[open] > summary::before { transform: rotate(45deg); }
details > summary:hover { color: var(--text); }
details > summary:hover::before { border-color: var(--muted); }
main > details, .list { margin: 18px 0 8px; }
details.list > summary { font-size: 15px; color: var(--text); margin-bottom: 8px; }
.card details { margin-top: 10px; }
.card details > summary { font-size: 13px; font-weight: 550; }

/* ---- machines overview ---- */
.machines { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-top: 16px; }
.machine { display: grid; grid-template-columns: 104px 1fr; gap: 14px; align-items: start; padding: 14px; transition: border-color .15s, box-shadow .15s, transform .15s; }
.machine.click { cursor: pointer; }
.machine.click:hover { border-color: var(--line-2); box-shadow: var(--sh-2); transform: translateY(-1px); }
.machine.tone-bad { box-shadow: inset 3px 0 0 var(--bad), var(--sh-1); }
.machine.tone-bad:hover { box-shadow: inset 3px 0 0 var(--bad), var(--sh-2); }
.machine.tone-off { background: #fbfcfd; }
.machine.tone-off .machine-pic { opacity: .7; }
.machine h3 { margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 15px; }
.machine-body { min-width: 0; }
.machine .kv { margin-top: 8px; font-size: 13px; }
.dev-id { font-family: var(--mono); font-size: 13.5px; font-weight: 600; letter-spacing: 0; }
.row.head h2 .dev-id { font-size: 15px; font-weight: 500; }
.dev-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 13px; min-height: 22px; }
.dev-label { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; background: var(--accent-weak); color: var(--accent); font-size: 12px; font-weight: 650; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mapcard { padding: 0; overflow: hidden; }
.mapcard .legend { padding: 10px 14px; margin: 0; border-top: 1px solid var(--line); }
.map { height: 360px; width: 100%; background: #e9eef3; }
.map.small { height: 200px; border-radius: var(--r); margin: 8px 0; border: 1px solid var(--line); }
.leaflet-container { font: inherit; }
.leaflet-tooltip { font-size: 12px; border-radius: var(--r-sm); border-color: var(--line); box-shadow: var(--sh-2); }

/* ---- AiO picture ---- */
.machine-pic { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.aio-pic { width: 104px; height: auto; }
.aio-pic.big { width: 100%; max-width: 320px; display: block; margin: 0 auto; }
.pic-small { font-size: 11px; fill: var(--muted); }
.pic-water { fill: #42a5f5; }
.pic-led { stroke: #fff; stroke-width: 1.5; }
.led-ok { fill: var(--ok); } .led-bad { fill: var(--bad); } .led-warn { fill: var(--warn); } .led-off { fill: #b0bcc5; }
.air-temp { font-size: 12px; text-align: center; white-space: nowrap; color: var(--muted); }
.air-temp b, .air-temp strong { color: var(--text); }
.air-temp.big { font-size: 15px; }

/* ---- device page ---- */
.hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin: 8px 0 12px; }
.hero-pic { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.part { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.part b { min-width: 86px; font-weight: 600; }
.part:last-of-type { border-bottom: 0; }
.labelform { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -6px 0 14px; }
.label-input { width: 220px; }
.posedit summary { font-size: 13px; }
.posedit form { margin-top: 10px; }
.posedit input { width: 140px; }
.card.board { margin-bottom: 12px; }
.card.board h4 { margin: 0 0 6px; }
.card.board details { margin-top: 8px; }
.danger-zone { margin-top: 28px; border-color: var(--badline); }
.danger-zone h3 { color: var(--bad); }
pre.log { max-height: 380px; overflow: auto; background: #0f172a; color: #dbe4ee; padding: 12px 14px; border-radius: var(--r); font: 12px/1.55 var(--mono); white-space: pre-wrap; margin: 6px 0; }

/* ---- charts (statistics): colours checked with the dataviz palette validator ---- */
.chart { padding: 14px; }
.chart text { font-size: 11px; fill: var(--muted); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart text.val { fill: var(--text); font-weight: 600; }
.k-hot { fill: #d9534f; background: #d9534f; }
.k-chilled { fill: #3d8fd6; background: #3d8fd6; }
.k-carbo { fill: #1f8a3d; background: #1f8a3d; }
.k-carbo_light { fill: #6dbb5a; background: #6dbb5a; }
.k-filtered { fill: #cfe6f5; background: #cfe6f5; }   /* very light blue (Pepe 27.10.2026): outline keeps it visible */
rect.k-filtered { stroke: #8ec3e6; stroke-width: 1; }
.sw.k-filtered { box-shadow: inset 0 0 0 1px #8ec3e6; }
.k-other { fill: #c17f2e; background: #c17f2e; }

/* ---- login ---- */
form.box.login { max-width: 380px; margin: 12vh auto 0; padding: 28px; gap: 14px; box-shadow: var(--sh-2); }
form.box.login h2 { margin: 0 0 4px; font-size: 20px; }
form.box.login button { margin-top: 4px; height: 40px; }

/* ---- live updates wait while the user is entering something (render in app.js) ---- */
.live-note { position: fixed; right: 20px; bottom: 20px; z-index: 1100; display: flex; gap: 12px; align-items: center; max-width: calc(100vw - 40px);
             background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px 10px 14px; box-shadow: 0 10px 30px rgba(15, 23, 42, .16);
             font-size: 13px; color: var(--text-2); animation: page-in .18s ease-out; }
.live-note button { height: 30px; padding: 0 10px; font-size: 12.5px; }

/* ---- narrow screens ---- */
@media (max-width: 900px) {
  .topbar-inner { gap: 14px; padding: 0 16px; }
  .who-text, .env { display: none; }
  main { padding: 4px 16px 48px; }
}
@media (max-width: 700px) {
  main table { display: block; overflow-x: auto; white-space: nowrap; }
  h2 { font-size: 19px; }
  .row.head .search { width: 100%; }
}
@media (max-width: 520px) {
  .brand-name { display: none; }
  .machines { grid-template-columns: 1fr; }
  .machine { grid-template-columns: 76px 1fr; }
  .aio-pic { width: 76px; }
  .label-input { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
