/* ==========================================================================
   Microbe Studio — Portal Design System
   Modern light SaaS theme (inspired by Notion / Linear / Stripe / Vercel)
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  /* Surfaces — light, airy canvas */
  --bg: #f5f7fb;
  --bg-elevated: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e8edf3;
  --overlay: rgba(255, 255, 255, 0.78);
  --scrim: rgba(15, 23, 42, 0.45);

  /* Borders / hairlines */
  --border: #e5e7eb;
  --border-strong: #d6dbe2;
  --border-focus: rgba(99, 102, 241, 0.55);

  /* Text */
  --text: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;

  /* Brand — Indigo */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-active: #4338ca;
  --primary-soft: rgba(99, 102, 241, 0.1);
  --primary-soft-border: rgba(99, 102, 241, 0.28);
  --on-primary: #ffffff;

  /* Semantic */
  --success: #16a34a;
  --success-soft: rgba(16, 185, 129, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --info: #3b82f6;
  --info-soft: rgba(59, 130, 246, 0.12);

  /* Accent tints for stat cards */
  --c-indigo: #6366f1;
  --c-violet: #8b5cf6;
  --c-emerald: #10b981;
  --c-amber: #f59e0b;
  --c-sky: #0ea5e9;
  --c-rose: #ec4899;
  --c-cyan: #06b6d4;

  /* Radius */
  --r-sm: 7px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* Shadows — soft, neutral (light theme) */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 4px 14px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 16px 44px rgba(16, 24, 40, 0.16);
  --shadow-glow: 0 0 0 1px var(--primary-soft-border), 0 10px 30px rgba(99, 102, 241, 0.16);

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --fast: 0.12s var(--ease);
  --med: 0.2s var(--ease);

  /* Layout */
  --sidebar-w: 256px;
  --topbar-h: 60px;

  font-size: 15px;
  color-scheme: light;
}

/* ---------- Reset & base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

/* The `hidden` attribute must always win: a class that sets `display` (e.g. `.badge`
   is `inline-flex`) otherwise overrides the UA `[hidden] { display: none }`, leaving a
   "hidden" element visible (e.g. the Store "+N" capability overflow chips). */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv02", "cv03", "cv04", "ss01";
}

a { color: var(--primary); text-decoration: none; transition: color var(--fast); }
a:hover { color: var(--primary-hover); }

h1, h2, h3, h4 { line-height: 1.2; font-weight: 650; letter-spacing: -0.02em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }

svg { flex-shrink: 0; }
.icon { width: 18px; height: 18px; stroke-width: 2; vertical-align: middle; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

::selection { background: rgba(99, 102, 241, 0.18); color: var(--text); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--r-pill); border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.muted { color: var(--text-muted); }
.mono { font-family: "JetBrains Mono", "Cascadia Code", Consolas, monospace; font-size: 0.82em; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 0.95rem;
  border-radius: var(--r);
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--on-primary);
  font: inherit;
  font-weight: 560;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--fast), border-color var(--fast), transform var(--fast), box-shadow var(--fast), opacity var(--fast);
  user-select: none;
}
.btn:hover { background: var(--primary-hover); color: #fff; }
.btn:active { transform: translateY(0.5px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.btn .icon { width: 16px; height: 16px; }

.btn.secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn.ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.outline { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn.outline:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #dc2626; color: #fff; }
.btn.success { background: var(--success); }
.btn.success:hover { background: #15803d; color: #fff; }
.btn.subtle-danger { background: var(--danger-soft); color: #b91c1c; }
.btn.subtle-danger:hover { background: rgba(239, 68, 68, 0.16); color: #b91c1c; }
.btn.subtle-success { background: var(--success-soft); color: #047857; }
.btn.subtle-success:hover { background: rgba(16, 185, 129, 0.18); color: #047857; }

.btn.sm { padding: 0.38rem 0.7rem; font-size: 0.82rem; border-radius: var(--r-sm); }
.btn.sm .icon { width: 14px; height: 14px; }
.btn.lg { padding: 0.72rem 1.3rem; font-size: 0.98rem; }
.btn.block { width: 100%; }
.btn.icon-only { padding: 0.45rem; }
.btn.icon-only.sm { padding: 0.35rem; }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn[aria-busy="true"] { color: transparent !important; position: relative; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 15px; height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.6s linear infinite;
}

/* ---------- Forms ---------- */
label { display: block; font-size: 0.82rem; font-weight: 520; color: var(--text-secondary); margin-bottom: 0.4rem; }
.field { margin-bottom: 1.1rem; }
.field-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.35rem; }

input, select, textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: var(--r);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  background: var(--surface);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2.2rem;
}
input[type="checkbox"] { width: auto; accent-color: var(--primary); width: 16px; height: 16px; }

.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.input-icon input { padding-left: 2.3rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.program-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.2rem; align-items: start; }
.price-input { width: 120px; text-align: right; }
.grant-list { display: flex; flex-direction: column; gap: 0.4rem; max-height: 230px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.7rem; background: var(--bg-elevated); }
.grant-item { display: flex; align-items: center; gap: 0.55rem; font-size: 0.86rem; color: var(--text-secondary); cursor: pointer; }
.grant-item input { width: 16px; }
.grant-list-title { font-size: 0.74rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.86rem; color: var(--text-secondary); cursor: pointer; }
.checkbox-row input { width: 16px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
}
.card.flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.05rem 1.3rem; border-bottom: 1px solid var(--border);
}
.card-head h3 { display: flex; align-items: center; gap: 0.55rem; }
.card-head .icon { color: var(--text-muted); }
.card-title { font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }

.section-label {
  font-size: 0.72rem; font-weight: 650; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-faint); margin-bottom: 0.9rem;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { padding: 0.78rem 1rem; text-align: left; }
thead th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-weight: 580;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
tbody td { border-bottom: 1px solid var(--border); color: var(--text-secondary); vertical-align: middle; }
tbody tr { transition: background var(--fast); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td strong { color: var(--text); font-weight: 600; }
.col-right { text-align: right; }
.cell-amount.pos { color: var(--success); font-weight: 600; }
.cell-amount.neg { color: var(--danger); font-weight: 600; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.55rem; border-radius: var(--r-pill);
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.01em;
  border: 1px solid transparent; line-height: 1.3; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.active, .badge.valid, .badge.published, .badge.fulfilled, .badge.paid, .badge.approved { background: var(--success-soft); color: #047857; }
.badge.locked, .badge.revoked, .badge.expired, .badge.rejected, .badge.cancelled { background: var(--danger-soft); color: #b91c1c; }
.badge.admin { background: var(--primary-soft); color: #4338ca; }
.badge.pending, .badge.suspended, .badge.review, .badge.draft, .badge.refunded, .badge.under_review { background: var(--warning-soft); color: #b45309; }
.badge.need_more_information { background: var(--info-soft); color: #1d4ed8; }
.badge.partner { background: rgba(139, 92, 246, 0.12); color: #6d28d9; }
.badge.customer, .badge.info { background: rgba(14, 165, 233, 0.12); color: #0369a1; }
.badge.archived, .badge.neutral { background: var(--surface-3); color: var(--text-secondary); }
button.badge { cursor: pointer; font-family: inherit; }
button.badge.cap-more:hover { background: var(--surface-4, var(--surface-3)); filter: brightness(0.97); }

/* ---------- Alerts ---------- */
.alert {
  display: flex; align-items: flex-start; gap: 0.65rem;
  padding: 0.8rem 1rem; border-radius: var(--r); margin-bottom: 1rem;
  font-size: 0.88rem; border: 1px solid transparent;
}
.alert .icon { width: 18px; height: 18px; margin-top: 1px; flex-shrink: 0; }
.alert.error { background: var(--danger-soft); border-color: rgba(239, 68, 68, 0.28); color: #b91c1c; }
.alert.success { background: var(--success-soft); border-color: rgba(16, 185, 129, 0.3); color: #047857; }
.alert.info { background: var(--info-soft); border-color: rgba(59, 130, 246, 0.28); color: #1d4ed8; }
.alert.warning { background: var(--warning-soft); border-color: rgba(245, 158, 11, 0.32); color: #b45309; }

/* ---------- Stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.2rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--med), transform var(--med), box-shadow var(--med);
}
/* Only clickable (link) KPI cards lift on hover — an honest affordance that
   signals which cards drill down to their section. */
a.stat { text-decoration: none; color: inherit; cursor: pointer; }
a.stat:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
a.stat:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
a.stat::after {
  content: "";
  position: absolute; top: 0.7rem; right: 0.8rem;
  width: 14px; height: 14px;
  background: var(--text-muted);
  opacity: 0; transition: opacity var(--med);
  -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 7h10v10'/%3E%3Cpath d='M7 17 17 7'/%3E%3C/svg%3E");
  mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 7h10v10'/%3E%3Cpath d='M7 17 17 7'/%3E%3C/svg%3E");
}
a.stat:hover::after, a.stat:focus-visible::after { opacity: 0.55; }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.7rem; }
.stat-ico {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 10px; background: var(--primary-soft); color: var(--primary);
}
.stat-ico .icon { width: 19px; height: 19px; }
.stat .value { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.stat .label { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.2rem; }
.stat.i-indigo .stat-ico { background: rgba(99, 91, 255, 0.14); color: var(--c-indigo); }
.stat.i-violet .stat-ico { background: rgba(163, 113, 247, 0.14); color: var(--c-violet); }
.stat.i-emerald .stat-ico { background: rgba(63, 185, 80, 0.14); color: var(--c-emerald); }
.stat.i-amber .stat-ico { background: rgba(210, 153, 34, 0.16); color: var(--c-amber); }
.stat.i-sky .stat-ico { background: rgba(88, 166, 255, 0.14); color: var(--c-sky); }
.stat.i-rose .stat-ico { background: rgba(247, 120, 186, 0.14); color: var(--c-rose); }
.stat.i-cyan .stat-ico { background: rgba(6, 182, 212, 0.14); color: var(--c-cyan); }

/* ---------- Portal shell ---------- */
.portal { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 1rem 0.75rem; display: flex; flex-direction: column;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.6rem 1.1rem; }
.brand-logo { width: 30px; height: 30px; flex-shrink: 0; object-fit: contain; border-radius: 8px; }
.brand-name { font-weight: 680; font-size: 0.98rem; letter-spacing: -0.02em; color: var(--text); }
.brand-name small { display: block; font-size: 0.66rem; font-weight: 500; letter-spacing: 0.04em; color: var(--text-muted); text-transform: uppercase; }

.nav-group { margin-bottom: 0.4rem; }
.nav-group-label { font-size: 0.68rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); padding: 0.6rem 0.65rem 0.3rem; }
.sidebar nav a {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.52rem 0.65rem; border-radius: var(--r);
  color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;
  margin-bottom: 0.1rem; transition: background var(--fast), color var(--fast);
}
.sidebar nav a .icon { width: 17px; height: 17px; color: var(--text-muted); transition: color var(--fast); }
.sidebar nav a:hover { background: var(--surface-2); color: var(--text); }
.sidebar nav a:hover .icon { color: var(--text-secondary); }
.sidebar nav a.active { background: var(--primary-soft); color: var(--primary-active); font-weight: 600; }
.sidebar nav a.active .icon { color: var(--primary); }

.shell-main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0 1.5rem;
  background: var(--overlay); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 1.02rem; font-weight: 620; letter-spacing: -0.02em; }
.topbar-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 0.6rem; }
/* Shared site nav in the portal topbar — mirrors the Website header links (.lp-nav .links). */
.topbar-nav { display: flex; align-items: center; gap: 1.25rem; margin-right: 0.35rem; }
.topbar-nav a { color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; }
.topbar-nav a:hover { color: var(--text); }
.crumbs { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--text-muted); }
.main { padding: 1.75rem 1.5rem; max-width: 1200px; width: 100%; }

.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: var(--r); border: 1px solid transparent; background: transparent;
  color: var(--text-secondary); cursor: pointer; transition: background var(--fast), color var(--fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* User menu */
.usermenu { position: relative; }
.usermenu-trigger {
  display: flex; align-items: center; gap: 0.55rem; padding: 0.3rem 0.5rem 0.3rem 0.35rem;
  border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; transition: border-color var(--fast), background var(--fast);
}
.usermenu-trigger:hover { border-color: var(--border-strong); background: var(--surface-2); }
.avatar {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--c-violet));
  color: #fff; font-size: 0.78rem; font-weight: 650;
}
.usermenu-trigger .uname { font-size: 0.84rem; font-weight: 550; color: var(--text); }
.menu {
  position: absolute; right: 0; top: calc(100% + 0.5rem); min-width: 220px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 0.4rem; z-index: 50;
  display: none; transform-origin: top right; animation: pop 0.14s var(--ease);
}
.menu.open { display: block; }
.menu-head { padding: 0.6rem 0.65rem; border-bottom: 1px solid var(--border); margin-bottom: 0.3rem; }
.menu-head .n { font-weight: 600; font-size: 0.88rem; }
.menu-head .r { font-size: 0.76rem; color: var(--text-muted); }
.menu a, .menu button {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  padding: 0.5rem 0.65rem; border-radius: var(--r-sm); border: none; background: transparent;
  color: var(--text-secondary); font: inherit; font-size: 0.86rem; cursor: pointer; text-align: left;
}
.menu a:hover, .menu button:hover { background: var(--surface-2); color: var(--text); }
.menu .icon { width: 16px; height: 16px; color: var(--text-muted); }
.menu .danger-item:hover { background: var(--danger-soft); color: #b91c1c; }
.menu .danger-item:hover .icon { color: #b91c1c; }

/* Language switcher */
.lang-switcher { display: inline-block; }
.lang-trigger {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.4rem 0.6rem;
  border-radius: var(--r); border: 1px solid var(--border); background: var(--surface);
  color: var(--text-secondary); font: inherit; font-size: 0.84rem; font-weight: 550; cursor: pointer;
  transition: border-color var(--fast), background var(--fast), color var(--fast);
}
.lang-trigger:hover { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.lang-trigger .icon { color: var(--text-muted); }
.lang-short { min-width: 1.4em; }
.lang-menu { min-width: 184px; }
.lang-menu.menu-left { right: auto; left: 0; }
.lang-menu a { justify-content: flex-start; }
.lang-menu a .icon { margin-left: auto; color: var(--primary); }
.lang-menu a.lang-active { color: var(--text); font-weight: 600; }
.lang-flag { font-size: 1rem; line-height: 1; }
.lp-nav .lang-trigger { background: transparent; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.45rem; }
.page-head .sub { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.25rem; }
.page-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

/* ---------- Toolbar (search + filters above tables) ---------- */
.toolbar { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.toolbar .search { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.toolbar .search .icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.toolbar .search input { padding-left: 2.35rem; }
.toolbar .spacer { flex: 1; }

/* ---------- Segmented control ---------- */
.segmented { display: inline-flex; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r); padding: 3px; gap: 2px; }
.segmented button {
  padding: 0.4rem 0.8rem; border-radius: var(--r-sm); border: none; background: transparent;
  color: var(--text-muted); font: inherit; font-size: 0.83rem; font-weight: 550; cursor: pointer; transition: var(--fast);
}
.segmented button.active { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 2.75rem 1.5rem; }
.empty svg.art { width: 116px; height: 116px; margin: 0 auto 1rem; display: block; }
.empty h3 { font-size: 1rem; margin-bottom: 0.35rem; }
.empty p { color: var(--text-muted); font-size: 0.88rem; max-width: 340px; margin: 0 auto 1.1rem; }
td .empty { padding: 2.25rem 1rem; }

/* ---------- Token / code box ---------- */
.token-box {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--bg-elevated); border: 1px solid var(--primary-soft-border); border-radius: var(--r);
  padding: 0.85rem 1rem; margin: 0.85rem 0;
}
.token-box code { flex: 1; font-family: "JetBrains Mono", Consolas, monospace; font-size: 0.82rem; word-break: break-all; color: #4338ca; }

/* ---------- Detail / definition list ---------- */
.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.1rem 1.5rem; }
.dl dt { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 0.25rem; }
.dl dd { font-size: 0.9rem; color: var(--text); }

/* ---------- Disclosure / inline form ---------- */
details.disclosure { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); margin-bottom: 1.25rem; overflow: hidden; box-shadow: var(--shadow-sm); }
details.disclosure > summary {
  display: flex; align-items: center; gap: 0.55rem; cursor: pointer;
  padding: 0.85rem 1.1rem; font-weight: 560; font-size: 0.9rem; color: var(--text);
  list-style: none; user-select: none; transition: background var(--fast);
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary:hover { background: var(--surface-2); }
details.disclosure > summary .chev { margin-left: auto; transition: transform var(--med); color: var(--text-muted); }
details.disclosure[open] > summary .chev { transform: rotate(180deg); }
details.disclosure[open] > summary { border-bottom: 1px solid var(--border); }
.disclosure-body { padding: 1.2rem 1.1rem; }

.inline-edit { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r); padding: 1rem; margin-top: 0.6rem; }
.inline-edit summary { font-size: 0.8rem; color: var(--text-muted); cursor: pointer; }

/* ---------- Row actions ---------- */
.row-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
/* Actions in a right-aligned cell hug the trailing edge automatically. */
.row-actions.end, td.col-right.row-actions, td.col-right .row-actions { justify-content: flex-end; }

/* ---------- Modal (confirm dialog) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 100; padding: 1.5rem;
  animation: fade 0.15s var(--ease);
}
.modal {
  width: 100%; max-width: 420px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); padding: 1.5rem; animation: pop 0.18s var(--ease);
}
.modal-ico { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; margin-bottom: 1rem; }
.modal-ico.lg { width: 60px; height: 60px; }
.modal-ico.warn { background: var(--warning-soft); color: var(--warning); }
.modal-ico.danger { background: var(--danger-soft); color: var(--danger); }
.modal h3 { margin-bottom: 0.4rem; }
.modal p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.3rem; }
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 200; display: flex; flex-direction: column; gap: 0.6rem; max-width: 360px; }
.toast {
  display: flex; align-items: flex-start; gap: 0.65rem;
  background: var(--surface); border: 1px solid var(--border-strong); border-left-width: 3px;
  border-radius: var(--r); padding: 0.8rem 0.95rem; box-shadow: var(--shadow-lg);
  font-size: 0.87rem; animation: toastin 0.25s var(--ease);
}
.toast.out { animation: toastout 0.2s var(--ease) forwards; }
.toast .icon { width: 18px; height: 18px; margin-top: 1px; }
.toast.success { border-left-color: var(--success); }
.toast.success .icon { color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.error .icon { color: var(--danger); }
.toast.info { border-left-color: var(--info); }
.toast.info .icon { color: var(--info); }
.toast-msg { flex: 1; color: var(--text); }

/* ---------- HTMX loading ---------- */
#progress {
  position: fixed; top: 0; left: 0; height: 2.5px; width: 0;
  background: linear-gradient(90deg, var(--primary), var(--c-violet)); z-index: 300;
  opacity: 0; transition: width 0.2s var(--ease), opacity 0.3s;
  box-shadow: 0 0 8px var(--primary);
}
#progress.active { opacity: 1; }
.htmx-indicator { opacity: 0; transition: opacity var(--med); }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-swapping { opacity: 0.4; transition: opacity 0.1s; }
.htmx-settling { animation: settle 0.2s var(--ease); }

/* skeleton */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--r-sm); }

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(6px); } }
@keyframes toastin { from { opacity: 0; transform: translateX(20px); } }
@keyframes toastout { to { opacity: 0; transform: translateX(20px); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes settle { from { opacity: 0.4; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ---------- Auth (split layout) ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-aside {
  position: relative; overflow: hidden; padding: 3rem;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(900px 500px at 10% 0%, rgba(99, 102, 241, 0.12), transparent 60%),
    radial-gradient(700px 500px at 90% 100%, rgba(139, 92, 246, 0.1), transparent 55%),
    var(--surface);
  border-right: 1px solid var(--border);
}
.auth-aside::before {
  content: ""; position: absolute; inset: 0; opacity: 0.4;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 38px 38px; -webkit-mask-image: radial-gradient(circle at 30% 30%, #000, transparent 70%); mask-image: radial-gradient(circle at 30% 30%, #000, transparent 70%);
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-hero h2 { font-size: 2rem; line-height: 1.15; margin-bottom: 0.9rem; max-width: 17ch; }
.auth-hero p { color: var(--text-secondary); font-size: 1.02rem; max-width: 42ch; }
.auth-points { display: flex; flex-direction: column; gap: 0.85rem; margin-top: 2rem; }
.auth-point { display: flex; align-items: center; gap: 0.7rem; color: var(--text-secondary); font-size: 0.92rem; }
.auth-point .tick { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--success-soft); color: var(--success); }
.auth-point .tick .icon { width: 14px; height: 14px; }
.auth-main { display: grid; place-items: center; padding: 2rem 1.5rem; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .brand { padding: 0; margin-bottom: 1.75rem; }
.auth-aside .brand { padding: 0; }
.auth-lang { display: flex; justify-content: flex-end; margin-bottom: 0.5rem; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 0.3rem; }
.auth-card .lead { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 1.6rem; }
.auth-foot { margin-top: 1.5rem; text-align: center; font-size: 0.86rem; color: var(--text-muted); }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-aside { display: none; } }

/* ---------- Landing ---------- */
.lp-nav { position: sticky; top: 0; z-index: 30; background: var(--overlay); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
/* Brand mark sits flush inside the marketing nav/footer (no portal padding). */
.lp-nav .brand, .lp-foot .brand { padding: 0; }
.lp-section.top-tight { padding-top: 4rem; }
.lp-nav .container { display: flex; justify-content: space-between; align-items: center; padding: 0.85rem 1.5rem; }
.lp-nav .links { display: flex; align-items: center; gap: 1.5rem; }
.lp-nav .links a { color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; }
.lp-nav .links a:hover { color: var(--text); }
.lp-hero { position: relative; overflow: hidden; padding: 5.5rem 0 4rem; }
.lp-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(800px 420px at 75% 10%, rgba(99, 102, 241, 0.12), transparent 60%),
    radial-gradient(600px 400px at 10% 90%, rgba(139, 92, 246, 0.09), transparent 55%);
}
.lp-hero .container { display: grid; grid-template-columns: 1.05fr 1fr; gap: 3rem; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.35rem 0.8rem; border-radius: var(--r-pill); background: var(--primary-soft); border: 1px solid var(--primary-soft-border); color: #4338ca; font-size: 0.8rem; font-weight: 550; margin-bottom: 1.4rem; }
.lp-hero h1 { font-size: 3rem; line-height: 1.05; letter-spacing: -0.035em; margin-bottom: 1.2rem; }
.lp-hero h1 .grad { background: linear-gradient(120deg, #6366f1, #8b5cf6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lp-hero .sub { font-size: 1.15rem; color: var(--text-secondary); max-width: 46ch; margin-bottom: 2rem; }
.lp-cta { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.trust { display: flex; gap: 1.5rem; margin-top: 2.2rem; flex-wrap: wrap; }
.trust div { display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); font-size: 0.86rem; }
.trust .icon { width: 16px; height: 16px; color: var(--success); }
.lp-section { padding: 4.5rem 0; border-top: 1px solid var(--border); }
.lp-section.alt { background: var(--bg-elevated); }
.lp-head { text-align: center; max-width: 600px; margin: 0 auto 2.75rem; }
.lp-head h1, .lp-head h2 { font-size: 2rem; margin-bottom: 0.7rem; }
.lp-head p { color: var(--text-muted); font-size: 1.02rem; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.feature-card { padding: 1.6rem; transition: border-color var(--med), transform var(--med); }
.feature-card:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.feature-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); margin-bottom: 1.1rem; }
.feature-ico .icon { width: 22px; height: 22px; }
.feature-card h3 { margin-bottom: 0.5rem; }
.feature-card p { color: var(--text-muted); font-size: 0.92rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.1rem; }
.gallery img { width: 100%; border-radius: var(--r-lg); border: 1px solid var(--border); }
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.25rem; max-width: 1080px; margin: 0 auto; }
.price-card { display: flex; flex-direction: column; padding: 1.6rem; transition: border-color var(--med), transform var(--med); }
.price-card:hover { border-color: var(--primary-soft-border); transform: translateY(-3px); }
.price-card.featured { border-color: var(--primary-soft-border); box-shadow: var(--shadow-glow); }
.price-card .ribbon { align-self: flex-start; margin-bottom: 0.9rem; }
.price-card .amount { display: flex; align-items: baseline; gap: 0.4rem; margin: 0.4rem 0 0.2rem; }
.price-card .amount .num { font-size: 2.3rem; font-weight: 750; letter-spacing: -0.03em; }
.price-card .amount .unit { color: var(--text-muted); font-size: 0.86rem; }
.price-card .desc { color: var(--text-muted); font-size: 0.9rem; margin: 0.8rem 0 1.1rem; flex: 1; }
.price-feats { display: flex; flex-direction: column; gap: 0.55rem; margin-bottom: 1.3rem; }
.price-feats div { display: flex; align-items: center; gap: 0.55rem; font-size: 0.88rem; color: var(--text-secondary); }
.price-feats .icon { width: 16px; height: 16px; color: var(--success); }
.faq-list { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 0.7rem; }
.faq-item { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.faq-item summary { display: flex; align-items: center; gap: 0.7rem; cursor: pointer; padding: 1.1rem 1.3rem; font-weight: 560; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .chev { margin-left: auto; color: var(--text-muted); transition: transform var(--med); }
.faq-item[open] summary .chev { transform: rotate(180deg); }
.faq-item .ans { padding: 0 1.3rem 1.2rem; color: var(--text-muted); font-size: 0.93rem; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; max-width: 760px; margin: 0 auto; }
.contact-card { display: flex; align-items: center; gap: 0.9rem; padding: 1.2rem; }
.contact-card .ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: var(--primary-soft); color: var(--primary); }
.contact-card .k { font-size: 0.76rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.contact-card .v { font-weight: 550; }
.video-wrap { position: relative; padding-top: 52%; border-radius: var(--r-xl); overflow: hidden; border: 1px solid var(--border); max-width: 880px; margin: 0 auto; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.lp-foot { padding: 2.5rem 0; border-top: 1px solid var(--border); color: var(--text-muted); }
.lp-foot .container { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* ---------- Unified site footer (Product / Legal / Support columns) ---------- */
.site-foot { padding: 3rem 0 2rem; }
.site-foot .container { display: block; }
.foot-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 2rem; padding-bottom: 2rem; }
.foot-brand .brand { margin-bottom: 0.7rem; }
.foot-tagline { color: var(--text-muted); font-size: 0.9rem; max-width: 32ch; }
.foot-col { display: flex; flex-direction: column; gap: 0.55rem; }
.foot-col h4 { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); font-weight: 600; margin-bottom: 0.25rem; }
.foot-col a { color: var(--text-secondary); font-size: 0.9rem; }
.foot-col a:hover { color: var(--text); }
.foot-bottom { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.foot-legal-links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.foot-legal-links a { color: var(--text-muted); font-size: 0.85rem; }
.foot-legal-links a:hover { color: var(--text); }

/* ---------- Pricing page extras ---------- */
.pricing-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; max-width: 920px; margin: 0 auto; }
.pstep { display: flex; gap: 0.9rem; align-items: flex-start; padding: 1.1rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.pstep-ico { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 11px; background: var(--primary-soft); color: var(--primary); }
.pstep strong { display: block; font-size: 0.94rem; margin-bottom: 0.15rem; }
.pstep p { color: var(--text-muted); font-size: 0.85rem; }
.price-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: auto; padding-top: 1rem; }
.price-amount { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.price-spec { display: flex; flex-direction: column; gap: 0.3rem; margin: 0.8rem 0; }
.price-spec div { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.88rem; }
.price-spec dt { color: var(--text-muted); }
.price-spec dd { color: var(--text-secondary); font-weight: 550; }
.price-caps { margin: 0.6rem 0 0.4rem; }
.price-caps .meta-label { margin-bottom: 0.4rem; }
.pricing-tax { display: flex; align-items: center; gap: 0.5rem; width: fit-content; max-width: 100%; margin: 0 auto; padding: 0.6rem 1rem; border-radius: var(--r); background: var(--info-soft); color: #1d4ed8; font-size: 0.9rem; font-weight: 500; }
.pricing-tax .icon { flex-shrink: 0; }
.lp-cta-band { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.lp-cta-band h2 { margin-bottom: 0.3rem; }

/* ---------- Terms & Policies (legal) ---------- */
.legal-layout { display: grid; grid-template-columns: 220px 1fr; gap: 2.5rem; align-items: start; max-width: 980px; margin: 0 auto; }
.legal-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 0.25rem; }
.legal-nav-title { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); font-weight: 600; margin-bottom: 0.5rem; }
.legal-nav a { padding: 0.5rem 0.8rem; border-radius: var(--r); color: var(--text-secondary); font-size: 0.92rem; }
.legal-nav a:hover { background: var(--surface-2); color: var(--text); }
.legal-nav a.active { background: var(--primary-soft); color: var(--primary-active); font-weight: 550; }
.legal-updated { color: var(--text-muted); font-size: 0.9rem; }
.legal-doc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 2.2rem 2.4rem; }
.legal-doc h2 { font-size: 1.1rem; margin: 1.8rem 0 0.7rem; }
.legal-doc h2:first-child { margin-top: 0; }
.legal-doc p { color: var(--text-secondary); margin-bottom: 0.8rem; font-size: 0.95rem; }
.legal-doc ul { margin: 0 0 0.9rem 1.1rem; display: flex; flex-direction: column; gap: 0.4rem; }
.legal-doc li { color: var(--text-secondary); font-size: 0.95rem; }
.legal-contact { display: flex; gap: 0.9rem; align-items: flex-start; margin-top: 2rem; padding: 1.2rem 1.3rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-lg); }
.legal-contact .ico { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 11px; background: var(--primary-soft); color: var(--primary); }
.legal-contact strong { font-size: 0.95rem; }

/* ---------- Product screenshots (real desktop app) ---------- */
.app-shot { display: block; }
.app-shot img { width: 100%; height: auto; aspect-ratio: 1472 / 832; border-radius: var(--r-lg); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); background: var(--surface-2); }

/* Hero shot — modern SaaS treatment: soft glow, layered float shadow, glass chips */
.hero-shot { position: relative; }
.hero-shot::before {
  content: ""; position: absolute; inset: -10% -8% -14%; z-index: -1; border-radius: 50%;
  background: radial-gradient(58% 58% at 52% 42%, rgba(99, 102, 241, 0.22), rgba(139, 92, 246, 0.10) 55%, transparent 72%);
  filter: blur(26px);
}
.hero-shot .app-shot img {
  border-color: var(--border);
  box-shadow: 0 28px 60px -24px rgba(16, 24, 40, 0.38), 0 10px 26px -12px rgba(16, 24, 40, 0.16);
}
.hero-chip {
  position: absolute; display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.75rem; border-radius: var(--r-pill); font-size: 0.78rem; font-weight: 600;
  color: var(--text); background: var(--overlay); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.hero-chip .icon { width: 15px; height: 15px; color: var(--primary); }
.chip-tl { top: 9%; left: -6%; }
.chip-br { bottom: 12%; right: -5%; }

/* ---------- Platform facts (Windows desktop positioning) ---------- */
.platform-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; max-width: 920px; margin: 0 auto; }
.pfact { display: flex; gap: 0.8rem; align-items: flex-start; padding: 1.1rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.pfact-ico { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 11px; background: var(--primary-soft); color: var(--primary); }
.pfact strong { display: block; font-size: 0.95rem; }
.pfact span { color: var(--text-muted); font-size: 0.86rem; }

/* ---------- Feature spotlights (image + copy, alternating) ---------- */
.feature-spot { display: grid; grid-template-columns: 1fr 1.1fr; gap: 3rem; align-items: center; margin-top: 3.5rem; }
.feature-spot:first-of-type { margin-top: 0; }
.feature-spot.reverse .fs-copy { order: 2; }
.fs-eyebrow { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--primary); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.7rem; }
.fs-copy h3 { font-size: 1.55rem; letter-spacing: -0.02em; margin-bottom: 0.7rem; }
.fs-copy > p { color: var(--text-secondary); margin-bottom: 1.1rem; }
.fs-list { display: flex; flex-direction: column; gap: 0.5rem; }
.fs-list li { display: flex; align-items: center; gap: 0.55rem; color: var(--text-secondary); font-size: 0.92rem; }
.fs-list .icon { width: 16px; height: 16px; color: var(--success); flex-shrink: 0; }

/* ---------- Licensing flow (USD -> Token -> License) ---------- */
.lic-flow { display: flex; align-items: stretch; justify-content: center; gap: 0.6rem; flex-wrap: wrap; }
.lic-step { flex: 1; min-width: 200px; max-width: 280px; text-align: center; padding: 1.4rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.lic-ico { display: grid; place-items: center; width: 46px; height: 46px; margin: 0 auto 0.8rem; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.lic-step strong { display: block; margin-bottom: 0.3rem; }
.lic-step p { color: var(--text-muted); font-size: 0.86rem; }
.lic-arrow { display: grid; place-items: center; color: var(--text-faint); }
.lic-arrow .icon { width: 22px; height: 22px; }

@media (max-width: 860px) {
  .lp-hero .container { grid-template-columns: 1fr; }
  .lp-hero-art { margin-top: 0.5rem; }
  .lp-hero h1 { font-size: 2.3rem; }
  .lp-nav .links a:not(.btn) { display: none; }
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
  .pricing-steps { grid-template-columns: 1fr; }
  .lp-cta-band { flex-direction: column; align-items: flex-start; }
  .legal-layout { grid-template-columns: 1fr; gap: 1.5rem; }
  .legal-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .legal-doc { padding: 1.6rem 1.4rem; }
  .platform-facts { grid-template-columns: 1fr; }
  .feature-spot { grid-template-columns: 1fr; gap: 1.5rem; margin-top: 2.5rem; }
  .feature-spot.reverse .fs-copy { order: 0; }
  .lic-arrow { transform: rotate(90deg); }
  .hero-chip { display: none; }
}

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

/* ---------- Mobile ---------- */
.menu-toggle { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 900px) {
  .portal { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60; width: 264px;
    transform: translateX(-100%); transition: transform var(--med); box-shadow: var(--shadow-lg);
  }
  .portal.nav-open .sidebar { transform: translateX(0); }
  .portal.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 55; }
  .menu-toggle { display: grid; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .main { padding: 1.25rem 1rem; }
  .topbar { padding: 0 1rem; }
  /* Keep the cramped mobile topbar to title + controls (mirrors the Website hiding its
     header links on small screens); the sidebar nav remains via the menu toggle. */
  .topbar-nav { display: none; }
}

@media (max-width: 560px) {
  .usermenu-trigger .uname { display: none; }
  .page-head { flex-direction: column; }
}

/* Numbered step badge for sequenced forms (e.g. onboard: create → subscribe). */
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  flex: 0 0 auto;
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-soft-border);
  font-size: 0.8rem;
  font-weight: 700;
}

/* Inline hint shown in place of a form/section when a prerequisite is missing. */
.empty-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 0;
  font-size: 0.9rem;
}

/* ==========================================================================
   Shared utilities & component refinements
   The canon below replaces the ad-hoc inline styles that had drifted across
   templates, so every screen composes from the same primitives.
   ========================================================================== */

/* ---------- Linked cards (drill-down affordance) ---------- */
/* A card that is itself a link gets an honest hover-lift, matching a.stat. */
a.card {
  color: inherit;
  text-decoration: none;
  transition: border-color var(--med), transform var(--med), box-shadow var(--med);
}
a.card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
a.card:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

/* ---------- Metrics (KPI numbers outside stat cards) ---------- */
.metric { display: block; font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; color: var(--text); }
.metric-sm { display: block; font-size: 1.2rem; font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; color: var(--text); }

/* ---------- Text scale helpers ---------- */
.text-xs { font-size: 0.74rem; }
.text-sm { font-size: 0.82rem; }
.text-md { font-size: 0.9rem; }
.text-lg { font-size: 1.1rem; }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.prewrap { white-space: pre-wrap; }
.break-all { word-break: break-all; }
.mb-0 { margin-bottom: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
/* Standalone small uppercase label (key/value blocks outside a .dl). */
.meta-label { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 0.35rem; }

/* Secondary sub-line under a primary cell value (e.g. email under a username). */
.cell-sub { display: block; margin-top: 0.15rem; font-size: 0.74rem; color: var(--text-muted); }

/* ---------- Spacing helpers (explicit rhythm used by the templates) ---------- */
.mt-1 { margin-top: 0.4rem; }
.mt-2 { margin-top: 0.6rem; }
.mt-3 { margin-top: 0.8rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.2rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.4rem; }
.mb-2 { margin-bottom: 0.6rem; }
.mb-3 { margin-bottom: 0.8rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.2rem; }
.mb-6 { margin-bottom: 1.5rem; }

/* ---------- Layout helpers ---------- */
/* Horizontal cluster that wraps (chips, button groups, meta rows). */
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.cluster.gap-sm { gap: 0.3rem; }
/* Vertical stack with consistent gap. */
.stack { display: flex; flex-direction: column; gap: 0.6rem; }
/* Split row: content pushed to both ends, vertically centred. */
.between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.cluster.center { justify-content: center; }
.ml-auto { margin-left: auto; }
.pt-xl { padding-top: 3.5rem; }
.fullscreen-center { min-height: 100vh; display: grid; place-items: center; }
.brand.centered { justify-content: center; }
.error-code { font-size: 2.5rem; font-weight: 700; letter-spacing: -0.04em; }

/* Compact inline form (table-cell grant/adjust, card price edit). */
.form-inline { display: flex; align-items: flex-end; gap: 0.4rem; flex-wrap: wrap; }
.form-inline .field { margin-bottom: 0; }
.input-narrow { max-width: 130px; }
.input-xnarrow { max-width: 90px; }

/* Constrained single-column blocks (forms, summary cards). */
.narrow { max-width: 620px; }
.narrow-sm { max-width: 440px; }

/* Column width hints for table headers carrying inline form controls. */
.w-25 { width: 25%; }
.w-35 { width: 35%; }

/* Row-action forms join the flex row instead of stacking, so multiple
   single-button forms line up like buttons. */
.row-actions form { display: contents; }

/* ---------- Empty state (shared illustration chip) ---------- */
.empty-ico {
  display: grid; place-items: center;
  width: 54px; height: 54px; margin: 0 auto 1rem;
  border-radius: 16px; background: var(--surface-2); color: var(--text-faint);
}
.empty-ico .icon { width: 26px; height: 26px; }

/* Gallery figures (landing) share the card border + tidy caption. */
.gallery figure { margin: 0; }
.gallery figcaption { text-align: center; font-size: 0.85rem; color: var(--text-muted); margin-top: 0.5rem; }

/* ==========================================================================
   List-view chrome — Search / Filter / Sort / Pagination (see _table.html)
   ========================================================================== */

/* Toolbar form lays its controls out on one wrapping row. */
form.toolbar { width: 100%; }
.toolbar .filter-select { width: auto; min-width: 130px; flex: 0 0 auto; }
.toolbar .search input { height: 100%; }
.toolbar .btn { flex: 0 0 auto; }
@media (max-width: 560px) {
  .toolbar .spacer { display: none; }
  .toolbar .search { max-width: none; flex: 1 1 100%; }
  .toolbar .filter-select { flex: 1 1 auto; }
}

/* Sortable header: the whole cell is a link with a trailing sort indicator. */
th.sortable { padding: 0; }
th.sortable .th-sort {
  display: inline-flex; align-items: center; gap: 0.35rem; width: 100%;
  padding: 0.78rem 1rem; color: inherit; font: inherit; letter-spacing: inherit;
  text-transform: inherit; transition: color var(--fast), background var(--fast);
}
th.sortable .th-sort:hover { color: var(--text); background: var(--surface-2); }
th.sortable.col-right .th-sort { justify-content: flex-end; }
th.sortable.is-sorted .th-sort { color: var(--text); }
.sort-ind { width: 14px; height: 14px; opacity: 0.85; }
.sort-ind.faint { opacity: 0; transition: opacity var(--fast); }
th.sortable:hover .sort-ind.faint { opacity: 0.4; }

/* Pager: result count on the left, numbered nav on the right. */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-top: 1rem;
}
.pager-info { font-size: 0.82rem; color: var(--text-muted); }
.pager-nav { display: flex; align-items: center; gap: 0.3rem; }
.pager-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 0.55rem;
  border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-secondary);
  font-size: 0.84rem; font-weight: 550; transition: var(--fast); cursor: pointer;
}
.pager-btn:hover { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.pager-btn.current { background: var(--primary); border-color: var(--primary); color: #fff; cursor: default; }
.pager-btn.disabled { opacity: 0.4; pointer-events: none; }
.pager-btn .icon { width: 15px; height: 15px; }
.pager-gap { color: var(--text-faint); padding: 0 0.15rem; }

/* Inline table-row editor (e.g. Accounts → Edit reveals this row). */
tr.edit-row > td { padding: 0; background: var(--bg-elevated); }
tr.edit-row:hover > td { background: var(--bg-elevated); }
.row-editor { padding: 1.15rem 1rem; border-top: 2px solid var(--primary-soft-border); }
.row-editor .grid-3 { margin-bottom: 0.5rem; }
.row-editor .field { margin-bottom: 0; }

/* ==========================================================================
   Token Center — secondary nav, Funding-package grid, upload dropzone
   ========================================================================== */

/* Secondary (sub-section) navigation: a tab-strip of links under the page head.
   Keeps the sidebar to one "Wallet" entry while the four wallet views each get a
   real page. State lives in the URL (plain links), so it works without JS. */
.subnav {
  display: flex; gap: 0.15rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); margin-bottom: 1.5rem;
}
.subnav a {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.6rem 0.9rem; margin-bottom: -1px;
  color: var(--text-secondary); font-size: 0.88rem; font-weight: 550;
  border-bottom: 2px solid transparent; border-radius: var(--r-sm) var(--r-sm) 0 0;
  transition: color var(--fast), background var(--fast), border-color var(--fast);
}
.subnav a:hover { color: var(--text); background: var(--surface-2); }
.subnav a.active { color: var(--primary-active); border-bottom-color: var(--primary); }
.subnav a .icon { width: 16px; height: 16px; }

/* Funding-package chooser (Buy Token): responsive card grid, no hardcoded count. */
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.1rem; align-items: stretch; }
.pack-card { display: flex; flex-direction: column; gap: 0.5rem; padding: 1.4rem; }
.pack-card .pack-tokens { display: flex; align-items: baseline; gap: 0.4rem; }
.pack-card .pack-tokens .num { font-size: 1.9rem; font-weight: 750; letter-spacing: -0.03em; }
.pack-card .pack-tokens .unit { color: var(--text-muted); font-size: 0.85rem; }
.pack-card .pack-price { font-size: 1.05rem; font-weight: 650; color: var(--text); }
.pack-card .pack-desc { color: var(--text-muted); font-size: 0.88rem; flex: 1; }
.pack-card .btn { margin-top: 0.4rem; }

/* Drag-&-drop image upload (payment proof / QR). Progressive enhancement: the
   hidden <input type=file> still works if JS is off; JS adds drop + preview. */
.dropzone {
  position: relative; display: block; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
  background: var(--bg-elevated); padding: 1.6rem 1.25rem;
  transition: border-color var(--fast), background var(--fast);
}
.dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone.dragover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone .dz-ico { display: grid; place-items: center; width: 46px; height: 46px; margin: 0 auto 0.6rem; border-radius: 12px; background: var(--surface-2); color: var(--text-muted); }
.dropzone .dz-ico .icon { width: 22px; height: 22px; }
.dropzone .dz-title { font-weight: 560; font-size: 0.9rem; }
.dropzone .dz-hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.2rem; }
.dz-preview { display: none; margin-top: 0.9rem; }
.dz-preview.show { display: block; }
.dz-preview img { max-height: 220px; max-width: 100%; border-radius: var(--r); border: 1px solid var(--border); }
.dz-preview .dz-file { display: flex; align-items: center; justify-content: center; gap: 0.6rem; margin-top: 0.5rem; font-size: 0.84rem; color: var(--text-secondary); }
.dz-preview .dz-remove { color: var(--danger); cursor: pointer; background: none; border: none; font: inherit; display: inline-flex; align-items: center; gap: 0.25rem; }

/* Proof thumbnail (admin detail) — a framed link to the presigned image. */
.proof-thumb { display: inline-block; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; max-width: 320px; }
.proof-thumb img { display: block; max-width: 100%; height: auto; }
