:root {
  --navy: #0b2331;
  --navy-2: #133747;
  --paper: #f3f0e9;
  --white: #fffdf8;
  --ink: #12242d;
  --muted: #66777e;
  --line: rgba(11, 35, 49, .12);
  --mint: #bfe9d7;
  --mint-strong: #66c6a3;
  --lime: #d9ee73;
  --orange: #f08362;
  --yellow: #f6d16f;
  --radius-lg: 28px;
  --radius-md: 20px;
  --shadow: 0 24px 70px rgba(11, 35, 49, .10);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
body { margin: 0; min-width: 320px; min-height: 100vh; background:
  radial-gradient(circle at 100% 0, rgba(191, 233, 215, .38), transparent 32rem),
  var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; background: var(--navy); color: white; padding: .8rem 1rem; border-radius: .6rem; }
.skip-link:focus { top: 1rem; }
.shell { min-height: 100vh; }
.topbar { height: 76px; max-width: 1240px; margin: auto; padding: 0 20px; display: flex; align-items: center; gap: 16px; }
.brand { color: var(--navy); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; gap: 11px; font-size: 1.15rem; font-weight: 760; letter-spacing: -.03em; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; background: var(--navy); color: var(--lime); border-radius: 11px; font-weight: 850; }
.connection-badge { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .78rem; font-weight: 650; }
.connection-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint-strong); box-shadow: 0 0 0 4px rgba(102,198,163,.15); }
.layout-narrow { width: min(100% - 40px, 630px); margin-inline: auto; }
.layout-wide { width: min(100% - 32px, 1120px); margin-inline: auto; }
.eyebrow { text-transform: uppercase; letter-spacing: .15em; font-size: .68rem; font-weight: 820; color: #386073; }
.eyebrow.soft { color: rgba(255,255,255,.65); }
.eyebrow.mint { color: var(--mint); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -.045em; }
.activation { padding: clamp(2rem, 8vh, 6.5rem) 0 5rem; }
.activation > h1 { font-size: clamp(3.2rem, 12vw, 6rem); line-height: .91; margin: .8rem 0 1.4rem; color: var(--navy); }
.lead { color: #47616d; font-size: clamp(1rem, 2.5vw, 1.2rem); line-height: 1.55; max-width: 540px; }
.activation-card { background: var(--white); border: 1px solid rgba(11,35,49,.08); box-shadow: var(--shadow); padding: 22px; border-radius: var(--radius-lg); margin-top: 32px; }
.activation-card label { display: block; font-weight: 740; font-size: .9rem; margin: 3px 3px 10px; }
.code-field { position: relative; }
.code-field input { width: 100%; min-height: 62px; border: 1px solid #c9d1d0; background: #f8f7f2; border-radius: 16px; padding: 0 48px 0 17px; color: var(--navy); font-size: 1.2rem; font-weight: 720; letter-spacing: .08em; text-transform: uppercase; outline: none; transition: .18s; }
.code-field input:focus { border-color: var(--mint-strong); box-shadow: 0 0 0 4px rgba(102,198,163,.18); background: white; }
.code-field > span { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: #7b8e91; }
.field-hint { margin: 9px 3px 20px; font-size: .79rem; color: var(--muted); }
.inline-error { margin: -4px 3px 16px; padding: 11px 13px; border-radius: 12px; background: #fff0ec; color: #9b3d27; font-size: .84rem; line-height: 1.4; }
.button { border: 0; min-height: 48px; border-radius: 14px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; font-weight: 760; color: var(--ink); transition: transform .15s, background .15s, opacity .15s; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: wait; opacity: .55; transform: none; }
.button.primary { color: white; background: var(--navy); }
.button.primary:hover { background: #123748; }
.button.secondary { color: var(--navy); background: #e5ede8; }
.button.light { color: var(--navy); background: var(--lime); }
.button.ghost { background: transparent; border: 1px solid var(--line); }
.button.compact { min-height: 44px; padding: 0 13px; margin-left: 0; }
.button.wide { width: 100%; justify-content: space-between; }
.trust-row { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 24px; color: var(--muted); font-size: .74rem; font-weight: 690; }
.trust-row span::before { content: "✓"; color: #16845f; margin-right: 6px; }
.dashboard { padding: 34px 0 80px; }
.dashboard-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; }
.dashboard-heading h1 { color: var(--navy); font-size: clamp(2.4rem, 7vw, 4.6rem); line-height: .94; margin: .5rem 0 0; }
.icon-button { width: 48px; height: 48px; border-radius: 16px; background: rgba(255,255,255,.55); border: 1px solid var(--line); color: var(--navy); font-size: 1.3rem; }
.icon-button.loading { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tabbar { margin: 32px 0 22px; display: flex; gap: 5px; padding: 5px; border-radius: 16px; background: rgba(11,35,49,.065); width: max-content; max-width: 100%; overflow-x: auto; }
.tab { border: 0; background: transparent; color: #526770; min-height: 44px; padding: 0 18px; border-radius: 12px; font-size: .86rem; font-weight: 740; white-space: nowrap; }
.tab.active { background: var(--white); color: var(--navy); box-shadow: 0 4px 18px rgba(11,35,49,.08); }
.monitoring-hero { min-height: 240px; border-radius: var(--radius-lg); padding: 26px; background: var(--navy); color: white; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 20px; box-shadow: 0 24px 80px rgba(11,35,49,.16); position: relative; overflow: hidden; }
.monitoring-hero::after { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; right: -80px; top: -100px; background: rgba(191,233,215,.1); border: 42px solid rgba(191,233,215,.05); pointer-events: none; }
.monitoring-hero.paused-state { background: #5d5c50; }
.monitoring-hero.alert-state { background: #7a3325; }
.shield { width: 78px; height: 88px; display: grid; place-items: center; border-radius: 40px 40px 48px 48px; background: var(--mint); color: var(--navy); font-size: 1.65rem; clip-path: polygon(50% 0, 94% 15%, 88% 72%, 50% 100%, 12% 72%, 6% 15%); }
.paused-state .shield { background: var(--yellow); }
.alert-state .shield { background: #ffc0ad; }
.monitoring-copy { align-self: center; z-index: 1; }
.monitoring-copy h2 { font-size: clamp(2.4rem, 8vw, 4.5rem); margin: .25rem 0 .45rem; line-height: .95; }
.monitoring-copy p { color: rgba(255,255,255,.72); margin: 0; line-height: 1.45; max-width: 430px; }
.monitoring-hero .button { grid-column: 1 / -1; justify-self: start; z-index: 1; }
.status-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 14px; }
.status-card { background: rgba(255,253,248,.82); border: 1px solid rgba(11,35,49,.08); border-radius: var(--radius-md); min-height: 178px; padding: 19px; }
.status-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.status-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-weight: 850; }
.status-icon.power { background: #fff0c2; color: #7e5a00; }
.status-icon.battery { background: #ecf1bd; color: #52630d; font-size: .76rem; }
.status-icon.ble { background: #ddecff; color: #24517e; }
.status-icon.gateway { background: var(--mint); color: #17664d; }
.status-card h3 { font-size: 1.25rem; margin: 24px 0 6px; color: var(--navy); }
.status-card p { color: var(--muted); font-size: .83rem; line-height: 1.45; margin: 0; }
.pill { min-height: 28px; padding: 0 10px; border-radius: 99px; display: inline-flex; align-items: center; font-size: .68rem; font-weight: 780; }
.pill.good { color: #116044; background: #d9f3e8; }
.pill.bad { color: #953922; background: #ffded4; }
.pill.neutral { color: #5d6a6e; background: #e9ece9; }
.section-block { margin-top: 46px; }
.section-block.first { margin-top: 10px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.section-heading h2 { margin: 5px 0 0; font-size: clamp(1.7rem, 5vw, 2.6rem); color: var(--navy); }
.count-badge { padding: 7px 10px; background: white; border: 1px solid var(--line); border-radius: 99px; font-size: .7rem; font-weight: 760; color: var(--muted); white-space: nowrap; }
.incident-list { display: grid; gap: 12px; }
.incident-card { background: var(--white); border-radius: var(--radius-md); border: 1px solid rgba(11,35,49,.09); overflow: hidden; }
.incident-card-main { padding: 20px; display: grid; grid-template-columns: auto 1fr; gap: 14px; }
.incident-symbol { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: #ffded4; color: #9c3f29; font-weight: 850; }
.incident-card h3 { margin: 0 0 6px; font-size: 1.18rem; }
.incident-card p { color: var(--muted); line-height: 1.45; font-size: .84rem; margin-bottom: 8px; }
.incident-meta { color: #7b898d; font-size: .72rem; }
.incident-actions { border-top: 1px solid var(--line); padding: 12px; display: grid; grid-template-columns: 1fr; gap: 8px; background: #faf9f5; }
.incident-actions button { min-height: 44px; }
.empty-state { min-height: 104px; background: rgba(255,255,255,.46); border: 1px dashed rgba(11,35,49,.2); border-radius: var(--radius-md); display: flex; align-items: center; gap: 14px; padding: 20px; }
.empty-check { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 14px; display: grid; place-items: center; background: var(--mint); color: #17664d; font-weight: 850; }
.empty-state strong { display: block; margin-bottom: 3px; }
.empty-state p { margin: 0; color: var(--muted); font-size: .8rem; }
.timeline { position: relative; display: grid; gap: 0; }
.timeline-item { display: grid; grid-template-columns: 30px 1fr; gap: 13px; min-height: 94px; }
.timeline-rail { position: relative; }
.timeline-rail::before { content: ""; position: absolute; width: 1px; background: #bdc9c5; top: 16px; bottom: -3px; left: 50%; }
.timeline-item:last-child .timeline-rail::before { display: none; }
.timeline-dot { width: 13px; height: 13px; border: 3px solid var(--paper); background: var(--mint-strong); border-radius: 50%; position: absolute; top: 6px; left: 50%; transform: translateX(-50%); box-shadow: 0 0 0 1px var(--mint-strong); z-index: 1; }
.timeline-content { padding-bottom: 24px; }
.timeline-content h3 { font-size: 1rem; margin: 0 0 5px; }
.timeline-content p { margin: 0 0 6px; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.timeline-content time { color: #829094; font-size: .69rem; }
.advanced-intro { border-radius: var(--radius-lg); padding: 24px; background: var(--navy); color: white; display: grid; gap: 22px; }
.advanced-intro h2 { font-size: clamp(2rem, 6vw, 3.3rem); margin: .55rem 0 .8rem; }
.advanced-intro p { margin: 0; color: rgba(255,255,255,.65); line-height: 1.55; max-width: 620px; }
.classification { align-self: end; border: 1px solid rgba(217,238,115,.35); color: var(--lime); border-radius: 14px; padding: 12px 14px; font-size: .78rem; line-height: 1.4; }
.node-supply-section { margin-top: 28px; }
.node-supply-list { display: grid; gap: 10px; }
.node-supply-card { padding: 17px; border-radius: 17px; background: var(--white); border: 1px solid var(--line); display: grid; gap: 13px; }
.node-supply-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.node-supply-head strong { color: var(--navy); }
.node-supply-head span { font-size: .68rem; color: var(--muted); }
.node-supply-value { display: flex; align-items: baseline; gap: 8px; }
.node-supply-value b { font-size: 2rem; letter-spacing: -.05em; color: var(--navy); }
.node-supply-value small { color: var(--muted); }
.node-supply-card p { margin: 0; color: var(--muted); font-size: .74rem; line-height: 1.45; }
.can-list { display: grid; gap: 8px; margin-top: 14px; }
.can-row { background: #153342; color: white; border-radius: 15px; padding: 15px; display: grid; gap: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; }
.can-id { color: var(--lime); font-weight: 780; }
.can-data { color: #e8f2ef; word-break: break-all; letter-spacing: .05em; }
.can-meta { display: flex; flex-wrap: wrap; gap: 7px 13px; color: #9fb4bb; font-size: .65rem; }
.empty-state.dark { margin-top: 14px; background: #153342; border-color: #35515e; color: white; }
.empty-state.dark p { color: #9fb4bb; }
.state-page { text-align: center; padding: 12vh 0; }
.state-page h1 { font-size: clamp(2.4rem, 8vw, 4rem); color: var(--navy); margin: 24px 0 12px; }
.state-page p { color: var(--muted); line-height: 1.55; }
.state-icon { width: 64px; height: 64px; margin: auto; border-radius: 22px; display: grid; place-items: center; background: #ffded4; color: #9c3f29; font-size: 1.5rem; font-weight: 850; }
.skeleton { background: linear-gradient(100deg, rgba(255,255,255,.4) 30%, rgba(255,255,255,.8) 50%, rgba(255,255,255,.4) 70%); background-size: 300% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-lg); }
.hero-skeleton { height: 240px; }
.card-skeleton { height: 178px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.modal { width: min(calc(100% - 28px), 480px); border: 0; border-radius: 26px; padding: 0; background: var(--white); color: var(--ink); box-shadow: 0 30px 120px rgba(0,0,0,.28); }
.modal::backdrop { background: rgba(5,20,28,.68); backdrop-filter: blur(6px); }
.modal form { padding: 28px; }
.modal h2 { font-size: 2rem; color: var(--navy); margin: .6rem 0 .7rem; }
.modal p { color: var(--muted); line-height: 1.5; }
.modal-close { float: right; width: 44px; height: 44px; border: 0; border-radius: 13px; background: #eef0ec; color: var(--navy); font-size: 1.4rem; }
.choice-stack { display: grid; gap: 9px; margin-top: 24px; }
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; width: min(calc(100% - 32px), 430px); padding: 13px 16px; border-radius: 14px; background: var(--navy); color: white; box-shadow: var(--shadow); text-align: center; font-size: .82rem; font-weight: 680; }

@media (min-width: 680px) {
  .topbar { padding-inline: 32px; height: 88px; }
  .connection-badge { margin-left: auto; }
  .button.compact { margin-left: 8px; }
  .layout-wide { width: min(100% - 64px, 1120px); }
  .monitoring-hero { grid-template-columns: auto 1fr auto; padding: 34px; }
  .monitoring-hero .button { grid-column: auto; justify-self: end; }
  .status-grid { grid-template-columns: repeat(2, 1fr); }
  .incident-actions { grid-template-columns: 1fr 1fr; }
  .advanced-intro { grid-template-columns: 1fr 260px; padding: 34px; }
  .can-row { grid-template-columns: 130px 1fr auto; align-items: center; }
}

@media (min-width: 980px) {
  .status-grid { grid-template-columns: repeat(4, 1fr); }
  .node-supply-list { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
