/* HomeWatch: flat, dark, one accent colour. */
:root { --bg: #0d1015; --panel: #141920; --panel-2: #1a2029; --line: #252d38; --text: #e8ebf0; --muted: #8993a3; --accent: #3b82f6; --accent-d: #2f6fd9; --bad: #f0616d; --warn: #e8a93b; --ok: #3ecf8e; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.logo svg { flex: none; }

/* buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-weight: 600; font-size: 14px; text-decoration: none; }
.btn:hover { background: #212936; text-decoration: none; } .btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; } .btn.pri:hover { background: var(--accent-d); }
.btn.bad { color: var(--bad); } .btn.sm { padding: 6px 11px; font-size: 13px; }
label.f { display: grid; gap: 6px; font-weight: 600; font-size: 13.5px; }
label.f small { font-weight: 400; color: var(--muted); }
.in { width: 100%; padding: 11px 13px; border-radius: 8px; border: 1px solid var(--line); background: #0f1319; color: var(--text); }
.in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.25); }
.msg { min-height: 20px; font-size: 14px; } .msg.bad { color: var(--bad); } .msg.ok { color: var(--ok); }

/* login */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-art { position: relative; padding: 44px 52px; display: flex; flex-direction: column; justify-content: space-between; background: #0a0d12; border-right: 1px solid var(--line); overflow: hidden; }
.auth-art h2 { font-size: 34px; line-height: 1.15; max-width: 440px; margin-bottom: 12px; } .auth-art p { color: var(--muted); max-width: 420px; margin: 0; font-size: 16px; }
.art-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 34px 0; max-width: 520px; }
.art-cam { position: relative; aspect-ratio: 16 / 10; border-radius: 10px; border: 1px solid var(--line); background: repeating-linear-gradient(0deg, #11161d 0 3px, #0e1218 3px 6px); }
.art-cam span { position: absolute; left: 10px; bottom: 8px; font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.art-cam i { position: absolute; right: 10px; top: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); opacity: .85; animation: blink 2.4s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.auth-main { display: grid; place-items: center; padding: 32px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; } .auth-card .sub { color: var(--muted); margin: 0 0 24px; }
.auth-card form { display: grid; gap: 16px; }
.pw { position: relative; } .pw button { position: absolute; right: 6px; top: 6px; bottom: 6px; padding: 0 10px; border: 0; background: transparent; color: var(--muted); font-size: 13px; border-radius: 6px; } .pw button:hover { color: var(--text); }
.auth-foot { margin-top: 22px; font-size: 13.5px; color: var(--muted); text-align: center; }
.callout { padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); font-size: 14px; }
.callout.warn { border-color: rgba(232,169,59,.45); background: rgba(232,169,59,.08); }

/* app shell */
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: #0a0d12; border-right: 1px solid var(--line); padding: 20px 12px; overflow-y: auto; }
.side .logo { padding: 2px 10px 22px; }
.nav { display: grid; gap: 2px; } .nav h6 { margin: 18px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: #5d6676; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 7px; color: #aab3c2; font-size: 14.5px; text-decoration: none; }
.nav a:hover { background: var(--panel); color: #fff; } .nav a.on { background: var(--panel-2); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); flex: none; } .dot.ok { background: var(--ok); }
.me { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); } .me b { display: block; color: var(--text); font-size: 14px; overflow-wrap: anywhere; }
.me .row { display: flex; gap: 8px; margin-top: 10px; }
.main { min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 32px; border-bottom: 1px solid var(--line); }
.top h1 { font-size: 21px; } .top .sub { color: var(--muted); font-size: 13.5px; }
.menu { display: none; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 8px; padding: 6px 10px; }
.content { padding: 28px 32px 60px; max-width: 1280px; }
.cams { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; }
.cam { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.cam-view { position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center; text-align: center; padding: 22px; background: repeating-linear-gradient(0deg, #10151c 0 3px, #0d1218 3px 6px); border-bottom: 1px solid var(--line); }
.cam-badge { position: absolute; top: 12px; left: 12px; display: flex; align-items: center; gap: 7px; padding: 4px 9px; border-radius: 6px; background: rgba(0,0,0,.55); font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.cam-time { position: absolute; top: 12px; right: 14px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.cam-err { max-width: 360px; } .cam-err svg { color: var(--bad); margin-bottom: 10px; } .cam-err h3 { font-size: 18px; margin-bottom: 6px; } .cam-err p { margin: 0 0 14px; color: #b7bfcc; font-size: 14.5px; }
.cam-err code { display: inline-block; margin-top: 12px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.cam-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; } .cam-foot b { display: block; } .cam-foot small { color: var(--muted); }
.fix { padding: 14px 18px 16px; border-top: 1px solid var(--line); font-size: 14px; color: #b7bfcc; } .fix h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); } .fix ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: sp .8s linear infinite; display: inline-block; } @keyframes sp { to { transform: rotate(360deg); } }
.room-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 18px; align-items: start; }
.card { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); } .card > .hd { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 600; } .card > .bd { padding: 16px 18px; }
.kv { display: grid; grid-template-columns: 120px 1fr; } .kv > div { padding: 9px 0; border-bottom: 1px solid var(--line); } .kv > div:nth-last-child(-n+2) { border-bottom: 0; } .kv .k { color: var(--muted); }
table { width: 100%; border-collapse: collapse; } th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 18px; border-bottom: 1px solid var(--line); font-weight: 600; } td { padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; } tr:last-child td { border-bottom: 0; }
.tw { overflow-x: auto; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); } .badge.ok { color: var(--ok); background: rgba(62,207,142,.12); } .badge.warn { color: var(--warn); background: rgba(232,169,59,.12); } .badge.acc { color: #7fb0ff; background: rgba(59,130,246,.14); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.checks { display: flex; gap: 8px 18px; flex-wrap: wrap; } .checks label { display: flex; align-items: center; gap: 7px; font-weight: 400; font-size: 14px; }
.temp { font-family: var(--mono); font-size: 20px; font-weight: 700; letter-spacing: .04em; padding: 10px 14px; border: 1px dashed var(--line); border-radius: 8px; display: inline-block; margin: 8px 0; user-select: all; }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(5,7,10,.78); } .modal .box { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; } .modal h2 { font-size: 20px; margin-bottom: 6px; } .modal form { display: grid; gap: 14px; margin-top: 16px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 60; padding: 11px 16px; border-radius: 8px; background: #20262f; border: 1px solid var(--line); opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; } .toast.show { opacity: 1; transform: none; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; } .auth-art { display: none; }
  .app { grid-template-columns: 1fr; } .side { position: fixed; z-index: 30; width: 260px; transform: translateX(-100%); transition: transform .2s; } body.nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.6); }
  .menu { display: inline-block; } .top, .content { padding-left: 16px; padding-right: 16px; } .cams { grid-template-columns: 1fr; } .room-grid { grid-template-columns: 1fr; }
}

.req-status { display: inline-block; padding: 6px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600; border: 1px solid var(--line); background: var(--panel-2); margin-bottom: 4px; } .req-status.warn { color: var(--warn); border-color: rgba(232,169,59,.45); } .req-status.bad { color: var(--bad); border-color: rgba(240,97,109,.45); } .req-status.ok { color: var(--ok); border-color: rgba(62,207,142,.45); }
.cam-badge.conn .dot { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; } @keyframes pulse { 50% { opacity: .25; } }
.conn-spin { margin-bottom: 12px; } .conn-spin .spin { width: 34px; height: 34px; border-width: 3px; }
.cam-err h3[data-conn] { min-width: 150px; font-weight: 600; }
.cam-badge.on .dot { background: var(--ok); }
.cam-view { position: relative; overflow: hidden; }
.cam-snap { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-scrim { position: absolute; inset: 0; background: rgba(8,10,14,.42); }
.cam-badge.low { top: auto; bottom: 12px; z-index: 2; }
.cam-err.over { position: relative; z-index: 2; text-shadow: 0 1px 6px rgba(0,0,0,.7); } .cam-err.over h3 { color: #fff; }
.cam-badge.on.bad .dot { background: var(--bad); animation: none; } .cam-badge.on.bad { color: var(--bad); }
.faults { display: grid; gap: 8px; margin: 12px auto 0; max-width: 300px; }
.fault { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border: 1px solid rgba(240,97,109,.4); border-radius: 8px; background: rgba(240,97,109,.1); text-align: left; } .fault b { color: #ff9aa2; font-size: 14px; } .fault code { font-family: var(--mono); font-size: 12px; color: var(--muted); }
/* images are icons now: the logo tile and the room markers are drawn, not pictures */
.logo-ic { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.logo-ic .ico { display: block; }
.nav a .ico, .cam-badge .ico, .art-cam .ico { flex: none; }
.cam-msg-ic { color: var(--muted); margin-bottom: 10px; }
.cam-err.lock svg { color: var(--warn); } .cam-err.lock h3 { color: var(--text); }
.cam-badge.lock .dot { background: var(--warn); }
.cam-err .note-small { margin: 0 0 6px; }

.art-ic { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); color: #2c3a4a; } .art-ic .ico { width: 34px; height: 34px; }
.cam-view { min-height: 340px; } .cam-err.over, .cam-err { max-width: 100%; }

/* camera controls under the picture: talk, listen, time slider (not connected yet) */
.cam-ctl { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line); background: var(--panel); }
.ctl { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text-2); font-size: 12.5px; font-weight: 600; cursor: pointer; } .ctl:hover { color: var(--text); background: #212936; }
.ctl.live { color: var(--muted); } .ctl.live.on { color: var(--ok); border-color: rgba(62,207,142,.45); }
.tl-wrap { flex: 1; min-width: 0; } .tl-labels { display: flex; justify-content: space-between; margin-top: 3px; font: 11px var(--mono); color: var(--muted); } .tl-labels [data-tl-label] { color: var(--text-2); }
.tl { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; margin: 8px 0 0; border-radius: 4px; background: var(--line); outline: none; cursor: pointer; }
.tl::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 2px solid #0d1015; cursor: pointer; }
.tl::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid #0d1015; cursor: pointer; }

.ctl.muted { color: var(--bad); border-color: rgba(240,97,109,.4); cursor: default; } .ctl.muted:hover { background: var(--panel-2); color: var(--bad); }

.btn[data-restart]:disabled { opacity: .6; cursor: not-allowed; }

/* a camera that is connected: no dimming, its name and the time across the top */
.cam.live .cam-scrim { display: none; }
.cam-top { display: none; position: absolute; top: 0; left: 0; right: 0; z-index: 2; justify-content: space-between; gap: 12px; padding: 12px 16px; font: 600 15px var(--mono); letter-spacing: .02em; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.9); }
.cam.live .cam-top { display: flex; } .cam-top span { font-weight: 500; }
