:root {
  --page: #f8f9ff;
  --surface: #fff;
  --surface-muted: #f1f2fa;
  --text: #242640;
  --muted: #798099;
  --primary: #595ad7;
  --primary-hover: #4b4dc1;
  --border: #e3e6f4;
  --border-strong: #c7cae0;
  --accent-soft: #eeeefe;
  --shadow: 0 16px 44px rgba(43,48,102,.04);
}
html[data-theme="dark"] {
  --page: #141727;
  --surface: #22263b;
  --surface-muted: #30354e;
  --text: #edf0ff;
  --muted: #adb5d1;
  --primary: #b1b0ff;
  --primary-hover: #cecdff;
  --border: #414660;
  --border-strong: #686e8e;
  --accent-soft: #383b60;
}
.app-shell { display: grid; grid-template-columns: 238px minmax(0,1fr); min-height: 100vh; }
.sidebar { --side-bg: var(--surface); --side-text: #242640; --side-muted: #5c6378; --side-hover: #f1f2fa; --side-active-bg: #eeeefe; --side-active-text: #4b4dc1; --side-active-bar: #595ad7; --side-line: #e3e6f4; --side-card: #f7f8fd; --side-control: #eeeefe; --side-control-text: #4b4dc1; position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; min-height: 0; background: var(--side-bg); border: 0; border-right: 1px solid var(--side-line); padding: 27px 13px 18px; color: var(--side-text); }
html[data-theme="dark"] .sidebar { --side-bg: #1d2133; --side-text: #dfe2f3; --side-muted: #bdc3da; --side-hover: #2a304a; --side-active-bg: #5d5dd7; --side-active-text: #fff; --side-active-bar: transparent; --side-line: #363c58; --side-card: #292e47; --side-control: #30354e; --side-control-text: #dcdcff; }
.console-masthead { display: contents; }
.sidebar-brand { order: 0; padding: 0 15px 51px; color: var(--side-text); font-size: 17px; letter-spacing: -.04em; }
.sidebar-brand .brand-mark { filter: drop-shadow(0 7px 10px rgba(89,90,215,.25)); }
.brand-copy { display: block; line-height: 1.05; }
.brand-copy strong { display: block; }
.brand-copy small { display: block; margin-top: 7px; color: var(--side-muted); font-size: 9px; font-weight: 700; letter-spacing: .24em; }
.nav-list { order: 1; display: flex; flex-direction: column; flex-wrap: nowrap; gap: 3px; max-width: none; width: 100%; margin: 0; padding: 0; }
.nav-item { display: flex; width: 100%; min-height: 44px; padding: 0 16px; border: 0; border-radius: 10px; background: transparent; color: var(--side-muted); text-align: left; font-size: 13px; font-weight: 600; }
.nav-item svg { display: block; width: 18px; height: 18px; }
.nav-item:hover { color: var(--side-text); background: var(--side-hover); }
.nav-item.active, .nav-item[aria-current="page"] { color: var(--side-active-text); background: var(--side-active-bg); border: 0; box-shadow: inset 3px 0 var(--side-active-bar); }
.nav-item[data-view="dashboard"] { order: 0; }
.nav-item[data-view="remote"] { order: 1; }
.nav-item[data-view="devices"] { order: 2; }
.nav-item[data-view="connections"] { order: 3; }
.nav-item[data-view="users"] { order: 4; margin-top: 29px; }
.nav-item[data-view="audit"] { order: 5; }
.nav-item[data-view="settings"] { order: 6; }
.nav-item[data-view="updates"] { order: 7; }
.nav-item[data-view="account"] { order: 8; }
.nav-secondary { display: contents; }
.nav-more, .nav-item .nav-mobile-label { display: none; }
.sidebar-footer { order: 2; margin-top: auto; padding: 14px 0 0; display: flex; flex-direction: column; align-items: stretch; gap: 10px; border-top: 1px solid var(--side-line); }
.sidebar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 7px; border: 1px solid var(--side-line); border-radius: 11px; background: var(--side-card); }
.sidebar-toolbar .icon-button, .mobile-preferences .icon-button, .auth-preferences .icon-button, .marketing-footer-actions .icon-button.theme-toggle, .marketing-footer-actions .icon-button.locale-toggle { width: auto; min-width: 44px; min-height: 44px; padding: 8px 10px; border-color: transparent; background: var(--side-control, var(--accent-soft)); color: var(--side-control-text, var(--primary)); font-size: 13px; }
.sidebar-toolbar .icon-button:hover, .mobile-preferences .icon-button:hover, .auth-preferences .icon-button:hover, .marketing-footer-actions .icon-button:hover { filter: brightness(.96); }
html[data-theme="dark"] .sidebar-toolbar .icon-button:hover, html[data-theme="dark"] .mobile-preferences .icon-button:hover, html[data-theme="dark"] .auth-preferences .icon-button:hover, html[data-theme="dark"] .marketing-footer-actions .icon-button:hover { filter: brightness(1.15); }
.theme-toggle svg { width: 19px; height: 19px; }
.user-chip { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0; padding: 7px 7px 7px 8px; background: var(--side-card); border: 1px solid var(--side-line); border-radius: 11px; color: var(--side-text); }
.user-chip-name { flex: 1; min-width: 0; }
.user-chip-name strong, .user-chip-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip small { color: var(--side-muted); }
#user-avatar { flex: none; border-radius: 9px; }
.user-chip .user-chip-logout { flex: none; width: 44px; min-height: 44px; padding: 10px; border-color: transparent; background: transparent; color: var(--side-muted); }
.user-chip .user-chip-logout:hover { background: var(--danger-bg); color: var(--danger); }
.workspace { width: 100%; max-width: none; margin: 0; padding: 0 4vw 75px; min-width: 0; }
.topbar { padding: 43px 0 24px; border: 0; background: transparent; }
.mobile-preferences { display: none; }
.theme-select { width: auto; min-width: 96px; max-width: 100%; min-height: 36px; padding: 6px 24px 6px 10px; border: 1px solid var(--border-strong); border-radius: 9px; background-color: var(--surface); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.theme-select:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.auth-preferences { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.auth-preferences .auth-locale-toggle { position: static; }
.topbar h1 { font-size: 29px; line-height: 1.2; }
.topbar .eyebrow { color: #737ad1; font-size: 10px; letter-spacing: .2em; }
.content { padding: 0; }
#main-content:focus, #modal-error:focus, .remote-dialog:focus { outline: none; }
.sync-status { display: inline-block; margin-top: -8px; padding: 0 0 15px; color: var(--muted); }
.panel, .overview-metrics, .quick-start, .device-tile, .connection-card { border-radius: 15px; box-shadow: var(--shadow); }
.overview-metrics { gap: 16px; border: 0; background: none; }
.overview-metric { background: var(--surface); border: 1px solid var(--border) !important; border-radius: 15px; padding: 22px; }
.overview-metric > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.overview-metric svg { width: 19px; height: 19px; color: var(--primary); }
.overview-metric small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.overview-metric strong { color: var(--text); }
.dashboard-primary { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(300px,1fr); gap: 20px; }
.dashboard-primary .panel { min-width: 0; border-radius: 15px; }
.dashboard-quick, .dashboard-health { min-height: 260px; }
.dashboard-quick { padding: 22px; }
.dashboard-quick .panel-header { padding: 0 0 18px; border-bottom: 1px solid var(--border); }
.dashboard-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.dashboard-actions button { display: flex; flex-direction: column; align-items: flex-start; gap: 15px; min-height: 130px; padding: 17px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.dashboard-actions button:hover { border-color: var(--primary); background: var(--accent-soft); }
.dashboard-actions button svg { width: 22px; height: 22px; color: var(--primary); }
.dashboard-actions button strong { font-size: 12px; }
.dashboard-actions button span { color: var(--primary); }
.dashboard-health .panel-header { margin-bottom: 0; }
.dashboard-health .health-rail-list { padding: 0 22px; }
.dashboard-health .health-rail-item { padding: 13px 0; }
.overview-banner { display: flex; align-items: center; justify-content: space-between; min-height: 96px; margin-top: 20px; padding: 20px 26px; background: linear-gradient(110deg,#3b3e82,#595ad7); border-radius: 16px; }
.overview-banner .eyebrow { display: none; }
.overview-banner h2 { font-size: 20px; margin-bottom: 5px; }
.overview-banner p { font-size: 12px; color: #e4e5ff; }
.overview-banner .button { flex: none; background: #fff; color: #4546be; }
.dashboard-traffic { margin-top: 20px; }
.overview-domain { border-color: rgba(255,255,255,.2); }
.overview-domain small { color: #dddfff; }
.button, .icon-button { border-radius: 9px; }
.button-primary { box-shadow: 0 8px 18px rgba(89,90,215,.14); }
.landing-hero h1 { letter-spacing: -.06em; }
.route-board, .platform-grid article, .auth-card { border-radius: 16px; }
.landing-screen { background: #fbfbff; }
.marketing-header, .marketing-footer, .landing-hero { max-width: 1220px; }
.marketing-header { padding: 31px 0; }
.marketing-brand { gap: 11px; font-size: 17px; font-weight: 800; letter-spacing: -.04em; }
.marketing-brand span { line-height: 1.05; }
.marketing-brand small { display: block; margin-top: 5px; color: #9499d0; font-size: 9px; letter-spacing: .23em; font-weight: 800; }
.marketing-feature-link { color: #697089; font-size: 12px; font-weight: 700; padding: 10px; }
.marketing-nav-actions .button { min-height: 36px; padding: 7px 12px; font-size: 12px; }
.landing-hero { grid-template-columns: minmax(0,1fr) minmax(0,1.05fr); gap: 70px; margin: 54px auto 0; padding: 0 0 100px; min-height: 555px; }
.landing-hero-copy { min-width: 0; }
.landing-hero .eyebrow { color: #777ec2; font-size: 10px; font-weight: 800; letter-spacing: .25em; }
.landing-hero h1 { font-size: clamp(46px, 5.1vw, 76px); line-height: 1.17; margin: 23px 0; }
.landing-hero h1 span { color: #595ad7; }
.landing-hero .hero-lead { max-width: 450px; margin-bottom: 0; font-size: 15px; line-height: 1.9; }
.landing-hero .actions { margin-top: 30px; }
.hero-foot { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 38px; color: #9399ae; font-size: 11px; }
.hero-foot span { display: inline-flex; align-items: center; gap: 7px; }
.hero-foot svg { width: 15px; height: 15px; color: #595ad7; }
.hero-art { position: relative; height: 420px; border-radius: 30px; overflow: hidden; background: radial-gradient(circle at 20% 20%, #ecebff, transparent 50%), linear-gradient(135deg, #f8f7ff, #e9ecff); box-shadow: 0 32px 70px #4045a016; }
.hero-art::before, .hero-art::after { content: ""; position: absolute; border: 1px solid #d8dcfc; border-radius: 50%; pointer-events: none; }
.hero-art::before { width: 470px; height: 470px; left: 31px; top: -28px; }
.hero-art::after { width: 300px; height: 300px; left: 116px; top: 57px; }
.art-server { position: absolute; z-index: 1; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; align-content: start; gap: 15px; width: 188px; height: 196px; padding: 24px; border-radius: 23px; background: #fff; box-shadow: 0 22px 45px #393c8130; color: #242640; }
.art-server-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #595ad7; color: #fff; }
.art-server-icon svg { width: 22px; height: 22px; }
.art-server strong { font-size: 18px; }
.art-server small { margin-top: -7px; color: #9299ab; }
.art-line { height: 7px; border-radius: 9px; background: #efeff8; }
.art-line:last-child { width: 60%; }
.art-chip { position: absolute; z-index: 2; display: flex; align-items: center; gap: 9px; padding: 11px 14px; border: 1px solid #ecedf8; border-radius: 12px; background: #fff; color: #464d65; box-shadow: 0 14px 32px #393c811b; font-size: 11px; font-weight: 700; white-space: nowrap; }
.art-chip svg { width: 17px; height: 17px; color: #595ad7; }
.art-chip-device { top: 54px; left: 35px; }
.art-chip-remote { top: 104px; right: 23px; }
.art-chip-service { bottom: 45px; left: 45px; }
.art-chip-server { bottom: 30px; right: 43px; }
.landing-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; max-width: 1152px; margin: 0 auto; padding: 40px 0 60px; border-top: 1px solid var(--border); }
.landing-features article { padding: 18px; }
.landing-features svg { width: 25px; height: 25px; color: #595ad7; }
.landing-features h2 { margin: 17px 0 7px; font-size: 15px; }
.landing-features p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.marketing-footer-actions { display: flex; align-items: center; gap: 14px; }
.marketing-footer-actions .button, .marketing-footer-actions .icon-button { min-height: 32px; padding: 5px 8px; }
html[data-theme="dark"] .landing-screen { background: var(--page); }
html[data-theme="dark"] .hero-art { background: radial-gradient(circle at 20% 20%, #353557, transparent 50%), linear-gradient(135deg, #272c48, #343961); }
html[data-theme="dark"] .art-chip, html[data-theme="dark"] .art-server { background: #282d48; border-color: #414660; color: var(--text); }
html[data-theme="dark"] .art-line { background: #404560; }
.auth-story { min-width: 0; padding: clamp(24px, 3vw, 40px); border-radius: 20px; background: linear-gradient(150deg,#343876,#5d5dd7); color: #fff; }
.auth-story h2, .auth-story > p, .auth-story .auth-route { color: #fff; }
.auth-story .auth-route { flex-wrap: wrap; gap: 12px; margin-top: 40px; }
.form-error-summary:not(:empty) { padding: 12px; border: 1px solid var(--danger); border-radius: 10px; background: var(--danger-bg); color: var(--text); }
.form-error-summary:empty { display: none; }
.status-dot, .health-rail-dot { background: #25b78d; }
.device-grid { gap: 18px; }
.device-tile { min-height: 190px; }
.update-grid { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(260px,.8fr); gap: 20px; }
.update-grid .panel { padding: 28px; }
.update-grid h2 { font-size: 24px; }
.update-grid p { color: var(--muted); }
.update-grid .version-mark { display: grid; place-items: center; width: 43px; height: 43px; margin-bottom: 22px; border-radius: 12px; background: var(--accent-soft); color: var(--primary); }
.update-grid .version-mark svg { width: 22px; height: 22px; }
.update-grid dl { display: grid; grid-template-columns: auto 1fr; gap: 14px 30px; }
.update-grid dt { color: var(--muted); }
.update-grid dd { margin: 0; font-weight: 700; }
@media (max-width: 850px) {
  .dashboard-primary { grid-template-columns: 1fr; }
  .app-shell { grid-template-columns: 68px minmax(0,1fr); }
  .sidebar { padding: 20px 8px; }
  .sidebar-brand { padding: 0 7px 26px; }
  .sidebar-brand .brand-copy, .nav-item span, .sidebar-footer { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-item svg { display: block; }
  .workspace { padding: 0 24px 48px; }
  .mobile-preferences { display: flex; gap: 6px; align-self: flex-start; }
}
@media (max-width: 760px) {
  .marketing-header { margin: 0 20px; padding: 20px 0; }
  .marketing-brand { font-size: 15px; }
  .marketing-feature-link { display: none; }
  .landing-hero { grid-template-columns: 1fr; gap: 35px; min-height: 0; margin: 0 24px; padding: 35px 0 50px; }
  .landing-hero h1 { font-size: clamp(42px, 9vw, 62px); }
  .hero-art { height: 330px; }
  .landing-features { grid-template-columns: 1fr; gap: 0; margin: 0 20px; padding: 10px 0 32px; }
  .landing-features article { padding: 18px 4px; }
  .marketing-footer { margin: 0 20px; }
}
@media (max-width: 480px) {
  .hero-art { height: 300px; }
  .hero-art::before { left: -60px; }
  .hero-art::after { left: 25px; }
  .art-chip-device { left: 8px; }
  .art-chip-remote { right: 6px; }
  .art-chip-service { left: 8px; }
  .art-chip-server { right: 6px; }
  .marketing-footer { align-items: flex-start; flex-direction: column; }
  .marketing-footer-actions { flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .app-shell { grid-template-columns: 1fr; padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  .sidebar { position: fixed; inset: auto 0 0; z-index: 20; height: auto; min-height: 74px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--side-line); box-shadow: 0 -8px 24px rgba(43,48,102,.06); }
  .sidebar-brand, .sidebar-footer { display: none; }
  .nav-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; overflow: visible; }
  .nav-item, .nav-more { width: 100%; min-width: 0; min-height: 60px; margin: 0 !important; padding: 6px 2px; }
  .nav-primary, .nav-more { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: var(--side-muted); font: inherit; font-size: .72rem; font-weight: 600; line-height: 1.25; text-align: center; border: 0; border-radius: 10px; background: transparent; overflow-wrap: anywhere; }
  .nav-item .nav-desktop-label { display: none; }
  .nav-item .nav-mobile-label, .nav-more span { display: block; }
  .nav-more { order: 4; }
  .nav-more svg { width: 18px; height: 18px; }
  .nav-more:hover { color: var(--side-text); background: var(--side-hover); }
  .nav-item.active, .nav-item[aria-current="page"] { box-shadow: none; }
  .nav-more.active, .nav-more[aria-expanded="true"] { color: var(--side-active-text); background: var(--side-active-bg); }
  .nav-secondary { display: none; position: absolute; inset: auto 8px calc(100% + 8px); max-height: 65vh; overflow-y: auto; padding: 8px; background: var(--side-bg); border: 1px solid var(--side-line); border-radius: 14px; box-shadow: 0 8px 30px rgba(20,23,39,.18); }
  .nav-secondary.is-open { display: grid; gap: 3px; }
  .nav-secondary .nav-item { justify-content: flex-start; min-height: 48px; padding: 10px 16px; }
  .nav-secondary .nav-item span { display: block; }
  .workspace { padding: 0 18px 36px; }
  .topbar { padding: 25px 0 20px; align-items: flex-start; flex-wrap: wrap; gap: 12px; }
  .topbar h1 { font-size: 26px; }
  .overview-metrics { grid-template-columns: 1fr 1fr; }
  .dashboard-actions { grid-template-columns: 1fr; }
  .dashboard-actions button { flex-direction: row; align-items: center; min-height: 58px; }
  .dashboard-actions button span { margin-left: auto; }
  .overview-banner { align-items: flex-start; flex-direction: column; gap: 15px; }
  .update-grid { grid-template-columns: 1fr; }
}
/* Connections: one compact row per tunnel. */
.connection-batch { gap: 8px; margin-bottom: 12px; }
.connection-batch .button { min-height: 36px; padding: 6px 12px; font-size: 12px; }
.connection-grid { gap: 10px; }
.connection-card.connection-row { display: grid; grid-template-columns: minmax(240px, 1.1fr) minmax(240px, 1.3fr) auto; align-items: center; gap: 12px 24px; padding: 16px 20px; }
.connection-row-main { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.connection-select { display: grid; place-items: center; flex: none; width: 28px; height: 40px; margin: 0 -4px 0 -6px; cursor: pointer; }
.connection-select input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.connection-row .connection-symbol { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); }
.connection-row .connection-identity { display: block; min-width: 0; }
.connection-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-height: 22px; }
.connection-row .connection-identity h3 { margin: 0; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.connection-row .connection-meta { margin: 3px 0 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.connection-row .connection-policy { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.connection-row-address { min-width: 0; }
.connection-row .public-address { padding: 4px 4px 4px 12px; }
.connection-row .public-url { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.connection-row .public-address .button { min-height: 32px; padding: 5px 10px; }
.connection-row .connection-target, .connection-row .connection-reason { margin: 6px 0 0; }
.connection-row .connection-actions { grid-column: auto; grid-row: auto; display: flex; flex-wrap: nowrap; align-items: center; justify-content: flex-end; gap: 6px; max-width: none; margin: 0; padding: 0; border: 0; }
.connection-row .connection-actions .button { min-height: 36px; padding: 6px 12px; font-size: 12px; white-space: nowrap; }
.connection-row .more-actions summary { display: inline-flex; align-items: center; gap: 6px; list-style: none; color: var(--text); }
.connection-row .more-actions summary::-webkit-details-marker { display: none; }
.connection-row .more-actions summary svg { width: 16px; height: 16px; }
.connection-row .more-actions[open] summary { background: var(--surface-muted); border-color: var(--border-strong); }
.connection-row .more-actions > div { display: grid; gap: 4px; top: calc(100% + 6px); min-width: 170px; border-radius: 10px; }
.connection-row .more-actions > div .button { min-height: 40px; font-size: 13px; }
@media (max-width: 1100px) {
  .connection-card.connection-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
  .connection-row .connection-actions { grid-column: 1 / -1; padding-top: 12px; border-top: 1px solid var(--border); }
}
@media (max-width: 720px) {
  .connection-card.connection-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px; }
  .connection-row .connection-actions { flex-wrap: wrap; justify-content: flex-start; }
}
@media (max-width: 600px) {
  .connection-batch .button, .connection-row .connection-actions .button, .connection-row .public-address .button, .connection-row .more-actions > div .button { min-height: 44px; }
  .connection-select { width: 44px; height: 44px; margin: -2px -10px 0 -12px; }
  .connection-row .connection-actions > .button, .connection-row .more-actions { flex: 1 1 auto; }
  .connection-row .more-actions summary { width: 100%; }
}
/* Account: appearance preference (system / light / dark), as in the desktop settings. */
.account-appearance { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-top: 20px; padding: 16px 0 0; border-top: 1px solid var(--border); }
.account-appearance .helper { margin: 4px 0 0; }
.account-appearance .theme-select { min-width: 160px; min-height: 44px; }
