/* Shared primitives for the new web frontends. Page adapters keep their own
   semantic fields and action hooks; this file owns the visual foundation. */
html:root {
  color-scheme: light dark;
  --web-bg: #f6f7f9; --web-surface: #fff; --web-subtle: #eef1f0;
  --web-text: #1d2923; --web-muted: #637168; --web-line: #dfe6e1;
  --web-brand: #c6e783; --web-selected: #e5eddb; --web-primary: #293e30;
  --web-primary-text: #fff; --web-positive: #2c7047; --web-warning: #8b6017;
  --web-negative: #a93545; --web-information: #326595; --web-radius: 10px;
  --web-map-land: #bdcdbf;
  --bg: var(--web-bg); --side: var(--web-subtle); --panel: var(--web-surface);
  --panel2: var(--web-subtle); --text: var(--web-text); --muted: var(--web-muted);
  --line: var(--web-line); --line2: var(--web-line); --accent: var(--web-primary);
  --selected: var(--web-selected); --link: var(--web-primary); --link-hover: var(--web-text);
  --green: var(--web-positive); --ok: var(--web-positive); --red: var(--web-negative);
  --danger: var(--web-negative); --yellow: var(--web-warning); --blue: var(--web-information);
  --info: var(--web-information); --focus: var(--web-information); --shadow: none;
}
html[data-web-theme="dark"] {
  color-scheme: dark;
  --web-bg: #101614; --web-surface: #18211c; --web-subtle: #202c24;
  --web-text: #e8efe9; --web-muted: #a5b3a9; --web-line: #344339;
  --web-selected: #2c3d25; --web-primary: #dce9d7; --web-primary-text: #18251c;
  --web-positive: #8acc9f; --web-warning: #edc67b; --web-negative: #f09ba5;
  --web-information: #9abce9;
  --web-map-land: #526958;
}
@media (prefers-color-scheme: dark) {
  html:not([data-web-theme="light"]):not([data-web-theme="dark"]) {
    --web-bg: #101614; --web-surface: #18211c; --web-subtle: #202c24;
    --web-text: #e8efe9; --web-muted: #a5b3a9; --web-line: #344339;
    --web-selected: #2c3d25; --web-primary: #dce9d7; --web-primary-text: #18251c;
    --web-positive: #8acc9f; --web-warning: #edc67b; --web-negative: #f09ba5;
    --web-information: #9abce9;
    --web-map-land: #526958;
  }
}
.web-rebuild { background: var(--web-bg); color: var(--web-text); font: 14px/1.55 Inter, "Segoe UI", system-ui, sans-serif; }
.web-rebuild *, .web-rebuild *::before, .web-rebuild *::after { box-sizing: border-box; }
.web-rebuild h1, .web-rebuild h2, .web-rebuild h3 { color: var(--web-text); }
.web-rebuild h1 { font-size: 30px; font-weight: 600; letter-spacing: -.035em; line-height: 1.2; }
.web-rebuild h2 { font-size: 18px; font-weight: 600; letter-spacing: -.015em; }
.web-rebuild h3 { font-size: 14px; font-weight: 600; }
.web-eyebrow { display: block; color: var(--web-muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 8px; }
.web-rebuild p { max-width: 78ch; }
.web-rebuild a { color: var(--web-primary); text-underline-offset: 3px; }
.web-rebuild a:hover { color: var(--web-text); }
.web-rebuild :focus-visible { outline: 2px solid var(--web-information); outline-offset: 3px; }
.web-rebuild .app { min-height: 100dvh; grid-template-columns: 224px minmax(0, 1fr); }
.web-rebuild .main { min-width: 0; }
.web-rebuild .content { padding: 32px 34px 48px; width: 100%; max-width: 1680px; margin-inline: auto; }
.web-rebuild .head { align-items: center; gap: 20px; margin-bottom: 26px; }
.web-rebuild .head h1 { margin-bottom: 8px; }
.web-rebuild .head p { color: var(--web-muted); max-width: 75ch; font-size: 13px; }
.web-rebuild .head .btn { flex: 0 0 auto; }
.web-rebuild .panel, .web-rebuild .card { background: var(--web-surface); border: 1px solid var(--web-line); border-radius: var(--web-radius); box-shadow: none; }
.web-rebuild .panel { padding: 24px; margin-bottom: 20px; }
.web-rebuild .ph { align-items: center; gap: 16px; margin-bottom: 20px; }
.web-rebuild .ph p { color: var(--web-muted); font-size: 13px; margin-top: 5px; }
.web-rebuild .cards { gap: 16px; }
.web-rebuild .metric { padding: 20px 22px; }
.web-rebuild .metric .k { color: var(--web-muted); font-size: 12px; }
.web-rebuild .metric .v { font-size: 29px; font-weight: 500; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.web-rebuild .metric .s { color: var(--web-muted); font-size: 12px; }
.web-rebuild .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 8px 13px; border: 1px solid var(--web-primary); border-radius: 6px; background: var(--web-primary); color: var(--web-primary-text); font-size: 13px; font-weight: 500; box-shadow: none; text-decoration: none; white-space: normal; }
.web-rebuild .btn:hover { filter: brightness(.95); color: var(--web-primary-text); }
.web-rebuild .btn.alt { border-color: var(--web-line); background: var(--web-surface); color: var(--web-text); }
.web-rebuild .btn.alt:hover { background: var(--web-subtle); color: var(--web-text); }
.web-rebuild .btn.sm { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.web-rebuild .btn:disabled, .web-rebuild .btn[aria-disabled="true"] { opacity: .6; cursor: not-allowed; }
.web-rebuild .btn.danger, .web-rebuild .btn.red, .web-rebuild .table-menu-danger { color: var(--web-negative); background: var(--web-surface); border-color: var(--web-line); }
.web-rebuild input, .web-rebuild select, .web-rebuild textarea { color: var(--web-text); background: var(--web-surface); border: 1px solid var(--web-line); border-radius: 6px; padding: 10px 11px; font: inherit; min-width: 0; }
.web-rebuild input::placeholder, .web-rebuild textarea::placeholder { color: var(--web-muted); opacity: 1; }
.web-rebuild input[type="checkbox"], .web-rebuild input[type="radio"] { accent-color: var(--web-primary); }
.web-rebuild input[readonly] { background: var(--web-subtle); }
.web-rebuild .form-grid { gap: 20px 24px; }
.web-rebuild .form-fields { gap: 18px; }
.web-rebuild .field small, .web-rebuild .form-fields small, .web-rebuild .form-grid small { color: var(--web-muted); font-size: 12px; }
.web-rebuild table { font-size: 13px; border-collapse: collapse; }
.web-rebuild th { background: var(--web-bg); color: var(--web-muted); font-size: 12px; font-weight: 500; padding: 11px 13px; border-bottom: 1px solid var(--web-line); }
.web-rebuild td { padding: 14px 13px; border-bottom: 1px solid var(--web-line); }
.web-rebuild tbody tr:hover { background: var(--web-subtle); }
.web-rebuild .table-scroll > table, .web-rebuild .table > table { min-width: 640px; }
.web-rebuild .table-sort-button { border: 0; background: transparent; color: inherit; min-height: 28px; padding: 0; font: inherit; }
.web-rebuild .table-menu { width: 32px; min-height: 32px; height: 32px; padding: 0 5px; opacity: 1; }
.web-rebuild .status { font-size: 11px; font-weight: 500; padding: 4px 7px; border-radius: 5px; }
.web-rebuild .status.ok, .web-rebuild .badge.ok { color: var(--web-positive); background: color-mix(in srgb, var(--web-positive) 10%, transparent); }
.web-rebuild .status.warn { color: var(--web-warning); background: color-mix(in srgb, var(--web-warning) 10%, transparent); }
.web-rebuild .status.err, .web-rebuild .badge.danger { color: var(--web-negative); background: color-mix(in srgb, var(--web-negative) 10%, transparent); }
.web-rebuild .status.off { color: var(--web-muted); background: var(--web-subtle); }
.web-rebuild .status.info { color: var(--web-information); background: color-mix(in srgb, var(--web-information) 10%, transparent); }
.web-rebuild .flash, .web-rebuild .refresh-stale { padding: 14px 17px; border-radius: 7px; border: 1px solid var(--web-line); box-shadow: none; }
.web-rebuild .flash-error, .web-rebuild .refresh-stale { color: var(--web-negative); background: color-mix(in srgb, var(--web-negative) 7%, var(--web-surface)); }
.web-rebuild .flash-success { color: var(--web-positive); background: color-mix(in srgb, var(--web-positive) 7%, var(--web-surface)); }
.web-rebuild .flash-info { color: var(--web-information); background: color-mix(in srgb, var(--web-information) 7%, var(--web-surface)); }
.web-rebuild dialog { color: var(--web-text); background: var(--web-surface); border: 1px solid var(--web-line); border-radius: 12px; box-shadow: 0 20px 80px #0003; }
.web-rebuild dialog::backdrop { background: #101b1666; }
.web-rebuild pre, .web-rebuild code, .web-rebuild .mono { font-family: "Cascadia Code", Consolas, monospace; }
.web-rebuild pre { background: var(--web-subtle); border: 1px solid var(--web-line); border-radius: 6px; }
/* Adapters retain the existing specialized workflows while their page
   layouts are rebuilt. All surfaces follow the explicit theme selection. */
.web-rebuild .plan-picker-options, .web-rebuild .routing-json-file,
.web-rebuild .monitor-node, .web-rebuild .mini-chart, .web-rebuild .referral-access-card,
.web-rebuild .support-screenshot { background: var(--web-subtle); border-color: var(--web-line); }
.web-rebuild input:disabled, .web-rebuild select:disabled, .web-rebuild textarea:disabled { color: var(--web-muted); background: var(--web-subtle); }
.web-rebuild input::file-selector-button { background: var(--web-subtle); color: var(--web-text); border: 1px solid var(--web-line); border-radius: 5px; }
.web-rebuild input::file-selector-button:hover { background: var(--web-selected); border-color: var(--web-primary); }
.web-rebuild .side-group::after { background: var(--web-line); }
.web-rebuild .account-nav a, .web-rebuild .account-nav button { color: var(--web-muted); }
.web-rebuild .account-nav a:hover, .web-rebuild .account-nav button:hover { background: var(--web-subtle); }
.web-rebuild .account-nav a.active, .web-rebuild .account-nav button.active { background: var(--web-selected); color: var(--web-text); }
.web-rebuild .routing-import-validation.is-error, .web-rebuild .result-error .result-icon,
.web-rebuild .auth-result-icon.error, .web-rebuild .danger-zone { color: var(--web-negative); border-color: var(--web-negative); background: color-mix(in srgb, var(--web-negative) 8%, var(--web-surface)); }
.web-rebuild .danger-zone b, .web-rebuild .danger-zone span { color: var(--web-negative); }
.web-rebuild .routing-import-validation.is-valid, .web-rebuild .ok-notice,
.web-rebuild .result-success .result-icon, .web-rebuild .auth-result-icon.success,
.web-rebuild .network-card, .web-rebuild .btn.service-start { color: var(--web-positive); border-color: var(--web-positive); background: color-mix(in srgb, var(--web-positive) 8%, var(--web-surface)); }
.web-rebuild .mail-verification, .web-rebuild .support-live-notice,
.web-rebuild .role-badge, .web-rebuild .routing-mode-badge, .web-rebuild .mail-step { color: var(--web-information); border-color: var(--web-line); background: color-mix(in srgb, var(--web-information) 8%, var(--web-surface)); }
.web-rebuild .notice, .web-rebuild .routing-import-atomic { color: var(--web-warning); border-color: var(--web-line); background: color-mix(in srgb, var(--web-warning) 8%, var(--web-surface)); }
.web-rebuild .refresh-stale-copy span, .web-rebuild .routing-import-atomic b { color: inherit; }
.web-rebuild .empty { border-color: var(--web-line); }
.web-rebuild .bar { background: var(--web-line); }
.web-rebuild .session-transfer .transfer-down { color: var(--web-information); }
.web-rebuild .session-transfer .transfer-up { color: var(--web-positive); }
.web-rebuild .server-map-land { fill: var(--web-map-land); }
.web-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--web-text); text-decoration: none; font-size: 19px; font-weight: 600; letter-spacing: -.04em; }
.web-brand img { object-fit: contain; border-radius: 8px; }
.web-brand small { font-size: 11px; font-weight: 400; letter-spacing: .08em; color: var(--web-muted); margin-left: 3px; }
.web-theme-control { display: inline-flex; align-items: center; }
html:not(.js) .web-theme-control { display: none; }
.web-theme-control select { font-size: 12px; min-height: 36px; padding: 7px 9px; max-width: 190px; }
.web-rebuild .side { padding: 24px 12px 18px; width: auto; background: var(--web-subtle); border-right: 1px solid var(--web-line); }
.web-rebuild .side .web-brand { padding: 0 10px; margin-bottom: 24px; font-size: 18px; }
.web-rebuild .side-group { margin: 21px 10px 7px; font-size: 11px; font-weight: 500; letter-spacing: .025em; color: var(--web-muted); }
.web-rebuild .side-nav a, .web-rebuild .side-nav button { min-height: 37px; padding: 8px 10px; font-size: 13px; border-radius: 6px; color: var(--web-muted); }
.web-rebuild .side-nav a.active { background: var(--web-selected); color: var(--web-text); font-weight: 500; }
.web-rebuild .side-nav a:hover, .web-rebuild .side-nav button:hover { background: var(--web-surface); color: var(--web-text); }
.web-rebuild .count { background: var(--web-surface); color: var(--web-muted); font-weight: 500; font-size: 11px; min-width: 22px; }
.web-rebuild .side-account { border-top: 1px solid var(--web-line); padding-top: 16px; margin-top: 28px; }
.web-rebuild .side-profile { margin-bottom: 9px; }
.web-rebuild .avatar { background: var(--web-selected); color: var(--web-text); border: 1px solid var(--web-line); font-weight: 500; }
.web-rebuild .top { min-height: 66px; padding: 14px 34px; background: var(--web-surface); border-bottom: 1px solid var(--web-line); box-shadow: none; gap: 15px; }
.web-rebuild .breadcrumb { color: var(--web-muted); font-size: 12px; }
.web-rebuild .breadcrumb b { color: var(--web-text); font-weight: 500; }
.web-top-actions { display: flex; align-items: center; gap: 18px; }
.web-rebuild .top-link { font-size: 12px; color: var(--web-muted); }
.web-portal .app { display: block; }
.web-portal .main { width: 100%; }
.web-portal .content { max-width: 1136px; padding: 36px 28px 44px; }
.portal-header { background: var(--web-surface); border-bottom: 1px solid var(--web-line); }
.portal-header-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px; max-width: 1440px; margin: auto; padding: 18px 30px; }
.portal-nav { display: flex; gap: 3px; align-items: center; }
.portal-nav a { color: var(--web-muted); text-decoration: none; font-size: 13px; padding: 8px 10px; border-radius: 6px; white-space: nowrap; }
.portal-nav a[aria-current="page"] { color: var(--web-text); background: var(--web-subtle); font-weight: 500; }
.portal-nav a:hover { background: var(--web-subtle); color: var(--web-text); }
.portal-account { display: flex; align-items: center; gap: 14px; }
.portal-account-link { display: inline-flex; gap: 8px; align-items: center; text-decoration: none; font-size: 13px; }
.portal-account-link .avatar { width: 31px; height: 31px; font-size: 12px; }
.portal-nav .side-menu-close { display: none; }
.portal-service-card { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 35px; padding: 30px; border-radius: 12px; border: 1px solid var(--web-line); background: var(--web-surface); margin-bottom: 22px; }
.portal-service-card h2 { font-size: 27px; letter-spacing: -.035em; margin: 15px 0 7px; }
.portal-service-card .portal-expiry { color: var(--web-muted); font-size: 13px; }
.portal-service-card .btn { margin-top: 22px; }
.portal-service-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: center; gap: 25px; }
.portal-service-facts dt { color: var(--web-muted); font-size: 12px; }
.portal-service-facts dd { margin: 8px 0 0; font-size: 19px; font-weight: 500; }
.portal-dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 22px; }
.portal-dashboard-grid .panel { margin-bottom: 0; }
.portal-dashboard-grid + .customer-next-step { margin-top: 22px; }
.portal-start-guide { margin-top: 22px; }
.web-api-certificate { margin: 22px 0; padding-top: 22px; border-top: 1px solid var(--web-line); }
.web-api-certificate dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin: 0; }
.web-api-certificate dd { margin: 0; }
.portal-device-list > .portal-device-card { border: 0; border-bottom: 1px solid var(--web-line); border-radius: 0; padding: 20px 0; }
.portal-device-list > .portal-device-card:first-child { padding-top: 0; }
.portal-device-list > .portal-device-card:last-child { border-bottom: 0; padding-bottom: 0; }
.portal-device-pair > .customer-sessions { margin-top: 20px; }
.portal-device-pair .portal-device-card { background: var(--web-subtle); }
.portal-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 22px; margin-top: 20px; }
.portal-section-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-top: 25px; padding: 22px 0; border-top: 1px solid var(--web-line); color: var(--web-muted); font-size: 13px; }
.portal-page-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 22px; align-items: start; }
.portal-page-grid > * { min-width: 0; }
.web-rebuild .customer-facts { gap: 19px 25px; }
.web-rebuild .customer-facts dt { color: var(--web-muted); font-size: 12px; }
.web-rebuild .customer-facts dd { font-size: 14px; }
.web-rebuild .customer-sessions { gap: 12px; }
.web-rebuild .customer-sessions > li { background: var(--web-surface); border-color: var(--web-line); border-radius: 8px; padding: 20px; }
.web-rebuild .customer-session-head { justify-content: space-between; }
.web-rebuild .customer-start-steps { gap: 25px; font-size: 13px; }
.web-rebuild .customer-note { color: var(--web-muted); font-size: 13px; }
.web-rebuild .customer-next-step { background: var(--web-selected); border-color: transparent; }
.web-rebuild .customer-next-step h2 { font-size: 19px; }
.web-rebuild .customer-support-tickets > li { border-color: var(--web-line); }
.web-rebuild .support-message { border: 1px solid var(--web-line); background: var(--web-subtle); border-radius: 9px; }
.web-rebuild .support-message.admin { background: color-mix(in srgb, var(--web-positive) 6%, var(--web-surface)); }
.support-triage-summary { display: block; color: var(--web-muted); font-size: 11px; margin-top: 5px; white-space: normal; }
.support-triage-form .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.web-auth { min-height: 100dvh; }
.web-auth .auth-shell { display: block; min-height: 100dvh; max-width: none; }
.web-auth-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; max-width: 1440px; margin: auto; padding: 25px 34px; }
.web-auth-main { max-width: 440px; margin: 45px auto 0; padding: 0 20px 45px; }
.web-auth .auth-card { max-width: none; width: 100%; padding: 29px; background: var(--web-surface); border: 1px solid var(--web-line); border-radius: 12px; box-shadow: none; }
.web-auth .auth-card-head { margin-bottom: 22px; }
.web-auth .auth-card-head h2 { font-size: 25px; letter-spacing: -.035em; margin-block: 8px; }
.web-auth .auth-card-head p { color: var(--web-muted); font-size: 13px; }
.web-auth .eyebrow { color: var(--web-muted); font-size: 11px; letter-spacing: .02em; text-transform: none; }
.web-auth .auth-meta { color: var(--web-muted); text-align: center; font-size: 12px; margin: 20px 0 0; }
.web-auth .auth-links a { color: var(--web-primary); }
@media (max-width: 1200px) {
  .portal-header-inner { gap: 16px; }
  .portal-nav { order: 3; flex-basis: 100%; flex-wrap: wrap; }
  .portal-account { margin-left: auto; }
}
@media (max-width: 980px) {
  .web-rebuild .content { padding: 27px 23px 38px; }
  .web-rebuild .top { padding-inline: 23px; }
  .portal-page-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .web-rebuild .app { display: block; }
  .web-rebuild .content { padding: 25px 17px 95px; }
  .web-rebuild h1 { font-size: 27px; }
  .web-rebuild .head { align-items: flex-start; flex-wrap: wrap; }
  .web-rebuild .head .btn { max-width: 100%; }
  .web-rebuild .panel { padding: 20px; }
  .web-rebuild .top { padding: 11px 17px; }
  .web-rebuild .top-link { display: none; }
  .web-rebuild .side { position: fixed; inset: 0 auto 0 0; height: 100dvh; width: min(310px, 88vw); padding-bottom: 24px; z-index: 60; }
  .web-rebuild .side-menu-close { display: inline-flex; }
  .portal-header-inner { padding: 16px 18px; }
  .portal-account-link > span:not(.avatar) { display: none; }
  .portal-account .web-theme-control { display: none; }
  .portal-nav { position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; align-items: stretch; justify-content: start; width: min(310px, 88vw); padding: 20px; height: 100dvh; overflow-y: auto; background: var(--web-surface); border-right: 1px solid var(--web-line); z-index: 60; transform: translateX(-105%); }
  .js body:not(.nav-open) .portal-nav { visibility: hidden; }
  body.nav-open .portal-nav { transform: translateX(0); visibility: visible; }
  .portal-nav a { min-height: 44px; display: flex; align-items: center; }
  .portal-nav .side-menu-close { display: inline-flex; align-self: end; margin-bottom: 20px; }
  .portal-nav .web-theme-control { margin-top: 20px; }
  html:not(.js) .portal-nav { position: static; transform: none; width: 100%; height: auto; overflow: visible; flex-direction: row; flex-wrap: wrap; padding: 0; border: 0; }
  .portal-service-card { grid-template-columns: minmax(0, 1fr); gap: 25px; padding: 24px; }
  .portal-service-facts { border-top: 1px solid var(--web-line); padding-top: 20px; }
  .portal-dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .web-rebuild .customer-start-steps { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .web-rebuild .mobile-tabs { background: var(--web-surface); border-top: 1px solid var(--web-line); box-shadow: none; }
  .web-rebuild .mobile-tabs a, .web-rebuild .mobile-tabs button { color: var(--web-muted); }
  .web-rebuild .mobile-tabs .active { color: var(--web-text); background: var(--web-selected); }
  .web-rebuild .mobile-tabs b { font-size: 11px; font-weight: 500; }
  .web-auth-header { padding: 20px; }
  .web-auth-main { margin-top: 24px; }
  .web-auth .auth-card { padding: 24px; }
}
@media (pointer: coarse) {
  .web-rebuild .btn, .web-rebuild .side-nav a, .web-rebuild .side-nav button { min-height: 44px; }
  .web-rebuild input, .web-rebuild select, .web-rebuild textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .web-rebuild *, .web-rebuild *::before, .web-rebuild *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
