/* ================================================================
   Macro Quantic Pro — Design System
   ================================================================ */

/* ── Tokens ───────────────────────────────────────────────────── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/inter-latin-400-800.260c81a4759b.woff2") format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-400-500.b636a65da4f0.woff2") format('woff2');
}

:root {
  color-scheme: dark;
  --red:          #e74c3c;
  --red-deep:     #c0392b;
  --red-soft:     #ff6b6b;
  --red-alpha:    rgba(231,76,60,0.14);
  --red-glow:     rgba(231,76,60,0.28);

  --bg:           #0b0b0c;
  --bg-raised:    #111113;
  --surface:      #17171a;
  --panel:        #1e1e22;
  --card:         #232328;
  --card-high:    #2a2a30;

  --line:         rgba(255,255,255,0.07);
  --line-med:     rgba(255,255,255,0.12);

  --text:         #f0f0f2;
  --text-muted:   #8c8c9a;
  --text-dim:     #5c5c6a;

  --ok:           #2ecc71;
  --ok-alpha:     rgba(46,204,113,0.12);
  --warn:         #f39c12;
  --warn-alpha:   rgba(243,156,18,0.12);
  --danger:       #e74c3c;
  --danger-alpha: rgba(231,76,60,0.12);
  --info:         #3b82f6;
  --info-alpha:   rgba(59,130,246,0.12);

  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  --r-sm:   8px;
  --r-md:   14px;
  --r-lg:   20px;
  --r-xl:   28px;
  --r-pill: 999px;

  --shadow-sm:  0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:  0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg:  0 20px 60px rgba(0,0,0,0.5);
  --shadow-red: 0 8px 32px rgba(231,76,60,0.25);

  --gap-xs: 6px;
  --gap-sm: 12px;
  --gap-md: 20px;
  --gap-lg: 32px;
  --gap-xl: 56px;

  --max-w:  1160px;
  --nav-h:  62px;
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 40% at 50% -10%, rgba(231,76,60,0.1), transparent),
    radial-gradient(ellipse 60% 30% at 100% 60%, rgba(231,76,60,0.05), transparent);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }
table { border-collapse: collapse; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--panel); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--card); }

/* ================================================================
   Layout
   ================================================================ */
.site-shell {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gap-md) var(--gap-xl);
}
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gap-md);
}

.deferred-section {
  content-visibility: auto;
  contain-intrinsic-size: 1px 840px;
}

/* ================================================================
   Navigation
   ================================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(11,11,12,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
}
.site-nav {
  max-width: var(--max-w);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--gap-md);
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}
.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex-shrink: 0;
  margin-right: var(--gap-md);
}
.brand-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--red-soft), var(--red-deep));
  box-shadow: var(--shadow-red);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-icon svg { width: 16px; height: 16px; }
.site-nav-links {
  display: flex; align-items: center; gap: 2px; flex: 1;
}
.site-nav-links a {
  padding: 8px 14px;
  border-radius: var(--r-pill);
  font-size: 14px; font-weight: 500;
  color: var(--text-muted);
  transition: color .15s, background .15s;
}
.site-nav-links a:hover,
.site-nav-links a.active { color: var(--text); background: rgba(255,255,255,.05); }
.site-nav-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.site-nav-actions a,
.site-nav-actions button {
  padding: 8px 16px;
  border-radius: var(--r-pill);
  font-size: 14px; font-weight: 500;
  border: none; background: transparent;
  color: var(--text-muted);
  transition: color .15s, background .15s;
}
.site-nav-actions a:hover { color: var(--text); background: rgba(255,255,255,.05); }

.nav-toggle {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  margin-left: auto;
}
.nav-mobile-menu {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: var(--gap-sm) var(--gap-md) var(--gap-md);
  border-bottom: 1px solid var(--line);
  background: rgba(11,11,12,.97);
}
.nav-mobile-menu a {
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: 15px;
  color: var(--text-muted);
}
.nav-mobile-menu a:hover { color: var(--text); background: var(--surface); }
.nav-mobile-menu.open { display: flex; }

/* ================================================================
   Notification Bell
   ================================================================ */
/* Use .site-nav-actions .notif-bell to beat the generic button override */
.site-nav-actions .notif-bell {
  position: relative;
  width: 35px;
  height: 28px;
  padding: 0;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s ease;
  flex-shrink: 0;
}
.site-nav-actions .notif-bell:hover { color: var(--text); background: var(--surface); }

.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  display: block;
  opacity: 0;
  transition: opacity .15s ease;
}
.notif-bell.has-unread .notif-badge { opacity: 1; }

.notif-dropdown {
  position: fixed;
  top: 62px;
  right: 20px;
  width: 320px;
  max-height: min(400px, calc(100vh - 82px));
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--card);
  border: 1px solid var(--line-med);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 10px;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 200;
  scrollbar-width: thin;
  scrollbar-color: #4a4a4a var(--surface);
}
.notif-dropdown.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.notif-dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.notif-dropdown-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.notif-clear-btn {
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color .13s ease;
}
.notif-clear-btn:hover { color: var(--red); }

.notif-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 8px;
}
.notif-filter-select,
.notif-filter-search {
  position: relative;
  display: flex;
  align-items: center;
}

.notif-filter-search {
  grid-column: 1 / -1;
}

.notif-filter-icon,
.notif-filter-caret {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  pointer-events: none;
  transition: color .15s ease;
}

.notif-filter-icon {
  left: 9px;
}

.notif-filter-caret {
  right: 8px;
}

.notif-filter-icon svg,
.notif-filter-caret svg {
  width: 12px;
  height: 12px;
}

.notif-filters input[type="text"],
.notif-filters select {
  width: 100%;
  min-width: 0;
  height: 28px;
  background: var(--surface);
  border: 1px solid var(--line-med);
  color: var(--text);
  border-radius: 4px;
  font-size: 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, color .15s ease;
}

.notif-filters select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 3px 28px 3px 28px;
}

.notif-filters input[type="text"] {
  padding: 3px 8px 3px 30px;
}

.notif-filters input[type="text"]:focus,
.notif-filters select:focus {
  border-color: rgba(231,76,60,.55);
  box-shadow: 0 0 0 3px rgba(231,76,60,.12);
}

.notif-filter-select:focus-within .notif-filter-icon,
.notif-filter-select:focus-within .notif-filter-caret,
.notif-filter-search:focus-within .notif-filter-icon {
  color: var(--red);
}

.notif-list {
  display: block;
}

.notif-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .2s ease;
  position: relative;
  background: var(--card);
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface); }

.notif-item.unread { background: var(--surface); }

.notif-item-info    { border-left-color: var(--info); }
.notif-item-success { border-left-color: var(--ok); }
.notif-item-warning { border-left-color: var(--warn); }
.notif-item-error   { border-left-color: var(--red); }

.notif-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  margin-top: 2px;
  flex-shrink: 0;
  color: var(--text-dim);
}
.notif-icon-info { color: var(--info); }
.notif-icon-success { color: var(--ok); }
.notif-icon-warning { color: var(--warn); }
.notif-icon-error { color: var(--red); }
.notif-icon svg { width: 12px; height: 12px; }

.notif-item-body {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  cursor: pointer;
}

.notif-item-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 2px 0;
  line-height: 1.35;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.notif-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}

.notif-item-ts {
  display: inline-block;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 400;
}

.notif-item-body p,
.notif-message {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.notif-item .notif-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 24px;
  height: 24px;
  min-width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color .2s ease, background .2s ease;
  flex-shrink: 0;
  opacity: .7;
}
.notif-item .notif-dismiss:hover { color: var(--red); background: rgba(231,76,60,.1); opacity: 1; }
.notif-item .notif-dismiss-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
}
.notif-item .notif-dismiss svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  flex-shrink: 0;
}

.notif-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 6px 0 2px;
  padding-top: 4px;
}

.notif-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.notif-empty svg {
  width: 20px;
  height: 20px;
  margin: 0 auto 10px;
  opacity: .5;
}

@media (max-width: 640px) {
  .notif-dropdown {
    top: 68px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: calc(100vh - 84px);
  }

  .notif-filters {
    grid-template-columns: 1fr;
  }

  .notif-filter-search {
    grid-column: auto;
  }
}

/* ================================================================
   Buttons
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 8px;
  position: relative;
  padding: 10px 20px;
  border-radius: var(--r-pill);
  font-size: 14px; font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all .15s;
  cursor: pointer;
  text-decoration: none;
}
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.is-loading:disabled { opacity: .85; }

.btn-loading-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity .15s ease;
}
.btn-loading-spinner {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  box-sizing: border-box;
  border-radius: 999px;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(255,255,255,.18));
}
.btn.is-loading .btn-loading-label { opacity: 0; }
.btn.is-loading .btn-loading-spinner {
  opacity: 1;
  animation: btn-spin .65s linear infinite;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .btn-loading-label,
  .btn-loading-spinner {
    transition: none;
  }

  .btn.is-loading .btn-loading-spinner {
    animation-duration: 1.2s;
  }
}

.btn-primary, button.btn-primary, a.btn-primary {
  background: linear-gradient(135deg, var(--red), var(--red-deep));
  color: #fff; box-shadow: var(--shadow-red);
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 8px 40px rgba(231,76,60,.4); transform: translateY(-1px); }

.btn-secondary, button.btn-secondary {
  background: var(--panel); color: var(--text); border-color: var(--line-med);
}
.btn-secondary:hover { background: var(--card); border-color: rgba(255,255,255,.2); }

.btn-ghost, button.btn-ghost {
  background: transparent; color: var(--text-muted); border-color: var(--line);
}
.btn-ghost:hover { color: var(--text); background: var(--surface); }

.btn-danger, button.btn-danger {
  background: var(--danger-alpha); color: var(--danger); border-color: rgba(231,76,60,.25);
}
.btn-danger:hover { background: rgba(231,76,60,.22); }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 13px 28px; font-size: 16px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--r-md); }
.icon-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
}
.icon-actions-end { justify-content: flex-end; }
.icon-actions form { display: inline-flex; }
.icon-action-btn {
  position: relative;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  flex-shrink: 0;
}
.icon-action-btn.btn-sm { padding: 0; }
.icon-action-btn svg {
  width: 15px;
  height: 15px;
}
.icon-action-btn::after,
.icon-action-btn::before {
  position: absolute;
  left: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;
}
.icon-action-btn::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 9px);
  transform: translate(-50%, 6px);
  background: rgba(8,8,10,.96);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: .35rem .5rem;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  z-index: 10;
}
.icon-action-btn::before {
  content: '';
  bottom: calc(100% + 3px);
  transform: translate(-50%, 6px);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(8,8,10,.96);
  z-index: 9;
}
.icon-action-btn:hover::after,
.icon-action-btn:hover::before,
.icon-action-btn:focus-visible::after,
.icon-action-btn:focus-visible::before {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ================================================================
   Cards
   ================================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: var(--gap-lg);
}
.card-sm { padding: var(--gap-md); border-radius: var(--r-lg); }
.card-glass {
  background: rgba(30,30,34,.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.card-red {
  background: linear-gradient(135deg, rgba(231,76,60,.1), rgba(192,57,43,.06));
  border-color: rgba(231,76,60,.2);
}

/* ================================================================
   Badges & Dots
   ================================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600;
  letter-spacing: .03em; white-space: nowrap;
}
.badge-red     { background: var(--red-alpha);    color: var(--red-soft); border: 1px solid rgba(231,76,60,.25); }
.badge-green   { background: var(--ok-alpha);     color: var(--ok);       border: 1px solid rgba(46,204,113,.25); }
.badge-yellow  { background: var(--warn-alpha);   color: var(--warn);     border: 1px solid rgba(243,156,18,.25); }
.badge-blue    { background: var(--info-alpha);   color: var(--info);     border: 1px solid rgba(59,130,246,.25); }
.badge-neutral { background: rgba(255,255,255,.05); color: var(--text-muted); border: 1px solid var(--line); }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-green  { background: var(--ok);   box-shadow: 0 0 6px var(--ok); }
.dot-red    { background: var(--red);  box-shadow: 0 0 6px var(--red); }
.dot-yellow { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.dot-gray   { background: var(--text-dim); }

/* ================================================================
   Typography
   ================================================================ */
.kicker {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: var(--red-alpha);
  color: var(--red-soft);
  font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid rgba(231,76,60,.2);
}
.kicker-neutral {
  background: rgba(255,255,255,.05);
  color: var(--text-muted);
  border-color: var(--line);
}
.lead { font-size: 1.05rem; color: var(--text-muted); line-height: 1.8; }
.mono { font-family: var(--font-mono); font-size: 13px; }

/* ================================================================
   Forms
   ================================================================ */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--gap-md); }
label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.form-control,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], input[type="url"],
input[type="date"], input[type="time"], input[type="datetime-local"],
textarea, select {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--line-med);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  -webkit-appearance: none; appearance: none;
}
.form-control:focus,
input[type="text"]:focus, input[type="email"]:focus,
input[type="password"]:focus, textarea:focus, select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(231,76,60,.15);
}
textarea { resize: vertical; min-height: 90px; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%238c8c9a' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}
.form-hint  { font-size: 12px; color: var(--text-dim); }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-control.is-error { border-color: var(--danger) !important; }
.form-card {
  max-width: 460px; margin: 0 auto;
  padding: 36px;
  border-radius: var(--r-xl);
  background: var(--card);
  border: 1px solid var(--line);
}
.form-divider {
  display: flex; align-items: center; gap: var(--gap-sm);
  margin: var(--gap-md) 0;
  color: var(--text-dim); font-size: 13px;
}
.form-divider::before, .form-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

/* ================================================================
   Tables
   ================================================================ */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 12px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 13px 16px;
  font-size: 14px; color: var(--text-muted);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr:hover td { background: rgba(255,255,255,.02); }
.table tbody tr:last-child td { border-bottom: none; }
.table td strong, .table td .text-main { color: var(--text); }

/* ================================================================
   Grid / Flex helpers
   ================================================================ */
.grid   { display: grid; gap: var(--gap-md); }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); }

/* ================================================================
   Alerts & Toasts
   ================================================================ */
.messages { display: grid; gap: 8px; margin: var(--gap-md) 0; }
.alert {
  padding: 13px 16px;
  border-radius: var(--r-md);
  font-size: 14px;
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid transparent;
}
.alert-success { background: var(--ok-alpha);     border-color: rgba(46,204,113,.2);  color: var(--ok); }
.alert-error   { background: var(--danger-alpha);  border-color: rgba(231,76,60,.2);   color: var(--red-soft); }
.alert-warning { background: var(--warn-alpha);    border-color: rgba(243,156,18,.2);  color: var(--warn); }
.alert-info    { background: var(--info-alpha);    border-color: rgba(59,130,246,.2);  color: var(--info); }

#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  padding: 13px 18px;
  border-radius: var(--r-lg);
  background: var(--card-high);
  border: 1px solid var(--line-med);
  box-shadow: var(--shadow-lg);
  font-size: 14px; color: var(--text);
  pointer-events: all;
  display: flex; align-items: center; gap: 10px;
  animation: slideUp .25s ease;
  max-width: 340px;
}
.toast-ok   { border-color: rgba(46,204,113,.35); }
.toast-err  { border-color: rgba(231,76,60,.35); }
.toast-warn { border-color: rgba(243,156,18,.35); }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   Footer
   ================================================================ */
.site-footer { margin-top: var(--gap-xl); padding: var(--gap-lg) 0 var(--gap-md); border-top: 1px solid var(--line); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: var(--gap-lg);
  margin-bottom: var(--gap-lg);
}
.footer-brand p {
  margin-top: var(--gap-sm);
  font-size: 13px; color: var(--text-dim);
  line-height: 1.7; max-width: 240px;
}
.footer-col h4 {
  font-size: 12px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: var(--gap-sm);
}
.footer-col ul { display: flex; flex-direction: column; gap: 8px; }
.footer-col ul li a { font-size: 14px; color: var(--text-muted); transition: color .15s; }
.footer-col ul li a:hover { color: var(--text); }
.footer-bottom {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "language copy actions";
  align-items: center;
  gap: 18px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-dim);
}
.footer-bottom-single {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "copy";
}
.footer-copy {
  grid-area: copy;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  justify-self: center;
  gap: 6px;
  min-width: 0;
  max-width: 72ch;
  text-align: center;
}
.footer-copy-legal {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-dim);
}
.footer-bottom-actions {
  grid-area: actions;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  justify-self: end;
  gap: 8px;
  min-width: 0;
}
.footer-meta-label {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.footer-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.payment-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.platform-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12px; color: var(--text-muted);
}
.footer-badges .platform-badge {
  min-height: 32px;
  padding: 0 10px;
  gap: 8px;
  background: transparent;
  border-color: var(--line-med);
  box-shadow: none;
  font-weight: 500;
}
.footer-badges .platform-badge svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-dim);
}
.payment-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}
.payment-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-med);
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}
.payment-mark-visa       { color: #1A1F71; }
.payment-mark-mastercard { color: #EB001B; }
.payment-mark-amex       { color: #007BC1; }
.payment-mark-paypal     { color: #003087; }
.language-switcher {
  grid-area: language;
  display: block;
  justify-self: start;
  width: 184px;
  min-width: 0;
}
.language-switcher-label {
  display: none;
}
.language-switcher-select-wrap {
  position: relative;
  width: 184px;
  max-width: 184px;
  min-height: 40px;
  padding: 0;
  color: var(--text-dim);
  border: 1px solid var(--line-med);
  border-radius: 14px;
  background: transparent;
  box-shadow: none;
  transition: border-color .18s ease, background-color .18s ease;
}
.language-switcher-select-wrap::before {
  display: none;
}
.language-switcher-select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
  transition: none;
}
.language-switcher-select-wrap:hover {
  border-color: rgba(255,255,255,.16);
  background: rgba(255,255,255,.02);
}
.language-switcher-select-wrap:focus-within {
  border-color: rgba(255,255,255,.2);
  background: rgba(255,255,255,.03);
}
.language-switcher-select {
  width: 100%;
  min-height: 40px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 8px 34px 8px 12px;
  border-radius: 14px;
  border: 0;
  background: transparent;
  background-image: none;
  box-shadow: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  cursor: pointer;
  transition: color .18s ease;
}
.language-switcher-select:hover {
  background: transparent;
}
.language-switcher-select:focus {
  outline: none;
}
.language-switcher-select:focus-visible {
  box-shadow: none;
}
.language-switcher-select option {
  color: var(--text);
  background-color: #111113;
}

/* ================================================================
   Hero
   ================================================================ */
.hero { padding: var(--gap-xl) 0 var(--gap-lg); text-align: center; }
.hero .kicker { margin-bottom: var(--gap-md); }
.hero-title {
  font-size: clamp(2.6rem, 5.5vw, 5rem);
  font-weight: 800; letter-spacing: -.045em; line-height: .92;
  max-width: 820px; margin: 0 auto var(--gap-md);
}
.hero-title em {
  font-style: normal;
  background: linear-gradient(135deg, var(--red-soft), var(--red-deep));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-lead {
  font-size: 1.1rem; color: var(--text-muted); line-height: 1.75;
  max-width: 560px; margin: 0 auto var(--gap-lg);
}
.hero-actions {
  display: flex; align-items: center; justify-content: center;
  gap: var(--gap-sm); flex-wrap: wrap;
}
.hero-platforms {
  display: flex; align-items: center; justify-content: center;
  gap: var(--gap-sm); margin-top: var(--gap-lg); flex-wrap: wrap;
}
.hero-platforms span { font-size: 13px; color: var(--text-dim); margin-right: 6px; }

/* ================================================================
   Feature Cards
   ================================================================ */
.feature-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  background: var(--red-alpha);
  border: 1px solid rgba(231,76,60,.2);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--gap-md); flex-shrink: 0;
}
.feature-icon svg { width: 22px; height: 22px; color: var(--red-soft); }
.feature-card .h3 { margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--text-muted); line-height: 1.7; }

/* ================================================================
   Pricing
   ================================================================ */
.price-card {
  padding: var(--gap-lg);
  border-radius: var(--r-xl);
  background: var(--card); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: var(--gap-md);
  transition: border-color .2s, box-shadow .2s;
}
.price-card.featured {
  border-color: rgba(231,76,60,.35);
  box-shadow: 0 0 0 1px rgba(231,76,60,.15), var(--shadow-lg);
}
.price-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--red-alpha); color: var(--red-soft);
  border: 1px solid rgba(231,76,60,.25);
  border-radius: var(--r-pill); padding: 4px 12px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  width: fit-content;
}
.price-amount { font-size: 3rem; font-weight: 800; letter-spacing: -.05em; line-height: 1; }
.price-amount sup { font-size: 1.4rem; font-weight: 600; vertical-align: top; margin-top: 8px; margin-right: 2px; }
.price-note { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.price-features { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.price-feature {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 14px; color: var(--text-muted);
}
.price-feature-check {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--ok-alpha);
  border: 1px solid rgba(46,204,113,.3);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.price-feature-check svg { width: 10px; height: 10px; color: var(--ok); }

/* ================================================================
   Downloads
   ================================================================ */
.download-tabs {
  display: flex; gap: 4px;
  padding: 4px;
  background: var(--surface);
  border-radius: var(--r-lg); border: 1px solid var(--line);
  width: fit-content; margin-bottom: var(--gap-lg);
}
.tab-btn {
  padding: 9px 22px;
  border-radius: var(--r-md);
  font-size: 14px; font-weight: 500;
  color: var(--text-muted);
  background: transparent; border: none; cursor: pointer;
  transition: all .15s;
  display: flex; align-items: center; gap: 8px;
}
.tab-btn.active { background: var(--card-high); color: var(--text); box-shadow: var(--shadow-sm); }
.tab-btn svg { width: 16px; height: 16px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.download-card {
  display: flex; align-items: center; gap: var(--gap-md);
  padding: var(--gap-md);
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: border-color .15s;
}
.download-card:hover { border-color: var(--line-med); }
.download-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.download-icon svg { width: 24px; height: 24px; }
.download-info { flex: 1; min-width: 0; }
.download-name { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.download-meta { font-size: 13px; color: var(--text-muted); }
.download-checksum {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-dim);
  margin-top: 4px; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: color .15s;
}
.download-checksum:hover { color: var(--text-muted); }
.download-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ================================================================
   Portal (Customer)
   ================================================================ */
.portal-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--gap-lg); align-items: start;
}
.portal-sidebar { position: sticky; top: calc(var(--nav-h) + var(--gap-md)); }
.portal-nav {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-xl); overflow: hidden;
}
.portal-nav-header { padding: var(--gap-md); border-bottom: 1px solid var(--line); min-width: 0; }
.portal-nav-profile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: flex-start;
  gap: .75rem;
  min-width: 0;
}
.portal-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--red), var(--red-deep));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: white;
  flex-shrink: 0;
}
.portal-nav-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .12rem;
  max-width: 100%;
  overflow: hidden;
}
.portal-nav-name,
.portal-email,
.portal-company {
  display: block;
  margin: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
}
.portal-nav-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}
.portal-email {
  font-size: 12px;
  line-height: 1.35;
  color: var(--red-soft);
}
.portal-company {
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
}
.portal-nav-links { display: flex; flex-direction: column; padding: 8px; }
.portal-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: 14px; font-weight: 500;
  color: var(--text-muted); transition: all .15s;
  position: relative;
}
.portal-nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.portal-nav-link:hover { color: var(--text); background: var(--surface); }
.portal-nav-link.active { color: var(--text); background: var(--surface); }
.portal-nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 5px; bottom: 5px;
  width: 2px;
  background: var(--red);
  border-radius: 0 2px 2px 0;
}
.portal-content { min-width: 0; }

.portal-dashboard { align-items: start; }
.portal-dashboard-studio {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  overflow: hidden;
  position: relative;
}
.portal-dashboard-studio::before {
  content: '';
  position: absolute;
  inset: 0 0 auto auto;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(231,76,60,.12), transparent 68%);
  pointer-events: none;
}
.portal-dashboard-stage,
.portal-dashboard-notice,
.portal-dashboard-chapter {
  position: relative;
  padding: 1.35rem 1.45rem;
}
.portal-dashboard-notice,
.portal-dashboard-chapter {
  border-top: 1px solid var(--line);
}
.portal-dashboard-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, .9fr);
  gap: 1.2rem;
  align-items: start;
  background:
    linear-gradient(135deg, rgba(231,76,60,.08), transparent 38%),
    linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0));
}
.portal-dashboard-kicker {
  margin: 0 0 .55rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.portal-dashboard-stage h1 {
  font-size: clamp(2rem, 4vw, 3.3rem);
  font-weight: 800;
  letter-spacing: -.06em;
  line-height: .94;
  margin: 0 0 .7rem;
  color: var(--text);
}
.portal-dashboard-lead {
  max-width: 60ch;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-muted);
  margin: 0;
}
.portal-dashboard-identity {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1rem;
}
.portal-dashboard-identity-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 .7rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-dim);
}
.portal-dashboard-stage-panel {
  padding: 1.05rem;
  border-radius: var(--r-lg);
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.portal-dashboard-panel-label {
  margin: 0 0 .55rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.portal-dashboard-stage-panel h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}
.portal-dashboard-stage-panel p {
  margin: .55rem 0 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-muted);
}
.portal-dashboard-stage-actions {
  display: flex;
  gap: .7rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.portal-dashboard-notice {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
}
.portal-dashboard-notice-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  border: 1px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.portal-dashboard-notice-icon svg { width: 16px; height: 16px; }
.portal-dashboard-notice-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: .2rem;
}
.portal-dashboard-notice-message {
  margin: 0;
  color: inherit;
  line-height: 1.55;
}
.portal-dashboard-chapter-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.portal-dashboard-chapter-index {
  margin: 0 0 .28rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--red-soft);
}
.portal-dashboard-chapter-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--text);
}
.portal-dashboard-chapter-copy,
.portal-dashboard-inline-link {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}
.portal-dashboard-inline-link {
  font-weight: 600;
  text-decoration: none;
}
.portal-dashboard-inline-link:hover { color: var(--text); }
.portal-license-ledger,
.portal-orders-track {
  display: grid;
  gap: .7rem;
}
.portal-license-ledger-row,
.portal-order-track-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  display: grid;
  gap: 1rem;
  padding: 1rem 1.05rem;
}
.portal-license-ledger-row {
  grid-template-columns: auto minmax(0, 1.35fr) minmax(140px, .85fr) minmax(170px, .95fr) auto;
  align-items: center;
}
.portal-license-ledger-mark {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--red);
  box-shadow: 0 0 0 6px rgba(231,76,60,.12);
}
.portal-license-ledger-main,
.portal-order-track-main {
  min-width: 0;
}
.portal-license-ledger-top,
.portal-order-track-top {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.portal-license-ledger-row h3,
.portal-order-track-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.portal-license-ledger-main p {
  margin: .24rem 0 0;
  font-size: 12px;
  color: var(--text-muted);
}
.portal-license-ledger-detail {
  display: flex;
  flex-direction: column;
  gap: .18rem;
  min-width: 0;
  font-size: 13px;
  color: var(--text-muted);
}
.portal-license-ledger-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.portal-license-ledger-detail code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}
.portal-license-ledger-tools {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.portal-dashboard-empty {
  padding: 1.25rem;
  border: 1px dashed var(--line-med);
  border-radius: var(--r-lg);
  text-align: center;
  color: var(--text-muted);
  background: rgba(255,255,255,.015);
}
.portal-dashboard-empty p {
  margin: 0;
  line-height: 1.6;
}
.portal-dashboard-empty.compact {
  padding: 1rem .85rem;
}
.portal-dashboard-empty-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--r-lg);
  margin: 0 auto .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.portal-dashboard-empty-icon svg {
  width: 20px;
  height: 20px;
}
.portal-dashboard-empty h3 {
  margin: 0 0 .55rem;
  font-size: 1.05rem;
  color: var(--text);
}
.portal-dashboard-empty p + .btn,
.portal-dashboard-empty h3 + p {
  margin-top: .2rem;
}
.portal-dashboard-empty h3 + p {
  max-width: 42ch;
  margin: .2rem auto 1rem;
}
.portal-order-track-item {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  color: inherit;
  text-decoration: none;
  position: relative;
}
.portal-order-track-item:hover {
  color: inherit;
  border-color: var(--line-med);
  background: rgba(255,255,255,.03);
}
.portal-order-track-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 2px solid var(--red-soft);
}
.portal-order-track-number {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.portal-order-track-title {
  margin-top: .28rem;
}
.portal-order-track-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .15rem;
}
.portal-order-track-amount {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--text);
  white-space: nowrap;
}
.portal-order-track-amount span {
  font-size: .72rem;
  font-weight: 500;
  color: var(--text-muted);
}
.portal-order-track-date {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}
.portal-dashboard-link-ribbon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: .7rem;
}
.portal-dashboard-link-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 48px;
  padding: .8rem .95rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.portal-dashboard-link-pill:hover {
  border-color: var(--line-med);
  background: rgba(255,255,255,.03);
}

/* Portal breadcrumb */
.portal-breadcrumb { display: flex; align-items: center; gap: .3rem; margin-bottom: 1.75rem; font-size: .8rem; color: var(--text-dim); }
.portal-breadcrumb-sep { opacity: .3; }
.portal-breadcrumb-link { color: var(--text-dim); text-decoration: none; transition: color .15s; }
.portal-breadcrumb-link:hover { color: var(--text-muted); }

.license-card {
  padding: var(--gap-md);
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg);
  display: flex; flex-direction: column; gap: var(--gap-sm);
}
.license-key {
  font-family: var(--font-mono); font-size: 14px; color: var(--text);
  background: var(--surface); padding: 8px 12px;
  border-radius: var(--r-md); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: var(--gap-sm);
}
.license-slots { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.slot-bar { flex: 1; height: 4px; background: var(--surface); border-radius: 99px; overflow: hidden; }
.slot-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--red), var(--red-soft)); }
.activation-row {
  display: flex; align-items: center; gap: var(--gap-sm);
  padding: 10px 12px;
  background: var(--surface); border-radius: var(--r-md); border: 1px solid var(--line);
}
.platform-icon {
  width: 28px; height: 28px;
  background: var(--panel); border-radius: var(--r-sm); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.platform-icon svg { width: 14px; height: 14px; }

/* ================================================================
   Stats
   ================================================================ */
.stat-card {
  padding: var(--gap-md);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.stat-value { font-size: 2.2rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; color: var(--text); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.stat-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; margin-top: 4px; }
.stat-delta.up   { color: var(--ok); }
.stat-delta.down { color: var(--danger); }

/* ================================================================
   Admin Panel
   ================================================================ */
.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.admin-sidebar {
  background: var(--surface); border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.admin-sidebar-header { padding: var(--gap-md); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.admin-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; }
.admin-logo-badge {
  font-size: 10px; font-weight: 600;
  background: var(--red-alpha); color: var(--red-soft);
  border: 1px solid rgba(231,76,60,.25);
  border-radius: var(--r-pill); padding: 2px 8px;
  letter-spacing: .06em; text-transform: uppercase;
}
.admin-nav { flex: 1; padding: var(--gap-sm); overflow-y: auto; }
.admin-nav-section { margin-bottom: var(--gap-md); }
.admin-nav-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-dim); padding: 6px 10px 4px; display: block;
}
.admin-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  font-size: 13.5px; font-weight: 500;
  color: var(--text-muted); transition: all .15s;
  position: relative;
}
.admin-nav-link svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .7; }
.admin-nav-link:hover { color: var(--text); background: var(--panel); }
.admin-nav-link.active { color: var(--text); background: var(--panel); }
.admin-nav-link.active svg { opacity: 1; }
.admin-nav-link.active::before {
  content: ''; position: absolute; left: 0; top: 4px; bottom: 4px;
  width: 3px; background: var(--red); border-radius: 0 2px 2px 0;
}
.admin-nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 600;
  background: var(--panel); color: var(--text-dim);
  border-radius: var(--r-pill); padding: 1px 7px;
}
.admin-nav-badge.red { background: var(--red-alpha); color: var(--red-soft); }
.admin-sidebar-footer { padding: var(--gap-md); border-top: 1px solid var(--line); flex-shrink: 0; }
.admin-user { display: flex; align-items: center; gap: 10px; }
.admin-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--red), var(--red-deep));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white; flex-shrink: 0;
}
.admin-user-info { flex: 1; min-width: 0; }
.admin-user-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-user-role { font-size: 11px; color: var(--text-dim); }
.admin-main { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.admin-topbar {
  height: 58px; padding: 0 var(--gap-lg);
  display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md);
  border-bottom: 1px solid var(--line);
  background: var(--bg); flex-shrink: 0;
  position: sticky; top: 0; z-index: 50;
}
.admin-breadcrumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-dim); }
.admin-breadcrumbs a { color: var(--text-muted); transition: color .15s; }
.admin-breadcrumbs a:hover { color: var(--text); }
.admin-breadcrumbs .sep { opacity: .4; }
.admin-breadcrumbs .current { color: var(--text); font-weight: 500; }
.admin-topbar-actions { display: flex; align-items: center; gap: 8px; }
.admin-topbar-actions .icon-actions { justify-content: flex-end; }
.admin-content { flex: 1; padding: var(--gap-lg); overflow: auto; }
.admin-page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--gap-md); margin-bottom: var(--gap-lg); flex-wrap: wrap;
}
.admin-page-header h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.admin-page-header p  { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

.filter-bar {
  display: flex; align-items: center; gap: var(--gap-sm);
  margin-bottom: var(--gap-md); flex-wrap: wrap;
}
.filter-bar .form-control { width: auto; min-width: 160px; }

.admin-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.admin-card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--gap-md); padding: var(--gap-md) var(--gap-lg);
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.admin-card-header h2 { font-size: 15px; font-weight: 600; }
.admin-card-body { padding: var(--gap-lg); }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: center; margin-top: var(--gap-lg); }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  font-size: 14px; color: var(--text-muted);
  border: 1px solid var(--line); transition: all .15s;
}
.pagination a:hover { color: var(--text); background: var(--surface); }
.pagination .current { background: var(--red); color: white; border-color: transparent; }
.pagination .disabled { opacity: .3; pointer-events: none; }

/* ================================================================
   Modal
   ================================================================ */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.7); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: var(--gap-md);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card); border: 1px solid var(--line-med);
  border-radius: var(--r-xl); padding: var(--gap-lg);
  max-width: 440px; width: 100%; box-shadow: var(--shadow-lg);
}
.modal h3 { margin-bottom: 8px; }
.modal p { color: var(--text-muted); font-size: 14px; margin-bottom: var(--gap-lg); }
.modal-actions { display: flex; gap: var(--gap-sm); justify-content: flex-end; }

/* ================================================================
   Section header
   ================================================================ */
.section-header { text-align: center; margin-bottom: var(--gap-xl); }
.section-header .kicker { margin-bottom: var(--gap-sm); }
.section-header h2 { font-size: clamp(1.8rem,3vw,2.8rem); font-weight: 700; letter-spacing: -.03em; margin-bottom: var(--gap-sm); }
.section-header p { color: var(--text-muted); max-width: 540px; margin: 0 auto; }

/* ================================================================
   Utilities
   ================================================================ */
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-sm { margin-top: var(--gap-sm); } .mt-md { margin-top: var(--gap-md); } .mt-lg { margin-top: var(--gap-lg); }
.mb-sm { margin-bottom: var(--gap-sm); } .mb-md { margin-bottom: var(--gap-md); } .mb-lg { margin-bottom: var(--gap-lg); }
.text-muted { color: var(--text-muted); } .text-dim { color: var(--text-dim); }
.text-red   { color: var(--red-soft); } .text-green { color: var(--ok); }
.text-sm { font-size: 13px; } .text-xs { font-size: 12px; }
.font-mono { font-family: var(--font-mono); }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.d-flex { display: flex; } .d-none { display: none; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--line); margin: var(--gap-lg) 0; }
.empty-state { text-align: center; padding: var(--gap-xl); color: var(--text-dim); }
.empty-state svg { width: 48px; height: 48px; margin: 0 auto var(--gap-md); opacity: .3; }
.empty-state p { font-size: 14px; }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--line); }
.faq-question {
  width: 100%; text-align: left;
  padding: var(--gap-md) 0;
  background: transparent; border: none;
  color: var(--text); font-size: 15px; font-weight: 500;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md);
}
.faq-question svg { flex-shrink: 0; transition: transform .2s; }
.faq-item.open .faq-question svg { transform: rotate(180deg); }
.faq-answer { display: none; padding-bottom: var(--gap-md); color: var(--text-muted); font-size: 14px; line-height: 1.8; }
.faq-item.open .faq-answer { display: block; }

/* Copy btn */
.copy-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: none;
  color: var(--text-dim); font-size: 12px; cursor: pointer;
  padding: 3px 6px; border-radius: var(--r-sm); transition: all .15s;
}
.copy-btn:hover { color: var(--text-muted); background: var(--surface); }
.copy-btn.copied { color: var(--ok); }

/* ================================================================
   Responsive
   ================================================================ */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .admin-shell  { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .admin-sidebar.open {
    display: flex; position: fixed;
    top: 0; left: 0; width: 280px; height: 100vh; z-index: 150;
  }
  .footer-bottom {
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "language"
      "actions";
    align-items: stretch;
    gap: 12px;
  }
  .footer-copy {
    justify-self: start;
    max-width: none;
    text-align: left;
    justify-content: flex-start;
  }
  .language-switcher { width: 184px; }
  .footer-bottom-actions {
    justify-self: stretch;
    justify-content: flex-start;
  }
}
@media (max-width: 768px) {
  .site-nav-links, .site-nav-actions { display: none; }
  .nav-toggle { display: flex; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .portal-layout { grid-template-columns: 1fr; }
  .portal-sidebar { position: static; }
  .portal-dashboard-stage,
  .portal-dashboard-notice,
  .portal-dashboard-chapter { padding: 1rem; }
  .portal-dashboard-stage { grid-template-columns: 1fr; }
  .portal-dashboard-stage-actions .btn { width: 100%; justify-content: center; }
  .portal-license-ledger-row,
  .portal-order-track-item,
  .portal-dashboard-link-ribbon { grid-template-columns: 1fr; }
  .portal-license-ledger-tools,
  .portal-order-track-side { justify-content: flex-start; width: 100%; }
  .portal-order-track-side { align-items: flex-start; }
  .download-card { flex-wrap: wrap; }
  .download-actions { width: 100%; }
  .admin-content { padding: var(--gap-md); }
  .admin-page-header { flex-direction: column; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .form-control { width: 100%; }
  .footer-bottom {
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "language"
      "actions";
    gap: 14px;
    padding-top: 10px;
  }
  .language-switcher,
  .footer-bottom-actions,
  .footer-copy {
    width: 100%;
    justify-self: stretch;
  }
  .footer-bottom-actions {
    align-items: flex-start;
  }
  .footer-badges {
    justify-content: flex-start;
  }
  .payment-badges {
    justify-content: flex-start;
  }
  .language-switcher {
    width: 100%;
  }
  .footer-copy {
    align-items: flex-start;
    text-align: left;
    justify-content: flex-start;
  }
}
@media (max-width: 480px) {
  .site-shell { padding: 0 16px var(--gap-lg); }
  .card { padding: var(--gap-md); }
  .form-card { padding: var(--gap-md); }
  .hero { padding: var(--gap-lg) 0; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .footer-bottom {
    padding-top: 8px;
  }
  .language-switcher-select-wrap {
    max-width: none;
  }
}

/* ── 404 Error Page ─────────────────────────────────────── */
.error-page {
  min-height: calc(100vh - var(--nav-h) - 200px);
  display: flex;
  align-items: center;
  padding: var(--gap-xl) 0;
}
.error-page-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--gap-lg);
}
.error-code-wrap {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  line-height: 1;
}
.error-digit {
  font-size: clamp(96px, 18vw, 160px);
  font-weight: 800;
  letter-spacing: -0.06em;
  color: var(--text);
  opacity: 0.12;
  font-variant-numeric: tabular-nums;
}
.error-icon-center {
  width: clamp(64px, 12vw, 100px);
  height: clamp(64px, 12vw, 100px);
  flex-shrink: 0;
  filter: drop-shadow(0 0 24px rgba(231,76,60,0.4));
  animation: error-pulse 3s ease-in-out infinite;
}
.error-icon-center svg {
  width: 100%;
  height: 100%;
}
@keyframes error-pulse {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(231,76,60,0.35)); }
  50%       { filter: drop-shadow(0 0 36px rgba(231,76,60,0.65)); }
}
.error-title {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0;
}
.error-desc {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 440px;
  margin: 0;
}
.error-actions {
  display: flex;
  gap: var(--gap-sm);
  flex-wrap: wrap;
  justify-content: center;
}
.error-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.error-links {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.875rem;
}
.error-links-label {
  color: var(--text-dim);
}
.error-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.error-links a:hover { color: var(--red-soft); }
@media (max-width: 480px) {
  .error-actions { flex-direction: column; width: 100%; }
  .error-actions .btn { width: 100%; justify-content: center; }
}

/* ================================================================
   Ops shared components — Stripe-style
   ================================================================ */

/* ── Metrics strip ──────────────────────────────────────────── */
.metrics-strip {
  display: flex; align-items: stretch;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden; margin-bottom: var(--gap-md);
}
.metric-cell {
  flex: 1; padding: 1rem 1.25rem;
  border-right: 1px solid var(--line); min-width: 0;
}
.metric-cell:last-child { border-right: none; }
.metric-label {
  font-size: 11px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: .3rem;
}
.metric-value {
  font-size: 1.55rem; font-weight: 700; letter-spacing: -.04em;
  line-height: 1; color: var(--text);
}
.metric-value.ok   { color: var(--ok); }
.metric-value.warn { color: var(--warn); }
.metric-value.info { color: var(--info); }
@media (max-width: 768px) {
  .metrics-strip { flex-wrap: wrap; }
  .metric-cell   { flex: 1 1 calc(50% - 1px); border-bottom: 1px solid var(--line); }
  .metric-cell:nth-last-child(-n+2) { border-bottom: none; }
}

/* ── Filter strip ───────────────────────────────────────────── */
.filter-strip {
  display: flex; gap: .5rem; align-items: center;
  flex-wrap: wrap; margin-bottom: var(--gap-md);
}
.filter-strip .form-control {
  height: 34px; font-size: 13px;
  background: var(--surface); border: 1px solid var(--line-med);
  border-radius: var(--r-sm); color: var(--text);
  padding: 0 .75rem; outline: none; transition: border-color .15s;
}
.filter-strip .form-control:focus { border-color: rgba(255,255,255,.25); }
.filter-strip .search-wrap {
  flex: 1; min-width: 200px; max-width: 300px; position: relative;
}
.filter-strip .search-wrap svg {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%); pointer-events: none; color: var(--text-dim);
}
.filter-strip .search-wrap input { padding-left: 30px; width: 100%; }

/* ── Ops table ──────────────────────────────────────────────── */
.ops-table { width: 100%; border-collapse: collapse; }
.ops-table thead tr { border-bottom: 1px solid var(--line); }
.ops-table th {
  font-size: 11px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-dim);
  padding: .65rem 1rem; text-align: left; white-space: nowrap;
}
.ops-table th:first-child { padding-left: 1.25rem; }
.ops-table th.right        { text-align: right; }
.ops-table tbody tr {
  border-bottom: 1px solid var(--line); transition: background .1s;
}
.ops-table tbody tr:last-child { border-bottom: none; }
.ops-table tbody tr.clickable { cursor: pointer; }
.ops-table tbody tr.clickable:hover { background: rgba(255,255,255,.025); }
.ops-table tbody tr:not(.clickable):hover { background: rgba(255,255,255,.015); }
.ops-table td {
  padding: .8rem 1rem; font-size: 13px;
  color: var(--text); vertical-align: middle;
}
.ops-table td:first-child { padding-left: 1.25rem; }
.ops-table td.right        { text-align: right; }
.ops-table td.muted        { color: var(--text-muted); }
.ops-table td.mono         { font-family: var(--font-mono); font-size: 12px; }
.ops-table .row-chevron {
  color: var(--text-dim); opacity: 0; transition: opacity .12s, transform .12s;
}
.ops-table tr.clickable:hover .row-chevron {
  opacity: 1; transform: translateX(2px);
}
.ops-empty {
  padding: 3.5rem 2rem; text-align: center;
}
.ops-empty svg { width: 36px; height: 36px; color: var(--text-dim); margin: 0 auto .75rem; }
.ops-empty p { color: var(--text-muted); font-size: 13.5px; }

/* ── Status pill ────────────────────────────────────────────── */
.status-pill {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: 11.5px; font-weight: 600; padding: 3px 10px;
  border-radius: var(--r-pill); white-space: nowrap;
}
.pill-paid, .pill-active      { background: var(--ok-alpha);               color: var(--ok);      }
.pill-pending                  { background: var(--warn-alpha);             color: var(--warn);    }
.pill-failed, .pill-cancelled,
.pill-revoked                  { background: var(--danger-alpha);           color: var(--danger);  }
.pill-refunded, .pill-inactive,
.pill-expired, .pill-neutral   { background: rgba(255,255,255,.07);         color: var(--text-muted); }
.pill-processed, .pill-stable  { background: var(--ok-alpha);               color: var(--ok);      }
.pill-received                 { background: var(--info-alpha);             color: var(--info);    }
.pill-beta, .pill-nightly      { background: var(--warn-alpha);             color: var(--warn);    }
.status-dot {
  width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0;
}
.dot-paid, .dot-active, .dot-processed { background: var(--ok); box-shadow: 0 0 5px var(--ok); }
.dot-pending, .dot-received    { background: var(--warn); }
.dot-failed, .dot-cancelled,
.dot-revoked                   { background: var(--danger); }
.dot-refunded, .dot-inactive,
.dot-expired                   { background: var(--text-dim); }
.dot-blue                      { background: var(--info); box-shadow: 0 0 5px var(--info); }

/* ── Detail section ─────────────────────────────────────────── */
.detail-section {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden; margin-bottom: var(--gap-md);
}
.detail-section:last-child { margin-bottom: 0; }
.detail-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.25rem; border-bottom: 1px solid var(--line);
}
.detail-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-dim);
}
.meta-row {
  display: flex; align-items: baseline; gap: 1rem;
  padding: .65rem 1.25rem; border-bottom: 1px solid var(--line);
}
.meta-row:last-child { border-bottom: none; }
.meta-key {
  font-size: 12px; color: var(--text-dim); min-width: 140px;
  flex-shrink: 0; font-weight: 500;
}
.meta-val {
  font-size: 13px; color: var(--text); flex: 1; min-width: 0;
  word-break: break-all; display: flex; align-items: center; gap: .5rem;
}
.meta-val.mono  { font-family: var(--font-mono); font-size: 12px; }
.meta-val.muted { color: var(--text-muted); }
.inline-copy {
  background: none; border: none; padding: 2px 5px; border-radius: 4px;
  cursor: pointer; color: var(--text-dim); transition: color .12s, background .12s;
  flex-shrink: 0;
}

/* ================================================================
   Admin light theme
   ================================================================ */
[data-theme="light"] {
  color-scheme: light;

  --bg:        #f6f9fc;
  --bg-raised: #eef2f7;
  --surface:   #f4f7fb;
  --panel:     #edf2f7;
  --card:      #ffffff;
  --card-high: #ffffff;

  --line:      rgba(15,23,42,0.08);
  --line-med:  rgba(15,23,42,0.13);

  --text:      #0a2540;
  --text-muted:#425466;
  --text-dim:  #6b7c93;

  --red-alpha: rgba(231,76,60,0.10);
}

[data-theme="light"] body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 72% 38% at 50% -12%, rgba(99,91,255,0.08), transparent 58%),
    radial-gradient(ellipse 46% 26% at 100% 8%, rgba(12,180,206,0.07), transparent 72%),
    linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0) 24%);
}

[data-theme="light"] .admin-sidebar {
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,252,0.98));
  border-color: var(--line);
  box-shadow:
    inset -1px 0 0 rgba(255,255,255,0.78),
    0 0 0 1px rgba(255,255,255,0.55);
}
[data-theme="light"] .admin-sidebar-header,
[data-theme="light"] .admin-sidebar-footer {
  background: rgba(248,250,252,0.65);
}
[data-theme="light"] .admin-nav-label {
  color: #7a8599;
}
[data-theme="light"] .admin-nav-link { color: var(--text-muted); }
[data-theme="light"] .admin-nav-link:hover,
[data-theme="light"] .admin-nav-link.active {
  background: #eef4ff;
  box-shadow: inset 0 0 0 1px rgba(99,91,255,0.08);
}
[data-theme="light"] .admin-nav-link.active::before {
  background: #635bff;
}
[data-theme="light"] .admin-topbar {
  background: rgba(246,249,252,0.86);
  border-color: var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
[data-theme="light"] .admin-main { background: transparent; }
[data-theme="light"] .admin-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(251,253,255,0.98));
  border-color: rgba(15,23,42,0.08);
  box-shadow:
    0 1px 3px rgba(15,23,42,0.04),
    0 12px 30px rgba(15,23,42,0.05);
}
[data-theme="light"] .admin-card-header {
  background: rgba(248,250,252,0.72);
  border-color: rgba(15,23,42,0.06);
}
[data-theme="light"] .btn-secondary,
[data-theme="light"] button.btn-secondary {
  background: var(--card);
  border-color: rgba(15,23,42,0.10);
  color: var(--text);
}
[data-theme="light"] .btn-secondary:hover {
  background: #f7f9fc;
  border-color: rgba(99,91,255,0.22);
}
[data-theme="light"] .btn-ghost,
[data-theme="light"] button.btn-ghost {
  border-color: rgba(15,23,42,0.08);
}
[data-theme="light"] .btn-ghost:hover {
  background: #eef4ff;
  color: var(--text);
}
[data-theme="light"] .form-control,
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="search"],
[data-theme="light"] input[type="url"],
[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="time"],
[data-theme="light"] input[type="datetime-local"],
[data-theme="light"] textarea,
[data-theme="light"] select {
  background: rgba(255,255,255,0.96);
  border-color: rgba(15,23,42,0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}
[data-theme="light"] .form-control:focus,
[data-theme="light"] input[type="text"]:focus,
[data-theme="light"] input[type="email"]:focus,
[data-theme="light"] input[type="password"]:focus,
[data-theme="light"] textarea:focus,
[data-theme="light"] select:focus {
  border-color: rgba(99,91,255,0.46);
  box-shadow: 0 0 0 3px rgba(99,91,255,0.12);
}
[data-theme="light"] .table tbody tr:hover td,
[data-theme="light"] .ops-table tbody tr.clickable:hover,
[data-theme="light"] .ops-table tbody tr:not(.clickable):hover {
  background: rgba(99,91,255,0.04);
}
[data-theme="light"] .pagination a:hover {
  background: #f2f6ff;
  border-color: rgba(99,91,255,0.16);
}
[data-theme="light"] .pagination .current {
  background: #635bff;
  box-shadow: 0 8px 20px rgba(99,91,255,0.18);
}
[data-theme="light"] .modal {
  background: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(249,251,255,0.99));
  border-color: rgba(15,23,42,0.08);
  box-shadow: 0 24px 60px rgba(15,23,42,0.12);
}
[data-theme="light"] .filter-strip .form-control {
  background: rgba(255,255,255,0.96);
  border-color: rgba(15,23,42,0.12);
}
[data-theme="light"] .filter-strip .form-control:focus {
  border-color: rgba(99,91,255,0.42);
}
[data-theme="light"] .metrics-strip,
[data-theme="light"] .detail-section {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(251,253,255,0.98));
  border-color: rgba(15,23,42,0.08);
  box-shadow:
    0 1px 3px rgba(15,23,42,0.04),
    0 12px 28px rgba(15,23,42,0.04);
}
[data-theme="light"] .detail-section-header {
  background: rgba(248,250,252,0.72);
  border-color: rgba(15,23,42,0.06);
}
[data-theme="light"] #policy-quill-toolbar.ql-toolbar.ql-snow { background: var(--surface); }
[data-theme="light"] .policy-editor-wrap { background: var(--card); }

/* Theme toggle button */
.theme-toggle {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--line-med);
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--text-muted);
  transition: color .15s, background .15s, border-color .15s;
  flex-shrink: 0;
  padding: 0;
}
.theme-toggle:hover { color: var(--text); background: var(--surface); }
[data-theme="light"] .theme-toggle:hover { background: var(--panel); }

/* Dark mode → muestra sol (para pasar a claro) */
.theme-toggle .icon-sun  { display: block; }
.theme-toggle .icon-moon { display: none; }
/* Light mode → muestra luna (para pasar a oscuro) */
[data-theme="light"] .theme-toggle .icon-sun  { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
.inline-copy:hover { color: var(--text); background: var(--panel); }

/* Theme toggle refresh */
.theme-toggle {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line-med);
  border-radius: 12px;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    transform .18s ease,
    background .18s ease,
    border-color .18s ease,
    color .18s ease,
    box-shadow .18s ease;
}
.theme-toggle:hover {
  transform: translateY(-1px);
  color: var(--text);
  background: var(--panel);
  border-color: rgba(231,76,60,.35);
  box-shadow: 0 10px 24px rgba(0,0,0,.16);
}
.theme-toggle:active { transform: translateY(0); }
.theme-toggle:focus-visible {
  outline: none;
  border-color: rgba(231,76,60,.45);
  box-shadow: 0 0 0 3px rgba(231,76,60,.18);
}

.theme-toggle-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle-icon svg {
  width: 18px;
  height: 18px;
  transition: color .16s ease;
}
.theme-toggle-icon-sun {
  color: #f4b942;
  display: inline-block;
}
.theme-toggle-icon-moon {
  color: var(--text-muted);
  display: none;
}

[data-theme="light"] .theme-toggle {
  background: var(--card);
  border-color: rgba(15,23,42,0.10);
}
[data-theme="light"] .theme-toggle:hover {
  background: #f2f6ff;
  border-color: rgba(99,91,255,0.22);
  box-shadow: 0 10px 24px rgba(15,23,42,0.08);
}
[data-theme="light"] .theme-toggle:focus-visible {
  border-color: rgba(99,91,255,0.36);
  box-shadow: 0 0 0 3px rgba(99,91,255,0.14);
}
[data-theme="light"] .theme-toggle-icon-sun {
  display: none;
}
[data-theme="light"] .theme-toggle-icon-moon {
  display: inline-block;
  color: #635bff;
}
