:root {
  color-scheme: light;
  --alg-canvas-ivory: #f4f0ea;
  --alg-canvas-soft: #faf7f2;
  --alg-surface-white: #ffffff;
  --alg-surface-raised: #fffdf9;
  --alg-surface-subtle: #f7f3ec;
  --alg-surface-disabled: #ece8e0;
  --alg-ink-primary: #1b1b19;
  --alg-ink-secondary: #3c403d;
  --alg-text-muted: #6b736d;
  --alg-text-subtle: #929993;
  --alg-text-disabled: #adb2ae;
  --alg-text-inverse: #ffffff;
  --alg-emerald-950: #153f32;
  --alg-emerald-900: #21453a;
  --alg-emerald-800: #275342;
  --alg-emerald-700: #2e604b;
  --alg-emerald-600: #39735a;
  --alg-emerald-100: #e7f0eb;
  --alg-emerald-050: #f1f6f3;
  --alg-gold-700: #a97d3c;
  --alg-gold-600: #b99054;
  --alg-gold-500: #c8a15c;
  --alg-gold-300: #dec28b;
  --alg-gold-100: #f2e6ce;
  --alg-gold-050: #faf4e8;
  --alg-border-neutral: #d9d4cb;
  --alg-border-soft: #e9e4dc;
  --alg-border-emerald: rgba(33, 69, 58, 0.28);
  --alg-border-gold: rgba(185, 144, 84, 0.38);
  --alg-success: #2e604b;
  --alg-success-bg: #e7f0eb;
  --alg-attention: #815c29;
  --alg-attention-bg: #f6ecd9;
  --alg-error: #9f3e39;
  --alg-error-bg: #f7e6e4;
  --alg-info: #315f73;
  --alg-info-bg: #e7f0f4;
  --alg-shadow-xs: 0 1px 2px rgba(27, 27, 25, 0.05);
  --alg-shadow-sm: 0 8px 24px rgba(27, 27, 25, 0.07);
  --alg-shadow-md: 0 18px 48px rgba(27, 27, 25, 0.1);
  --alg-sidebar-width: 282px;
  --alg-topbar-height: 76px;
  --alg-radius-sm: 12px;
  --alg-radius-md: 16px;
  --alg-radius-lg: 22px;
  --alg-radius-xl: 28px;
  --alg-fast: 140ms;
  --alg-base: 190ms;
  --alg-slow: 280ms;
  --alg-ease: cubic-bezier(0.22, 0.8, 0.28, 1);

  /* Stable semantic aliases retained for existing customer templates. */
  --paper: var(--alg-ink-primary);
  --text-2: var(--alg-ink-secondary);
  --text-3: var(--alg-text-muted);
  --border: var(--alg-border-soft);
  --border-strong: var(--alg-border-neutral);
  --surface: var(--alg-surface-white);
  --surface-raised: var(--alg-surface-raised);
  --shadow-1: var(--alg-shadow-sm);
  --shadow-2: var(--alg-shadow-md);
  --lime: var(--alg-emerald-700);
  --lime-rgb: 46, 96, 75;
  --success: var(--alg-success);
  --warning: var(--alg-attention);
  --critical: var(--alg-error);
  --sidebar-w: var(--alg-sidebar-width);
  --topbar-h: var(--alg-topbar-height);
  --radius-sm: var(--alg-radius-sm);
  --radius-md: var(--alg-radius-md);
  --radius-lg: var(--alg-radius-lg);
  --radius-xl: var(--alg-radius-xl);
  --radius-2xl: var(--alg-radius-xl);
  --ease: var(--alg-ease);
  --fast: var(--alg-fast);
  --base: var(--alg-base);
  --slow: var(--alg-slow);
}

*, *::before, *::after { box-sizing: border-box; }
html {
  min-width: 320px;
  min-height: 100%;
  color: var(--alg-ink-primary);
  background: var(--alg-canvas-ivory);
  scroll-behavior: smooth;
}
body {
  margin: 0;
  min-height: 100vh;
  color: var(--alg-ink-primary);
  background:
    radial-gradient(circle at 92% 2%, rgba(200, 161, 92, 0.08), transparent 27rem),
    radial-gradient(circle at 6% 94%, rgba(46, 96, 75, 0.07), transparent 30rem),
    var(--alg-canvas-ivory);
  font: 500 16px/1.55 Manrope, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background-image: radial-gradient(circle, rgba(33, 69, 58, 0.18) 1px, transparent 1.35px);
  background-position: calc(100% - 42px) 42px;
  background-size: 18px 18px;
  mask-image: linear-gradient(135deg, transparent 0 70%, #000 100%);
  opacity: 0.32;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: var(--alg-emerald-800); text-decoration: none; }
a:hover { color: var(--alg-emerald-950); }
code, kbd, .mono, .mono-tag { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
.is-locked { overflow: hidden; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
::selection { color: #fff; background: var(--alg-emerald-700); }
:focus-visible {
  outline: 3px solid rgba(46, 96, 75, 0.64);
  outline-offset: 3px;
  box-shadow: 0 0 0 2px var(--alg-canvas-soft);
}

h1, h2, h3, h4, p { overflow-wrap: anywhere; }
h1, h2, h3, h4 {
  color: var(--alg-ink-primary);
  font-weight: 760;
  letter-spacing: -0.035em;
}
h1 { margin: 0 0 16px; font-size: clamp(36px, 5vw, 64px); line-height: 1.02; }
h2 { margin: 0 0 12px; font-size: clamp(22px, 2.5vw, 32px); line-height: 1.16; }
h3 { margin: 0 0 10px; font-size: 19px; line-height: 1.3; }
p { margin: 0 0 16px; color: var(--alg-ink-secondary); }
small { color: var(--alg-text-muted); }

.skip-link {
  position: fixed;
  z-index: 500;
  left: 16px;
  top: -80px;
  padding: 11px 16px;
  border-radius: var(--alg-radius-sm);
  color: #fff;
  background: var(--alg-emerald-900);
  font-weight: 800;
  transition: top var(--alg-base) var(--alg-ease);
}
.skip-link:focus { top: 16px; }

.ambient { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.ambient i { position: absolute; border: 1px solid rgba(33, 69, 58, 0.08); border-radius: 50%; }
.ambient i:nth-child(1) { width: 360px; height: 360px; right: -180px; top: 110px; box-shadow: 0 0 0 44px rgba(185, 144, 84, 0.025), 0 0 0 88px rgba(33, 69, 58, 0.022); }
.ambient i:nth-child(2) { width: 540px; height: 540px; left: -390px; bottom: -260px; box-shadow: 0 0 0 70px rgba(33, 69, 58, 0.018); }
.ambient i:nth-child(3) { display: none; }

.app-shell { position: relative; z-index: 1; min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 80;
  width: var(--alg-sidebar-width);
  padding: 20px 16px 18px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--alg-border-soft);
  background: rgba(255, 253, 249, 0.96);
  box-shadow: 8px 0 30px rgba(27, 27, 25, 0.035);
  backdrop-filter: blur(18px) saturate(110%);
}
.brand { min-height: 54px; padding: 2px 8px 20px; display: flex; align-items: center; gap: 12px; }
.brand-logo { display: block; width: 174px; height: auto; }
.brand__mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: inline-block;
  background: center / contain no-repeat url("/assets/brand/algorithm-mark.svg");
}
.brand__mark i { display: none; }
.brand > span:nth-child(2) { min-width: 0; }
.brand strong { display: block; font-size: 14px; letter-spacing: 0.11em; }
.brand small { display: block; margin-top: 3px; color: var(--alg-text-muted); font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
.sidebar__close { display: none !important; margin-left: auto; }

.workspace { padding: 7px 4px 18px; }
.workspace__eyebrow, .nav__label {
  display: block;
  margin: 0 10px 9px;
  color: var(--alg-text-muted);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.workspace__switch {
  width: 100%;
  min-height: 64px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--alg-border-soft);
  border-radius: var(--alg-radius-md);
  background: var(--alg-surface-white);
  box-shadow: var(--alg-shadow-xs);
}
.workspace__switch > span:nth-child(2) { min-width: 0; flex: 1; }
.workspace__switch strong, .workspace__switch small { display: block; }
.workspace__switch strong { font-size: 14px; }
.workspace__switch small { margin-top: 2px; color: var(--alg-text-muted); font-size: 12px; }
.avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--alg-border-emerald);
  border-radius: 13px;
  color: var(--alg-emerald-900);
  background: var(--alg-emerald-050);
  font-size: 13px;
  font-weight: 850;
}
.avatar--company { color: #fff; background: var(--alg-emerald-900); }

.nav { min-height: 0; padding: 3px 0 10px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--alg-border-neutral) transparent; }
.nav__label { margin-top: 9px; }
.nav__item {
  position: relative;
  min-height: 46px;
  margin: 3px 0;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: var(--alg-radius-sm);
  color: var(--alg-text-muted);
  font-weight: 680;
  transition: color var(--alg-base), background var(--alg-base), border-color var(--alg-base), transform var(--alg-base);
}
.nav__item:hover { color: var(--alg-emerald-950); background: var(--alg-emerald-050); transform: translateX(2px); }
.nav__item.is-active { color: var(--alg-emerald-950); border-color: var(--alg-border-emerald); background: var(--alg-emerald-100); }
.nav__item.is-active::before { position: absolute; left: -1px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--alg-emerald-700); content: ""; }
.nav__item > span:not(.icon) { flex: 1; font-size: 14px; }
.nav__item.is-active .icon { color: var(--alg-emerald-800); }
.nav--secondary { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--alg-border-soft); }
.sidebar__footer { margin-top: 0; padding: 8px 4px 0; }
.sidebar-logout { margin: 0; }
.sidebar-logout button { width: 100%; color: var(--alg-text-muted); background: transparent; box-shadow: none; }

.icon { position: relative; width: 20px; height: 20px; flex: 0 0 20px; display: inline-grid; place-items: center; color: currentColor; }
.icon::before, .icon::after { position: absolute; content: ""; }
.icon--menu::before { width: 16px; height: 2px; border-radius: 2px; background: currentColor; box-shadow: 0 5px currentColor, 0 10px currentColor; }
.icon--grid::before { inset: 2px; border: 1.6px solid currentColor; border-radius: 5px; background: linear-gradient(90deg, transparent 47%, currentColor 47% 53%, transparent 53%), linear-gradient(transparent 47%, currentColor 47% 53%, transparent 53%); }
.icon--flow::before { width: 12px; height: 12px; left: 1px; top: 1px; border: 1.6px solid currentColor; border-radius: 4px; }
.icon--flow::after { width: 8px; height: 8px; right: 0; bottom: 0; border: 1.6px solid currentColor; border-radius: 3px; background: var(--alg-surface-white); }
.icon--spark::before { inset: 2px; background: currentColor; clip-path: polygon(50% 0, 61% 38%, 100% 50%, 61% 62%, 50% 100%, 39% 62%, 0 50%, 39% 38%); }
.icon--ledger::before { inset: 2px 3px; border: 1.6px solid currentColor; border-radius: 4px; }
.icon--ledger::after { width: 8px; height: 2px; border-radius: 2px; background: currentColor; box-shadow: 0 5px currentColor; }
.icon--network::before { width: 6px; height: 6px; left: 0; top: 7px; border: 1.6px solid currentColor; border-radius: 50%; box-shadow: 11px -6px 0 -1px var(--alg-surface-white), 11px -6px 0 0 currentColor, 11px 6px 0 -1px var(--alg-surface-white), 11px 6px 0 0 currentColor; }
.icon--network::after { width: 10px; height: 12px; left: 5px; top: 3px; border: 1.6px solid currentColor; border-left: 0; }
.icon--user::before { width: 7px; height: 7px; top: 1px; border: 1.6px solid currentColor; border-radius: 50%; }
.icon--user::after { width: 14px; height: 8px; bottom: 1px; border: 1.6px solid currentColor; border-radius: 9px 9px 3px 3px; }
.icon--lock::before { width: 13px; height: 10px; bottom: 1px; border: 1.6px solid currentColor; border-radius: 4px; }
.icon--lock::after { width: 8px; height: 8px; top: 0; border: 1.6px solid currentColor; border-bottom: 0; border-radius: 7px 7px 0 0; }
.icon--chevron::before { width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg); }
.icon--search::before { width: 11px; height: 11px; left: 1px; top: 1px; border: 1.6px solid currentColor; border-radius: 50%; }
.icon--search::after { width: 7px; height: 1.6px; right: 0; bottom: 3px; background: currentColor; transform: rotate(45deg); }

.main { min-width: 0; min-height: 100vh; margin-left: var(--alg-sidebar-width); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  min-height: var(--alg-topbar-height);
  padding: 0 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(217, 212, 203, 0.86);
  background: rgba(255, 253, 249, 0.9);
  backdrop-filter: blur(20px) saturate(120%);
}
.topbar__start, .topbar__actions { display: flex; align-items: center; gap: 10px; }
.breadcrumbs { display: flex; align-items: center; gap: 9px; color: var(--alg-text-muted); font-size: 13px; }
.breadcrumbs b { color: var(--alg-gold-600); }
.breadcrumbs strong { color: var(--alg-ink-primary); font-weight: 700; }
.mobile-brand { display: none; width: 112px; }
.mobile-brand img { display: block; }
.icon-button {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--alg-border-soft);
  border-radius: 13px;
  color: var(--alg-ink-secondary);
  background: var(--alg-surface-white);
  box-shadow: var(--alg-shadow-xs);
  cursor: pointer;
  transition: border-color var(--alg-base), color var(--alg-base), transform var(--alg-base), box-shadow var(--alg-base);
}
.icon-button:hover { color: var(--alg-emerald-900); border-color: var(--alg-border-emerald); box-shadow: var(--alg-shadow-sm); }
.icon-button:active { transform: scale(0.97); }
.locale-switch {
  height: 42px;
  padding: 3px;
  display: flex;
  align-items: center;
  border: 1px solid var(--alg-border-soft);
  border-radius: 13px;
  background: var(--alg-surface-white);
}
.locale-switch span, .locale-switch strong { min-width: 31px; padding: 6px; border-radius: 10px; font-size: 12px; text-align: center; }
.locale-switch span { color: var(--alg-text-muted); }
.locale-switch strong { color: #fff; background: var(--alg-emerald-900); }
.profile-button {
  min-height: 48px;
  padding: 4px 10px 4px 4px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--alg-border-soft);
  border-radius: 15px;
  background: var(--alg-surface-white);
  box-shadow: var(--alg-shadow-xs);
  cursor: pointer;
}
.profile-button__copy { min-width: 92px; text-align: left; }
.profile-button__copy strong, .profile-button__copy small { display: block; }
.profile-button__copy strong { font-size: 13px; }
.profile-button__copy small { color: var(--alg-text-muted); font-size: 12px; }
.mobile-only, .bottom-nav { display: none; }

.page { width: min(100%, 1320px); margin: 0 auto; padding: 44px 42px 88px; }
.page-heading, .workspace-heading, .section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 26px;
}
.page-heading > div:first-child, .workspace-heading > div:first-child, .section-title > div:first-child { min-width: 0; }
.page-heading h1, .workspace-heading h1, .section-title h1 {
  max-width: 790px;
  margin: 12px 0 13px;
  font-family: Oswald, "Roboto Condensed", "Arial Narrow", Manrope, sans-serif;
  font-size: clamp(38px, 5vw, 68px);
  font-stretch: condensed;
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.page-heading h1 em { color: var(--alg-gold-700); font-style: normal; }
.page-heading p, .workspace-heading p, .section-title p { max-width: 700px; color: var(--alg-ink-secondary); }
.page-heading__actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.eyebrow, .overline {
  color: var(--alg-emerald-800);
  font-size: 12px;
  font-weight: 820;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.eyebrow { display: flex; align-items: center; gap: 10px; }
.eyebrow > span { width: 26px; height: 2px; background: var(--alg-emerald-700); }

.panel, .signal-card, .action-card, .auth-card {
  min-width: 0;
  border: 1px solid var(--alg-border-soft);
  border-radius: var(--alg-radius-lg);
  background: var(--alg-surface-white);
  box-shadow: var(--alg-shadow-sm);
}
.panel { padding: 24px; }
.panel-heading, .section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.panel-heading > div, .section-heading > div { min-width: 0; }
.panel-heading p, .section-heading p { color: var(--alg-text-muted); }

button, .button {
  min-height: 44px;
  padding: 11px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--alg-emerald-900);
  border-radius: 14px;
  color: #fff;
  background: var(--alg-emerald-900);
  box-shadow: 0 7px 18px rgba(33, 69, 58, 0.15);
  font-weight: 760;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  transition: background var(--alg-base), border-color var(--alg-base), color var(--alg-base), box-shadow var(--alg-base), transform var(--alg-base);
}
button:hover, .button:hover { color: #fff; background: var(--alg-emerald-950); box-shadow: 0 10px 24px rgba(33, 69, 58, 0.2); transform: translateY(-1px); }
button:active, .button:active { transform: translateY(0); }
button:disabled, .button.disabled, [aria-disabled="true"] { cursor: not-allowed; opacity: 0.55; transform: none; box-shadow: none; }
.button--quiet, .ghost, .secondary, .table-action {
  color: var(--alg-ink-primary);
  border-color: var(--alg-border-neutral);
  background: var(--alg-surface-white);
  box-shadow: var(--alg-shadow-xs);
}
.button--quiet:hover, .ghost:hover, .secondary:hover, .table-action:hover { color: var(--alg-emerald-950); border-color: var(--alg-border-emerald); background: var(--alg-emerald-050); }
.button--compact { min-height: 38px; padding: 8px 12px; font-size: 13px; }
.premium-button { color: var(--alg-emerald-950); border-color: var(--alg-border-gold); background: var(--alg-gold-050); }
.warning, .danger, .danger-text { color: var(--alg-error); border-color: rgba(179, 77, 71, 0.28); background: var(--alg-error-bg); box-shadow: none; }
.warning:hover, .danger:hover { color: #fff; border-color: var(--alg-error); background: var(--alg-error); }

label { color: var(--alg-ink-secondary); font-size: 14px; font-weight: 680; }
input, select, textarea {
  width: 100%;
  min-height: 46px;
  margin: 8px 0 16px;
  padding: 11px 13px;
  border: 1px solid var(--alg-border-neutral);
  border-radius: 13px;
  color: var(--alg-ink-primary);
  background: var(--alg-surface-white);
  box-shadow: inset 0 1px 2px rgba(27, 27, 25, 0.025);
}
textarea { min-height: 124px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--alg-text-subtle); }
input:focus, select:focus, textarea:focus { border-color: var(--alg-emerald-700); outline: 0; box-shadow: 0 0 0 4px rgba(46, 96, 75, 0.11); }
input[readonly], input:disabled, select:disabled, textarea:disabled { color: var(--alg-text-muted); background: var(--alg-surface-disabled); }
.checkbox, .check-row { display: flex !important; align-items: flex-start; gap: 10px; }
.checkbox input, .check-row input, input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 20px; flex: 0 0 20px; margin: 2px 0 0; accent-color: var(--alg-emerald-700); }
details > summary { min-height: 44px; display: flex; align-items: center; color: var(--alg-emerald-800); font-weight: 700; cursor: pointer; }

.badge, .state-pill, .status-tag, .mode-chip, .prelaunch-label {
  min-height: 28px;
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--alg-border-neutral);
  border-radius: 999px;
  color: var(--alg-ink-secondary);
  background: var(--alg-surface-subtle);
  font-size: 13px;
  font-weight: 740;
  line-height: 1.25;
  white-space: nowrap;
}
.badge__dot, .mode-chip i, .status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--success, .state-pill--pass, .state-pill--sent, .state-pill--approved, .state-pill--completed { color: var(--alg-success); border-color: rgba(46, 96, 75, 0.25); background: var(--alg-success-bg); }
.badge--warning, .badge--orange, .prelaunch-label, .state-pill--partial { color: var(--alg-attention); border-color: rgba(138, 101, 47, 0.25); background: var(--alg-attention-bg); }
.badge--critical, .state-pill--failed { color: var(--alg-error); border-color: rgba(179, 77, 71, 0.25); background: var(--alg-error-bg); }
.badge--purple { color: var(--alg-info); border-color: rgba(49, 95, 115, 0.24); background: var(--alg-info-bg); }

.profile-drawer, .network-selector { position: relative; z-index: 100; }
.profile-drawer > summary, .network-selector > summary { list-style: none; }
.profile-drawer > summary::-webkit-details-marker, .network-selector > summary::-webkit-details-marker { display: none; }
.profile-drawer__menu, .network-selector__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 120;
  padding: 10px;
  border: 1px solid var(--alg-border-neutral);
  border-radius: 18px;
  background: var(--alg-surface-white);
  box-shadow: var(--alg-shadow-md);
}
.profile-drawer__menu { min-width: 310px; display: grid; gap: 4px; }
.profile-drawer__menu a, .profile-drawer__menu button { min-height: 44px; padding: 10px 12px; justify-content: flex-start; color: var(--alg-ink-primary); border: 0; border-radius: 11px; background: transparent; box-shadow: none; text-align: left; }
.profile-drawer__menu a:hover, .profile-drawer__menu button:hover { color: var(--alg-emerald-950); background: var(--alg-emerald-050); transform: none; }
.profile-drawer__menu hr { width: 100%; margin: 5px 0; border: 0; border-top: 1px solid var(--alg-border-soft); }
.network-selector > summary {
  min-width: 224px;
  min-height: 48px;
  padding: 6px 10px;
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--alg-border-emerald);
  border-radius: 15px;
  background: var(--alg-surface-white);
  box-shadow: var(--alg-shadow-xs);
  cursor: pointer;
}
.network-selector > summary small, .network-selector > summary strong { display: block; }
.network-selector > summary small { color: var(--alg-text-muted); font-size: 12px; }
.network-selector > summary strong { font-size: 14px; }
.network-selector > summary > i { max-width: 94px; overflow: hidden; color: var(--alg-text-muted); font-size: 12px; font-style: normal; text-overflow: ellipsis; }
.network-chip__icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; color: var(--alg-emerald-900); background: var(--alg-emerald-100); font-size: 16px; }
.network-selector__state { color: var(--alg-emerald-800); font-size: 12px; }
.network-selector__chevron { font-size: 16px; transition: transform var(--alg-base); }
.network-selector[open] .network-selector__chevron { transform: rotate(180deg); }
.network-selector__menu { width: min(380px, calc(100vw - 24px)); }
.network-selector__menu form { margin: 0; }
.network-selector__row {
  width: 100%;
  min-height: 62px;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: var(--alg-ink-primary);
  background: transparent;
  box-shadow: none;
  text-align: left;
}
.network-selector__row:hover, .network-selector__row:focus-visible, .network-selector__row.is-active { color: var(--alg-emerald-950); border-color: var(--alg-border-emerald); background: var(--alg-emerald-050); transform: none; }
.network-selector__row strong, .network-selector__row small { display: block; }
.network-selector__row strong { font-size: 14px; }
.network-selector__row small { margin-top: 3px; color: var(--alg-text-muted); font-size: 12px; }
.network-selector__row > b { color: var(--alg-text-muted); font-size: 12px; }

.scrim { position: fixed; inset: 0; z-index: 70; display: none; width: 100%; height: 100%; border: 0; border-radius: 0; background: rgba(21, 63, 50, 0.2); box-shadow: none; backdrop-filter: blur(4px); }
.command-layer, .modal-layer { position: fixed; inset: 0; z-index: 260; display: grid; place-items: start center; padding: 12vh 16px 16px; opacity: 0; transition: opacity var(--alg-base); }
.command-layer.is-open, .modal-layer.is-open { opacity: 1; }
.command-layer > .scrim, .modal-layer > .scrim { display: block; }
.command-palette, .modal { position: relative; z-index: 1; width: min(620px, 100%); padding: 18px; border: 1px solid var(--alg-border-neutral); border-radius: var(--alg-radius-lg); background: var(--alg-surface-white); box-shadow: var(--alg-shadow-md); }
.command-search { display: flex; align-items: center; gap: 10px; }
.command-search input { margin: 0; }
.command-results { display: grid; gap: 5px; margin-top: 12px; }
.command-results a { min-height: 44px; padding: 10px 12px; border-radius: 11px; }
.command-results a:hover { background: var(--alg-emerald-050); }
.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: grid; gap: 8px; }
.toast { max-width: 360px; padding: 14px; display: flex; gap: 10px; border: 1px solid var(--alg-border-neutral); border-radius: var(--alg-radius-md); background: var(--alg-surface-white); box-shadow: var(--alg-shadow-md); opacity: 0; transform: translateY(8px); transition: opacity var(--alg-base), transform var(--alg-base); }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  :root { --alg-sidebar-width: 250px; }
  .page { padding-inline: 28px; }
  .topbar { padding-inline: 24px; }
}

@media (max-width: 900px) {
  body::before { display: none; }
  .sidebar { width: min(320px, calc(100vw - 38px)); transform: translateX(-105%); transition: transform var(--alg-slow) var(--alg-ease); }
  .app-shell.nav-open .sidebar { transform: translateX(0); }
  .app-shell.nav-open > .scrim { display: block; }
  .sidebar__close { display: inline-grid !important; }
  .main { margin-left: 0; }
  .mobile-only, .mobile-brand { display: inline-flex; }
  .breadcrumbs { display: none; }
  .topbar { padding: max(10px, env(safe-area-inset-top)) 16px 10px; min-height: 70px; }
  .topbar__start { gap: 10px; }
  .page { padding: 30px 18px calc(106px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 65;
    min-height: calc(70px + env(safe-area-inset-bottom));
    padding: 7px 8px max(7px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    border-top: 1px solid var(--alg-border-soft);
    background: rgba(255, 253, 249, 0.97);
    box-shadow: 0 -8px 26px rgba(27, 27, 25, 0.06);
    backdrop-filter: blur(18px);
  }
  .bottom-nav a { min-width: 0; min-height: 56px; padding: 5px 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 12px; color: var(--alg-text-muted); font-size: 12px; line-height: 1.05; text-align: center; }
  .bottom-nav a span:last-child { max-width: 100%; max-height: 2.1em; overflow: hidden; white-space: normal; }
  .bottom-nav a.is-active { color: var(--alg-emerald-950); background: var(--alg-emerald-100); }
  .page-heading, .workspace-heading, .section-title { align-items: flex-start; flex-direction: column; gap: 14px; }
  .page-heading__actions { justify-content: flex-start; }
}

@media (max-width: 700px) {
  body { font-size: 16px; }
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .topbar__start { flex: 1 1 auto; }
  .topbar__actions { width: 100%; order: 2; gap: 7px; }
  .network-selector { flex: 1; order: 1; }
  .network-selector > summary { min-width: 0; width: 100%; grid-template-columns: auto 1fr auto; }
  .network-selector > summary > i, .network-selector__state { display: none; }
  .network-selector__menu { position: fixed; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 120px); width: auto; max-height: calc(100dvh - 150px - env(safe-area-inset-bottom)); overflow: auto; }
  .profile-button__copy { display: none; }
  .profile-drawer__menu { position: fixed; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 120px); min-width: 0; max-height: calc(100dvh - 150px - env(safe-area-inset-bottom)); overflow: auto; }
  .locale-switch { flex: 0 0 auto; }
  .page { padding-top: 26px; }
  .panel { padding: 20px; }
  .panel-heading, .section-heading { display: grid; gap: 10px; }
}

@media (max-width: 430px) {
  .mobile-brand { width: 98px; }
  .topbar-web-exit { width: 44px; padding: 8px; }
  .topbar-web-exit > span:last-child { display: none; }
  .locale-switch span, .locale-switch strong { min-width: 27px; padding-inline: 4px; }
  .page { padding-inline: 16px; }
  .bottom-nav a { font-size: 12px; letter-spacing: -0.02em; }
}

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