/* =============================================================================
   Oakscroft Partner Network — Design System
   Premium SaaS · Stripe / Linear inspired · Custom CSS (no Bootstrap)
   ============================================================================= */

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #f4f6f9;
  --bg-elevated: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-sidebar: #0b1220;
  --bg-sidebar-hover: rgba(255,255,255,0.06);
  --bg-sidebar-active: rgba(20,184,166,0.15);
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #f8fafc;
  --primary: #0f766e;
  --primary-hover: #0d9488;
  --primary-soft: #ccfbf1;
  --primary-rgb: 15, 118, 110;
  --accent: #14b8a6;
  --success: #059669;
  --success-soft: #d1fae5;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(15,23,42,0.04), 0 4px 16px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 24px rgba(15,23,42,0.08);
  --shadow-lg: 0 12px 40px rgba(15,23,42,0.12);
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --transition: 180ms ease;
  --glass: rgba(255,255,255,0.72);
}

[data-theme="dark"] {
  --bg: #0b1220;
  --bg-elevated: #111827;
  --bg-muted: #1e293b;
  --border: #1e293b;
  --border-strong: #334155;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --shadow: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.3);
  --glass: rgba(17,24,39,0.8);
  --primary-soft: rgba(20,184,166,0.15);
  --success-soft: rgba(5,150,105,0.15);
  --warning-soft: rgba(217,119,6,0.15);
  --danger-soft: rgba(220,38,38,0.15);
  --info-soft: rgba(37,99,235,0.15);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1,h2,h3,h4,h5,h6 { margin: 0 0 0.5rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; }
ul { margin: 0; padding: 0; list-style: none; }

/* Layout shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-inverse);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-brand .logo-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  display: grid; place-items: center; font-weight: 700; font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(20,184,166,0.35);
}
.sidebar-brand .brand-text { display: flex; flex-direction: column; }
.sidebar-brand .brand-text strong { font-size: 0.9rem; letter-spacing: -0.01em; }
.sidebar-brand .brand-text span { font-size: 0.7rem; color: #94a3b8; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 1rem 0.75rem; }
.nav-section { margin-bottom: 1.25rem; }
.nav-section-title {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: #64748b; padding: 0 0.75rem; margin-bottom: 0.4rem; font-weight: 600;
}
.nav-link {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.75rem; border-radius: var(--radius-sm);
  color: #cbd5e1; font-size: 0.875rem; font-weight: 500;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
}
.nav-link:hover { background: var(--bg-sidebar-hover); color: #fff; }
.nav-link.active { background: var(--bg-sidebar-active); color: #5eead4; }
.nav-link i, .nav-link svg { width: 18px; height: 18px; opacity: 0.9; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: #f59e0b; color: #111;
  font-size: 0.65rem; font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 999px;
}

.main-wrap {
  flex: 1; margin-left: var(--sidebar-width);
  min-width: 0; min-height: 100vh;
  display: flex; flex-direction: column;
}
.topbar {
  height: var(--topbar-height);
  background: var(--glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; position: sticky; top: 0; z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 0.75rem; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.page-content { padding: 1.5rem; flex: 1; min-height: 0; }
.page-header {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem;
}
.page-header .subtitle { color: var(--text-secondary); margin: 0.25rem 0 0; font-size: 0.875rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* Cards */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.card-header h3 { margin: 0; font-size: 0.95rem; }
.card-body { padding: 1.25rem; }
.card-footer { padding: 0.85rem 1.25rem; border-top: 1px solid var(--border); background: var(--bg-muted); border-radius: 0 0 var(--radius) var(--radius); }

/* Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-label {
  font-size: 0.75rem; font-weight: 500; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.35rem;
}
.stat-card .stat-value {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.2;
}
.stat-card .stat-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.35rem; }
.stat-card .stat-icon {
  position: absolute; right: 1rem; top: 1rem;
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap { gap: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.text-right { text-align: right; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th {
  text-align: left; padding: 0.75rem 1rem;
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); font-weight: 600;
  border-bottom: 1px solid var(--border); background: var(--bg-muted);
  white-space: nowrap;
}
.data-table td {
  padding: 0.85rem 1rem; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: rgba(var(--primary-rgb), 0.03); }
.data-table .row-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em;
  text-transform: capitalize; white-space: nowrap;
}
.badge-pending, .badge-draft { background: var(--warning-soft); color: var(--warning); }
.badge-approved, .badge-active, .badge-paid, .badge-delivered, .badge-confirmed, .badge-success { background: var(--success-soft); color: var(--success); }
.badge-rejected, .badge-cancelled, .badge-failed, .badge-danger, .badge-reversed { background: var(--danger-soft); color: var(--danger); }
.badge-suspended, .badge-inactive, .badge-processing { background: var(--bg-muted); color: var(--text-secondary); }
.badge-shipped, .badge-info { background: var(--info-soft); color: var(--info); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.5rem 1rem; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 550; border: 1px solid transparent;
  cursor: pointer; transition: all var(--transition); line-height: 1.25;
  background: var(--bg-elevated); color: var(--text); text-decoration: none;
  white-space: nowrap;
}
.btn:hover { filter: brightness(0.98); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #0f766e, #0d5f59);
  color: #fff; border-color: #0d5f59;
  box-shadow: 0 1px 2px rgba(15,118,110,0.3);
}
.btn-primary:hover { color: #fff; background: linear-gradient(180deg, #0d9488, #0f766e); }
.btn-secondary { background: var(--bg-elevated); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: var(--bg-muted); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; border-color: #b91c1c; }
.btn-danger:hover { color: #fff; filter: brightness(1.05); }
.btn-success { background: var(--success); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-muted); color: var(--text); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn-lg { padding: 0.7rem 1.25rem; font-size: 0.95rem; }
.btn-icon {
  width: 36px; height: 36px; padding: 0; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-secondary);
  display: inline-grid; place-items: center; cursor: pointer;
}
.btn-icon:hover { background: var(--bg-muted); color: var(--text); }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block; font-size: 0.8rem; font-weight: 550;
  color: var(--text-secondary); margin-bottom: 0.35rem;
}
.form-label .req { color: var(--danger); }
.form-control, .form-select, textarea.form-control {
  width: 100%; padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-elevated); color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus, .form-select:focus, textarea.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}
.form-control.is-invalid { border-color: var(--danger); }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 0.3rem; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check input { width: 16px; height: 16px; accent-color: var(--primary); }

/* Filters bar */
.filters-bar {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center;
  margin-bottom: 1rem; padding: 0.85rem 1rem;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.filters-bar .form-control, .filters-bar .form-select {
  width: auto; min-width: 160px;
}
.search-input { min-width: 220px !important; }

/* Tabs / pills */
.pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.pill {
  padding: 0.35rem 0.85rem; border-radius: 999px; font-size: 0.8rem; font-weight: 500;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-secondary);
}
.pill:hover { border-color: var(--primary); color: var(--primary); }
.pill.active { background: var(--primary-soft); border-color: transparent; color: var(--primary); font-weight: 600; }
.pill .count {
  margin-left: 0.3rem; background: rgba(0,0,0,0.06); padding: 0.05rem 0.4rem;
  border-radius: 999px; font-size: 0.7rem;
}

/* Alerts & toast */
.alert {
  padding: 0.85rem 1rem; border-radius: var(--radius-sm);
  margin-bottom: 1rem; font-size: 0.875rem;
  display: flex; align-items: flex-start; gap: 0.6rem;
  border: 1px solid transparent;
}
/* Author display:flex above must not override the HTML hidden attribute (Dismiss button) */
.alert[hidden],
[hidden],
.opn-push-banner-hidden {
  display: none !important;
}
.alert-success { background: var(--success-soft); color: #065f46; border-color: #a7f3d0; }
.alert-error { background: var(--danger-soft); color: #991b1b; border-color: #fecaca; }
.alert-warning { background: var(--warning-soft); color: #92400e; border-color: #fde68a; }
.alert-info { background: var(--info-soft); color: #1e40af; border-color: #bfdbfe; }

.toast-container {
  position: fixed; top: 1rem; right: 1rem; z-index: 100;
  display: flex; flex-direction: column; gap: 0.5rem; max-width: 380px;
}
.toast {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 0.85rem 1rem; animation: slideIn 0.25s ease;
  display: flex; gap: 0.6rem; align-items: flex-start;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

/* Empty state */
.empty-state {
  text-align: center; padding: 3rem 1.5rem; color: var(--text-secondary);
}
.empty-state .empty-icon {
  width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 16px;
  background: var(--bg-muted); display: grid; place-items: center; color: var(--text-muted);
}
.empty-state h3 { margin-bottom: 0.35rem; color: var(--text); }
.empty-state p { max-width: 360px; margin: 0 auto 1.25rem; }

/* Pagination */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem; padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
}
.pagination-links { display: flex; gap: 0.25rem; }
.pagination-links a, .pagination-links span {
  min-width: 32px; height: 32px; display: inline-grid; place-items: center;
  border-radius: 6px; font-size: 0.8rem; border: 1px solid var(--border);
  color: var(--text-secondary); padding: 0 0.4rem;
}
.pagination-links a:hover { border-color: var(--primary); color: var(--primary); }
.pagination-links .current {
  background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600;
}

/* Auth layout */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}
.auth-card.wide { max-width: 640px; }
.auth-logo {
  display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem;
}
.auth-logo .mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  display: grid; place-items: center; color: #fff; font-weight: 700;
}
.auth-title { font-size: 1.35rem; margin-bottom: 0.25rem; }
.auth-subtitle { color: var(--text-secondary); margin-bottom: 1.5rem; font-size: 0.875rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; font-size: 0.875rem; color: var(--text-secondary); }

/* Premium login card (Affiliate + Super Admin share this screen) */
.auth-login-card {
  max-width: 440px;
  padding: 2.25rem 2rem 1.75rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 40px rgba(15, 23, 42, 0.08);
}
.auth-login-brand {
  text-align: center;
  margin-bottom: 1.35rem;
}
.auth-login-logo {
  display: block;
  margin: 0 auto 0.85rem;
  height: 80px;
  width: auto;
  max-width: min(260px, 100%);
  object-fit: contain;
  object-position: center;
}
.auth-login-product {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.auth-login-heading {
  text-align: center;
  margin-bottom: 1.35rem;
}
.auth-login-card .auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.3rem;
  color: var(--text);
}
.auth-login-card .auth-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.auth-password-label {
  margin: 0 0 0.85rem;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--text-secondary);
}
.auth-login-form .form-group {
  margin-bottom: 1.05rem;
}
.auth-login-form .form-label {
  margin-bottom: 0.4rem;
  font-size: 0.8125rem;
}
.auth-login-form .form-control {
  height: 46px;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  border-color: var(--border-strong);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.auth-login-form .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.16);
}
.auth-login-submit {
  margin-top: 0.25rem;
  height: 48px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: filter var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.25);
}
.auth-login-submit:hover {
  filter: brightness(1.05);
}
.auth-login-submit:active {
  transform: scale(0.99);
}
.auth-login-card .auth-methods .btn {
  height: 46px;
  border-radius: 10px;
  font-weight: 550;
}
.auth-login-card .otp-panel {
  border-radius: 12px;
}
.auth-login-card .phone-prefix {
  border-radius: 10px 0 0 10px;
}
.auth-login-card .phone-row .form-control {
  height: 46px;
  border-radius: 0 10px 10px 0;
}
.auth-login-card .auth-footer {
  margin-top: 1.35rem;
}
.auth-login-card .auth-legal-links {
  margin-top: 1rem;
}
.auth-login-credit {
  margin-top: 1.5rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
  text-align: center;
}
.auth-login-copy {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.auth-login-powered {
  margin: 0.25rem 0 0;
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.85;
}
[data-theme="dark"] .auth-login-card {
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.2),
    0 16px 40px rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] .btn-google {
  background: var(--bg-muted);
  color: var(--text);
}
@media (max-width: 480px) {
  .auth-login-card {
    padding: 1.65rem 1.25rem 1.35rem;
    border-radius: 16px;
  }
  .auth-login-logo {
    height: 70px;
    max-width: 220px;
  }
  .auth-login-card .auth-title {
    font-size: 1.35rem;
  }
}

/* Auth social / OTP (v1.1 — additive only) */
.auth-methods { display: grid; gap: 0.65rem; margin-bottom: 1rem; }
.btn-google {
  background: #fff; color: #1f2937; border-color: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
}
.btn-google:hover { background: var(--bg-muted); color: #111; }
.auth-divider {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 1.15rem 0; color: var(--text-muted); font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.otp-panel {
  margin-bottom: 1rem; padding: 1rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-muted);
}
.phone-row { display: flex; align-items: stretch; gap: 0; }
.phone-prefix {
  display: grid; place-items: center; padding: 0 0.75rem;
  border: 1px solid var(--border-strong); border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--bg-elevated); color: var(--text-secondary); font-weight: 600; font-size: 0.875rem;
}
.phone-row .form-control { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.tabs { display: flex; gap: 0.35rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.tab {
  padding: 0.45rem 0.85rem; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.875rem; font-weight: 500; text-decoration: none;
}
.tab:hover { background: var(--bg-muted); color: var(--text); }
.tab.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* Avatar */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: 0.8rem; flex-shrink: 0;
}
.user-menu { display: flex; align-items: center; gap: 0.6rem; }
.user-menu .meta { line-height: 1.2; }
.user-menu .meta strong { display: block; font-size: 0.85rem; }
.user-menu .meta span { font-size: 0.7rem; color: var(--text-muted); }

/* Chart container */
.chart-box { position: relative; height: 280px; }

/* Link copy box */
.link-box {
  display: flex; gap: 0.5rem; align-items: center;
  background: var(--bg-muted); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.5rem 0.65rem;
}
.link-box input {
  flex: 1; border: none; background: transparent; outline: none;
  font-size: 0.8rem; color: var(--text); min-width: 0;
}

/* Mobile */
.sidebar-toggle { display: none; }
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 35;
}
@media (max-width: 1024px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main-wrap { margin-left: 0; }
  .sidebar-toggle { display: inline-grid; }
  .page-content { padding: 1rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .user-menu .meta { display: none; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 1.5rem; }
}

/* Loading spinner */
.spinner {
  width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* QR box */
.qr-box {
  display: inline-flex; padding: 0.75rem; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}

/* Timeline */
.timeline { border-left: 2px solid var(--border); margin-left: 0.5rem; padding-left: 1.25rem; }
.timeline-item { position: relative; padding-bottom: 1.25rem; }
.timeline-item::before {
  content: ''; position: absolute; left: -1.5rem; top: 0.25rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); border: 2px solid var(--bg-elevated);
}
.timeline-item .time { font-size: 0.75rem; color: var(--text-muted); }

/* Campaign cards (affiliate) */
.campaign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.campaign-card { overflow: hidden; }
.campaign-card-banner {
  height: 140px;
  background: var(--bg-muted);
  overflow: hidden;
}
.campaign-card-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.campaign-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}
.campaign-card-desc {
  margin: 0 0 0.85rem;
  line-height: 1.45;
}
.campaign-card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.campaign-card-actions { margin-top: 0.85rem; }

/* Marketing kit cards (affiliate) — gallery-style fixed previews */
.marketing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  align-items: stretch;
}
.marketing-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
/* Fixed media frame: prevents full-height image stretch */
.marketing-thumb {
  position: relative;
  flex: 0 0 190px;
  width: 100%;
  height: 190px;
  max-height: 190px;
  min-height: 190px;
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
}
.marketing-thumb-link {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 190px;
  position: relative;
  cursor: zoom-in;
  color: inherit;
  text-decoration: none;
}
.marketing-thumb img,
.marketing-thumb video {
  width: 100%;
  height: 100%;
  max-height: 190px;
  object-fit: cover;
  object-position: center;
  display: block;
  border: 0;
}
.marketing-thumb-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.28);
  color: #fff;
  pointer-events: none;
}
.marketing-thumb-overlay i,
.marketing-thumb-overlay svg {
  width: 42px;
  height: 42px;
}
.marketing-thumb-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  height: 100%;
  color: var(--text-secondary);
}
.marketing-thumb-icon i,
.marketing-thumb-icon svg {
  width: 40px;
  height: 40px;
  color: var(--primary);
}
.marketing-thumb-icon span {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.marketing-card-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.marketing-card-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.marketing-card-desc {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.marketing-card-meta {
  margin: 0.5rem 0 0.85rem;
}
.marketing-card-actions {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-end;
}

/* =============================================================================
   Help & FAQ (affiliate help center) — additive module styles only
   ============================================================================= */
.help-search-card .card-body { padding-bottom: 1rem; }
.help-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.help-search-icon {
  position: absolute;
  left: 0.85rem;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}
.help-search-input {
  padding-left: 2.5rem;
}
.faq-section-icon {
  width: 18px;
  height: 18px;
  color: var(--primary);
  margin-right: 0.45rem;
  vertical-align: -3px;
}
.faq-section .card-header h3 {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}
.faq-section-body {
  padding: 0;
}
.faq-item {
  border-bottom: 1px solid var(--border);
}
.faq-item:last-child {
  border-bottom: none;
}
.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 550;
  line-height: 1.4;
  transition: background var(--transition);
}
.faq-question:hover {
  background: var(--bg-muted);
}
.faq-question:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.faq-item.open .faq-question {
  background: rgba(var(--primary-rgb), 0.06);
  color: var(--primary);
}
.faq-chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.25s ease;
}
.faq-item.open .faq-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}
.faq-answer {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.28s ease;
}
.faq-answer-inner {
  padding: 0 1.25rem 1.1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
}
.faq-answer-inner p {
  margin: 0 0 0.65rem;
}
.faq-answer-inner p:last-child {
  margin-bottom: 0;
}
.help-empty {
  margin-top: 0;
}

/* Tips for Success */
.help-tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.help-tip-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.15rem;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  transition: transform var(--transition), box-shadow var(--transition);
}
.help-tip-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.help-tip-card p {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.45;
}
.help-tip-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
}
.help-tip-icon i,
.help-tip-icon svg {
  width: 20px;
  height: 20px;
}

/* Support card */
.help-support-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
}
.help-support-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.help-support-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 1.15rem;
  flex-shrink: 0;
}
.help-support-item a {
  word-break: break-word;
}

@media (max-width: 480px) {
  .help-tips-grid {
    grid-template-columns: 1fr;
  }
  .faq-question {
    padding: 0.9rem 1rem;
    font-size: 0.85rem;
  }
  .faq-answer-inner {
    padding: 0 1rem 1rem;
  }
}

/* =============================================================================
   Support Chat — internal affiliate ↔ admin messaging
   ============================================================================= */
.support-center-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 1rem;
  align-items: start;
  min-height: calc(100vh - 180px);
}
.support-thread-list {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 160px);
  overflow: hidden;
}
.support-thread-search-wrap {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.support-search-form { margin: 0; }
.support-thread-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.support-thread-item {
  display: block;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
  transition: background var(--transition);
}
.support-thread-item:hover {
  background: var(--bg-muted);
  color: inherit;
}
.support-thread-item.active {
  background: rgba(var(--primary-rgb), 0.08);
  border-left: 3px solid var(--primary);
}
.support-thread-item.has-unread strong {
  color: var(--text);
}
.support-thread-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.15rem;
}
.support-thread-preview {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0.25rem 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.support-conversation-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.support-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem 1rem;
}
.support-chat-shell {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  min-height: 480px;
  max-height: calc(100vh - 220px);
}
.support-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-muted);
  flex-shrink: 0;
}
.support-chat-header-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.support-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.support-avatar-admin {
  background: var(--primary-soft);
  color: var(--primary);
}
.support-avatar-admin i,
.support-avatar-admin svg {
  width: 20px;
  height: 20px;
}
.support-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem 1.15rem;
  background:
    radial-gradient(ellipse 80% 50% at 10% 0%, rgba(20,184,166,0.05), transparent),
    var(--bg);
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.support-empty {
  margin: auto;
  text-align: center;
  max-width: 360px;
  color: var(--text-secondary);
  padding: 1.5rem;
}
.support-empty h3 {
  color: var(--text);
  margin-bottom: 0.35rem;
}
.support-empty p {
  margin: 0;
  font-size: 0.875rem;
}
.support-msg {
  display: flex;
  max-width: min(65%, 480px);
  width: fit-content;
}
.support-msg.mine { align-self: flex-end; }
.support-msg.theirs { align-self: flex-start; }
.support-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.7rem 0.9rem;
  box-shadow: var(--shadow);
  position: relative;
  min-width: 120px;
  max-width: 100%;
}
.support-msg.mine .support-bubble {
  background: linear-gradient(180deg, rgba(var(--primary-rgb), 0.12), rgba(var(--primary-rgb), 0.06));
  border-color: rgba(var(--primary-rgb), 0.22);
  border-bottom-right-radius: 4px;
}
.support-msg.theirs .support-bubble {
  border-bottom-left-radius: 4px;
}
.support-msg-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.35rem;
}
.support-sender {
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.support-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.support-msg-text {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
}
.support-msg-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.4rem;
  min-height: 1.1rem;
}
.support-seen {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
}
.support-seen-yes {
  color: var(--primary);
}
.support-seen-delivered {
  color: var(--text-secondary, #64748b);
}
.support-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}
.support-filter-chip {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.support-filter-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.support-filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.support-thread-item-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}
.support-thread-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-muted);
}
.support-thread-avatar-fallback {
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary);
  background: var(--primary-soft, #eef2ff);
}
.support-thread-item-body {
  min-width: 0;
  flex: 1;
}
.support-avatar-img {
  object-fit: cover;
  padding: 0;
}
.support-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-muted);
}
.support-new-chat-results {
  margin-top: 0.75rem;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.support-new-chat-item {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  padding: 0.65rem 0.75rem;
  cursor: pointer;
}
.support-new-chat-item:last-child {
  border-bottom: none;
}
.support-new-chat-item:hover {
  background: var(--bg-muted);
}
@media (max-width: 900px) {
  .support-center-layout {
    grid-template-columns: 1fr;
  }
  .support-thread-list {
    max-height: 40vh;
  }
  .support-quick-actions {
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .support-quick-actions .btn {
    white-space: nowrap;
  }
}
.support-delete-btn {
  opacity: 0;
  border: none;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  padding: 0.15rem;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  transition: opacity var(--transition), background var(--transition);
}
.support-bubble:hover .support-delete-btn,
.support-delete-btn:focus {
  opacity: 1;
}
.support-delete-btn:hover {
  background: var(--danger-soft);
}
.support-delete-btn i,
.support-delete-btn svg {
  width: 14px;
  height: 14px;
}
.support-attach {
  margin-top: 0.5rem;
}
.support-attach-image img {
  max-width: 260px;
  max-height: 320px;
  width: auto;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  object-fit: contain;
  background: var(--bg-muted);
  display: block;
}
.support-attach-audio audio,
.support-attach-video video {
  width: 100%;
  max-width: 360px;
  border-radius: var(--radius-sm);
  background: #000;
}
.support-attach-doc {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}
.support-doc-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.support-doc-icon i,
.support-doc-icon svg {
  width: 18px;
  height: 18px;
}
.support-doc-meta { flex: 1; min-width: 100px; }
.support-composer {
  border-top: 1px solid var(--border);
  padding: 0.85rem 1rem 1rem;
  background: var(--bg-elevated);
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 2;
}
.support-attach-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  margin-bottom: 0.5rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}
.support-send-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}
.support-message-input {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  line-height: 1.4;
  overflow-y: auto;
}
.support-composer-hint {
  margin-top: 0.45rem;
}
.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

/* Affiliate Support Chat — same components as Admin; full-height flex page */
.support-page-affiliate {
  display: flex;
  flex-direction: column;
  /* Fallback when :has() is unavailable: leave room for topbar + footer card */
  min-height: calc(100vh - var(--topbar-height) - 12rem);
}
.support-page-affiliate .page-header {
  flex-shrink: 0;
  margin-bottom: 1rem;
}
.support-page-affiliate .support-conversation-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.support-page-affiliate .support-chat-shell {
  flex: 1 1 auto;
  min-height: 480px;
  max-height: none;
  height: 100%;
}
/* Prefer true remaining viewport height via layout flex chain */
.page-content:has(.support-page-affiliate) {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.page-content:has(.support-page-affiliate) .support-page-affiliate {
  flex: 1 1 auto;
  min-height: 0;
}

@media (max-width: 1024px) {
  .support-center-layout {
    grid-template-columns: 1fr;
  }
  .support-thread-list {
    max-height: 320px;
  }
  .support-center-layout .support-chat-shell {
    max-height: none;
    min-height: 520px;
  }
  .support-page-affiliate {
    min-height: calc(100vh - var(--topbar-height) - 8rem);
  }
}
@media (max-width: 640px) {
  .support-msg {
    max-width: min(88%, 420px);
  }
  .support-send-form {
    flex-wrap: wrap;
  }
  .support-send-form .support-message-input {
    order: -1;
    flex: 1 1 100%;
  }
  .support-center-layout .support-chat-shell {
    min-height: 460px;
  }
  .support-page-affiliate .support-chat-shell {
    min-height: 420px;
  }
  .support-attach-image img,
  .support-img-open img {
    max-width: min(260px, 100%);
  }
}

/* Support Chat enhancements — presence, lightbox, drop zone, downloads */
.support-presence {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-weight: 500;
}
.support-presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.support-presence-dot.online {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}
.support-img-open {
  display: block;
  padding: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  max-width: 260px;
}
.support-img-open img {
  max-width: 260px;
  max-height: 320px;
  width: auto;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  object-fit: contain;
  background: var(--bg-muted);
  display: block;
}
.support-attach-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.45rem;
}
.support-dl-btn {
  margin-top: 0;
}
.support-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: rgba(var(--primary-rgb), 0.12);
  border: 2px dashed var(--primary);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  pointer-events: none;
}
.support-drop-overlay-inner {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  color: var(--primary);
  box-shadow: var(--shadow-md);
}
.support-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, 0.88);
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.support-lightbox[hidden] {
  display: none !important;
}
.support-lightbox img {
  max-width: min(96vw, 1100px);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  background: #000;
}
.support-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.support-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
}
.support-dashboard-widget:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.nav-badge[hidden] {
  display: none !important;
}

/* Support Center — super-admin tools + confirm modal */
.support-admin-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.support-modal[hidden] {
  display: none !important;
}
.support-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.support-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}
.support-modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}
.support-modal-dialog .card-body p + p {
  margin-top: 0.65rem;
}

/* =============================================================================
   Legal Center (affiliate) — dashboard footer card (visual only)
   SaaS dashboard style — not a marketing/landing footer
   ============================================================================= */
.affiliate-legal-footer {
  margin-top: auto;
  padding: 2rem 1.5rem 1.75rem;
  background: transparent;
  border-top: none;
}
.affiliate-legal-footer-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.5rem;
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
  padding: 2.25rem 2.5rem 1.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.affiliate-legal-footer-brand {
  text-align: center;
  max-width: 420px;
  margin: 0 auto;
}
.affiliate-legal-footer-brand-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.affiliate-legal-footer-brand-tagline {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-muted);
}
.affiliate-legal-footer-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  align-self: center;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.affiliate-legal-footer-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  animation: affiliate-footer-status-pulse 2s ease-in-out infinite;
}
.affiliate-legal-footer-status-text {
  line-height: 1.3;
}
@keyframes affiliate-footer-status-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}
.affiliate-legal-footer-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem 2rem;
  padding-top: 0.25rem;
}
.affiliate-legal-footer-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 0;
}
.affiliate-legal-footer-label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.3;
  padding: 0 0.5rem;
}
/* Shared nav base (also used by public legal shell) */
.affiliate-legal-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
}
/* Dashboard footer: vertical nav-item links */
.affiliate-legal-footer .affiliate-legal-footer-nav {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.2rem;
  width: 100%;
}
.affiliate-legal-footer .affiliate-legal-footer-nav a {
  display: block;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-secondary);
  text-decoration: none;
  transition:
    color 250ms ease,
    background-color 250ms ease,
    transform 250ms ease;
}
.affiliate-legal-footer .affiliate-legal-footer-nav a:hover {
  color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-2px);
  text-decoration: none;
}
.affiliate-legal-footer .affiliate-legal-footer-nav a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  color: var(--primary);
  background: var(--primary-soft);
}
.affiliate-legal-footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.affiliate-legal-footer-copy,
.affiliate-legal-footer-version {
  white-space: nowrap;
  line-height: 1.4;
}
@media (max-width: 900px) {
  .affiliate-legal-footer {
    padding: 1.75rem 1.15rem 1.5rem;
  }
  .affiliate-legal-footer-card {
    padding: 2rem 1.5rem 1.5rem;
  }
  .affiliate-legal-footer-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.35rem 1.5rem;
  }
}
@media (max-width: 640px) {
  .affiliate-legal-footer {
    padding: 1.5rem 1rem 1.35rem;
  }
  .affiliate-legal-footer-card {
    padding: 1.75rem 1.15rem 1.35rem;
    border-radius: 16px;
    gap: 1.35rem;
  }
  .affiliate-legal-footer-columns {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    width: 100%;
  }
  .affiliate-legal-footer-block {
    align-items: center;
    text-align: center;
  }
  .affiliate-legal-footer .affiliate-legal-footer-nav {
    align-items: center;
  }
  .affiliate-legal-footer .affiliate-legal-footer-nav a {
    width: auto;
    min-width: 12rem;
    max-width: 100%;
    text-align: center;
  }
  .affiliate-legal-footer-bottom {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-align: center;
  }
  .affiliate-legal-footer-copy,
  .affiliate-legal-footer-version {
    white-space: normal;
  }
}
@media (prefers-reduced-motion: reduce) {
  .affiliate-legal-footer-status-dot {
    animation: none;
  }
  .affiliate-legal-footer .affiliate-legal-footer-nav a {
    transition: none;
  }
  .affiliate-legal-footer .affiliate-legal-footer-nav a:hover {
    transform: none;
  }
}
.legal-nav-groups {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.legal-nav-group-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.legal-subhead {
  font-size: 0.92rem;
  margin: 0.85rem 0 0.35rem;
  color: var(--text);
}

/* Information Center — hub, how-it-works, contact, public shell */
.legal-public-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.legal-public-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.legal-public-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: inherit;
  text-decoration: none;
}
.legal-public-brand .logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
}
.legal-public-brand .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.legal-public-brand .brand-text strong { font-size: 0.9rem; }
.legal-public-brand .brand-text span { font-size: 0.7rem; color: var(--text-muted); }
.legal-public-top-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.legal-public-main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}
.legal-public-footer {
  border-top: 1px solid var(--border);
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-elevated);
}
.auth-legal-links {
  margin-top: 1.15rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.35rem;
  justify-content: center;
}
.auth-legal-links a {
  color: var(--text-secondary);
  font-weight: 500;
}
.auth-legal-links a:hover { color: var(--primary); }
.auth-legal-sep { opacity: 0.5; }
.legal-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}
.legal-hub-card {
  height: 100%;
  transition: transform var(--transition), box-shadow var(--transition);
}
.legal-hub-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.legal-hub-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  margin-bottom: 0.75rem;
}
.legal-hub-icon i,
.legal-hub-icon svg {
  width: 20px;
  height: 20px;
}
.legal-hub-title {
  font-size: 0.98rem;
  margin: 0 0 0.4rem;
}
.legal-hub-desc {
  margin: 0 0 0.85rem;
  min-height: 2.6em;
}
.how-flow {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.how-flow-step {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.how-flow-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.how-flow-icon i,
.how-flow-icon svg {
  width: 20px;
  height: 20px;
}
.how-flow-index {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}
.how-flow-title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}
.how-flow-text {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.how-flow-arrow {
  display: grid;
  place-items: center;
  color: var(--text-muted);
  height: 1.1rem;
}
.how-flow-arrow i,
.how-flow-arrow svg {
  width: 18px;
  height: 18px;
}
.info-contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin: 0.75rem 0 0.25rem;
}
.info-contact-card {
  padding: 0.9rem 1rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.info-contact-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  margin-bottom: 0.55rem;
}
.info-contact-icon i,
.info-contact-icon svg {
  width: 18px;
  height: 18px;
}
.info-map-placeholder {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 1.15rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-muted);
  color: var(--text-secondary);
}
.info-map-placeholder i,
.info-map-placeholder svg {
  width: 22px;
  height: 22px;
  color: var(--primary);
  flex-shrink: 0;
}
.info-map-frame {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  min-height: 240px;
}
.info-map-frame iframe {
  width: 100%;
  height: 280px;
  border: 0;
  display: block;
}
.release-timeline {
  position: relative;
  padding-left: 1.25rem;
  border-left: 2px solid var(--border);
  margin: 0.75rem 0 0.25rem;
}
.release-item {
  position: relative;
  margin-bottom: 1rem;
}
.release-dot {
  position: absolute;
  left: -1.55rem;
  top: 1.1rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-elevated);
}
.release-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}
.legal-example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.legal-example-card {
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-muted);
}
.legal-example-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
}
.legal-example-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 0.4rem;
}
.legal-example-card.good {
  border-color: rgba(5, 150, 105, 0.35);
  background: var(--success-soft);
}
.legal-example-card.good .legal-example-badge { color: var(--success); }
.legal-example-card.bad {
  border-color: rgba(220, 38, 38, 0.3);
  background: var(--danger-soft);
}
.legal-example-card.bad .legal-example-badge { color: var(--danger); }
@media (max-width: 640px) {
  .legal-public-topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}
.affiliate-legal-footer-nav a {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.affiliate-legal-footer-nav a:hover {
  color: var(--primary);
}
.legal-page-header .legal-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}
.legal-breadcrumb a { color: var(--text-secondary); }
.legal-breadcrumb a:hover { color: var(--primary); }
.legal-breadcrumb-sep { opacity: 0.6; }
.legal-breadcrumb-current { color: var(--text-secondary); font-weight: 500; }
.legal-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}
.legal-sibling-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.legal-toc {
  margin: 0;
  padding-left: 1.15rem;
  columns: 2;
  column-gap: 1.5rem;
}
.legal-toc li {
  margin: 0 0 0.4rem;
  break-inside: avoid;
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.legal-toc-link {
  color: var(--primary);
  font-weight: 500;
}
.legal-toc-link:hover { text-decoration: underline; }
.legal-icon {
  width: 16px;
  height: 16px;
  color: var(--primary);
  margin-right: 0.35rem;
  vertical-align: -2px;
}
.legal-doc-body {
  max-width: 920px;
}
.legal-section {
  padding: 0.35rem 0 1.35rem;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 88px;
}
.legal-section:last-child {
  border-bottom: none;
  padding-bottom: 0.25rem;
}
.legal-section h2 {
  font-size: 1.08rem;
  margin: 0 0 0.65rem;
  color: var(--text);
}
.legal-section p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.65;
}
.legal-list {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
  list-style: disc;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}
.legal-list li { margin-bottom: 0.35rem; }
.legal-section-hidden { display: none !important; }
mark.legal-hit {
  background: var(--warning-soft);
  color: inherit;
  padding: 0 0.15em;
  border-radius: 3px;
}
.legal-footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem 1rem;
}
@media (max-width: 900px) {
  .legal-toc { columns: 1; }
}
@media print {
  .sidebar,
  .sidebar-overlay,
  .topbar,
  .affiliate-legal-footer,
  .legal-toolbar-card,
  .legal-sibling-nav,
  .page-actions,
  #notification-permission-banner {
    display: none !important;
  }
  .main-wrap { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  .legal-section { break-inside: avoid; }
  mark.legal-hit { background: transparent; font-weight: 600; }
}



/* =============================================================================
   Admin Marketing Library - File Explorer / media manager (UI only)
   Scoped under .ml-* so affiliate marketing-grid styles stay untouched
   ============================================================================= */
.ml-page-layout {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  align-items: start;
}
.ml-library {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ml-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.ml-header-left {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
}
.ml-header-left h3 { margin: 0; }
.ml-view-switcher {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.ml-view-select {
  width: auto;
  min-width: 11.5rem;
  padding: 0.4rem 0.65rem;
  font-size: 0.8125rem;
}
.ml-toolbar {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.ml-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.ml-search-icon {
  position: absolute;
  left: 0.75rem;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.ml-search {
  padding-left: 2.25rem;
}
.ml-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
}
.ml-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}
.ml-filters .pill {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 550;
  transition: all var(--transition);
}
.ml-filters .pill:hover {
  background: var(--bg-muted);
  color: var(--text);
}
.ml-filters .pill.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: rgba(var(--primary-rgb), 0.35);
}
.ml-sort-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.ml-sort-select {
  width: auto;
  min-width: 8.5rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
}
.ml-server-folders {
  padding-top: 0.15rem !important;
}
.ml-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.55rem 1rem;
  background: rgba(var(--primary-rgb), 0.06);
  border-bottom: 1px solid var(--border);
}
.ml-bulk-select-all {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}
.ml-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.ml-bulk-folder {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.ml-bulk-folder .form-select {
  width: auto;
  min-width: 10rem;
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
}
.ml-stage {
  padding: 0.85rem 1rem 1.1rem;
  min-height: 220px;
}
.ml-empty .empty-state {
  padding: 2rem 1rem;
  text-align: center;
}
.ml-empty .empty-state h3 { margin-bottom: 0.35rem; }

/* ---- Grid cards ---- */
.ml-grid {
  display: grid;
  gap: 0.85rem;
  align-items: stretch;
}
.ml-stage[data-view="xlarge"] .ml-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.ml-stage[data-view="large"] .ml-grid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.ml-stage[data-view="tiles"] .ml-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.ml-stage[data-view="medium"] .ml-grid {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}
.ml-stage[data-view="small"] .ml-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.45rem;
}

.ml-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  min-width: 0;
}
.ml-card:hover {
  transform: translateY(-2px) scale(1.012);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  z-index: 2;
}
.ml-check {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  z-index: 4;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.92);
  border-radius: 6px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
}
[data-theme="dark"] .ml-check {
  background: rgba(17, 24, 39, 0.9);
}
.ml-check input {
  margin: 0;
  cursor: pointer;
}

.ml-thumb {
  position: relative;
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: zoom-in;
  flex: 0 0 auto;
}
.ml-stage[data-view="xlarge"] .ml-thumb { height: 180px; }
.ml-stage[data-view="large"] .ml-thumb { height: 130px; }
.ml-stage[data-view="tiles"] .ml-thumb { height: 120px; }
.ml-stage[data-view="medium"] .ml-thumb { height: 96px; }
.ml-stage[data-view="small"] .ml-thumb {
  height: 40px;
  width: 40px;
  flex: 0 0 40px;
  border-radius: var(--radius-sm);
  margin: 0.55rem 0 0.55rem 0.55rem;
  cursor: pointer;
}

.ml-stage[data-view="small"] .ml-card {
  flex-direction: row;
  align-items: center;
  min-height: 52px;
}
.ml-stage[data-view="small"] .ml-card-body {
  padding: 0.45rem 0.65rem 0.45rem 0.5rem;
  flex: 1;
  min-width: 0;
}
.ml-stage[data-view="small"] .ml-card-meta,
.ml-stage[data-view="small"] .ml-card-actions,
.ml-stage[data-view="medium"] .ml-card-meta .ml-meta-res,
.ml-stage[data-view="medium"] .ml-card-meta .ml-meta-size,
.ml-stage[data-view="medium"] .ml-card-meta .ml-meta-dl,
.ml-stage[data-view="medium"] .ml-card-meta .ml-meta-folder,
.ml-stage[data-view="medium"] .ml-card-meta .ml-meta-date,
.ml-stage[data-view="medium"] .ml-card-actions,
.ml-stage[data-view="large"] .ml-card-meta .ml-meta-res,
.ml-stage[data-view="large"] .ml-card-meta .ml-meta-folder,
.ml-stage[data-view="large"] .ml-card-meta .ml-meta-date,
.ml-stage[data-view="large"] .ml-card-actions {
  display: none;
}
.ml-stage[data-view="large"] .ml-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.45rem;
}
.ml-stage[data-view="tiles"] .ml-card-actions { display: none; }
.ml-stage[data-view="medium"] .ml-card-meta .ml-meta-type {
  display: none;
}

.ml-thumb-img,
.ml-thumb-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.ml-file-glyph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--text-secondary);
  padding: 0.5rem;
}
.ml-file-glyph i,
.ml-file-glyph svg {
  width: 32px;
  height: 32px;
  color: var(--primary);
}
.ml-file-glyph span {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.04em;
}
.ml-kind-zip .ml-file-glyph i,
.ml-kind-zip .ml-file-glyph svg { color: #b45309; }
.ml-kind-pdf .ml-file-glyph i,
.ml-kind-pdf .ml-file-glyph svg { color: #dc2626; }
.ml-kind-word .ml-file-glyph i,
.ml-kind-word .ml-file-glyph svg { color: #2563eb; }
.ml-kind-excel .ml-file-glyph i,
.ml-kind-excel .ml-file-glyph svg { color: #059669; }
.ml-kind-powerpoint .ml-file-glyph i,
.ml-kind-powerpoint .ml-file-glyph svg { color: #ea580c; }
.ml-kind-video .ml-file-glyph i,
.ml-kind-video .ml-file-glyph svg { color: #7c3aed; }

.ml-play-badge {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.28);
  color: #fff;
  pointer-events: none;
}
.ml-play-badge i,
.ml-play-badge svg {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
}

.ml-hover-actions {
  position: absolute;
  inset: auto 0.4rem 0.4rem auto;
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 3;
}
.ml-card:hover .ml-hover-actions,
.ml-card:focus-within .ml-hover-actions {
  opacity: 1;
  transform: translateY(0);
}
.ml-stage[data-view="small"] .ml-hover-actions { display: none; }
.ml-ha-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.96);
  color: var(--text-secondary);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  text-decoration: none;
  padding: 0;
}
[data-theme="dark"] .ml-ha-btn {
  background: rgba(17, 24, 39, 0.95);
}
.ml-ha-btn:hover {
  color: var(--primary);
  border-color: rgba(var(--primary-rgb), 0.35);
}
.ml-ha-btn.ml-ha-danger:hover {
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.35);
}
.ml-ha-btn i,
.ml-ha-btn svg {
  width: 14px;
  height: 14px;
}

.ml-card-body {
  padding: 0.7rem 0.8rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  flex: 1;
}
.ml-card-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ml-stage[data-view="small"] .ml-card-title {
  -webkit-line-clamp: 1;
  font-size: 0.85rem;
}
.ml-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.5rem;
  align-items: center;
}
.ml-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: auto;
  padding-top: 0.25rem;
}
.ml-card-actions .btn {
  padding: 0.28rem 0.55rem;
  font-size: 0.75rem;
}
.ml-card-actions .btn i,
.ml-card-actions .btn svg {
  width: 13px;
  height: 13px;
}
.ml-delete-form { display: inline; margin: 0; }

/* List view */
.ml-list-preview {
  width: 48px;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-muted);
  padding: 0;
  cursor: zoom-in;
  display: grid;
  place-items: center;
}
.ml-list-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ml-list-icon {
  color: var(--primary);
  display: grid;
  place-items: center;
}
.ml-list-icon i,
.ml-list-icon svg {
  width: 18px;
  height: 18px;
}
.ml-linkish {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 550;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.ml-linkish:hover { color: var(--primary); }
.ml-list-desc {
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ml-col-check { width: 36px; }

/* Modals */
body.ml-modal-open { overflow: hidden; }
.ml-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.ml-modal[hidden] { display: none !important; }
.ml-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.ml-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  max-height: min(92vh, 900px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ml-edit-dialog { width: min(480px, 100%); }
.ml-modal-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.ml-modal-top h3 { margin: 0; font-size: 1rem; }
.ml-modal-top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  justify-content: flex-end;
}
.ml-modal-body {
  padding: 0.85rem 1rem 1rem;
  overflow: auto;
  min-height: 120px;
  background: var(--bg-muted);
}
.ml-edit-dialog .ml-modal-body {
  background: var(--bg-elevated);
}
.ml-zoom-stage {
  display: grid;
  place-items: center;
  min-height: 280px;
  max-height: min(70vh, 640px);
  overflow: auto;
  background: #0b1220;
  border-radius: var(--radius-sm);
  padding: 1rem;
}
.ml-zoom-img {
  max-width: 100%;
  max-height: min(65vh, 600px);
  object-fit: contain;
  transform-origin: center center;
  transition: transform 120ms ease;
  user-select: none;
}
.ml-preview-video {
  width: 100%;
  max-height: min(70vh, 640px);
  background: #000;
  border-radius: var(--radius-sm);
}
.ml-preview-pdf {
  width: 100%;
  height: min(70vh, 680px);
  border: 0;
  border-radius: var(--radius-sm);
  background: #fff;
}
.ml-preview-fallback {
  text-align: center;
  padding: 2rem 1rem;
}

@media (max-width: 1100px) {
  .ml-stage[data-view="xlarge"] .ml-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }
}
@media (max-width: 1024px) {
  .ml-page-layout {
    grid-template-columns: 1fr;
  }
  .ml-stage[data-view="xlarge"] .ml-grid,
  .ml-stage[data-view="large"] .ml-grid,
  .ml-stage[data-view="tiles"] .ml-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}
@media (max-width: 640px) {
  .ml-stage[data-view="xlarge"] .ml-grid,
  .ml-stage[data-view="large"] .ml-grid,
  .ml-stage[data-view="tiles"] .ml-grid,
  .ml-stage[data-view="medium"] .ml-grid {
    grid-template-columns: 1fr;
  }
  .ml-stage[data-view="xlarge"] .ml-thumb { height: 200px; }
  .ml-view-select { min-width: 9rem; }
  .ml-bulk-bar { align-items: stretch; }
  .ml-bulk-actions { width: 100%; }
  .ml-modal-top { flex-direction: column; }
  .ml-modal-top-actions { width: 100%; }
}


/* =============================================================================
   Super Admin TOTP 2FA (auth challenge + security settings)
   ============================================================================= */
.tf-form { margin-top: 0.5rem; }
.tf-code-input {
  letter-spacing: 0.2em;
  font-size: 1.15rem;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.tf-remember {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.tf-alt-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  margin-top: 1.25rem;
  font-size: 0.85rem;
}
.tf-link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}
.tf-link-btn:hover { color: var(--primary-hover); text-decoration: underline; }
.tf-admin-grid {
  display: grid;
  gap: 1rem;
  max-width: 720px;
}
.tf-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.tf-steps {
  margin: 0 0 1rem 1.1rem;
  padding: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
}
.tf-steps li { margin-bottom: 0.35rem; }
.tf-enroll-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.tf-qr-wrap {
  padding: 0.65rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.tf-qr-wrap img {
  display: block;
  width: 200px;
  height: 200px;
}
.tf-secret-box { flex: 1; min-width: 200px; }
.tf-secret {
  display: block;
  word-break: break-all;
  padding: 0.65rem 0.75rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--text);
}
.tf-backup-card { border-color: rgba(var(--primary-rgb), 0.35); }
.tf-backup-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.45rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}
.tf-backup-list code {
  display: block;
  text-align: center;
  padding: 0.45rem 0.5rem;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}
@media (max-width: 640px) {
  .tf-enroll-layout { flex-direction: column; align-items: center; }
  .tf-secret-box { width: 100%; }
}


/* Password change + strength checklist (Super Admin Security) */
.tf-pwd-checklist {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.25rem;
}
.tf-pwd-checklist li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: color var(--transition);
}
.tf-pwd-checklist li.is-ok {
  color: var(--success);
  font-weight: 550;
}
.tf-pwd-mark {
  display: inline-grid;
  place-items: center;
  width: 1.1rem;
  font-size: 0.85rem;
  line-height: 1;
}
.tf-pwd-match.is-ok { color: var(--success); }
.tf-pwd-match.is-bad { color: var(--danger); }


/* Sidebar brand logo image */
.sidebar-brand .logo-mark-img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: contain;
  object-position: center;
  background: #fff;
  padding: 3px;
  box-shadow: 0 4px 12px rgba(20,184,166,0.25);
  flex-shrink: 0;
}

/* Profile photo in topbar */
.avatar.avatar-photo {
  object-fit: cover;
  padding: 0;
  background: var(--bg-muted);
  border: 1px solid var(--border);
}
.avatar-lg {
  width: 96px;
  height: 96px;
  font-size: 1.5rem;
  border-radius: 50%;
}

/* Profile photo card */
.profile-photo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
}
.profile-photo-preview {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.profile-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.profile-photo-controls .btn {
  cursor: pointer;
}
@media (max-width: 480px) {
  .profile-photo-row { align-items: flex-start; }
}
