/* ═══════════════════════════════════════════════════════════════════════════
   NNEAT Partners Portal — Shared Design System
   Based on calculator.html · Extended for full portal
   ═══════════════════════════════════════════════════════════════════════════ */

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

:root {
  /* Brand colours */
  --red:         #650D00;
  --red-h:       #7d1000;
  --red-dim:     rgba(101,13,0,.08);
  --red-border:  rgba(101,13,0,.2);
  --orange:      #CC4205;
  --orange-h:    #e84d08;

  /* Backgrounds */
  --bg:          #f4f5f7;
  --surface:     #ffffff;
  --card:        #ffffff;

  /* Borders */
  --border:      #e2e6ea;
  --border2:     #d0d5dd;

  /* Text */
  --text:        #111827;
  --dim:         #374151;
  --muted:       #6b7280;
  --subtle:      #9ca3af;

  /* Sidebar */
  --sidebar-w:   240px;
  --sidebar-bg:  #1a0400;
  --sidebar-border: rgba(255,255,255,.07);

  /* Shadows */
  --shadow-card: 0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --shadow-deep: 0 8px 32px rgba(0,0,0,.12);
}

/* ── TYPOGRAPHY ─────────────────────────────────────────────────────────── */
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ══════════════════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ══════════════════════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a0400 0%, #650D00 60%, #8b1200 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.login-box {
  background: var(--surface);
  border-radius: 20px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
  position: relative;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo img { height: 36px; }
.login-logo .logo-fallback {
  font-family: 'Montagu Slab', serif;
  font-size: 26px; font-weight: 600;
  color: var(--red);
}
.login-title {
  font-family: 'Montagu Slab', serif;
  font-size: 22px; font-weight: 500;
  color: var(--text); text-align: center;
  margin-bottom: 8px;
}
.login-sub {
  font-size: 13px; color: var(--muted);
  text-align: center; margin-bottom: 28px;
  line-height: 1.55;
}
.login-field { margin-bottom: 14px; }
.login-field label {
  display: block;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--dim); margin-bottom: 7px;
}
.login-field input {
  width: 100%;
  border: 1.5px solid var(--border2);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: inherit; font-size: 15px;
  color: var(--text); background: var(--surface);
  transition: border-color .15s;
}
.login-field input:focus { outline: none; border-color: var(--red); }
.login-field input::placeholder { color: var(--subtle); }

/* OTP input */
.otp-wrap {
  display: flex; gap: 8px; justify-content: center;
  margin-bottom: 14px;
}
.otp-digit, .partner-otp-digit {
  width: 46px; height: 54px;
  border: 1.5px solid var(--border2); border-radius: 10px;
  font-size: 22px; font-weight: 700; font-family: 'Montagu Slab', serif;
  text-align: center; color: var(--text); background: var(--surface);
  transition: border-color .15s;
}
.otp-digit:focus, .partner-otp-digit:focus { outline: none; border-color: var(--red); }

.login-countdown {
  font-size: 12px; color: var(--muted); text-align: center;
  margin-bottom: 16px;
}
.login-countdown span { color: var(--red); font-weight: 600; }

.login-back {
  background: none; border: none;
  font-family: inherit; font-size: 13px;
  color: var(--muted); cursor: pointer;
  display: block; margin: 10px auto 0;
  text-decoration: underline;
}
.login-back:hover { color: var(--red); }

.login-divider {
  border: none; border-top: 1px solid var(--border);
  margin: 20px 0;
}
.login-note {
  font-size: 11px; color: var(--subtle);
  text-align: center; line-height: 1.5;
}

/* ── Login lang switcher ── */
.login-lang {
  position: absolute; top: 18px; right: 18px;
  display: flex; align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px; overflow: hidden;
}
.login-lang-btn {
  background: none; border: none;
  font-family: inherit; font-size: 10px; font-weight: 600;
  color: var(--muted); padding: 4px 10px; cursor: pointer;
  letter-spacing: 0.5px;
}
.login-lang-btn.active { background: var(--red); color: #fff; }
.login-lang-sep { width: 1px; height: 14px; background: var(--border); }

/* ══════════════════════════════════════════════════════════════════════════
   APP SHELL — SIDEBAR + CONTENT AREA
   ══════════════════════════════════════════════════════════════════════════ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  transition: transform .25s ease;
}
.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-logo img { height: 30px; }
.sidebar-logo .logo-fallback {
  font-family: 'Montagu Slab', serif;
  font-size: 20px; font-weight: 600; color: #fff;
}

.sidebar-section {
  padding: 16px 0 4px;
}
.sidebar-section-label {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.8px;
  color: rgba(255,255,255,.3);
  padding: 0 20px 8px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.6);
  font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  border-left: 3px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
  background: none; border-top: none; border-right: none; border-bottom: none;
  width: 100%; text-align: left; font-family: inherit;
}
.sidebar-item:hover {
  color: #fff; background: rgba(255,255,255,.06);
  border-left-color: rgba(255,255,255,.15);
}
.sidebar-item.active {
  color: #fff; background: rgba(101,13,0,.5);
  border-left-color: var(--orange);
}
.sidebar-item .si-icon {
  width: 20px; text-align: center; font-size: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-item .si-icon i { line-height: 1; }
.sidebar-item.external .si-icon-ext i { font-size: 11px; }
.sidebar-item.external .si-icon-ext {
  margin-left: auto; font-size: 10px; opacity: .5;
}

/* Support button */
.sidebar-support {
  margin: 8px 16px 20px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--orange);
  border: none; border-radius: 8px;
  padding: 10px 14px;
  color: #fff; font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background .15s;
}
.sidebar-support:hover { background: var(--orange-h); }

.sidebar-divider {
  border: none; border-top: 1px solid var(--sidebar-border);
  margin: 8px 0;
}

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  padding: 14px 16px 18px;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar-lang {
  display: flex; align-items: center;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px; overflow: hidden;
  margin-bottom: 12px; width: fit-content;
}
.sidebar-lang-btn {
  background: none; border: none;
  color: rgba(255,255,255,.5);
  font-family: inherit; font-size: 10px; font-weight: 600;
  padding: 4px 12px; cursor: pointer;
  letter-spacing: 0.5px; transition: color .15s, background .15s;
}
.sidebar-lang-btn.active {
  background: rgba(255,255,255,.18); color: #fff;
}
.sidebar-lang-sep { width: 1px; height: 14px; background: rgba(255,255,255,.15); }

.sidebar-user {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.sidebar-email {
  font-size: 11px; color: rgba(255,255,255,.5);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1;
}
.sidebar-logout {
  background: none; border: none;
  color: rgba(255,255,255,.4); font-size: 14px;
  cursor: pointer; padding: 4px; border-radius: 4px;
  transition: color .15s;
  flex-shrink: 0;
}
.sidebar-logout:hover { color: rgba(255,255,255,.8); }

/* ── CONTENT AREA ── */
.app-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* ── TOP BAR ── */
.topbar {
  background: var(--red);
  height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  box-shadow: 0 2px 12px rgba(101,13,0,.3);
  position: sticky; top: 0; z-index: 100;
}
.topbar-title {
  font-family: 'Montagu Slab', serif;
  font-size: 22px; font-weight: 500;
  color: #fff; letter-spacing: -0.2px;
}
.topbar-tag {
  font-size: 10px; font-weight: 500;
  color: rgba(255,255,255,.65);
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  padding: 3px 10px; border-radius: 20px; letter-spacing: 0.4px;
}
/* ── IMPERSONATION BANNER ── */
.impersonation-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 500;
  background: #d97706;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.impersonation-banner i { font-size: 16px; opacity: .9; }
.impersonation-banner strong { font-weight: 700; }
.impersonation-banner button {
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.45);
  color: #fff;
  font-family: inherit; font-size: 11px; font-weight: 600;
  padding: 4px 14px; border-radius: 20px;
  cursor: pointer; margin-left: 6px;
  transition: background .15s;
}
.impersonation-banner button:hover { background: rgba(255,255,255,.35); }

/* Mobile hamburger */
.topbar-hamburger {
  display: none;
  background: none; border: none;
  color: #fff; font-size: 20px; cursor: pointer; padding: 4px;
}

/* ── MAIN PAGE AREA ── */
.page-wrap {
  flex: 1;
  padding: 32px 36px 56px;
  max-width: 1600px;
  width: 100%;
}

.page-header {
  margin-bottom: 28px;
}
.page-header h1 {
  font-family: 'Montagu Slab', serif;
  font-size: 26px; font-weight: 500;
  color: var(--text); letter-spacing: -0.3px;
  margin-bottom: 4px;
}
.page-header p {
  font-size: 14px; color: var(--muted);
}

/* ── FOOTER ── */
.app-footer {
  border-top: 1px solid var(--border);
  padding: 14px 36px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: var(--muted);
}
.app-footer a { color: var(--red); text-decoration: none; }
.app-footer a:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════════════════
   SHARED COMPONENTS (cards, buttons, tables, forms)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── CARD ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 28px;
  box-shadow: var(--shadow-card);
}
.card-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.8px;
  color: var(--red); margin-bottom: 20px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: none; border-radius: 8px;
  font-family: inherit; font-weight: 500; cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .1s;
  text-decoration: none;
}
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--red); color: #fff;
  padding: 9px 18px; font-size: 13px;
}
.btn-primary:hover { background: var(--red-h); }

.btn-cta {
  display: block; width: 100%;
  background: var(--orange); border: none; border-radius: 4px;
  padding: 0 30px; height: 50px; line-height: 50px;
  color: #fff; font-family: inherit; font-size: 15px; font-weight: 500;
  cursor: pointer; text-align: center;
  transition: background .15s, box-shadow .15s, transform .1s;
  margin-top: 12px; letter-spacing: 0.2px;
}
.btn-cta:hover   { background: var(--orange-h); box-shadow: 0 4px 16px rgba(204,66,5,.3); }
.btn-cta:active  { transform: scale(.99); }
.btn-cta:disabled { opacity: .5; cursor: not-allowed; }

/* Partner request — outlined secondary button */
.btn-partner {
  display: block; width: 100%;
  background: transparent;
  border: 1.5px solid var(--orange);
  border-radius: 4px;
  padding: 0 30px; height: 46px; line-height: 44px;
  color: var(--orange); font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; text-align: center;
  transition: background .15s, color .15s, transform .1s;
  margin-top: 8px; letter-spacing: 0.2px;
}
.btn-partner:hover   { background: var(--orange); color: #fff; }
.btn-partner:active  { transform: scale(.99); }
.btn-partner:disabled { opacity: .5; cursor: not-allowed; }

/* Partner CTA caption */
.login-partner-cta-text {
  margin: 0 0 6px;
  font-size: 13px; color: var(--muted); text-align: center;
}

.btn-sm {
  padding: 6px 12px; font-size: 12px; border-radius: 6px;
}
.btn-danger {
  background: #fef2f2; color: #dc2626;
  border: 1px solid #fecaca;
}
.btn-danger:hover { background: #fee2e2; }

.btn-outline {
  background: var(--surface);
  border: 1.5px solid var(--border2);
  color: var(--dim);
  padding: 9px 18px; font-size: 13px;
}
.btn-outline:hover { border-color: var(--red); color: var(--red); }

/* ── FORM ELEMENTS ── */
.field-label {
  font-size: 11px; font-weight: 600; color: var(--dim);
  margin-bottom: 7px; text-transform: uppercase; letter-spacing: 0.8px;
  display: block;
}
.input, .select, .textarea {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border2); border-radius: 8px;
  padding: 10px 13px;
  color: var(--text); font-family: inherit; font-size: 14px;
  transition: border-color .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--red);
}
.input::placeholder, .textarea::placeholder { color: var(--subtle); }
.select {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23650D00'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
  padding-right: 36px;
}
.textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
.form-row { margin-bottom: 16px; }
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }

/* ── TABLES ── */
.data-table-wrap { overflow-x: auto; width: 100%; max-width: 100%; border-radius: 12px; border: 1px solid var(--border); }
.data-table {
  width: 100%; min-width: 680px; border-collapse: collapse; font-size: 13px;
}
.data-table th {
  background: #f0f2f5; padding: 10px 14px;
  text-align: left; font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  color: var(--muted); vertical-align: middle;
}
.data-table td:first-child { color: var(--text); font-weight: 500; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfc; }
.data-table .td-actions { text-align: right; white-space: nowrap; }
.data-table .td-center { text-align: center; }

.data-table .col-hide-md,
.data-table .col-hide-sm { }

/* Hide non-essential columns on smaller screens to prevent horizontal scroll.
   Breakpoints add ~312px to account for sidebar (240px) + page padding (72px). */
@media (max-width: 1560px) {
  .data-table .col-hide-md { display: none; }
}
@media (max-width: 1300px) {
  .data-table .col-hide-sm { display: none; }
}

/* ── BADGES ── */
.badge {
  display: inline-block;
  padding: 2px 9px; border-radius: 20px;
  font-size: 10px; font-weight: 600;
}
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-red    { background: #fee2e2; color: #dc2626; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-gray   { background: #f3f4f6; color: #4b5563; }
.badge.active { outline: 2px solid currentColor; box-shadow: 0 0 0 2px #fff; }

/* ── ALERT / MESSAGE BOX ── */
.alert {
  border-radius: 10px; padding: 12px 16px;
  font-size: 13px; line-height: 1.55;
  margin-top: 14px; display: none;
}
.alert.visible { display: block; }
.alert-error   { background: #fff5f5; border: 1px solid #fca5a5; color: #b91c1c; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }

/* ── SPINNER ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block; width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
  vertical-align: middle; margin-right: 6px;
}
.spinner-dark {
  border-color: rgba(0,0,0,.15); border-top-color: var(--red);
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 56px 24px; color: var(--muted);
}
.empty-state-icon { font-size: 40px; margin-bottom: 14px; opacity: .4; line-height: 1; }
.empty-state-icon i { font-size: 40px; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--dim); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; }

/* ══════════════════════════════════════════════════════════════════════════
   HOME PAGE
   ══════════════════════════════════════════════════════════════════════════ */
.home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px; margin-bottom: 28px;
}
.home-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 26px 24px;
  box-shadow: var(--shadow-card);
  cursor: pointer; text-decoration: none;
  display: block;
  transition: border-color .18s, box-shadow .18s, transform .15s;
}
.home-card:hover {
  border-color: var(--red);
  box-shadow: 0 4px 24px rgba(101,13,0,.12);
  transform: translateY(-2px);
}
.home-card-icon {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--red-dim); border: 1px solid var(--red-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 14px; color: var(--red);
}
.home-card h3 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.home-card p  { font-size: 12px; color: var(--muted); line-height: 1.5; }

.home-links-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.home-link-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px 22px;
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; box-shadow: var(--shadow-card);
  transition: border-color .18s, box-shadow .18s;
}
.home-link-card:hover {
  border-color: var(--red);
  box-shadow: 0 4px 20px rgba(101,13,0,.1);
}
.home-link-card .hlc-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--red-dim); border: 1px solid var(--red-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0; color: var(--red);
}
.home-link-card h4 { font-size: 13px; font-weight: 600; color: var(--text); }
.home-link-card p  { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ══════════════════════════════════════════════════════════════════════════
   CALCULATOR (migrated from calculator.html, no standalone header/hero)
   ══════════════════════════════════════════════════════════════════════════ */
.calc-layout {
  display: grid;
  grid-template-columns: 480px 1fr;
  gap: 24px; align-items: start;
}

/* Tier selector */
.tier-grid {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 10px; margin-bottom: 24px;
}
.tier-btn {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 12px; padding: 16px 8px 14px;
  cursor: pointer; text-align: center;
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.tier-btn:hover { border-color: var(--red); background: var(--red-dim); }
.tier-btn.active {
  border-color: var(--red); background: var(--red-dim);
  box-shadow: 0 0 0 3px rgba(101,13,0,.08);
}
.tier-pill {
  display: inline-block; font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  padding: 2px 8px; border-radius: 20px; margin-bottom: 9px;
  background: var(--red-dim); color: var(--red);
  border: 1px solid var(--red-border);
}
.tier-btn.active .tier-pill { background: var(--red); color: #fff; border-color: var(--red); }
.tier-name  { font-size: 14px; font-weight: 600; color: var(--text); }
.tier-price { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Domain selector */
.domain-section { display: none; margin-bottom: 22px; }
.domain-section.visible { display: block; }
.domain-select {
  width: 100%; background: var(--surface);
  border: 1.5px solid var(--border2); border-radius: 8px;
  padding: 11px 38px 11px 13px; color: var(--text);
  font-family: inherit; font-size: 14px;
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23650D00'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 17px;
  transition: border-color .15s;
}
.domain-select:focus { outline: none; border-color: var(--red); }

/* Breakdown table */
.breakdown {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; overflow-x: auto; overflow-y: hidden; margin-bottom: 18px;
}
.breakdown table { min-width: 480px; }
.breakdown table { width: 100%; border-collapse: collapse; font-size: 13px; }
.breakdown th {
  background: #edf0f3; padding: 9px 13px;
  text-align: left; font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.breakdown td {
  padding: 12px 13px; border-bottom: 1px solid var(--border); color: var(--muted);
}
.breakdown td:last-child { text-align: right; color: var(--text); font-weight: 600; }
.breakdown td.item-name  { color: var(--text); font-weight: 600; }
.breakdown td.note       { color: var(--subtle); font-style: italic; font-size: 11px; }
.breakdown tr:last-child td { border-bottom: none; }
.breakdown tr.eag-row, .breakdown tr.eag-note-row { display: none; }
.breakdown tr.eag-row.visible, .breakdown tr.eag-note-row.visible { display: table-row; }

/* Total card */
.total-card {
  background: linear-gradient(135deg, #650D00 0%, #8b1200 100%);
  border-radius: 14px; padding: 20px 22px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 4px 20px rgba(101,13,0,.25);
}
.total-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: rgba(255,255,255,.7); margin-bottom: 3px;
}
.total-amount {
  font-family: 'Montagu Slab', serif;
  font-size: 34px; font-weight: 500; color: #fff;
  letter-spacing: -1px; text-align: right;
}
.total-period { font-size: 11px; color: rgba(255,255,255,.55); text-align: right; margin-top: 2px; }
.total-sub    { font-size: 11px; color: rgba(255,255,255,.5); margin-top: 4px; }

/* AI Card */
.ai-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 26px 28px;
  box-shadow: var(--shadow-card); margin-top: 24px;
}
.ai-header { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; }
.ai-icon {
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
  background: var(--red-dim); border: 1px solid var(--red-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--red);
}
.ai-header-text h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.ai-header-text p  { font-size: 12px; color: var(--muted); margin-top: 1px; }
.ai-textarea {
  width: 100%; background: var(--bg);
  border: 1.5px solid var(--border2); border-radius: 10px;
  padding: 12px 14px; color: var(--text);
  font-family: inherit; font-size: 14px;
  resize: vertical; min-height: 88px; line-height: 1.6;
  transition: border-color .15s;
}
.ai-textarea::placeholder { color: var(--subtle); }
.ai-textarea:focus { outline: none; border-color: var(--red); }
.ai-response {
  display: none; margin-top: 14px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
  font-size: 13px; color: var(--dim); line-height: 1.7;
}
.ai-response.visible { display: block; }
.ai-response.error   { border-color: #fca5a5; background: #fff5f5; color: #b91c1c; }
.ai-response.success { border-color: #bbf7d0; background: #f0fdf4; color: var(--dim); }
.ai-response strong  { color: var(--text); }

/* Features table */
.features-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-card);
}
.features-card-header {
  padding: 22px 26px 18px; border-bottom: 1px solid var(--border);
}
.features-card-header .card-label { margin-bottom: 4px; }
.features-card-header p { font-size: 13px; color: var(--muted); }
.features-table-wrap { overflow-x: auto; }
.features-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.features-table th {
  background: #f8f9fb; padding: 11px 15px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.features-table th.tier-col { text-align: center; min-width: 100px; }
.features-table td {
  padding: 10px 15px; border-bottom: 1px solid var(--border);
  color: var(--muted); vertical-align: middle;
}
.features-table td.feat { color: var(--dim); }
.features-table td.tv   { text-align: center; font-size: 13px; font-weight: 500; }
.features-table tr:last-child td { border-bottom: none; }
.features-table tr:hover td { background: #fafbfc; }
.features-table tr.sect td {
  background: #f2f4f7; color: var(--red);
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.8px; padding: 6px 15px;
}
.features-table th.active-col { background: var(--red-dim); color: var(--red); }
.features-table td.active-col { background: rgba(101,13,0,.03); }
.th-badge {
  display: inline-block; margin-top: 5px;
  padding: 2px 9px; border-radius: 20px;
  font-size: 10px; font-weight: 600;
  text-transform: none; letter-spacing: 0;
}
.th-t1 { background: rgba(101,13,0,.07); color: var(--red); border: 1px solid var(--red-border); }
.th-t2 { background: rgba(101,13,0,.12); color: var(--red); border: 1px solid rgba(101,13,0,.25); }
.th-t3 { background: var(--red); color: #fff; border: 1px solid var(--red); }
.chk { color: #16a34a; font-size: 15px; font-weight: 700; }
.crs { color: var(--border2); font-size: 15px; }

/* ══════════════════════════════════════════════════════════════════════════
   DOCUMENTS PAGE
   ══════════════════════════════════════════════════════════════════════════ */
.docs-filters {
  display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap;
}
.docs-filter-btn {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 20px; padding: 6px 14px;
  font-family: inherit; font-size: 12px; font-weight: 500;
  color: var(--muted); cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.docs-filter-btn:hover { border-color: var(--red); color: var(--red); }
.docs-filter-btn.active {
  background: var(--red); color: #fff; border-color: var(--red);
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.doc-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
  transition: border-color .18s, box-shadow .18s;
}
.doc-card:hover { border-color: var(--red-border); box-shadow: 0 4px 20px rgba(101,13,0,.08); }
.doc-card-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--red-dim); border: 1px solid var(--red-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 12px; flex-shrink: 0;
  color: var(--red);
}
.doc-card h4  { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.doc-card p   { font-size: 12px; color: var(--muted); line-height: 1.5; flex: 1; margin-bottom: 14px; }
.doc-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto;
}
.doc-size { font-size: 11px; color: var(--subtle); }

/* ══════════════════════════════════════════════════════════════════════════
   CERTIFICATE PAGE
   ══════════════════════════════════════════════════════════════════════════ */
.cert-profile-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 44px 40px;
  box-shadow: var(--shadow-deep);
  max-width: 560px; margin: 0 auto;
  text-align: center;
}
.cert-profile-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 22px; border-radius: 30px;
  font-size: 12px; font-weight: 600; color: #fff;
  letter-spacing: 0.5px; margin-bottom: 26px;
}
.cert-profile-badge i { font-size: 16px; }
.cert-profile-company {
  font-family: 'Montagu Slab', serif;
  font-size: 30px; font-weight: 600; color: var(--text);
  margin-bottom: 6px; line-height: 1.2;
}
.cert-profile-domain {
  font-size: 13px; color: var(--subtle); letter-spacing: 1px;
  margin-bottom: 16px;
}
.cert-profile-contact {
  font-size: 13px; color: var(--muted); margin-bottom: 22px;
}
.cert-profile-contact i { margin-right: 4px; }
.cert-profile-dates {
  display: flex; justify-content: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.cert-date-chip {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 16px;
  font-size: 13px; color: var(--dim); text-align: left;
}
.cert-date-chip span {
  display: block; font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--muted); margin-bottom: 3px;
}
.cert-profile-ref {
  font-size: 10px; color: var(--subtle); letter-spacing: 1.5px;
  text-transform: uppercase; margin-bottom: 30px;
}
.cert-profile-actions {
  border-top: 1px solid var(--border); padding-top: 24px;
}
.cert-print-hint {
  font-size: 11px; color: var(--subtle); margin-top: 10px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}

/* ══════════════════════════════════════════════════════════════════════════
   SUPPORT PAGE
   ══════════════════════════════════════════════════════════════════════════ */
.support-wrap {
  max-width: 640px;
}

/* ══════════════════════════════════════════════════════════════════════════
   ADMIN PANEL
   ══════════════════════════════════════════════════════════════════════════ */
.admin-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; flex-wrap: wrap; gap: 12px;
}
.admin-toolbar h2 {
  font-size: 16px; font-weight: 600; color: var(--text);
}
.filter-row {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px;
}
.filter-row .input, .filter-row .select {
  max-width: 220px; font-size: 13px; padding: 8px 11px;
}
.filter-row .select { max-width: 180px; }

/* Log row metadata expand */
.log-meta {
  font-size: 11px; color: var(--subtle); font-family: monospace;
  white-space: pre-wrap; word-break: break-all;
}

/* Upload doc form */
.upload-form {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 24px; margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}
.upload-form h3 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 18px; }
.file-drop-zone {
  border: 2px dashed var(--border2);
  border-radius: 10px; padding: 28px;
  text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
  margin-bottom: 16px;
}
.file-drop-zone:hover, .file-drop-zone.dragover {
  border-color: var(--red); background: var(--red-dim);
}
.file-drop-zone-icon { font-size: 28px; margin-bottom: 8px; opacity: .5; line-height: 1; }
.file-drop-zone-icon i { font-size: 28px; }
.file-drop-zone p { font-size: 13px; color: var(--muted); }
.file-drop-zone input[type=file] { display: none; }
.file-selected {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px;
  font-size: 13px; color: var(--dim); margin-bottom: 16px;
  display: none;
}
.file-selected.visible { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .calc-layout { grid-template-columns: 420px 1fr; }
  .home-grid { grid-template-columns: repeat(2, 1fr); }
}

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

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 32px rgba(0,0,0,.4);
  }
  .sidebar.open { transform: translateX(0); }
  .app-content { margin-left: 0; }
  .topbar-hamburger { display: block; }
  .page-wrap { padding: 20px 18px 48px; }
  .topbar { padding: 0 18px; }
  .home-grid { grid-template-columns: 1fr; }
  .home-links-grid { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .app-footer { padding: 14px 18px; }
}

@media (max-width: 600px) {
  html, body { overflow-x: hidden; }
  .tier-grid  { gap: 8px; }
  .tier-btn   { padding: 12px 4px 10px; border-radius: 10px; }
  .tier-pill  { font-size: 8px; padding: 2px 6px; margin-bottom: 7px; }
  .tier-name  { font-size: 13px; }
  .tier-price { font-size: 10px; margin-top: 3px; }
  .total-card { flex-direction: column; align-items: stretch; gap: 10px; padding: 18px; }
  .total-amount { font-size: 32px; text-align: left; }
  .total-period { text-align: left; }
  .breakdown table  { font-size: 12px; }
  .breakdown th     { padding: 8px; font-size: 8px; }
  .breakdown td     { padding: 10px 8px; }
  .breakdown th:nth-child(2), .breakdown td:nth-child(2),
  .breakdown th:nth-child(5), .breakdown td:nth-child(5) { display: none; }
  .features-table th { padding: 10px 10px; font-size: 9px; }
  .features-table td { padding: 9px 10px; font-size: 12px; }
  .features-table th.tier-col { min-width: 80px; }
  .th-badge { padding: 2px 7px; font-size: 9px; }
  .ai-icon  { width: 38px; height: 38px; border-radius: 9px; font-size: 16px; }
  .ai-header-text h3 { font-size: 14px; }
  .ai-textarea  { font-size: 14px; min-height: 80px; }
  .btn-cta { font-size: 14px; height: 46px; line-height: 46px; }
  .docs-grid { grid-template-columns: 1fr; }
}

/* ── Sidebar overlay on mobile ── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 199;
}
.sidebar-overlay.visible { display: block; }

/* ══════════════════════════════════════════════════════════════════════════
   NNEAT CLIENTS PORTAL — Extended styles
   ══════════════════════════════════════════════════════════════════════════ */

/* ── KPI CARDS ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px; margin-bottom: 28px;
}
.kpi-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px 18px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 6px;
  transition: box-shadow .18s;
}
.kpi-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.1); }
.kpi-card.kpi-danger { border-color: #fca5a5; background: #fff5f5; }
.kpi-card.kpi-warn   { border-color: #fde68a; background: #fffbeb; }
.kpi-card.kpi-ok     { border-color: #bbf7d0; background: #f0fdf4; }
.kpi-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--red-dim); border: 1px solid var(--red-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: var(--red); margin-bottom: 4px;
}
.kpi-danger .kpi-icon { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }
.kpi-warn .kpi-icon   { background: #fef3c7; border-color: #fde68a; color: #d97706; }
.kpi-ok .kpi-icon     { background: #dcfce7; border-color: #bbf7d0; color: #16a34a; }
.kpi-value {
  font-family: 'Montagu Slab', serif;
  font-size: 30px; font-weight: 500; color: var(--text);
  line-height: 1;
}
.kpi-danger .kpi-value { color: #dc2626; }
.kpi-warn .kpi-value   { color: #d97706; }
.kpi-ok .kpi-value     { color: #16a34a; }
.kpi-label {
  font-size: 11px; color: var(--muted); line-height: 1.4;
}

/* ── ALERT ITEMS (dashboard) ── */
.alerts-list {
  display: flex; flex-direction: column; gap: 8px;
}
.alert-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px;
  font-size: 13px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.alert-item:hover { border-color: var(--red-border); box-shadow: 0 2px 10px rgba(101,13,0,.06); }
.alert-item .ai-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.ai-dot-red    { background: #dc2626; }
.ai-dot-orange { background: #d97706; }
.ai-dot-blue   { background: #2563eb; }
.ai-dot-gray   { background: #9ca3af; }
.alert-item .ai-type { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); width: 110px; flex-shrink: 0; }
.alert-item .ai-detail { flex: 1; color: var(--text); font-weight: 500; }
.alert-item .ai-meta   { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ── CHART WRAPPER ── */
.chart-wrap {
  position: relative;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 22px;
  box-shadow: var(--shadow-card);
}
.chart-wrap h3 {
  font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 16px;
}
.chart-wrap canvas { max-height: 260px; }

/* ── DASHBOARD GRID ── */
.dash-row {
  display: grid; gap: 18px; margin-bottom: 20px;
}
.dash-row-2 { grid-template-columns: 2fr 1fr; }
.dash-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── MODULE BADGES ── */
.mod-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.mod-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 20px;
  font-size: 10px; font-weight: 600;
  background: var(--red-dim); color: var(--red);
  border: 1px solid var(--red-border);
  white-space: nowrap;
}
.mod-badge i { font-size: 11px; }
.mod-badge-surface    { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.mod-badge-compliance { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.mod-badge-siem       { background: #f3e8ff; color: #7c3aed; border-color: #e9d5ff; }
.mod-badge-ticketing  { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.mod-badge-agent      { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.mod-badge-defend     { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.mod-badge-service    { background: #f8fafc; color: #475569; border-color: #e2e8f0; }
.mod-badge-early_warning { background: #fdf2f8; color: #9d174d; border-color: #fbcfe8; }
.mod-badge-spores        { background: #fdf4ff; color: #7e22ce; border-color: #e9d5ff; }

/* ── POC BADGE ── */
.poc-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 10px; font-weight: 700;
  background: #fff7ed; color: #c2410c;
  border: 1px solid #fed7aa;
}

/* ── LICENSE STATUS ── */
.lic-badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 10px; font-weight: 600;
}
.lic-expired  { background: #fee2e2; color: #dc2626; }
.lic-expiring { background: #fef3c7; color: #92400e; }
.lic-ok       { background: #dcfce7; color: #15803d; }
.lic-none     { background: #f3f4f6; color: #6b7280; }

/* ── USER STATUS ── */
.status-active   { color: #15803d; font-weight: 600; }
.status-inactive { color: #9ca3af; }
.status-never    { color: #dc2626; font-weight: 600; }

/* ── CLIENT DETAIL SECTIONS ── */
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 18px; margin-bottom: 20px;
  align-items: start;
}
.detail-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-row .info-label { color: var(--muted); }
.info-row .info-value { color: var(--text); font-weight: 500; text-align: right; overflow-wrap: break-word; word-break: break-word; }

/* ── BAR PROGRESS ── */
.bar-progress {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px;
}
.bar-track {
  flex: 1; height: 6px; background: var(--border);
  border-radius: 3px; overflow: hidden;
}
.bar-fill {
  height: 100%; background: var(--red);
  border-radius: 3px; transition: width .4s;
}

/* ── CRM ── */
.crm-tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  border-bottom: 2px solid var(--border); padding-bottom: 0;
}
.crm-tab {
  padding: 10px 18px; font-size: 13px; font-weight: 500;
  color: var(--muted); cursor: pointer;
  border: none; background: none; font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.crm-tab.active { color: var(--red); border-bottom-color: var(--red); }
.crm-tab:hover:not(.active) { color: var(--dim); }

.crm-panel { display: none; }
.crm-panel.active { display: block; }

.crm-alert-banner {
  background: #fff7ed; border: 1px solid #fed7aa;
  border-radius: 10px; padding: 12px 16px;
  font-size: 13px; color: #92400e; margin-bottom: 18px;
  display: flex; align-items: center; gap: 10px;
}

/* ── MODAL ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 500; display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 16px;
  padding: 32px; width: 100%; max-width: 520px;
  box-shadow: var(--shadow-deep);
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.modal-header h2 { font-size: 17px; font-weight: 600; color: var(--text); }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--muted); padding: 4px;
  border-radius: 6px; transition: color .15s;
}
.modal-close:hover { color: var(--text); }
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 24px; padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ── ANALYTICS ── */
.analytics-filters {
  display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap;
  align-items: center;
}
.analytics-filters .btn-group {
  display: flex; border: 1.5px solid var(--border2); border-radius: 8px; overflow: hidden;
}
.analytics-filters .btn-group button {
  background: none; border: none; border-right: 1px solid var(--border2);
  padding: 7px 14px; font-size: 12px; font-weight: 500;
  color: var(--muted); cursor: pointer; font-family: inherit;
  transition: background .15s, color .15s;
}
.analytics-filters .btn-group button:last-child { border-right: none; }
.analytics-filters .btn-group button.active { background: var(--red); color: #fff; }
.analytics-filters .btn-group button:not(.active):hover { background: var(--bg); color: var(--dim); }

.analytics-grid-2 {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 18px; margin-bottom: 18px;
}

/* ── CAMPAIGNS ── */
.campaign-status-draft { background: #f3f4f6; color: #4b5563; }
.campaign-status-sent  { background: #dcfce7; color: #15803d; }
.campaign-row-status {
  display: inline-block; padding: 2px 9px;
  border-radius: 20px; font-size: 10px; font-weight: 600;
}
.recipient-status-pending { color: #d97706; }
.recipient-status-sent    { color: #15803d; }
.recipient-status-failed  { color: #dc2626; }

/* ── SECTION HEADER ROW ── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-header h2 {
  font-size: 15px; font-weight: 600; color: var(--text);
}

/* ── TENANT CARD HEADER (detail view) ── */
.tenant-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 22px 24px; margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}
.tenant-header-left h1 {
  font-family: 'Montagu Slab', serif;
  font-size: 22px; font-weight: 500; color: var(--text);
  margin-bottom: 4px;
}
.tenant-header-left .tenant-sub {
  font-size: 13px; color: var(--muted);
}
.tenant-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ── API ACCESS BADGES ── */
.api-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 10px; font-weight: 600;
  background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0;
}

/* ── BACK BUTTON ── */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); cursor: pointer;
  background: none; border: none; font-family: inherit;
  padding: 0 0 16px; transition: color .15s;
}
.back-btn:hover { color: var(--red); }

/* ── INLINE NOTE CARD ── */
.note-card {
  background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 10px; padding: 12px 14px; margin-bottom: 10px;
  font-size: 13px; color: var(--dim); line-height: 1.5;
}
.note-card-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.note-card-meta .note-author { font-size: 11px; font-weight: 600; color: var(--muted); }
.note-card-meta .note-date   { font-size: 11px; color: var(--subtle); }

/* ── MEETING CARD ── */
.meeting-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 10px;
  font-size: 13px;
}
.meeting-card-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.meeting-date { font-size: 12px; font-weight: 700; color: var(--red); }
.meeting-tenant { font-size: 12px; color: var(--muted); }
.meeting-summary { color: var(--dim); line-height: 1.5; margin-bottom: 6px; }
.meeting-next {
  font-size: 11px; color: #16a34a; font-weight: 600;
  display: flex; align-items: center; gap: 5px;
}

/* ── RESPONSIVE CLIENTS-SPECIFIC ── */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-row-2 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .analytics-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .dash-row-3 { grid-template-columns: 1fr; }
}

/* ── Health Score cards ── */
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.health-card { background: var(--card); border: 2px solid var(--border); border-radius: 16px; padding: 22px; box-shadow: var(--shadow-card); transition: box-shadow .18s, transform .15s; }
.health-card:hover { box-shadow: 0 4px 24px rgba(0,0,0,.12); transform: translateY(-2px); }
.health-card.green  { border-color: #bbf7d0; }
.health-card.yellow { border-color: #fde68a; }
.health-card.red    { border-color: #fca5a5; }
.health-score-num { font-family: 'Montagu Slab', serif; font-size: 44px; font-weight: 500; line-height: 1; }
.health-score-num.green  { color: #15803d; }
.health-score-num.yellow { color: #d97706; }
.health-score-num.red    { color: #dc2626; }
.health-score-dim { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 12px; }
.health-score-dim-label { width: 88px; color: var(--muted); flex-shrink: 0; }
.health-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.health-bar-fill { height: 100%; border-radius: 3px; transition: width .4s; }
.health-bar-fill.green  { background: #16a34a; }
.health-bar-fill.yellow { background: #d97706; }
.health-bar-fill.red    { background: #dc2626; }

/* ── Adoption ── */
.adoption-pct-bar  { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.adoption-pct-fill { height: 100%; border-radius: 4px; transition: width .4s; }
.adoption-row-detail { background: #fafbfc; border-top: 1px solid var(--border); padding: 14px 16px; font-size: 13px; }

/* ── Activity Feed ── */
.feed-day  { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); margin: 20px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.feed-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: none; }
.feed-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.feed-icon-login    { background: #dbeafe; color: #2563eb; }
.feed-icon-security { background: #f3e8ff; color: #7c3aed; }
.feed-icon-admin    { background: #fef3c7; color: #92400e; }
.feed-user   { font-weight: 600; color: var(--text); font-size: 13px; }
.feed-tenant { font-size: 11px; color: var(--muted); margin-top: 2px; }
.feed-time   { font-size: 11px; color: var(--subtle); white-space: nowrap; flex-shrink: 0; padding-top: 2px; }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE UTILITIES — replace inline grid styles so media queries work
   ══════════════════════════════════════════════════════════════════════════ */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.grid-2col-start {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

/* ══════════════════════════════════════════════════════════════════════════
   MOBILE — ≤ 768px
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Prevent any child from causing page-level horizontal scroll */
  .app-content { overflow-x: hidden; }
  .page-wrap   { overflow-x: hidden; }

  /* Grid utilities collapse to 1 column */
  .grid-2col, .grid-2col-start { grid-template-columns: 1fr; gap: 14px; }

  /* Tables: let them scroll inside their wrapper */
  .data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table th   { padding: 8px 10px; font-size: 8px; letter-spacing: 0.8px; white-space: nowrap; }
  .data-table td   { padding: 9px 10px; font-size: 12px; }

  /* Page headers */
  .page-header h1  { font-size: 20px; }
  .page-header p   { font-size: 13px; }
  .page-header     { margin-bottom: 18px; }

  /* Cards */
  .card { padding: 18px 14px; }

  /* Tenant detail header */
  .tenant-header { flex-direction: column; gap: 10px; }
  .tenant-header > div:last-child { align-self: flex-start; }
  .tenant-badges { flex-wrap: wrap; gap: 6px; }

  /* Alert items */
  .alert-item { flex-wrap: wrap; gap: 6px; }
  .alert-item .ai-type { width: auto; min-width: 80px; }
  .alert-item .ai-meta { font-size: 10px; }

  /* Modals — near full screen on mobile */
  .modal-backdrop { padding: 10px; align-items: flex-end; }
  .modal { padding: 24px 16px 20px; max-height: 92vh; border-radius: 16px 16px 0 0; width: 100%; max-width: 100%; }

  /* Topbar */
  .topbar-tag { display: none; }
  .topbar-title { font-size: 22px; }

  /* Charts — cap height on mobile */
  .chart-wrap canvas { max-height: 220px !important; }
  .chart-wrap h3 { font-size: 12px; }

  /* Analytics filters */
  .analytics-filters { gap: 8px; flex-wrap: wrap; }
  .analytics-filters .btn-group button { padding: 6px 10px; font-size: 11px; }
  .analytics-filters .select { max-width: 100% !important; font-size: 12px; }

  /* KPI cards */
  .kpi-value { font-size: 26px; }
  .kpi-label { font-size: 10px; }

  /* Health cards */
  .health-grid { grid-template-columns: 1fr; }
  .health-score-num { font-size: 38px; }

  /* CRM */
  .crm-tab { padding: 8px 12px; font-size: 12px; }
  .crm-alert-banner { font-size: 12px; }

  /* Activity feed */
  .feed-item { flex-wrap: wrap; }
  .feed-time { width: 100%; text-align: right; font-size: 10px; margin-top: 2px; }
  .feed-icon { width: 28px; height: 28px; font-size: 13px; }

  /* Adoption bars */
  .adoption-pct-bar { min-width: 60px; }

  /* Back button */
  .back-btn { padding: 0 0 12px; font-size: 12px; }

  /* Docs filters */
  .docs-filters { gap: 6px; }
  .docs-filter-btn { padding: 5px 10px; font-size: 11px; }

  /* Info rows */
  .info-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .info-row .info-value { text-align: left; }

  /* Section headers */
  .section-header h2 { font-size: 13px; }

  /* Admin toolbar */
  .admin-toolbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .filter-row { flex-direction: column; gap: 8px; }
  .filter-row .input, .filter-row .select { max-width: 100%; }

  /* Note/meeting cards */
  .note-card, .meeting-card { font-size: 12px; padding: 10px 12px; }

  /* Mod badges */
  .mod-badges { gap: 3px; }
  .mod-badge { font-size: 9px; padding: 2px 5px; }

  /* PoC badge */
  .poc-badge { font-size: 9px; padding: 2px 7px; }

  /* Buttons */
  .btn-sm { padding: 5px 10px; font-size: 11px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   SMALL PHONES — ≤ 480px
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

  .page-wrap { padding: 14px 12px 48px; }

  /* KPI grid: force 2 per row on small phones */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi-card { padding: 12px 10px; }
  .kpi-value { font-size: 22px; }
  .kpi-icon  { width: 28px; height: 28px; font-size: 13px; border-radius: 8px; }
  .kpi-label { font-size: 9px; }

  /* OTP inputs */
  .otp-wrap { gap: 4px; }
  .otp-digit, .partner-otp-digit { width: 36px; height: 44px; font-size: 18px; border-radius: 8px; }

  /* Tables on tiny screens: key columns only by hiding less-important ones */
  /* Each table can opt-in by adding .table-compact to its wrapper */
  .table-compact .data-table th:nth-child(n+5),
  .table-compact .data-table td:nth-child(n+5) { display: none; }

  /* Badges */
  .badge { font-size: 8px; padding: 2px 6px; }
  .lic-badge { font-size: 9px; }

  /* Cards */
  .card { padding: 14px 12px; border-radius: 12px; }
  .card-label { font-size: 9px; margin-bottom: 14px; }

  /* Chart heights */
  .chart-wrap canvas { max-height: 180px !important; }

  /* Modal full height */
  .modal { padding: 20px 14px 16px; }

  /* Detail grid: reduce gap */
  .detail-grid { gap: 12px; }

  /* Health scores on tiny phones */
  .health-card { padding: 16px 14px; border-radius: 12px; }
  .health-score-num { font-size: 32px; }
  .health-score-dim-label { width: 72px; font-size: 11px; }
}

/* ── Login box on very small phones ── */
@media (max-width: 420px) {
  .login-box { padding: 36px 22px; border-radius: 16px; }
  .login-title { font-size: 18px; }
  .login-sub { font-size: 12px; margin-bottom: 20px; }
}

/* ── Masonry (client detail) — CSS columns, no JS needed, never breaks ── */
.masonry-grid {
  columns: 2;
  column-gap: 18px;
  margin-bottom: 20px;
}
.masonry-item {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  margin-bottom: 18px;
  display: block;
  width: 100%;
}
@media (max-width: 1100px) {
  .masonry-grid { columns: 1; }
  .masonry-item { margin-bottom: 14px; }
}
