/* ============================================================
   CODIVUS PLATFORM — Design System
   ============================================================ */

/* ---- Variables ---- */
:root {
  --bg-base:      #09090b;
  --bg-elevated:  #18181b;
  --bg-overlay:   #27272a;
  --bg-hover:     #2e2e33;
  --bg-active:    #3f3f46;

  --border:       #27272a;
  --border-strong:#3f3f46;

  --text-1: #fafafa;
  --text-2: #a1a1aa;
  --text-3: #52525b;

  --accent:       #f97316;
  --accent-hover: #fb923c;
  --accent-soft:  rgba(249,115,22,.14);
  --accent-ring:  rgba(249,115,22,.35);

  --green:        #22c55e;
  --green-soft:   rgba(34,197,94,.12);
  --yellow:       #f59e0b;
  --yellow-soft:  rgba(245,158,11,.12);
  --red:          #ef4444;
  --red-soft:     rgba(239,68,68,.12);
  --blue:         #3b82f6;
  --blue-soft:    rgba(59,130,246,.12);
  --purple:       #a855f7;
  --purple-soft:  rgba(168,85,247,.12);

  --sidebar-w:    236px;
  --topbar-h:     56px;
  --radius:       8px;
  --radius-sm:    5px;
  --radius-lg:    12px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow:    0 4px 16px rgba(0,0,0,.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.6);

  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Cascadia Code", ui-monospace, monospace;
}

/* ---- Light theme ---- */
html[data-theme="light"] {
  --bg-base:      #fafafa;
  --bg-elevated:  #ffffff;
  --bg-overlay:   #f4f4f5;
  --bg-hover:     #e4e4e7;
  --bg-active:    #d4d4d8;

  --border:       #e4e4e7;
  --border-strong:#d4d4d8;

  --text-1: #09090b;
  --text-2: #52525b;
  --text-3: #a1a1aa;

  --accent-soft:  rgba(249,115,22,.10);
  --green-soft:   rgba(34,197,94,.12);
  --yellow-soft:  rgba(245,158,11,.14);
  --red-soft:     rgba(239,68,68,.10);
  --blue-soft:    rgba(59,130,246,.10);
  --purple-soft:  rgba(168,85,247,.10);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.12);
}

/* ---- Profile dropdown menu ---- */
.profile-menu {
  position: fixed;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  padding: 6px;
  z-index: 500;
  animation: fadeIn .12s ease;
}
.profile-menu-header {
  padding: 10px 10px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.profile-menu-name { font-size: 13px; font-weight: 600; color: var(--text-1); }
.profile-menu-email { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.profile-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 10px;
  background: none; border: none;
  color: var(--text-2); font-size: 13px;
  cursor: pointer; border-radius: var(--radius-sm);
  text-align: left;
  transition: background .12s, color .12s;
}
.profile-menu-item:hover { background: var(--bg-overlay); color: var(--text-1); }
.profile-menu-item svg { flex-shrink: 0; opacity: .75; }
.profile-menu-item:hover svg { opacity: 1; }
.profile-menu-item.danger:hover { color: var(--red); background: var(--red-soft); }
.profile-menu-sep { height: 1px; background: var(--border); margin: 6px 0; }
.profile-menu-switch {
  margin-left: auto;
  width: 28px; height: 16px;
  background: var(--bg-active);
  border-radius: 10px;
  position: relative;
  transition: background .15s;
}
.profile-menu-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
}
.profile-menu-switch.on { background: var(--accent); }
.profile-menu-switch.on::after { transform: translateX(12px); }

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-1);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button { cursor: pointer; font-family: var(--font); }
input, textarea, select { font-family: var(--font); }
img, svg { display: block; }
ul { list-style: none; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-active); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ============================================================
   PUBLIC PAGES (landing + auth)
   ============================================================ */
.public-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(249,115,22,.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(251,191,36,.04) 0%, transparent 50%);
}
.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.public-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-1);
  cursor: pointer;
  /* Ensure a big enough tap target on mobile and that clicks aren't
   * swallowed by overlapping elements. */
  padding: 4px 6px;
  margin: -4px -6px;
  position: relative;
  z-index: 2;
}
.public-brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.public-brand-icon img {
  display: block;
  width: 40px;
  height: 40px;
}
.public-brand-text {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.1;
}
.public-brand-name { font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.public-brand-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .04em;
  margin-top: 2px;
}
.public-nav {
  display: inline-flex;
  align-items: center;
  gap: 18px;
}
.public-nav-divider {
  width: 1px;
  height: 18px;
  background: var(--border-strong);
  display: inline-block;
}
.public-nav a {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: color .12s, background .12s;
}
.public-nav a:hover { color: var(--accent); background: transparent; }
.public-nav a.active { color: var(--accent); background: transparent; }
.public-nav a.active:hover { color: var(--accent); background: transparent; }
.public-nav a.public-nav-cta {
  background: var(--accent);
  color: #fff;
  padding: 7px 14px;
}
.public-nav a.public-nav-cta:hover { background: var(--accent-hover); color: #fff; }
.public-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font: inherit;
  transition: color .12s, background .12s, border-color .12s;
}
.public-nav-icon:hover { color: var(--text-1); background: var(--bg-overlay); border-color: var(--border-strong); }
.public-main {
  flex: 1;
  padding: 48px 32px;
}
.public-main:has(.auth-card) {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Landing */
.landing-split {
  display: flex;
  flex-direction: column;
  gap: 56px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}
.landing-hero { text-align: center; }
.landing-title {
  font-size: 44px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -.02em;
  margin-bottom: 18px;
  color: var(--text-1);
}
.landing-lede {
  font-size: 16px;
  color: var(--text-2);
  max-width: 560px;
  margin: 0 auto 28px;
  line-height: 1.55;
}
.landing-cta {
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

.install-dropdown {
  position: relative;
  display: inline-flex;
}
.install-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(3px);
  z-index: 200;
}
.install-menu {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 10px;
  flex-direction: column;
  gap: 2px;
  z-index: 201;
  text-align: left;
}
.install-dropdown.open .install-backdrop { display: block; animation: doc-fade .18s ease; }
.install-dropdown.open .install-menu { display: flex; animation: doc-rise .18s ease; }
.install-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text-1);
  text-decoration: none;
}
.install-item:hover {
  background: var(--accent-soft);
  color: var(--text-1);
}
.install-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.install-body { display: flex; flex-direction: column; min-width: 0; }
.install-title { font-size: 13px; font-weight: 600; line-height: 1.25; }
.install-sub {
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--font-mono);
  line-height: 1.4;
}
.landing-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.landing-feature {
  padding: 18px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.landing-feature-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.landing-feature-desc { font-size: 13px; color: var(--text-2); line-height: 1.5; }

.landing-gallery-header { text-align: center; margin-bottom: 24px; }
.landing-gallery-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.landing-gallery-subtitle {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 4px;
}
.landing-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.landing-sample {
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.landing-sample:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.landing-sample-image {
  aspect-ratio: 5 / 3;
  background: var(--bg-overlay);
  overflow: hidden;
}
.landing-sample-image svg {
  display: block;
  width: 100%;
  height: 100%;
  transition: transform .25s ease;
}
.landing-sample:hover .landing-sample-image svg { transform: scale(1.04); }
.landing-sample-caption { padding: 12px 14px; }
.landing-sample-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--text-1);
}
.landing-sample-stack {
  font-size: 11px;
  color: var(--accent);
  font-family: var(--font-mono);
}

/* ----- Generic public page scaffold ----- */
.generic-section {
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 0 40px;
}
.generic-header {
  text-align: center;
  margin-bottom: 36px;
}
.generic-header h1 {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -.02em;
  margin: 0 0 10px;
  color: var(--text-1);
}
.generic-header p {
  font-size: 15px;
  color: var(--text-2);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.55;
}
.generic-cta {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 40px;
}

/* ----- Features ----- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.feature-card {
  padding: 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color .15s, transform .15s;
}
.feature-card:hover { border-color: var(--accent-ring); transform: translateY(-2px); }
.feature-card .feature-icon {
  font-size: 22px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border-radius: 10px;
  margin-bottom: 4px;
}
.feature-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  color: var(--text-1);
}
.feature-card p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  margin: 0;
}

/* ----- Docs ----- */
.docs-search { max-width: 480px; margin: 0 auto 28px; }
.docs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.docs-group {
  padding: 20px 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.docs-group h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  margin: 0 0 10px;
}
.docs-group ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.docs-group li a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-1);
  font-size: 14px;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.docs-group li a:hover { background: var(--accent-soft); color: var(--accent); }

/* ----- Install page ----- */
.install-page { max-width: 880px; }
.install-anchors {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 36px;
}
.install-anchor {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  color: var(--text-1);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  background: transparent;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.install-anchor:hover { border-color: var(--accent-ring); background: var(--accent-soft); }
.install-anchor.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.install-anchor.active:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.install-anchor svg { flex-shrink: 0; }

/* Native-app OS sub-switcher — reuses the .install-anchor pill (a touch
   tighter) and toggles which platform variant of the block is shown. */
.native-os-switch {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.native-os-switch .install-anchor { padding: 8px 14px; font-size: 13px; }
.native-variant { display: none; }
.native-variant.active { display: block; }

.install-block {
  display: none;
  padding: 28px 32px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  margin-bottom: 20px;
}
.install-block.active { display: block; }
.install-block-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}
.install-block-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.install-block-head h2 { font-size: 20px; font-weight: 800; margin: 0 0 4px; }
.install-block-head p { font-size: 13px; color: var(--text-2); margin: 0; line-height: 1.55; }

.install-steps {
  list-style: decimal;
  padding-left: 20px;
  margin: 0 0 18px;
}
.install-steps li {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-1);
  margin-bottom: 6px;
}
.install-steps code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--bg-overlay);
  padding: 1px 6px;
  border-radius: 4px;
}
.install-steps kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-overlay);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
}

.install-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.install-note {
  font-size: 12px;
  color: var(--text-3);
  margin: 0;
}
.install-note a { color: var(--accent); }

.install-tabs { margin-bottom: 18px; }
.install-tab-title {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  margin: 14px 0 6px;
}
.install-tab-title:first-child { margin-top: 0; }
.install-code {
  margin: 0;
  padding: 10px 14px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
}

.install-help {
  text-align: center;
  margin-top: 24px;
  padding: 8px 24px;
}
.install-help h3 { font-size: 16px; margin: 0 0 6px; }
.install-help p { font-size: 13px; color: var(--text-2); margin: 0; }
.install-help .btn-filled { color: #fff; }

@media (max-width: 720px) {
  .install-block { padding: 22px 20px; }
  .install-block-head h2 { font-size: 18px; }
}

/* ----- Docs article modal ----- */
.doc-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 32px;
  overflow-y: auto;
}
.doc-modal.open { display: flex; }
.doc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
  animation: doc-fade .2s ease;
}
.doc-modal-panel {
  position: relative;
  width: 100%;
  max-width: 780px;
  margin: auto 0;
  background: var(--bg-elevated);
  color: var(--text-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 44px 32px;
  animation: doc-rise .2s ease;
}
.doc-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.doc-modal-close:hover {
  background: var(--bg-overlay);
  color: var(--text-1);
  border-color: var(--border-strong);
}
.doc-meta { display: flex; gap: 10px; align-items: center; font-size: 12px; margin-bottom: 8px; }
.doc-section {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 999px;
}
.doc-read { color: var(--text-3); }
.doc-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.015em;
  margin: 0 0 18px;
  line-height: 1.2;
}
.doc-content h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 20px 0 8px;
}
.doc-content p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-1);
  margin: 0 0 12px;
}
.doc-content ul,
.doc-content ol {
  padding-left: 22px;
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-1);
}
.doc-content li { margin-bottom: 4px; }
.doc-content code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--bg-overlay);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text-1);
}
.doc-content pre {
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 0 14px;
  overflow-x: auto;
}
.doc-content pre code {
  background: transparent;
  padding: 0;
  font-size: 12.5px;
  line-height: 1.6;
}
.doc-content kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-overlay);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
}
.doc-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
}
.doc-footer .btn { padding: 6px 12px; font-size: 12px; }

@keyframes doc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes doc-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (max-width: 720px) {
  .doc-modal { padding: 20px 12px; }
  .doc-modal-panel { padding: 32px 22px 24px; }
  .doc-title { font-size: 22px; }
}

/* ----- Blog ----- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ---- Demos gallery ---- */
.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 32px;
  padding: 8px 4px;
}
@media (max-width: 640px) {
  .demo-grid { grid-template-columns: 1fr; gap: 20px; padding: 4px 0; }
}
.demo-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.demo-card:hover {
  border-color: var(--accent-ring);
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.14);
}
.demo-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-2);
  min-height: 180px; /* safety for browsers where aspect-ratio collapses */
}
/* Fallback for browsers without aspect-ratio support (rare in 2026) */
@supports not (aspect-ratio: 1) {
  .demo-thumb::before {
    content: '';
    display: block;
    padding-top: 62.5%;
  }
}
/* SVG wireframe sits behind everything and fills the thumb. Always renders
 * so mobile / blocked / still-loading iframes never leave a blank card. */
.demo-thumb svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  display: block;
}
/* Live preview iframe. The site renders at a real 1440×900 desktop viewport
 * (set via HTML width/height attributes — iOS Safari ignores CSS widths on
 * iframes but respects the attributes + scrolling="no"). JS then applies a
 * transform: scale so the 1440-wide render shrinks to fit the card.
 *
 * Layered on top of the SVG wireframe; fades in on `load` so there's no
 * blank white flash. If the target blocks embedding, the SVG shows through. */
.demo-iframe {
  position: absolute;
  top: 0; left: 0;
  border: 0;
  pointer-events: none;
  background: transparent;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.demo-iframe.loaded { opacity: 1; }
.demo-thumb-chrome {
  position: absolute;
  top: 8px; left: 10px;
  display: flex;
  gap: 4px;
  z-index: 2;
}
.demo-thumb-chrome span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.18);
  box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.3);
}
.demo-thumb-tech {
  position: absolute;
  bottom: 8px; left: 8px; right: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  z-index: 2;
}
.demo-chip-overlay {
  /* Semi-transparent light backdrop so black bold text stays legible on
   * preview backgrounds of any colour. */
  background: rgba(255, 255, 255, 0.85) !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
  color: #000 !important;
  backdrop-filter: blur(6px);
}
.demo-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.demo-title { font-size: 15px; font-weight: 600; margin: 0; color: var(--text-1); }
.demo-prompt { font-size: 12px; color: var(--text-2); margin: 0; line-height: 1.55; font-style: italic; }
.demo-tech { display: flex; flex-wrap: wrap; gap: 6px; }
.demo-chip {
  font-size: 10px;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: .02em;
  color: #000;
  background: transparent;
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 999px;
}
.demo-actions {
  display: flex;
  gap: 6px;
  justify-content: space-between;
  margin-top: 4px;
}
.blog-card {
  padding: 20px 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color .15s, transform .15s;
}
.blog-card:hover { border-color: var(--accent-ring); transform: translateY(-2px); }
.blog-meta { display: flex; gap: 10px; font-size: 11px; align-items: center; }
.blog-tag {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 999px;
}
.blog-date { color: var(--text-3); }
.blog-card h3 { font-size: 16px; margin: 0; font-weight: 700; line-height: 1.35; }
.blog-card h3 a { color: var(--text-1); text-decoration: none; }
.blog-card h3 a:hover { color: var(--accent); }
.blog-card p { font-size: 13px; color: var(--text-2); margin: 0; line-height: 1.55; }
.blog-more {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  margin-top: auto;
  font-weight: 600;
}

/* ----- Enterprise ----- */
.enterprise-contact {
  margin-top: 48px;
  padding: 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.enterprise-contact h2 { font-size: 22px; font-weight: 800; margin: 0 0 4px; }
.enterprise-contact > p { font-size: 14px; color: var(--text-2); margin: 0 0 18px; }
.enterprise-form { display: flex; flex-direction: column; gap: 14px; }
.enterprise-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.enterprise-form .form-field { display: flex; flex-direction: column; gap: 6px; }
.enterprise-form .form-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.enterprise-form button { align-self: flex-start; }

@media (max-width: 900px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .blog-grid   { grid-template-columns: 1fr; }
  .docs-grid   { grid-template-columns: 1fr; }
  .enterprise-form .form-row { grid-template-columns: 1fr; }
  .generic-header h1 { font-size: 32px; }
}
@media (max-width: 560px) {
  .feature-grid { grid-template-columns: 1fr; }
}

/* ----- Pricing page ----- */
.pricing-section {
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 0 32px;
}
.pricing-header { text-align: center; margin-bottom: 36px; }
.pricing-title {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -.02em;
  margin: 0 0 10px;
  color: var(--text-1);
}
.pricing-subtitle {
  font-size: 15px;
  color: var(--text-2);
  margin: 0;
}
.pricing-currency-tabs {
  display: inline-flex;
  margin-top: 18px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface, #1a1a1a);
  border: 1px solid var(--border);
  gap: 2px;
}
.pricing-currency-tab {
  padding: 6px 18px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.pricing-currency-tab:hover { color: var(--text-1); }
.pricing-currency-tab.active {
  background: var(--accent, #f97316);
  color: #fff;
}
.pricing-currency-tab:focus-visible {
  outline: 2px solid var(--accent, #f97316);
  outline-offset: 2px;
}
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.price-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.price-card:hover {
  border-color: var(--accent-ring);
  transform: translateY(-2px);
}
.price-card-featured {
  border-color: var(--accent);
  box-shadow: 0 10px 30px -18px rgba(249,115,22,.5);
}
.price-ribbon {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 3px 10px;
  border-radius: 999px;
}
.price-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
}
.price-amount {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
}
.price-num {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -.015em;
  color: var(--text-1);
}
.price-cadence {
  font-size: 12px;
  color: var(--text-3);
}
.price-blurb {
  font-size: 13px;
  color: var(--text-2);
  margin: 0 0 18px;
  line-height: 1.5;
  min-height: 38px;
}
.price-cta { width: 100%; justify-content: center; margin-bottom: 18px; }
.price-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.price-features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.45;
}
.price-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.pricing-faq {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 24px;
  margin-top: 56px;
  max-width: 880px;
  margin-left: auto;
  margin-right: auto;
}
.faq-item h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 6px;
}
.faq-item p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  margin: 0;
}

@media (max-width: 960px) {
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .pricing-grid { grid-template-columns: 1fr; }
  .pricing-faq { grid-template-columns: 1fr; }
  .pricing-title { font-size: 32px; }
}

/* ----- Public footer ----- */
.public-footer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
}
.public-footer-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 48px 32px 32px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr);
  gap: 40px;
}
.public-footer-brand { display: flex; flex-direction: column; gap: 12px; }
.public-footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-1);
}
.public-footer-tagline {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-3);
  max-width: 280px;
}
.public-footer-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.public-footer-col { display: flex; flex-direction: column; gap: 8px; }
.public-footer-col h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-1);
  margin: 0 0 6px;
}
.public-footer-col a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.8;
  transition: color .15s;
}
.public-footer-col a:hover { color: var(--accent); }

.public-footer-bottom {
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px 32px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  color: var(--text-3);
}
.public-footer-social { display: inline-flex; gap: 8px; }
.public-footer-social a {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-3);
  border: 1px solid var(--border);
  transition: color .15s, border-color .15s, background .15s;
}
.public-footer-social a:hover {
  color: var(--accent);
  border-color: var(--accent-ring);
  background: var(--accent-soft);
}

@media (max-width: 720px) {
  .public-footer-inner {
    grid-template-columns: 1fr;
    padding: 32px 20px 24px;
    gap: 28px;
  }
  .public-footer-cols { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .public-footer-bottom {
    padding: 16px 20px 20px;
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ----- Capabilities section (bento) ----- */
.capabilities-section {
  position: relative;
  margin: 48px calc(-50vw + 50%) 0;
  padding: 48px max(32px, calc(50vw - 480px)) 64px;
  background: #ffffff;
  /* Scope light-mode-ish tokens for this section so contents stay readable on white */
  --bg-elevated: #ffffff;
  --bg-overlay: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text-1: #09090b;
  --text-2: #52525b;
  --text-3: #71717a;
  --accent-soft: rgba(249,115,22,.10);
  --accent-ring: rgba(249,115,22,.35);
  color: var(--text-1);
}
.capabilities-section > .capabilities-header,
.capabilities-section > .capabilities-bento {
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}
.capabilities-section > .capabilities-header { margin-bottom: 28px; }
.capabilities-header { text-align: center; margin-bottom: 28px; }
.capabilities-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.015em;
  margin: 0 0 6px;
}
.capabilities-subtitle {
  font-size: 14px;
  color: var(--text-2);
  margin: 0;
}
.capabilities-bento {
  display: grid;
  /* 12-col base grid lets tiles snap to thirds (4), halves (6), 2/3 (8),
   * 3/4 (9), and quarters (3) with clean math. Default tile span is 4 (1/3). */
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: minmax(220px, auto);
  gap: 14px;
}
.bento { grid-column: span 4; }
.bento {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.bento:hover {
  border-color: var(--accent-ring);
  transform: translateY(-3px);
  box-shadow: 0 14px 30px -18px rgba(249,115,22,.45);
}
.bento-wide { grid-column: span 8; }            /* 2/3 */
.bento-full { grid-column: span 12; }           /* full row */
.bento-three-quarter { grid-column: span 9; }   /* 3/4 */
.bento-quarter { grid-column: span 3; }         /* 1/4 — pairs with three-quarter on the same row */
.bento-art {
  flex: 1;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 20px 8px;
  background: transparent;
  position: relative;
  overflow: hidden;
}
.bento-body {
  padding: 14px 20px 20px;
  border-top: 1px solid var(--border);
}
.bento-body h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text-1);
}
.bento-body p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  margin: 0;
}

/* Mini-tree (reads codebase) */
.mini-tree {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-2);
  padding: 8px 4px;
  position: relative;
}
.mini-tree .mt-row { display: flex; align-items: center; gap: 8px; }
.mini-tree .mt-nested { padding-left: 14px; }
.mini-tree .mt-active { color: var(--text-1); font-weight: 600; }
.mini-tree .mt-caret { color: var(--accent); font-size: 10px; }
.mini-tree .mt-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border-strong);
}
.mini-tree .mt-dot-on {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.mini-tree .mt-scan {
  position: absolute;
  left: 0; right: 0; height: 22px;
  background: linear-gradient(180deg, transparent, var(--accent-soft), transparent);
  animation: mini-tree-scan 3.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes mini-tree-scan {
  0%   { top: 0;    opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { top: 92%;  opacity: 0; }
}

/* Mini image (image understanding) */
.mini-image {
  position: relative;
  width: 100%;
  max-width: 180px;
  aspect-ratio: 3/2;
}
.mini-image svg { width: 100%; height: 100%; display: block; }
.mini-image .mi-scan {
  position: absolute;
  left: 4%; right: 4%; height: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: mi-scan 2.4s ease-in-out infinite;
}
@keyframes mi-scan {
  0%,100% { top: 8%;  opacity: .9; }
  50%     { top: 88%; opacity: .9; }
}

/* Mini diff (edits code) */
.mini-diff {
  margin: 0;
  padding: 10px 12px;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.mini-diff .md-ctx   { color: var(--text-3); display: block; }
.mini-diff .md-plus  { color: #16a34a; background: rgba(34,197,94,.12);  display: block; padding: 0 4px; border-radius: 3px; }
.mini-diff .md-minus { color: #dc2626; background: rgba(239,68,68,.12);  display: block; padding: 0 4px; border-radius: 3px; text-decoration: line-through; text-decoration-color: rgba(239,68,68,.55); }
.mini-diff .md-plus  { animation: diff-slide .5s ease .2s both; }
.mini-diff .md-minus { animation: diff-fade  .4s ease both; }
@keyframes diff-slide { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@keyframes diff-fade  { from { opacity: 1; } to { opacity: .65; } }

/* Mini ring (tests) */
.mini-ring { width: 72px; height: 72px; display: block; }
.mini-ring-fill {
  animation: ring-fill 2.4s ease-out infinite;
}
@keyframes ring-fill {
  0%   { stroke-dashoffset: 201; opacity: .4; }
  70%  { stroke-dashoffset: 0;   opacity: 1; }
  100% { stroke-dashoffset: 0;   opacity: 1; }
}
.mini-count {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  text-align: center;
}
.mini-count span { color: var(--accent); font-weight: 700; }
.cap-tests .bento-art { flex-direction: column; }

/* Mini terminal (tools) */
.mini-term {
  width: 100%;
  max-width: 240px;
  background: #0b0b0f;
  color: #e4e4e7;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 6px 10px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.7;
}
.mini-term .mt-chrome { display: flex; gap: 4px; margin-bottom: 6px; }
.mini-term .mt-chrome span { width: 7px; height: 7px; border-radius: 50%; }
.mini-term .mt-dot-r { background: #ef4444; }
.mini-term .mt-dot-y { background: #eab308; }
.mini-term .mt-dot-g { background: #22c55e; }
.mini-term .mt-prompt { color: var(--accent); margin-right: 6px; }
.mini-term .mt-ok { color: #22c55e; margin-left: 6px; }
.mini-term .mt-caret-blink { color: var(--accent); animation: caret-blink 1s steps(1) infinite; }

/* Mini search */
.mini-search { width: 100%; max-width: 180px; }
.mini-search .mini-search-glass {
  transform-origin: 78px 44px;
  animation: search-move 4s ease-in-out infinite;
}
@keyframes search-move {
  0%,100% { transform: translate(0,0); }
  50%     { transform: translate(-48px, 0); }
}

/* Mini branch (PR) */
.mini-branch { width: 100%; max-width: 520px; height: auto; }

/* Mini chat */
.mini-chat { width: 100%; max-width: 220px; display: flex; flex-direction: column; gap: 6px; }
.mc-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.4;
  max-width: 80%;
}
.mc-user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.mc-agent {
  align-self: flex-start;
  background: var(--bg-overlay);
  color: var(--text-1);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.mc-typing { display: inline-flex; gap: 3px; padding: 2px 0; }
.mc-typing span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  animation: mc-bounce 1.2s ease-in-out infinite;
}
.mc-typing span:nth-child(2) { animation-delay: .15s; }
.mc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes mc-bounce {
  0%,80%,100% { transform: translateY(0); opacity: .5; }
  40%         { transform: translateY(-4px); opacity: 1; }
}

/* Mini shield (audit) */
.mini-shield { width: 80px; height: 80px; }
.mini-docs   { width: 80px; height: 80px; }
.mini-shield path:last-child { animation: shield-check .6s ease .3s both; stroke-dasharray: 40; stroke-dashoffset: 40; animation-fill-mode: forwards; }
@keyframes shield-check { to { stroke-dashoffset: 0; } }

/* ----- Why choose us section (landing) ----- */
.why-section {
  width: 100%;
  max-width: 960px;
  margin: 64px auto 0;
}
.why-header { text-align: center; margin-bottom: 32px; }
.why-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.015em;
  margin: 0 0 8px;
}
.why-subtitle {
  font-size: 14px;
  color: var(--text-2);
  margin: 0;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.55;
}
.why-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.why-card {
  position: relative;
  padding: 24px 22px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: transparent;
  transition: border-color .15s, transform .15s;
}
.why-card:hover {
  border-color: var(--accent-ring);
  transform: translateY(-2px);
}
.why-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .08em;
  margin-bottom: 10px;
}
.why-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 8px;
  line-height: 1.3;
}
.why-card p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0;
}

@media (max-width: 900px) {
  .why-grid { grid-template-columns: 1fr; }
  .why-title { font-size: 26px; }
}

/* ----- Agent stage (landing visualization) ----- */

/* Light-mode tuning: boost contrast for orbit rings, panel borders, terminal fade */
html[data-theme="light"] .agent-stage-glow {
  background:
    radial-gradient(60% 50% at 50% 40%, rgba(249,115,22,.12) 0%, transparent 70%),
    radial-gradient(40% 40% at 20% 70%, rgba(249,115,22,.08) 0%, transparent 70%);
}
html[data-theme="light"] .agent-orbit ellipse {
  stroke: rgba(249,115,22,.55);
  opacity: .85;
}
html[data-theme="light"] .agent-orbit .sat circle,
html[data-theme="light"] .agent-orbit .agent-core + circle {
  stroke: var(--accent);
  stroke-width: 1.75;
}
html[data-theme="light"] .agent-panel {
  border-color: var(--border-strong);
  box-shadow: 0 1px 0 rgba(0,0,0,.02), 0 12px 28px -16px rgba(249,115,22,.35);
}
html[data-theme="light"] .agent-terminal-body {
  background:
    linear-gradient(180deg, rgba(255,255,255,0) 55%, rgba(249,115,22,.06) 100%),
    var(--bg-elevated);
}
html[data-theme="light"] .log .t { color: var(--text-2); }
html[data-theme="light"] .log { color: var(--text-1); }
html[data-theme="light"] .agent-diff-body .ctx { color: var(--text-2); }


.agent-stage {
  position: relative;
  padding: 32px 0 8px;
  isolation: isolate;
}
.agent-stage-glow {
  position: absolute;
  inset: -40px 10% -20px 10%;
  background:
    radial-gradient(60% 50% at 50% 40%, var(--accent-soft) 0%, transparent 70%),
    radial-gradient(40% 40% at 20% 70%, rgba(249,115,22,.08) 0%, transparent 70%);
  filter: blur(8px);
  z-index: -1;
  pointer-events: none;
}
.agent-orbit {
  display: block;
  width: 100%;
  height: auto;
  max-height: 360px;
  margin-top: -48px;
  margin-bottom: -40px;
}
.agent-orbit .agent-core { transform-origin: 300px 180px; animation: core-pulse 2.4s ease-in-out infinite; }
.agent-orbit .agent-core-halo { transform-origin: 300px 180px; animation: core-halo 3.2s ease-in-out infinite; }
.agent-orbit .sat { animation: sat-bob 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.agent-orbit .sat:nth-child(odd) { animation-delay: -1.5s; }
@keyframes sat-bob {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-3px); }
}
@keyframes core-pulse {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.08); }
}
@keyframes core-halo {
  0%,100% { opacity: .7; transform: scale(1); }
  50%     { opacity: 1; transform: scale(1.1); }
}
/* Panels row */
.agent-panels {
  display: grid;
  grid-template-columns: 1.2fr 1.3fr 1fr;
  gap: 14px;
  margin-top: 16px;
}
.agent-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0,0,0,.02), 0 10px 30px -20px rgba(249,115,22,.25);
}
.agent-panel-chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-overlay);
  font-size: 11px;
  color: var(--text-3);
}
.agent-panel-chrome .dot { width: 8px; height: 8px; border-radius: 50%; }
.agent-panel-chrome .dot.r { background: #ef4444; }
.agent-panel-chrome .dot.y { background: #eab308; }
.agent-panel-chrome .dot.g { background: #22c55e; }
.agent-panel-title { margin-left: 6px; font-family: var(--font-mono); }
.agent-live {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.agent-live .pulse {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-ring);
  animation: live-pulse 1.4s ease-out infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-ring); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* Terminal */
.agent-terminal-body {
  position: relative;
  height: 180px;
  overflow: hidden;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  background:
    linear-gradient(180deg, rgba(0,0,0,0) 60%, rgba(0,0,0,.15) 100%),
    var(--bg-elevated);
}
.log-track { animation: log-scroll 18s linear infinite; }
.log { display: flex; gap: 10px; white-space: nowrap; color: var(--text-2); }
.log .t { color: var(--text-3); width: 40px; }
.log .a { color: var(--accent); text-transform: uppercase; font-size: 10px; letter-spacing: .08em; width: 56px; }
.log .plus  { color: #22c55e; }
.log .minus { color: #ef4444; }
.log .ok    { color: #22c55e; }
.agent-caret {
  position: absolute;
  bottom: 10px; left: 12px;
  color: var(--accent);
  font-family: var(--font-mono);
  animation: caret-blink 1s steps(1) infinite;
}
@keyframes log-scroll {
  0%   { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}
@keyframes caret-blink {
  50% { opacity: 0; }
}

/* Diff */
.agent-diff-body {
  margin: 0;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.75;
  height: 180px;
  overflow: hidden;
}
.agent-diff-body .line { display: block; padding: 0 6px; border-radius: 3px; }
.agent-diff-body .ctx   { color: var(--text-3); }
.agent-diff-body .plus  { background: rgba(34,197,94,.12);  color: #16a34a; }
.agent-diff-body .minus { background: rgba(239,68,68,.12);  color: #dc2626; text-decoration: line-through; text-decoration-color: rgba(239,68,68,.5); }
/* Loop the +/- lines so the diff panel feels alive next to the streaming
 * terminal. Each line starts hidden, slides in at its staggered delay,
 * holds visible, then fades back out before the cycle restarts. */
.agent-diff-body .plus,
.agent-diff-body .minus {
  animation: diff-loop 6s ease-in-out infinite both;
  opacity: 0;
}
.agent-diff-body .minus { animation-delay: 0.2s; }
.agent-diff-body .plus:nth-of-type(1) { animation-delay: 0.8s; }
.agent-diff-body .plus:nth-of-type(2) { animation-delay: 1.4s; }
@keyframes diff-loop {
  0%   { opacity: 0; transform: translateX(-6px); }
  10%  { opacity: 1; transform: translateX(0); }
  80%  { opacity: 1; transform: translateX(0); }
  95%  { opacity: 0; transform: translateX(-6px); }
  100% { opacity: 0; transform: translateX(-6px); }
}

/* Pipeline */
.agent-pipe-body {
  padding: 14px 14px 18px;
  height: 180px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--font-mono);
  opacity: .4;
  transition: opacity .3s, color .3s;
}
.step-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--border-strong);
  box-shadow: 0 0 0 0 transparent;
  transition: background .3s, box-shadow .3s;
}
.agent-pipe-body .step { position: relative; z-index: 1; padding-left: 2px; }
.agent-pipe-body .step .step-dot { margin-left: 5px; }
.agent-pipe-body .step.s1 { animation: step-on 6s infinite; animation-delay: 0s; }
.agent-pipe-body .step.s2 { animation: step-on 6s infinite; animation-delay: 1.2s; }
.agent-pipe-body .step.s3 { animation: step-on 6s infinite; animation-delay: 2.4s; }
.agent-pipe-body .step.s4 { animation: step-on 6s infinite; animation-delay: 3.6s; }
.agent-pipe-body .step.s5 { animation: step-on 6s infinite; animation-delay: 4.8s; }
@keyframes step-on {
  0%, 15%   { opacity: .4; color: var(--text-3); }
  20%, 90%  { opacity: 1; color: var(--text-1); }
  100%      { opacity: .4; color: var(--text-3); }
}
@keyframes step-on-dot {}
.step.s1 .step-dot,
.step.s2 .step-dot,
.step.s3 .step-dot,
.step.s4 .step-dot,
.step.s5 .step-dot { animation: step-dot-on 6s infinite; }
.step.s1 .step-dot { animation-delay: 0s; }
.step.s2 .step-dot { animation-delay: 1.2s; }
.step.s3 .step-dot { animation-delay: 2.4s; }
.step.s4 .step-dot { animation-delay: 3.6s; }
.step.s5 .step-dot { animation-delay: 4.8s; }
@keyframes step-dot-on {
  0%,15%   { background: var(--border-strong); box-shadow: 0 0 0 0 transparent; }
  20%,90%  { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
  100%     { background: var(--border-strong); box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .agent-orbit *, .log-track, .agent-caret,
  .agent-pipe-body .step, .agent-pipe-body .step .step-dot,
  .agent-diff-body .plus, .agent-diff-body .minus {
    animation: none !important;
  }
}

/* Mobile nav toggle — hidden on desktop */
.public-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-1);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
}
.public-nav-toggle:hover { background: var(--bg-overlay); }

@media (max-width: 720px) {
  .public-header { position: relative; }
  .public-nav-toggle { display: inline-flex; }
  .public-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px 16px 14px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    z-index: 50;
  }
  .public-nav.open { display: flex; }
  .public-nav-divider { display: none; }
  .public-nav a,
  .public-nav .public-nav-icon {
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 14px;
  }
  .public-nav .public-nav-cta { text-align: left; }
  .public-nav .public-nav-icon {
    justify-content: flex-start;
    border: 0;
    width: auto;
    height: auto;
    gap: 10px;
  }
  .public-nav .public-nav-icon::after {
    content: "Toggle theme";
    font-size: 14px;
    font-weight: 500;
    color: var(--text-2);
  }
}

@media (max-width: 900px) {
  .landing-features { grid-template-columns: 1fr; }
  .landing-gallery-grid { grid-template-columns: 1fr; }
  .landing-title { font-size: 32px; }
  .public-header { padding: 12px 16px; }
  .agent-panels { grid-template-columns: 1fr; }
  .agent-orbit { max-height: 260px; }
  .capabilities-bento { grid-template-columns: 1fr; }
  .bento { grid-column: span 1; }
  .bento-wide { grid-column: span 1; }
  .bento-full { grid-column: span 1; }
  .bento-three-quarter { grid-column: span 1; }
  .bento-quarter { grid-column: span 1; }
}

/* Legacy alias — .auth-shell used by old templates */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(249,115,22,.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(251,191,36,.04) 0%, transparent 50%);
}

.auth-card {
  width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 40px 40px;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tab {
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 7px;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.auth-tab:hover { color: var(--text-1); }
.auth-tab.active {
  background: var(--bg-elevated);
  color: var(--text-1);
}
.auth-pane { display: none; }
.auth-pane.active { display: block; }

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}
.auth-logo-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
}
.auth-logo-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--text-1);
}

.auth-heading { font-size: 22px; font-weight: 700; letter-spacing: -.4px; margin-bottom: 6px; }
.auth-subheading { font-size: 13px; color: var(--text-2); margin-bottom: 28px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text-2); letter-spacing: .02em; text-transform: uppercase; }
.form-input {
  background: var(--bg-overlay);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.form-input::placeholder { color: var(--text-3); }

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -4px;
}
.auth-check { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.auth-check input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; }
.auth-check span { font-size: 13px; color: var(--text-2); }
.auth-link { font-size: 13px; color: var(--accent); }
.auth-link:hover { color: var(--accent-hover); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  padding: 11px 20px;
  cursor: pointer;
  transition: background .15s, transform .1s;
  width: 100%;
  margin-top: 4px;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 0;
  color: var(--text-3); font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-2); }
.auth-footer a { color: var(--accent); }

/* OTP input */
.otp-inputs { display: flex; gap: 10px; justify-content: center; margin: 8px 0; }
.otp-digit {
  width: 52px; height: 56px;
  background: var(--bg-overlay);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.otp-digit:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

.otp-hint { font-size: 12px; color: var(--text-3); text-align: center; margin-top: 8px; }
.otp-resend { font-size: 13px; color: var(--text-2); text-align: center; margin-top: 16px; }
.otp-resend a { color: var(--accent); }

.auth-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-2);
  cursor: pointer; margin-bottom: 24px;
  background: none; border: none;
}
.auth-back:hover { color: var(--text-1); }

/* ============================================================
   SHELL LAYOUT
   ============================================================ */
.shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: 16px 8px 12px;
  border-bottom: 1px solid var(--border);
}

.org-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--bg-overlay);
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  user-select: none;
  transition: background .12s, border-color .12s;
}
.org-selector:hover { background: var(--bg-overlay); }
.org-selector:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.org-avatar {
  width: 52px; height: 52px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.org-avatar img { width: 44px; height: 44px; }
.org-info { flex: 1; min-width: 0; }
.org-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-plan { font-size: 11px; color: var(--text-2); }
.org-chevron { color: var(--text-3); flex-shrink: 0; }

.sidebar-nav { flex: 1; padding: 8px 8px; }

.nav-section { margin-bottom: 4px; }
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: background .12s, color .12s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}
.nav-item:hover { background: var(--bg-overlay); color: var(--text-1); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active svg { color: var(--accent); }
.nav-item svg { flex-shrink: 0; opacity: .75; }
.nav-item.active svg { opacity: 1; }

.nav-section-divider {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.nav-item-external { text-decoration: none; }
.nav-item-external:hover { color: var(--accent); }
.nav-item-external:hover svg { opacity: 1; color: var(--accent); }
.nav-item-external .nav-external-icon {
  margin-left: auto;
  opacity: .5;
}
.nav-item-external:hover .nav-external-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.nav-badge.green { background: var(--green-soft); color: var(--green); }
.nav-badge.yellow { background: var(--yellow-soft); color: var(--yellow); }
.nav-badge.red { background: var(--red-soft); color: var(--red); }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.org-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  outline: none;
}
.org-footer:hover,
.org-footer:focus-visible { background: var(--bg-overlay); border-color: var(--border); }
.org-footer-text { flex: 1; min-width: 0; }
.org-footer-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-3);
}
.org-footer-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.org-footer-chevron { color: var(--text-3); flex-shrink: 0; }

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s;
}
.user-row:hover { background: var(--bg-overlay); }
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Main area ---- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ---- Top bar ---- */
.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
}
.breadcrumbs .crumb { cursor: pointer; transition: color .12s; }
.breadcrumbs .crumb:hover { color: var(--text-1); }
.breadcrumbs .sep { color: var(--text-3); }
.breadcrumbs .current { color: var(--text-1); font-weight: 500; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .12s, color .12s;
  position: relative;
}
.icon-btn:hover { background: var(--bg-overlay); color: var(--text-1); }

.topbar-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-2);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.topbar-action:hover { background: var(--bg-overlay); color: var(--text-1); }
.topbar-action svg { flex-shrink: 0; opacity: .85; }
.topbar-action-icon { position: relative; display: inline-flex; }
.topbar-action-icon .notif-dot { top: -2px; right: -2px; }

/* ---- Global search modal ---- */
.modal-search { width: 560px; max-width: calc(100vw - 32px); padding: 0; overflow: hidden; }
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
}
.search-input-field {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  color: var(--text-1);
  font-family: inherit;
  font-size: 14px;
}
.search-input-field::placeholder { color: var(--text-3); }
.search-kbd {
  font-family: inherit;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  color: var(--text-3);
  background: var(--bg-overlay);
}
.search-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 6px 0;
}
.search-section + .search-section { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
.search-section-label {
  padding: 6px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.search-result {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 14px;
  cursor: pointer;
  transition: background .12s;
  font-family: inherit;
}
.search-result:hover { background: var(--bg-overlay); }
.search-result-label { font-size: 13px; font-weight: 500; color: var(--text-1); }
.search-result-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ---- Notifications panel ---- */
.notif-panel {
  padding: 0;
  overflow: hidden;
  max-height: 460px;
  display: flex;
  flex-direction: column;
}
.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.notif-header-title { font-size: 13px; font-weight: 600; color: var(--text-1); }
.notif-mark-all {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.notif-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 14px;
  cursor: pointer;
  transition: background .12s;
  font-family: inherit;
}
.notif-item:hover { background: var(--bg-overlay); }
.notif-item-row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.notif-item-action { font-size: 12px; font-weight: 500; color: var(--text-1); text-transform: capitalize; }
.notif-item-time { font-size: 10px; color: var(--text-3); white-space: nowrap; }
.notif-item-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-footer {
  display: block;
  width: 100%;
  text-align: center;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  padding: 9px;
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
  font-family: inherit;
}
.notif-footer:hover { background: var(--bg-overlay); }
.notif-empty { padding: 24px 14px; text-align: center; }
.notif-empty-title { font-size: 13px; font-weight: 500; color: var(--text-2); }
.notif-empty-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 1.5px solid var(--bg-elevated);
}

.topbar-divider { width: 1px; height: 20px; background: var(--border); }

/* ---- Page content ---- */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px;
  background: var(--bg-base);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-title-group {}
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -.4px; margin-bottom: 2px; }
.page-subtitle { font-size: 13px; color: var(--text-2); }
.page-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ============================================================
   COMPONENTS
   ============================================================ */

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.btn svg { flex-shrink: 0; }

.btn-ghost {
  background: none;
  color: var(--text-2);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-overlay); color: var(--text-1); border-color: var(--border-strong); }

.btn-filled {
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
}
.btn-filled:hover { background: var(--accent-hover); color: #fff; }

.btn-danger {
  background: none;
  color: var(--red);
  border: 1px solid var(--red-soft);
}
.btn-danger:hover { background: var(--red-soft); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---- Cards ---- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-subtitle { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ---- Stats grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-label { font-size: 12px; color: var(--text-2); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.5px; line-height: 1; }
.stat-change {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; margin-top: 6px;
}
.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }
.stat-change.neutral { color: var(--text-2); }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-1);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--bg-overlay); }

.table-empty {
  text-align: center;
  padding: 48px !important;
  color: var(--text-3);
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.yellow { background: var(--yellow-soft); color: var(--yellow); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.purple { background: var(--purple-soft); color: var(--purple); }
.badge.gray { background: var(--bg-overlay); color: var(--text-2); }

/* ---- Search / filter bar ---- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}
.search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 13px;
  padding: 8px 12px 8px 32px;
  outline: none;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-3); }

.filter-select {
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--accent); }

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  margin-top: 16px;
}
.page-btn {
  min-width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  transition: background .12s;
  padding: 0 8px;
}
.page-btn:hover:not(:disabled) { background: var(--bg-overlay); color: var(--text-1); }
.page-btn.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-ring); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  color: var(--text-3);
  font-size: 12px;
  user-select: none;
}
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.pagination-summary { font-size: 12px; color: var(--text-3); }
.pagination-bar .pagination { margin-top: 0; }

/* ---- Avatar group ---- */
.avatar-group { display: flex; }
.avatar-group .avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--bg-elevated);
  margin-left: -7px;
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.avatar-group .avatar:first-child { margin-left: 0; }

/* ---- Code / mono ---- */
.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-overlay);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-2);
  letter-spacing: .03em;
}

/* ---- Progress bar ---- */
.progress-wrap { background: var(--bg-overlay); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width .3s; }
.progress-fill.green { background: var(--green); }
.progress-fill.yellow { background: var(--yellow); }
.progress-fill.red { background: var(--red); }

.subscription-card { padding: 16px 18px; }
.subscription-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.subscription-plan { min-width: 0; }
.subscription-usage { margin-top: 4px; }

.plan-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 6px 6px 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 14px;
  line-height: 1;
}
.plan-pill-name { font-weight: 600; color: var(--text-1); }
.plan-pill-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  text-transform: capitalize;
}
.plan-pill-status::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.plan-pill-active .plan-pill-status {
  background: var(--green-soft, rgba(34,197,94,.14));
  color: var(--green, #22c55e);
}
.plan-pill-free .plan-pill-status {
  background: var(--bg-active);
  color: var(--text-2);
}
.plan-pill-trial .plan-pill-status {
  background: rgba(59,130,246,.14);
  color: #3b82f6;
}
.plan-pill-warn .plan-pill-status {
  background: rgba(245,158,11,.16);
  color: #f59e0b;
}
.plan-pill-danger .plan-pill-status {
  background: rgba(239,68,68,.14);
  color: var(--red, #ef4444);
}

/* ---- Tabs ---- */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  border: none; background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .12s, border-color .12s;
}
.tab:hover { color: var(--text-1); }
.tab.active { color: var(--text-1); border-bottom-color: var(--accent); }

/* Secondary tabs — used inside cards (e.g. the Usage card's
 * "Team Usage / Members usage" toggle). Visually lighter than top-level
 * .tab so the two levels don't compete. */
.sub-tab {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  border: none; background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .12s, border-color .12s;
  display: inline-flex; align-items: center; gap: 4px;
}
.sub-tab:hover { color: var(--text-1); }
.sub-tab.active { color: var(--text-1); border-bottom-color: var(--accent); }

/* ---- Toggle ---- */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle {
  width: 38px; height: 20px;
  background: var(--bg-active);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}
.toggle.on { background: var(--accent); }
.toggle::after {
  content: '';
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 3px; left: 3px;
  transition: transform .15s;
}
.toggle.on::after { transform: translateX(18px); }

/* ---- Section divider ---- */
.section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  margin-bottom: 12px;
  margin-top: 24px;
}
.section-title:first-child { margin-top: 0; }

/* ---- Grid layouts ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* ---- Flex utilities ---- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-2); }
.text-dim { color: var(--text-3); }
.font-mono { font-family: var(--font-mono); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.activity-feed { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-overlay);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.activity-body { flex: 1; }
.activity-text { color: var(--text-1); }
.activity-text strong { font-weight: 600; }
.activity-time { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.session-list { display: flex; flex-direction: column; gap: 8px; }
.session-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--bg-overlay);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color .12s;
}
.session-item:hover { border-color: var(--border-strong); }
.session-indicator {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--green-soft);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--green-soft); }
  50% { box-shadow: 0 0 0 6px rgba(34,197,94,.04); }
}
.session-info { flex: 1; min-width: 0; }
.session-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-meta { font-size: 11px; color: var(--text-3); margin-top: 1px; }

/* ============================================================
   PROJECTS
   ============================================================ */
.project-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.project-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

.project-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.project-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.project-name { font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
.project-desc { font-size: 12px; color: var(--text-2); line-height: 1.5; }

.project-stats { display: flex; gap: 16px; }
.project-stat { display: flex; flex-direction: column; gap: 1px; }
.project-stat-value { font-size: 18px; font-weight: 700; }
.project-stat-label { font-size: 11px; color: var(--text-3); }

.project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   BILLING
   ============================================================ */
.plan-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  background: var(--bg-elevated);
  position: relative;
  transition: border-color .15s;
}
.plan-card.current { border-color: var(--accent); }
.plan-badge-current {
  position: absolute; top: -10px; left: 20px;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 10px;
  border-radius: 10px; text-transform: uppercase; letter-spacing: .05em;
}
.plan-name { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.plan-price { font-size: 32px; font-weight: 700; letter-spacing: -1px; margin-bottom: 4px; }
.plan-price span { font-size: 16px; font-weight: 400; color: var(--text-2); }
.plan-desc { font-size: 13px; color: var(--text-2); margin-bottom: 20px; }
.plan-features { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.plan-feature { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.plan-feature svg { color: var(--green); flex-shrink: 0; }

.usage-meter { margin-bottom: 14px; }
.usage-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 5px; }
.usage-name { color: var(--text-2); }
.usage-value { color: var(--text-1); font-weight: 500; }

.invoice-row { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 14px; }
.invoice-row:last-child { border-bottom: none; }
.invoice-date { font-size: 13px; color: var(--text-2); width: 100px; flex-shrink: 0; }
.invoice-desc { flex: 1; font-size: 13px; }
.invoice-amount { font-size: 13px; font-weight: 600; width: 80px; text-align: right; flex-shrink: 0; }

.payment-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.card-brand {
  width: 42px; height: 28px;
  background: var(--bg-active);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--text-2);
  flex-shrink: 0;
}
.card-info { flex: 1; }
.card-number { font-size: 13px; font-family: var(--font-mono); letter-spacing: .05em; }
.card-expiry { font-size: 11px; color: var(--text-3); margin-top: 1px; }

/* ============================================================
   TEAM / USERS
   ============================================================ */
.member-row { display: flex; align-items: center; gap: 12px; }
.member-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.member-info { flex: 1; min-width: 0; }
.member-name { font-size: 13px; font-weight: 500; }
.member-email { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.role-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}

/* ============================================================
   TOKENS / API
   ============================================================ */
.token-reveal {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
}
.token-reveal button { background: none; border: none; color: var(--text-3); cursor: pointer; margin-left: auto; }
.token-reveal button:hover { color: var(--text-1); }

.scope-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.scope-tag {
  padding: 2px 8px; border-radius: 4px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-family: var(--font-mono);
}

/* ============================================================
   AUDIT LOG
   ============================================================ */
.audit-action {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 7px; border-radius: 4px;
  background: var(--bg-overlay); color: var(--text-2);
}
.audit-action.create { background: var(--green-soft); color: var(--green); }
.audit-action.delete { background: var(--red-soft); color: var(--red); }
.audit-action.update { background: var(--blue-soft); color: var(--blue); }
.audit-action.auth { background: var(--purple-soft); color: var(--purple); }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-section { margin-bottom: 32px; }
.settings-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  gap: 24px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row-info { flex: 1; min-width: 0; }
.settings-row-label { font-size: 14px; font-weight: 500; }
.settings-row-desc { font-size: 12px; color: var(--text-2); margin-top: 3px; line-height: 1.5; }
.settings-row-control { flex-shrink: 0; display: flex; align-items: center; }

.settings-card { margin-bottom: 16px; }
.settings-card .card-header { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.settings-card .modal-field + .modal-field { margin-top: 12px; }
.settings-card .card-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.settings-card .form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.settings-empty {
  color: var(--text-3); font-size: 13px;
  text-align: center; padding: 20px;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.settings-grid .settings-card { margin-bottom: 0; }
.settings-grid > .settings-card-wide { grid-column: 1 / -1; }
@media (max-width: 900px) {
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .settings-card .form-grid { grid-template-columns: 1fr; }
}

.danger-zone-card {
  border: 1px solid var(--red-soft);
  border-radius: var(--radius);
  padding: 20px;
  background: rgba(239,68,68,.03);
}
.danger-zone-title { font-size: 14px; font-weight: 600; color: var(--red); margin-bottom: 8px; }

/* ============================================================
   ADMIN
   ============================================================ */
.agent-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.agent-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.agent-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.agent-status-dot.online { background: var(--green); }
.agent-status-dot.idle { background: var(--yellow); }
.agent-status-dot.offline { background: var(--text-3); }
.agent-name { font-size: 13px; font-weight: 600; }
.agent-id { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }
.agent-metrics { display: flex; gap: 16px; }
.agent-metric { display: flex; flex-direction: column; gap: 2px; }
.agent-metric-value { font-size: 18px; font-weight: 700; }
.agent-metric-label { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }

.health-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.health-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--bg-overlay);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.health-icon { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.health-icon.ok { background: var(--green); }
.health-icon.warn { background: var(--yellow); }
.health-icon.err { background: var(--red); }
.health-name { font-size: 13px; font-weight: 500; flex: 1; }
.health-val { font-size: 12px; color: var(--text-2); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  /* flex-start so tall modals don't get clipped off the top when content
     exceeds the viewport — the backdrop itself scrolls in that case. */
  display: flex; align-items: flex-start; justify-content: center;
  padding: 32px 20px;
  overflow-y: auto;
  z-index: 1000;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 480px;
  max-width: calc(100vw - 40px);
  /* Always leave at least ~32px top+bottom visible around the modal, even
     when content would exceed the viewport. If taller, the internal body
     scrolls (backdrop also scrolls as a fallback). */
  margin: auto;
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp .18s ease;
}
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-lg { width: 640px; }
.modal-sm { width: 360px; }

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 16px; font-weight: 700; letter-spacing: -.3px; }
.modal-close {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  background: none; border: none;
  color: var(--text-3); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1;
  transition: background .12s, color .12s;
}
.modal-close:hover { background: var(--bg-overlay); color: var(--text-1); }
.modal-body { display: flex; flex-direction: column; gap: 16px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; flex-shrink: 0; }

.modal-field { display: flex; flex-direction: column; gap: 6px; }
.modal-label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.modal-input {
  background: var(--bg-overlay);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.modal-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.modal-input::placeholder { color: var(--text-3); }
.modal-textarea { min-height: 80px; resize: vertical; }
.modal-select {
  background: var(--bg-overlay);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  cursor: pointer;
  width: 100%;
}
.modal-hint { font-size: 11px; color: var(--text-3); }

.modal-token-reveal {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--green);
  word-break: break-all;
  letter-spacing: .05em;
}

/* ============================================================
   TOAST
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 2000;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  font-size: 13px;
  min-width: 260px;
  max-width: 380px;
  animation: slideInRight .2s ease;
}
@keyframes slideInRight { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }
.toast-icon { flex-shrink: 0; }
.toast-msg { flex: 1; }
.toast-title { font-weight: 600; }
.toast-sub { font-size: 12px; color: var(--text-2); margin-top: 1px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty-icon { margin-bottom: 16px; opacity: .4; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty-desc { font-size: 13px; color: var(--text-3); max-width: 260px; line-height: 1.5; margin-bottom: 20px; }

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.hidden { display: none !important; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copy-btn {
  background: none; border: none;
  color: var(--text-3); cursor: pointer;
  padding: 2px 4px; border-radius: 3px;
  transition: background .1s, color .1s;
}
.copy-btn:hover { background: var(--bg-hover); color: var(--text-1); }

.info-banner {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px; color: var(--text-2);
  margin-bottom: 16px;
}
.info-banner svg { color: var(--accent); flex-shrink: 0; margin-top: 1px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-2);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Topbar menu button — always visible (toggles sidebar) */
.topbar-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
  flex-shrink: 0;
}
.topbar-page-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Desktop sidebar collapse */
body.sidebar-collapsed .sidebar { display: none; }

/* Mobile backdrop — hidden on desktop */
.mobile-backdrop { display: none; }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 260px; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .mobile-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
    z-index: 55;
  }
  .mobile-backdrop.visible { opacity: 1; pointer-events: auto; }
  body.sidebar-open { overflow: hidden; }

  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-right { gap: 2px; }
  #searchBtn, #docsBtn, #supportBtn { display: none; }
  .topbar-divider { display: none; }

  .content { padding: 16px; }
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
  }
  .page-actions { flex-wrap: wrap; }

  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex-shrink: 0; padding: 10px 12px; }
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 14px 14px; }
  .stat-value { font-size: 22px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page-title { font-size: 18px; }
  .content { padding: 12px; }
  .card { padding: 14px; }
  .card.table-card .card-header { padding: 12px 14px; }
  .card.table-card .table th:first-child,
  .card.table-card .table td:first-child { padding-left: 14px; }
  .card.table-card .table th:last-child,
  .card.table-card .table td:last-child { padding-right: 14px; }
  .modal { width: calc(100vw - 24px); max-width: calc(100vw - 24px); }
  .modal-lg { width: calc(100vw - 24px); max-width: calc(100vw - 24px); }
  .btn { padding: 6px 10px; }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   WEBHOOK
   ============================================================ */
.webhook-events { display: flex; flex-wrap: wrap; gap: 5px; }
.event-chip {
  padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-family: var(--font-mono);
  background: var(--bg-overlay); color: var(--text-2);
  border: 1px solid var(--border);
}

/* ============================================================
   SCROLLABLE TABLES
   ============================================================ */
.card.table-card { padding: 0; overflow: hidden; }
.card.table-card .card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); margin-bottom: 0; }
.card.table-card .table th:first-child,
.card.table-card .table td:first-child { padding-left: 20px; }
.card.table-card .table th:last-child,
.card.table-card .table td:last-child { padding-right: 20px; }

/* ============================================================
   CUSTOM CHECKBOX
   ============================================================ */
.checkbox-wrap {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 13px;
}
.checkbox-wrap input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; }

/* ============================================================
   SKELETON LOADER
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-overlay) 25%, var(--bg-hover) 50%, var(--bg-overlay) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ============================================================
   BREADCRUMB TRAIL
   ============================================================ */
.breadcrumb-trail {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-3);
  margin-bottom: 20px;
}
.breadcrumb-trail a { color: var(--text-2); cursor: pointer; }
.breadcrumb-trail a:hover { color: var(--text-1); }
.breadcrumb-trail span { color: var(--text-3); }
.breadcrumb-trail .current { color: var(--text-1); }

/* ============================================================
   BOOT LOADER  (see loader.ts)
   ============================================================ */
.loader-backdrop {
  position: fixed; inset: 0;
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(4px);
  animation: fadeIn .15s ease;
  transition: opacity .25s ease;
}
.loader-backdrop.loader-hide { opacity: 0; pointer-events: none; }

.loader-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px;
  width: 300px; max-width: calc(100vw - 48px);
  padding: 32px 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.loader-caption {
  font-size: 12px; font-weight: 700;
  letter-spacing: .18em;
  color: var(--text-2);
}
.loader-bar-track {
  width: 100%; height: 6px;
  background: var(--bg-overlay);
  border-radius: 999px;
  overflow: hidden;
}
.loader-bar-fill {
  height: 100%; width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .25s ease;
}
.loader-percent {
  font-size: 13px; font-weight: 600;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}
