:root {
  --ink: #17231f;
  --muted: #66746f;
  --line: #dfe7e3;
  --paper: #fff;
  --canvas: #f4f7f5;
  --green: #0d765b;
  --green-dark: #075943;
  --mint: #dff4eb;
  --red: #c63838;
  --red-pale: #fff0ed;
  --amber: #9b6500;
  --shadow: 0 14px 38px rgba(24, 54, 43, .07);
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 15px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--green-dark); text-decoration: none; }
button, input, textarea { font: inherit; }
.topbar { height: 70px; padding: 0 34px; display: flex; align-items: center; gap: 38px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { color: var(--ink); font-weight: 760; display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: inline-grid; place-items: center; background: var(--green); color: #fff; font-weight: 850; letter-spacing: -.05em; }
.brand-mark.large { width: 52px; height: 52px; border-radius: 15px; font-size: 21px; }
nav { display: flex; align-items: center; gap: 24px; flex: 1; }
nav a { color: #52615c; font-weight: 650; }
nav a:hover { color: var(--green); }
.account { display: flex; align-items: center; gap: 18px; }
.account span { font-weight: 680; }
.account small { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.page { max-width: 1500px; margin: 0 auto; padding: 44px 34px 70px; }
.page-heading { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 28px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(30px, 3vw, 44px); line-height: 1.1; letter-spacing: -.035em; margin-bottom: 8px; }
h2 { font-size: 20px; letter-spacing: -.015em; margin-bottom: 5px; }
.eyebrow { color: var(--green); font-size: 12px; text-transform: uppercase; letter-spacing: .14em; font-weight: 800; margin-bottom: 8px; }
.muted, .subtle { color: var(--muted); }
.subtle { display: block; margin-top: 3px; }
.messages { display: grid; gap: 9px; margin-bottom: 20px; }
.message { padding: 13px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
.message.success { border-color: #9cd5c1; background: #effaf6; }
.message.error { border-color: #f1aaa1; background: var(--red-pale); }
.message.warning { border-color: #e9ca82; background: #fff9e9; }
.setup-strip { padding: 13px 18px; border: 1px solid #ead29a; border-radius: 12px; background: #fff9e9; display: flex; gap: 28px; margin-bottom: 22px; color: #675124; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-grid article { padding: 20px 22px; background: var(--paper); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.stat-grid span { color: var(--muted); display: block; font-weight: 650; font-size: 13px; }
.stat-grid strong { display: block; font-size: 31px; line-height: 1.15; margin-top: 7px; }
.stat-grid .small-value { font-size: 21px; }
.stat-grid .danger-stat { background: var(--red-pale); border-color: #f0c5be; }
.stat-grid .danger-stat strong { color: var(--red); }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 24px; margin-bottom: 22px; box-shadow: var(--shadow); }
.panel-heading, .add-panel { display: flex; justify-content: space-between; align-items: center; gap: 25px; }
.panel-heading { margin-bottom: 18px; }
.add-panel > div { flex: 1; }
.inline-form { display: flex; gap: 10px; min-width: min(500px, 100%); }
input, textarea { width: 100%; padding: 12px 13px; color: var(--ink); background: #fbfdfc; border: 1px solid #cbd7d2; border-radius: 9px; outline: none; }
input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(13,118,91,.12); }
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
button { border: 0; cursor: pointer; border-radius: 9px; font-weight: 740; padding: 11px 16px; }
button.primary { background: var(--green); color: #fff; }
button.primary:hover { background: var(--green-dark); }
button.secondary { border: 1px solid #bac9c3; background: #fff; color: var(--ink); }
button.full { width: 100%; }
.link-button { padding: 0; background: transparent; color: var(--green-dark); font-weight: 700; }
.danger-text { color: var(--red); }
.mini-form { display: inline; margin-left: 7px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px 12px; border-bottom: 1px solid #edf1ef; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.leak-row { background: #fff8f6; }
.uid { font: 650 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.pill { display: inline-flex; padding: 3px 8px; border-radius: 99px; font-size: 11px; font-weight: 780; margin-left: 7px; }
.pill.calm { background: var(--mint); color: var(--green-dark); }
.pill.danger { background: #ffdcd6; color: #9d2828; }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #97a29e; }
.status.ok { color: var(--green-dark); }.status.ok::before { background: #1ba476; }
.status.bad { color: var(--red); }.status.bad::before { background: var(--red); }
.status.neutral { color: var(--muted); }
.empty { padding: 42px 15px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 4px; }
.stacked-form { display: grid; gap: 17px; }
.stacked-form label { display: grid; gap: 7px; font-weight: 700; }
.stacked-form small { color: var(--muted); font-weight: 450; }
.stacked-form.compact { max-width: 480px; }
.two-column { display: grid; grid-template-columns: minmax(300px, .7fr) minmax(500px, 1.3fr); gap: 22px; }
.scan-panel { max-width: 920px; }
.compact-stats { max-width: 920px; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 30px; background: radial-gradient(circle at 50% 5%, #e4f4ed 0, var(--canvas) 42%); }
.login-card { width: min(430px, 100%); padding: 38px; border: 1px solid var(--line); background: rgba(255,255,255,.96); border-radius: 20px; box-shadow: 0 24px 70px rgba(24,54,43,.13); }
.login-brand { margin-bottom: 28px; }
.back-link { display: inline-block; margin-bottom: 24px; font-weight: 700; }
.device-title { font: 700 clamp(20px, 2.4vw, 34px)/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
@media (max-width: 900px) {
  .topbar { padding: 0 18px; gap: 16px; }.brand span:last-child { display: none; } nav { gap: 14px; }.account span { display: none; }
  .page { padding: 30px 18px 50px; }.stat-grid { grid-template-columns: repeat(2, 1fr); }.two-column { grid-template-columns: 1fr; }
  .add-panel { align-items: stretch; flex-direction: column; }.inline-form { min-width: 0; width: 100%; }
}
@media (max-width: 560px) {
  .topbar { height: auto; min-height: 64px; flex-wrap: wrap; padding-block: 10px; } nav { order: 3; width: 100%; }
  .page-heading { align-items: flex-start; flex-direction: column; }.stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }.stat-grid article { padding: 16px; }.stat-grid strong { font-size: 25px; }
  .panel { padding: 18px; }.inline-form { flex-direction: column; }.setup-strip { flex-direction: column; gap: 5px; }
}

