:root {
  --ink: #17324d;
  --ink-soft: #4a6074;
  --paper: #f3f7f9;
  --surface: #ffffff;
  --line: #d9e4e9;
  --aqua: #0f8f91;
  --aqua-soft: #dff3f1;
  --sky: #4aa8c0;
  --amber: #d9822b;
  --amber-soft: #fff0dc;
  --coral: #c75050;
  --shadow: 0 18px 50px rgba(23, 50, 77, .08);
  --radius: 18px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif; line-height: 1.45; }
button, input, select { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 3px solid rgba(15,143,145,.35); outline-offset: 3px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 30px 22px 22px; display: flex; flex-direction: column; background: #e8f0f4; border-right: 1px solid var(--line); }
.wordmark { display: flex; gap: 12px; align-items: center; text-decoration: none; margin-bottom: 48px; }
.wordmark > span:last-child { display: grid; line-height: 1; }
.wordmark strong { font-family: ui-rounded, "Aptos Display", sans-serif; font-size: 20px; letter-spacing: -.4px; }
.wordmark small { margin-top: 4px; color: var(--aqua); font: 700 10px/1 ui-monospace, monospace; letter-spacing: 2px; text-transform: uppercase; }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; position: relative; border: 1px solid rgba(255,255,255,.25); border-radius: 14px; background: rgba(255,255,255,.1); }
.brand-mark span { position: absolute; width: 6px; border-radius: 4px; background: currentColor; transform-origin: bottom; }
.brand-mark span:nth-child(1) { height: 13px; transform: translateX(-9px) rotate(-18deg); }
.brand-mark span:nth-child(2) { height: 25px; }
.brand-mark span:nth-child(3) { height: 17px; transform: translateX(9px) rotate(18deg); }
.brand-mark.mini { width: 42px; height: 42px; background: var(--ink); color: white; border-radius: 13px; }
.sidebar nav { display: grid; gap: 7px; }
.sidebar nav a { padding: 11px 13px; border-radius: 11px; text-decoration: none; color: var(--ink-soft); font-weight: 650; }
.sidebar nav a span { display: inline-grid; width: 25px; color: var(--aqua); }
.sidebar nav a:hover, .sidebar nav a.active { background: var(--surface); color: var(--ink); box-shadow: 0 5px 20px rgba(23,50,77,.05); }
.sidebar-foot { margin-top: auto; padding: 16px 14px; border-top: 1px solid var(--line); }
.sidebar-foot p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.sidebar-foot strong { display: block; margin: 3px 0 8px; }

.main-canvas { width: 100%; max-width: 1500px; padding: 34px clamp(24px, 4vw, 64px) 30px; overflow: hidden; }
.topbar, .section-heading { display: flex; justify-content: space-between; gap: 28px; align-items: flex-end; }
.topbar { margin-bottom: 30px; align-items: center; }
h1, h2 { font-family: ui-rounded, "Aptos Display", "Segoe UI", sans-serif; letter-spacing: -.035em; margin: 0; }
h1 { font-size: clamp(29px, 3vw, 42px); }
h2 { font-size: clamp(24px, 2.2vw, 32px); }
.eyebrow { margin: 0 0 6px; color: var(--aqua); font: 750 10px/1.2 ui-monospace, "SFMono-Regular", monospace; letter-spacing: .14em; text-transform: uppercase; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid #b8deda; background: var(--aqua-soft); color: #116a6d; border-radius: 999px; font-size: 13px; font-weight: 700; }
.live-pill span { width: 8px; height: 8px; border-radius: 50%; background: var(--aqua); box-shadow: 0 0 0 6px rgba(15,143,145,.11); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px rgba(15,143,145,.08); } }

.pulse-board, .content-section { margin-bottom: 26px; padding: clamp(22px, 3vw, 36px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.section-heading { margin-bottom: 26px; }
.section-heading > p { max-width: 440px; margin: 0; color: var(--ink-soft); font-size: 14px; text-align: right; }
.pulse-rail { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; padding-top: 14px; }
.pulse-rail::before { content: ""; position: absolute; top: 24px; left: 7%; right: 7%; height: 2px; background: linear-gradient(90deg, var(--aqua) 0 67%, var(--amber) 67%); }
.pulse-node { position: relative; min-width: 0; padding-top: 32px; }
.node-dot { position: absolute; z-index: 1; top: 0; left: 0; width: 22px; height: 22px; border: 6px solid var(--surface); border-radius: 50%; box-shadow: 0 0 0 2px currentColor; background: currentColor; }
.pulse-node.is-good { color: var(--aqua); }
.pulse-node.is-warning { color: var(--amber); }
.pulse-node small { display: block; margin-bottom: 3px; color: currentColor; font: 700 10px/1.2 ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; }
.pulse-node strong { color: var(--ink); font-size: 18px; }
.pulse-node p { margin: 4px 0 0; color: var(--ink-soft); font-size: 13px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.metric-grid article { padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.78); }
.metric-grid p, .metric-grid small { margin: 0; color: var(--ink-soft); }
.metric-grid p { font-size: 13px; font-weight: 700; }
.metric-grid strong { display: block; margin: 8px 0 5px; font: 750 32px/1 ui-rounded, sans-serif; letter-spacing: -.04em; }
.metric-grid small { font-size: 11px; }

.whatsapp-console { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, .72fr); overflow: hidden; border: 1px solid #c8dedc; border-radius: 17px; background: linear-gradient(135deg, #f6fbfb 0%, #e5f3f1 100%); }
.whatsapp-copy { padding: clamp(24px, 4vw, 42px); }
.channel-state { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 999px; background: var(--amber-soft); color: #9a5d20; font-size: 11px; font-weight: 800; }
.channel-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 5px rgba(217,130,43,.12); }
.is-connected .channel-state { background: var(--aqua-soft); color: #116a6d; }
.is-connected .channel-state i { background: var(--aqua); box-shadow: 0 0 0 5px rgba(15,143,145,.12); }
.instance-label { margin: 26px 0 2px; color: var(--ink-soft); font: 700 10px/1.2 ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; }
.whatsapp-copy h3 { margin: 0; font: 750 clamp(28px, 4vw, 46px)/1 ui-rounded, sans-serif; letter-spacing: -.04em; }
.whatsapp-copy > p:not(.instance-label):not(.channel-error) { max-width: 580px; color: var(--ink-soft); }
.whatsapp-copy ol { margin: 24px 0; padding-left: 22px; color: var(--ink-soft); font-size: 14px; }
.whatsapp-copy li { margin: 8px 0; padding-left: 4px; }
.channel-error { max-width: 560px; margin: 16px 0 0; color: var(--coral); font-size: 12px; font-weight: 700; }
.qr-stage { min-height: 370px; display: grid; place-content: center; justify-items: center; gap: 13px; padding: 28px; border-left: 1px solid rgba(15,143,145,.16); background: rgba(255,255,255,.72); text-align: center; }
.qr-stage img { width: min(300px, 100%); height: auto; padding: 12px; border: 1px solid #c8dedc; border-radius: 16px; background: white; box-shadow: 0 18px 45px rgba(23,50,77,.12); image-rendering: pixelated; }
.qr-stage > small { max-width: 300px; color: var(--ink-soft); font-size: 11px; }
.qr-placeholder { position: relative; width: 190px; height: 190px; border: 2px dashed #a9c9c7; border-radius: 24px; background: repeating-linear-gradient(45deg, rgba(15,143,145,.035) 0 8px, transparent 8px 16px); }
.qr-placeholder span, .qr-placeholder i, .qr-placeholder b { position: absolute; width: 42px; height: 42px; border: 8px solid var(--aqua); }
.qr-placeholder span { top: 24px; left: 24px; }
.qr-placeholder i { top: 24px; right: 24px; }
.qr-placeholder b { bottom: 24px; left: 24px; }
.linked-seal { width: 220px; height: 220px; display: grid; place-content: center; justify-items: center; border: 1px solid #b8deda; border-radius: 50%; background: var(--aqua-soft); color: #116a6d; box-shadow: 0 0 0 18px rgba(15,143,145,.05); }
.linked-seal span { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 12px; border-radius: 50%; background: var(--aqua); color: white; font-size: 27px; }
.linked-seal strong { font-size: 20px; }
.linked-seal small { margin-top: 4px; color: #397d7e; }

.task-list { display: grid; gap: 10px; }
.task-row { display: grid; grid-template-columns: minmax(250px, 1.6fr) 120px 110px 105px 90px 82px; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.task-identity { display: flex; gap: 12px; align-items: center; min-width: 0; }
.task-identity > div { min-width: 0; }
.task-identity strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.task-identity small { color: var(--ink-soft); font-size: 11px; }
.task-kind { flex: 0 0 auto; padding: 6px 8px; border-radius: 8px; background: #edf4f7; color: var(--aqua); font: 700 10px/1 ui-monospace, monospace; text-transform: uppercase; }
.compact-field { color: var(--ink-soft); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.compact-field span { display: flex; align-items: center; gap: 4px; margin-top: 3px; color: var(--ink); font-size: 11px; text-transform: none; }
.compact-field input { width: 58px; padding: 6px 7px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); }
.switch-label { display: flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 11px; font-weight: 700; cursor: pointer; }
.switch-label input { position: absolute; opacity: 0; pointer-events: none; }
.switch-label span { position: relative; width: 31px; height: 18px; border-radius: 999px; background: #c8d4da; transition: .18s ease; }
.switch-label span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: white; transition: .18s ease; }
.switch-label input:checked + span { background: var(--aqua); }
.switch-label input:checked + span::after { transform: translateX(13px); }

.button { border: 0; border-radius: 10px; padding: 9px 13px; font-weight: 750; cursor: pointer; }
.button-primary { background: var(--ink); color: white; }
.button-primary:hover { background: #234966; }
.button-quiet { background: #edf3f6; color: var(--ink); font-size: 12px; }
.button-quiet:hover { background: #dfeaed; }
.link-button { padding: 0; border: 0; background: transparent; color: var(--aqua); font-weight: 750; cursor: pointer; }

.endpoint-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.endpoint-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fbfdfe; }
.endpoint-card.is-muted { opacity: .62; }
.endpoint-top { display: flex; justify-content: space-between; color: var(--aqua); font: 700 10px/1 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .08em; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--aqua); }
.is-muted .status-dot { background: #aab9c0; }
.endpoint-card > strong { display: block; margin: 20px 0 6px; }
.endpoint-card code { display: block; overflow: hidden; color: var(--ink-soft); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.endpoint-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
details summary { cursor: pointer; font-weight: 700; color: var(--aqua); font-size: 12px; }
.edit-form { display: grid; gap: 11px; margin-top: 14px; }
.edit-form label, .stack-form label { display: grid; gap: 5px; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.edit-form input, .edit-form select, .stack-form input { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); }
.endpoint-add { border-style: dashed; background: transparent; }
.endpoint-add > summary { min-height: 114px; display: grid; place-content: center; justify-items: center; list-style: none; color: var(--ink); }
.endpoint-add > summary::-webkit-details-marker { display: none; }
.endpoint-add > summary span { font-size: 26px; color: var(--aqua); }
.endpoint-add > summary small { margin-top: 4px; color: var(--ink-soft); font-weight: 400; }

.activity-list { display: grid; }
.activity-list > div { display: grid; grid-template-columns: 14px 170px 1fr auto; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.activity-list > div:last-child { border-bottom: 0; }
.activity-mark { width: 8px; height: 8px; border: 2px solid var(--aqua); border-radius: 50%; }
.activity-list span, .activity-list small { color: var(--ink-soft); }
.empty-state { color: var(--ink-soft); }
.security-panel { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.security-panel > summary { color: var(--ink); }
.password-form { max-width: 420px; }
.alert { margin-bottom: 20px; padding: 12px 15px; border-radius: 11px; font-size: 13px; font-weight: 700; }
.alert-success { border: 1px solid #b6dcd7; background: var(--aqua-soft); color: #116a6d; }
.alert-error { border: 1px solid #efc2c2; background: #fff0f0; color: #993a3a; }
footer { display: flex; justify-content: space-between; color: #748795; font-size: 11px; }

.login-body { min-height: 100vh; background: #dce9ee; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; }
.login-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: clamp(40px, 8vw, 120px); background: var(--ink); color: white; }
.login-brand::after { content: ""; position: absolute; width: 500px; height: 500px; right: -180px; bottom: -220px; border: 90px solid rgba(74,168,192,.12); border-radius: 50%; }
.login-brand .brand-mark { margin-bottom: 50px; color: #78c9cd; }
.login-brand h1 { max-width: 700px; font-size: clamp(42px, 6vw, 78px); line-height: .98; }
.login-copy { max-width: 540px; margin: 28px 0 0; color: #c4d4de; font-size: 17px; }
.signal-line { display: flex; gap: 8px; align-items: end; height: 42px; margin-top: 55px; }
.signal-line i { width: 9px; border-radius: 5px; background: #62bdc2; }
.signal-line i:nth-child(1) { height: 12px; }.signal-line i:nth-child(2) { height: 35px; }.signal-line i:nth-child(3) { height: 21px; }.signal-line i:nth-child(4) { height: 29px; background: var(--amber); }
.login-card { align-self: center; width: min(430px, calc(100% - 48px)); margin: auto; padding: clamp(30px, 5vw, 48px); border: 1px solid rgba(255,255,255,.8); border-radius: 24px; background: rgba(255,255,255,.86); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.login-card h2 { font-size: 34px; }
.login-card > div > p:last-child { color: var(--ink-soft); }
.stack-form { display: grid; gap: 16px; margin-top: 28px; }
.stack-form input { padding: 13px; }
.stack-form .button { margin-top: 4px; padding: 13px; }
.login-foot { margin: 20px 0 0; color: #718591; font-size: 11px; text-align: center; }

@media (max-width: 1120px) {
  .task-row { grid-template-columns: minmax(240px, 1fr) 120px 110px; }
  .task-row .switch-label, .task-row .button { justify-self: start; }
  .endpoint-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: auto; height: auto; padding: 18px; flex-direction: row; align-items: center; }
  .wordmark { margin: 0; }
  .sidebar nav { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .sidebar-foot p, .sidebar-foot strong { display: none; }
  .main-canvas { padding: 24px 16px; }
  .topbar, .section-heading { align-items: flex-start; flex-direction: column; }
  .section-heading > p { text-align: left; }
  .pulse-rail { grid-template-columns: 1fr 1fr; }
  .pulse-rail::before { display: none; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .task-row { grid-template-columns: 1fr 1fr; }
  .task-identity { grid-column: 1 / -1; }
  .endpoint-grid { grid-template-columns: 1fr; }
  .whatsapp-console { grid-template-columns: 1fr; }
  .qr-stage { min-height: 340px; border-top: 1px solid rgba(15,143,145,.16); border-left: 0; }
  .activity-list > div { grid-template-columns: 14px 1fr auto; }
  .activity-list > div span:nth-child(3) { display: none; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 38vh; padding: 40px 28px; }
  .login-brand .brand-mark, .signal-line { display: none; }
  .login-brand h1 { font-size: 42px; }
  .login-card { margin: -24px auto 30px; position: relative; }
}
@media (max-width: 480px) {
  .live-pill { display: none; }
  .pulse-rail, .metric-grid { grid-template-columns: 1fr; }
  .task-row { grid-template-columns: 1fr; }
  footer { gap: 8px; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
