:root {
  --bg: #111315;
  --surface: #111315;
  --surface-elevated: #1a1c1e;
  --surface-card: #1a1c1e;
  --surface-hover: #1a1c1e;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.1);
  --text: #ffffff;
  --text-muted: #8b9199;
  --text-secondary: #b0b5bd;
  --accent: #0982fe;
  --accent-blue: #0982fe;
  --accent-purple-light: #9f7ff0;
  --accent-purple: #603fb3;
  --accent-mint: #9ae7b1;
  --accent-dim: rgba(9, 130, 254, 0.12);
  --accent-glow: rgba(9, 130, 254, 0.18);
  --green: #9ae7b1;
  --red: #fca5a5;
  --red-strong: #f87171;
  --radius: 20px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --sidebar-width: 280px;
  --shadow-card: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.mono {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.9em;
}

/* ── App Shell ── */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* ── Sidebar ── */

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.25rem;
  margin-bottom: 0.25rem;
}

.brand-text strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-text span {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 300;
  line-height: 1.3;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-purple);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
}

.brand-mark svg {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.brand-centered {
  justify-content: center;
  margin-bottom: 1.5rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nav-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0 1.25rem;
  margin-bottom: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-secondary);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.65;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-decoration: none;
}

.nav-item.active {
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}

.nav-item.active .nav-icon {
  opacity: 1;
  color: var(--accent-blue);
}

.nav-badge {
  margin-left: auto;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: var(--radius-pill);
  background: var(--accent-blue);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
}

.nav-badge--purple {
  background: var(--accent-purple-light);
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 0.5rem;
}

.sidebar-search {
  position: relative;
  margin: 0;
}

.sidebar-search .search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.sidebar-search .search-input {
  width: 100%;
  padding: 0.7rem 1rem 0.7rem 2.75rem;
  background: var(--surface-hover);
  border: none;
  border-radius: var(--radius-pill);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
}

.sidebar-search .search-input::placeholder {
  color: var(--text-muted);
}

.sidebar-search .search-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(9, 130, 254, 0.25);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

.logout-form {
  margin: 0;
}

/* ── Main Content ── */

.main-content {
  padding: 2rem 2.5rem 2.5rem;
  min-width: 0;
}

/* ── Topbar ── */

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.topbar-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--accent-blue);
  color: #fff;
}

.topbar-badge--test {
  background: rgba(251, 191, 36, 0.2);
  color: #fcd34d;
}

.topbar-badge--live {
  background: var(--accent-blue);
  color: #fff;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-hover);
  color: var(--text);
}

/* ── Page Header (fallback) ── */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--accent-blue);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Stats Grid ── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stats-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.stats-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.stat-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}

.stat-card-link:hover {
  border-color: rgba(9, 130, 254, 0.25);
  transform: translateY(-1px);
  text-decoration: none;
}

.stat-card-warning {
  border-color: rgba(248, 113, 113, 0.25);
  background: var(--surface-card);
}

.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  position: relative;
  overflow: hidden;
}

.stat-card.featured {
  background: var(--surface-card);
  border-color: rgba(9, 130, 254, 0.2);
}

.stat-card-label {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-card-value {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat-card-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
}

.stat-card-trend.up {
  color: var(--accent-mint);
  background: rgba(154, 231, 177, 0.12);
}

.stat-card-trend.down {
  color: var(--red);
  background: rgba(248, 113, 113, 0.14);
}

.stat-card-trend.neutral {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
}

/* ── Cards ── */

.bento-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
}

.section-title {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.client-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .client-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1400px) {
  .client-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.15rem;
  }
}

.key-list {
  display: grid;
  gap: 0.85rem;
}

.client-card,
.key-card {
  transition: border-color 0.2s, box-shadow 0.2s;
}

.client-card:hover,
.key-card:hover {
  border-color: rgba(9, 130, 254, 0.2);
}

.client-card-header {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.75rem;
}

.client-card-header h2,
.key-card-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.client-email {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-badge--active {
  background: rgba(154, 231, 177, 0.14);
  border-color: rgba(154, 231, 177, 0.28);
  color: var(--accent-mint);
}

.status-badge--inactive {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text-muted);
}

.status-badge-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.9;
}

/* Legacy status-chip (updates page etc.) */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid var(--border);
}

.status-chip.active {
  background: rgba(154, 231, 177, 0.12);
  border-color: rgba(154, 231, 177, 0.25);
  color: var(--accent-mint);
}

.status-chip.inactive {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-chip.active .status-dot {
  box-shadow: none;
}

.status-chip-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.85;
}

.client-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0 0 1.15rem;
}

.client-meta-tile {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  min-height: 88px;
}

.client-meta-tile--full {
  grid-column: 1 / -1;
  min-height: 0;
}

.client-meta-tile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.client-meta-tile-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.12);
}

.client-meta-tile-icon svg {
  width: 15px;
  height: 15px;
}

.client-meta-tile--blue {
  background: rgba(9, 130, 254, 0.1);
  border-color: rgba(9, 130, 254, 0.18);
}

.client-meta-tile--blue .client-meta-tile-icon {
  color: var(--accent-blue);
  background: rgba(9, 130, 254, 0.18);
}

.client-meta-tile--purple {
  background: rgba(159, 127, 240, 0.1);
  border-color: rgba(159, 127, 240, 0.18);
}

.client-meta-tile--purple .client-meta-tile-icon {
  color: var(--accent-purple-light);
  background: rgba(159, 127, 240, 0.18);
}

.client-meta-tile--mint {
  background: rgba(154, 231, 177, 0.08);
  border-color: rgba(154, 231, 177, 0.16);
}

.client-meta-tile--mint .client-meta-tile-icon {
  color: var(--accent-mint);
  background: rgba(154, 231, 177, 0.16);
}

.client-meta-tile--warn {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.18);
}

.client-meta-tile--warn .client-meta-tile-icon {
  color: #fcd34d;
  background: rgba(251, 191, 36, 0.16);
}

.client-meta-tile--key {
  background: rgba(96, 63, 179, 0.12);
  border-color: rgba(159, 127, 240, 0.22);
  border-left: 3px solid var(--accent-purple);
}

.client-meta-tile--key .client-meta-tile-icon {
  color: var(--accent-purple-light);
  background: rgba(159, 127, 240, 0.2);
}

.client-meta-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  line-height: 1.35;
}

.client-meta-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.client-meta-hint {
  margin: 0.15rem 0 0;
}

.client-license-key {
  font-size: 0.82rem;
}

.pkg-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: capitalize;
  width: fit-content;
  letter-spacing: -0.01em;
}

.pkg-badge--basic {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.pkg-badge--pro {
  background: var(--accent-purple);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.update-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.update-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
}

.update-badge span {
  opacity: 0.8;
  font-weight: 500;
}

.update-badge--wp {
  background: rgba(9, 130, 254, 0.18);
  color: #7ec4ff;
  border-color: rgba(9, 130, 254, 0.28);
}

.update-badge--plugin {
  background: rgba(159, 127, 240, 0.18);
  color: var(--accent-purple-light);
  border-color: rgba(159, 127, 240, 0.28);
}

.update-badge--theme {
  background: rgba(154, 231, 177, 0.16);
  color: var(--accent-mint);
  border-color: rgba(154, 231, 177, 0.28);
}

.update-badge--ok {
  background: rgba(154, 231, 177, 0.14);
  color: var(--accent-mint);
  border-color: rgba(154, 231, 177, 0.24);
}

.update-badge:hover {
  text-decoration: none;
  filter: brightness(1.1);
}

@media (max-width: 768px) {
  .client-meta-grid {
    grid-template-columns: 1fr;
  }
}

.meta-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem 1rem;
  margin: 0 0 1.15rem;
}

.meta-list dt {
  margin: 0;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.meta-list dd {
  margin: 0.1rem 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.meta-list .meta-full {
  grid-column: 1 / -1;
}

.meta-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
}

.update-link {
  color: var(--accent);
  font-weight: 500;
}

.update-link:hover {
  text-decoration: underline;
}

.info-callout {
  background: var(--accent-dim);
  border: 1px solid rgba(9, 130, 254, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.info-callout p {
  margin: 0;
}

.info-callout-muted {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
}

.update-client-section {
  margin-bottom: 2rem;
}

.update-client-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.update-client-header .section-title {
  margin-bottom: 0.25rem;
}

.update-table-card {
  padding: 0;
  overflow: hidden;
}

.update-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.update-table th,
.update-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.update-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.02);
}

.update-table tbody tr:last-child td {
  border-bottom: none;
}

.update-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.update-table .row-security {
  background: rgba(248, 113, 113, 0.04);
}

.type-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.type-core {
  background: rgba(96, 165, 250, 0.12);
  color: #93c5fd;
}

.type-plugin {
  background: rgba(9, 130, 254, 0.12);
  color: #93c5fd;
}

.type-theme {
  background: rgba(192, 132, 252, 0.12);
  color: #c4b5fd;
}

.vuln-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.severity-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
}

.severity-high {
  background: rgba(248, 113, 113, 0.15);
  color: #fca5a5;
}

.severity-medium {
  background: rgba(251, 191, 36, 0.12);
  color: #fcd34d;
}

.severity-low {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding-top: 1rem;
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.client-card {
  display: flex;
  flex-direction: column;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s, border-color 0.15s;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-blue);
  color: #ffffff;
}

.btn-primary:hover {
  background: #1a8cff;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  border-color: var(--border-hover);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.35);
  color: var(--red);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.15);
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
}

.btn-icon svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.85;
}

.btn-full {
  width: 100%;
}

/* ── Alerts ── */

.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.alert-error {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: #fca5a5;
}

.alert-success {
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.2);
  color: #86efac;
}

/* ── Forms ── */

.form-card {
  max-width: 560px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

label span {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(9, 130, 254, 0.4);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.toggle-label input {
  accent-color: var(--accent);
  width: 1rem;
  height: 1rem;
}

/* ── Empty State ── */

.empty-state {
  text-align: center;
  padding: 2.5rem;
  color: var(--text-muted);
}

.empty-state .btn {
  margin-top: 1rem;
}

/* ── API Keys ── */

.key-reveal {
  margin-bottom: 1rem;
  border-color: rgba(9, 130, 254, 0.25);
}

.key-display {
  display: block;
  padding: 0.85rem 1rem;
  background: var(--surface-elevated);
  border-radius: var(--radius-sm);
  word-break: break-all;
  margin: 0.75rem 0;
}

.key-prefix {
  margin: 0.5rem 0;
  color: var(--text-muted);
}

.hint {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.hint code {
  background: var(--surface-elevated);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
}

.key-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* ── Login ── */

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-shell {
  width: 100%;
  max-width: 400px;
  padding: 1.5rem;
}

.login-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

/* ── Accessibility ── */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:focus-visible,
.nav-item:focus-visible,
.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sidebar-search .search-input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(9, 130, 254, 0.45);
}

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

/* ── Sensitive values (keys) ── */

.sensitive-value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.sensitive-text {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-all;
}

.sensitive-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.sensitive-actions .btn {
  min-width: 2.25rem;
}

.sensitive-value-block {
  margin-top: 0.35rem;
}

.sensitive-text-field {
  display: block;
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}

.key-reveal .sensitive-value {
  align-items: stretch;
}

.key-reveal .key-display {
  margin: 0.75rem 0 0;
}

.key-reveal .sensitive-actions {
  margin-top: 0.75rem;
}

.form-field-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}


/* ── Search filter ── */

.client-card.hidden,
[data-search].hidden {
  display: none;
}

/* ── Responsive ── */

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

  .topbar {
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    position: static;
    height: auto;
    padding: 1rem;
  }

  .sidebar-footer {
    display: flex;
  }

  .main-content {
    padding: 1.25rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .update-table-card {
    overflow-x: auto;
  }

  .update-table {
    min-width: 640px;
  }

  .update-client-header {
    flex-direction: column;
  }
}

/* ── Finanzen ── */

.finanzen-subtitle {
  margin: -0.5rem 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.finanzen-mrr-hint {
  margin: -0.5rem 0 1.5rem;
}

.finanzen-setup .hint {
  margin: 0.5rem 0;
}

.finanzen-code {
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.finanzen-code code {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.85rem;
  color: var(--accent-blue);
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mode-badge--live {
  background: rgba(74, 222, 128, 0.12);
  color: var(--green);
  border: 1px solid rgba(74, 222, 128, 0.2);
}

.mode-badge--test {
  background: rgba(251, 191, 36, 0.12);
  color: #fcd34d;
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.finanzen-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 1100px) {
  .finanzen-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .finanzen-section {
    grid-column: span 4;
  }

  .finanzen-section--wide {
    grid-column: span 8;
  }

  .finanzen-section--half {
    grid-column: span 6;
  }

  .finanzen-section--full {
    grid-column: span 12;
  }
}

.finanzen-section {
  padding: 1.5rem 2rem;
  min-width: 0;
}

.finanzen-table-wrap {
  overflow-x: auto;
}

.finanzen-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.finanzen-table th,
.finanzen-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.finanzen-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.02);
}

.finanzen-table tbody tr:last-child td {
  border-bottom: none;
}

.finanzen-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.finanzen-amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.finanzen-muted {
  color: var(--text-muted);
}

.finanzen-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.finanzen-top-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.finanzen-top-header .section-title {
  margin: 0;
}

.finanzen-top-hint {
  margin: 0;
  flex-shrink: 0;
}

.finanzen-top-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 900px) {
  .finanzen-top-list {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

.finanzen-top-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  min-width: 0;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.finanzen-top-rank {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--accent-dim);
  color: var(--accent-blue);
  flex-shrink: 0;
}

.finanzen-top-item:nth-child(1) .finanzen-top-rank {
  background: rgba(251, 191, 36, 0.16);
  color: #fcd34d;
}

.finanzen-top-item:nth-child(2) .finanzen-top-rank {
  background: rgba(176, 181, 189, 0.16);
  color: #d1d5db;
}

.finanzen-top-item:nth-child(3) .finanzen-top-rank {
  background: rgba(217, 119, 87, 0.16);
  color: #f0ab8a;
}

.finanzen-top-body {
  min-width: 0;
  flex: 1;
}

.finanzen-top-name {
  margin: 0 0 0.4rem;
  font-weight: 600;
  line-height: 1.3;
}

.finanzen-top-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  margin: 0 0 0.45rem;
}

.finanzen-top-stats {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.finanzen-top-stats strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.finanzen-top-item .btn {
  align-self: center;
  flex-shrink: 0;
}

.finanzen-product-desc {
  display: block;
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.finanzen-failure-hint {
  margin-left: 0.35rem;
  color: var(--text-muted);
  cursor: help;
}

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-badge--success {
  background: rgba(154, 231, 177, 0.15);
  color: var(--accent-mint);
}

.status-badge--warning {
  background: rgba(251, 191, 36, 0.12);
  color: #fcd34d;
}

.status-badge--danger {
  background: rgba(248, 113, 113, 0.15);
  color: #fca5a5;
}

.status-badge--info {
  background: rgba(9, 130, 254, 0.12);
  color: #93c5fd;
}

.finanzen-products-hint {
  margin: 1rem 0;
}

.finanzen-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.finanzen-modal[hidden] {
  display: none;
}

.finanzen-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.finanzen-modal__panel {
  position: relative;
  width: min(960px, 100%);
  max-height: calc(100vh - 3rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.finanzen-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.finanzen-modal__header .section-title {
  margin-bottom: 0.25rem;
}

.finanzen-modal__close {
  font-size: 1.25rem;
  line-height: 1;
  min-width: 2.25rem;
}

.finanzen-modal__body {
  padding: 1.25rem 1.5rem 1.5rem;
  overflow-y: auto;
}

.finanzen-modal__panel--form {
  width: min(520px, 100%);
}

.modal-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}

body.finanzen-modal-open {
  overflow: hidden;
}

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

  .finanzen-table {
    min-width: 640px;
  }

  .wallet-hero-row {
    grid-template-columns: 1fr;
  }

  .wallet-kpi-stack {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .wallet-kpi-card {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 140px;
  }
}

/* ── Wallet Dashboard ── */

.wallet-hero-row {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.wallet-balance-card {
  background: var(--accent-blue);
  border-radius: var(--radius-lg);
  padding: 2rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

.wallet-balance-card::before {
  display: none;
}

.wallet-balance-label {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 400;
  opacity: 0.9;
}

.wallet-balance-value {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.wallet-balance-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.82rem;
  opacity: 0.85;
}

.wallet-balance-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.15);
  font-weight: 600;
}

.wallet-balance-trend.up {
  color: var(--accent-mint);
}

.wallet-balance-trend.down {
  color: #fecaca;
}

.wallet-balance-trend.neutral {
  color: rgba(255, 255, 255, 0.8);
}

.wallet-balance-chart-icon {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: grid;
  place-items: center;
}

.wallet-balance-chart-icon svg {
  width: 18px;
  height: 18px;
}

.wallet-actions {
  display: flex;
  gap: 1.5rem;
  margin-top: auto;
  padding-top: 2rem;
}

.wallet-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  opacity: 0.9;
  transition: opacity 0.15s;
}

.wallet-action:hover {
  opacity: 1;
  text-decoration: none;
}

.wallet-action--disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.wallet-action--disabled:hover {
  opacity: 0.45;
}

.wallet-action-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: grid;
  place-items: center;
  transition: background 0.15s;
}

.wallet-action:hover .wallet-action-icon {
  background: rgba(255, 255, 255, 0.25);
}

.wallet-action-icon svg {
  width: 18px;
  height: 18px;
}

.wallet-kpi-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.wallet-kpi-card {
  flex: 1;
  border-radius: var(--radius);
  padding: 1.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  min-height: 0;
}

.wallet-kpi-card--purple {
  background: var(--accent-purple);
}

.wallet-kpi-card--mint {
  background: var(--accent-mint);
  color: #111315;
}

.wallet-kpi-card--mint .wallet-kpi-label,
.wallet-kpi-card--mint .wallet-kpi-sub {
  color: #111315;
  opacity: 0.72;
}

.wallet-kpi-card--mint .wallet-kpi-value {
  color: #111315;
}

.wallet-kpi-card--dark {
  background: var(--surface-card);
  border: 1px solid var(--border);
  color: var(--text);
}

.wallet-kpi-label {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 400;
  opacity: 0.85;
}

.wallet-kpi-card--dark .wallet-kpi-label {
  color: var(--text-muted);
  opacity: 1;
}

.wallet-kpi-value {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.wallet-kpi-card--dark .wallet-kpi-value {
  font-size: 1.25rem;
}

.wallet-kpi-sub {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  opacity: 0.75;
}

.wallet-kpi-card--dark .wallet-kpi-sub {
  color: var(--text-muted);
  opacity: 1;
}

.wallet-balance-card--warning {
  background: #d97706;
}

.wallet-kpi-card--alert {
  border-color: rgba(248, 113, 113, 0.3);
  background: var(--surface-card);
}

.wallet-kpi-link {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 600;
}

.wallet-kpi-link:hover {
  text-decoration: underline;
}

.wallet-stats-section {
  margin-bottom: 2rem;
}

.wallet-stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.wallet-stats-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.wallet-stats-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-family: inherit;
}

.wallet-stats-filter svg {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

.wallet-stats-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.5rem;
}

.wallet-stat-mini {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.wallet-stat-mini-label {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.wallet-stat-mini-value {
  margin: 0;
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.wallet-stat-mini-icon {
  margin-top: 1rem;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  color: var(--accent-blue);
  display: grid;
  place-items: center;
}

.wallet-stat-mini-icon svg {
  width: 18px;
  height: 18px;
}

.wallet-chart-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  min-height: 180px;
}

.wallet-chart {
  width: 100%;
  height: 140px;
  display: block;
}

.wallet-chart-empty {
  display: grid;
  place-items: center;
  height: 140px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

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

  .wallet-balance-value {
    font-size: 2rem;
  }

  .wallet-actions {
    gap: 1rem;
    flex-wrap: wrap;
  }

  .finanzen-top-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .finanzen-top-item {
    flex-wrap: wrap;
  }
}
