/* ============================================================
   FamAPI ADMIN — Complete Styles v4
   Canva purple #a370fc | Light theme (matches dashboard)
   ============================================================ */
:root{
  --canvas:#f7f5fc;--ink:#0f0a1e;--body:#4b4560;--muted:#8b86a0;--muted-soft:#a9a4bc;
  --hairline:#eae6f5;--hairline-soft:#f1eef9;
  --surface:#ffffff;--surface-soft:#faf9fe;--surface-strong:#f3eeff;
  --primary:#a370fc;--primary-active:#8b5cf6;
  --grad:linear-gradient(135deg,#a370fc,#8b5cf6);
  --green:#10b981;--up:#10b981;--down:#ef4444;--warn:#f59e0b;
  --shadow-sm:0 1px 4px rgba(124,58,237,.07);
  --shadow:0 4px 18px rgba(124,58,237,.10);
  --radius:16px;--radius-sm:12px;
  --mono:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,monospace;
}
*{box-sizing:border-box;margin:0;padding:0}
body{font-family:'Inter',system-ui,-apple-system,sans-serif;background:
  radial-gradient(900px 400px at 85% -10%,rgba(139,92,246,.09),transparent 60%),
  radial-gradient(700px 300px at -10% 30%,rgba(163,112,252,.06),transparent 55%),
  var(--canvas);
  color:var(--ink);line-height:1.55;font-size:15px;min-height:100vh}
a{color:var(--primary);text-decoration:none}
img{max-width:100%}
.mono{font-family:var(--mono)}
.text-muted{color:var(--muted)}
.container{max-width:1200px;margin:0 auto;padding:0 20px}

/* ============ TOP NAV ============ */
.topnav{background:var(--surface);border-bottom:1px solid var(--hairline);padding:14px 0}
.topnav-inner{max-width:1200px;margin:0 auto;padding:0 20px}
.nav-logo{font-family:'Space Grotesk',sans-serif;font-weight:700;font-size:20px;color:var(--ink)!important;display:inline-flex;align-items:center;gap:8px}
.nav-logo-accent{background:var(--grad);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}
.logo-tag{font-size:10px;font-weight:700;letter-spacing:.12em;color:var(--primary);background:var(--surface-strong);border:1px solid var(--hairline);border-radius:99px;padding:3px 10px;margin-left:6px}

/* ============ ADMIN TOP STRIP ============ */
.admin-top{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;
  max-width:1200px;margin:18px auto 0;padding:14px 20px;background:var(--surface);
  border:1px solid var(--hairline);border-radius:var(--radius);box-shadow:var(--shadow-sm)}
.admin-top .brand{font-weight:700;font-size:16px;display:flex;align-items:center;gap:9px;color:var(--ink)}
.admin-top .brand .tag{font-size:11px;font-weight:700;letter-spacing:.08em;color:#fff;background:var(--grad);border-radius:99px;padding:4px 12px}
.admin-top .user-box{display:flex;align-items:center;gap:14px;font-size:13px;color:var(--muted)}
.admin-top .user-box strong{color:var(--ink)}
.admin-top .user-box a{display:inline-flex;align-items:center;gap:6px;font-weight:600;font-size:13px}

/* ============ ADMIN NAV PILLS ============ */
.admin-nav{display:flex;align-items:center;gap:6px;flex-wrap:wrap;
  max-width:1200px;margin:14px auto 0;padding:8px 12px;background:var(--surface);
  border:1px solid var(--hairline);border-radius:var(--radius);box-shadow:var(--shadow-sm)}
.admin-nav a{display:inline-flex;align-items:center;gap:7px;font-size:13.5px;font-weight:600;
  color:var(--body);padding:9px 16px;border-radius:99px;transition:.2s}
.admin-nav a:hover{color:var(--primary);background:var(--surface-strong)}
.admin-nav a.active{color:#fff!important;background:var(--grad);box-shadow:0 3px 12px rgba(139,92,246,.35)}
.admin-nav a.logout{color:var(--down)}
.admin-nav a.logout:hover{color:var(--down);background:#fee2e2}
.admin-nav .spacer{flex:1}

/* ============ ADMIN HERO ============ */
.admin-hero{max-width:1200px;margin:18px auto 22px;padding:34px 26px;border-radius:22px;
  background:linear-gradient(135deg,#171029,#251747 60%,#2d1b57);color:#fff;position:relative;overflow:hidden}
.admin-hero::after{content:'';position:absolute;width:340px;height:340px;border-radius:50%;
  background:radial-gradient(circle,rgba(163,112,252,.35),transparent 70%);top:-140px;right:-80px}
.admin-hero-inner{position:relative;z-index:1;display:flex;align-items:flex-end;justify-content:space-between;gap:18px;flex-wrap:wrap}
.hero-badge{display:inline-flex;align-items:center;gap:7px;font-size:11.5px;font-weight:600;letter-spacing:.05em;
  color:#e9defc;background:rgba(255,255,255,.09);border:1px solid rgba(255,255,255,.16);border-radius:99px;padding:6px 14px;margin-bottom:14px}
.admin-hero h1{font-size:32px;font-weight:800;letter-spacing:-.02em}
.admin-hero p{color:#cfc3ea;font-size:14.5px;margin-top:5px}
.hero-live{display:inline-flex;align-items:center;gap:9px;font-size:12.5px;font-weight:600;color:#bbf7d0;
  background:rgba(16,185,129,.12);border:1px solid rgba(16,185,129,.35);border-radius:99px;padding:8px 16px}
.hero-live .dot{width:8px;height:8px;border-radius:50%;background:#34d399;animation:pulse-dot 1.8s ease infinite}
@keyframes pulse-dot{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.45;transform:scale(.8)}}

/* ============ WRAP + GRID ============ */
.admin-wrap{max-width:1200px;margin:0 auto;padding:0 20px 60px}
.grid3{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:18px}
.stat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:16px;margin-bottom:24px}
.row.mt-24{margin-top:24px}
.row{display:flex;gap:12px;align-items:center;flex-wrap:wrap}

/* ============ STAT CARDS ============ */
.stat-card{background:var(--surface);border:1px solid var(--hairline);border-radius:var(--radius);
  padding:20px;position:relative;overflow:hidden;transition:.25s;box-shadow:var(--shadow-sm)}
.stat-card:hover{transform:translateY(-3px);box-shadow:var(--shadow)}
.stat-card::after{content:'';position:absolute;top:0;left:0;right:0;height:3px;background:var(--grad);opacity:0;transition:.25s}
.stat-card:hover::after{opacity:1}
.stat-card.primary{background:linear-gradient(135deg,#171029,#2d1b57);border-color:transparent}
.stat-card.primary .stat-label{color:#cfc3ea}
.stat-label{font-size:12px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.stat-value{font-size:28px;font-weight:800;letter-spacing:-.02em;margin:6px 0 2px;color:var(--ink)}
.stat-value.up{color:var(--up)}
.stat-value.down{color:var(--down)}
.stat-desc{font-size:12.5px;color:var(--muted)}

/* ============ CARDS ============ */
.card{background:var(--surface);border:1px solid var(--hairline);border-radius:var(--radius);
  padding:22px;box-shadow:var(--shadow-sm);margin-bottom:22px}
.table-card{padding:0;overflow:hidden}
.card-title{font-size:17px;font-weight:700;letter-spacing:-.01em;display:flex;align-items:center;gap:9px;margin-bottom:6px}
.card-sub{font-size:13px;color:var(--muted)}

/* ============ TABLES ============ */
.data-table{width:100%;border-collapse:collapse;font-size:13.5px}
.data-table th{text-align:left;font-size:11px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;
  color:var(--muted);background:var(--surface-soft);padding:13px 16px;border-bottom:1px solid var(--hairline)}
.data-table td{padding:13px 16px;border-bottom:1px solid var(--hairline-soft);color:var(--body);vertical-align:middle}
.data-table tbody tr:last-child td{border-bottom:none}
.data-table tbody tr{transition:background .15s}
.data-table tbody tr:hover{background:var(--surface-soft)}
.empty-row{text-align:center!important;color:var(--muted);padding:36px 16px!important}
.user-row{display:flex;align-items:center;gap:10px}

/* ============ BADGES ============ */
.badge-status,.badge{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;font-weight:700;
  border-radius:99px;padding:4px 11px;white-space:nowrap}
.badge-status.success{color:#047857;background:#d1fae5}
.badge-status.pending{color:#92400e;background:#fef3c7}
.badge-status.failed{color:#b91c1c;background:#fee2e2}
.badge-green{color:#047857;background:#d1fae5}
.badge-red{color:#b91c1c;background:#fee2e2}
.badge-amber{color:#92400e;background:#fef3c7}
.badge-gray{color:#4b5563;background:#f3f4f6}

/* ============ BUTTONS ============ */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;font-family:inherit;
  font-size:14px;font-weight:600;border:none;border-radius:12px;padding:11px 20px;cursor:pointer;transition:.2s;text-decoration:none}
.btn-primary{background:var(--grad);color:#fff!important;box-shadow:0 3px 14px rgba(139,92,246,.35)}
.btn-primary:hover{filter:brightness(1.07);transform:translateY(-1px)}
.btn-secondary{background:var(--surface-strong);color:var(--primary-active)!important;border:1px solid var(--hairline)}
.btn-secondary:hover{background:#ece3fd}
.btn-outline{background:transparent;color:var(--primary-active)!important;border:1.5px solid var(--primary)}
.btn-outline:hover{background:var(--surface-strong)}
.btn-danger{background:#fee2e2;color:#b91c1c!important}
.btn-danger:hover{background:#fecaca}
.btn-sm{font-size:12.5px;padding:7px 14px;border-radius:10px}
.btn-block{width:100%}

/* ============ FORMS ============ */
.label{display:block;font-size:12.5px;font-weight:600;color:var(--ink);margin-bottom:7px}
.input,.form-control{width:100%;font-family:inherit;font-size:14px;color:var(--ink);
  background:var(--surface-soft);border:1.5px solid var(--hairline);border-radius:12px;padding:11px 14px;transition:.2s}
.input:focus,.form-control:focus{outline:none;border-color:var(--primary);background:#fff;box-shadow:0 0 0 4px rgba(163,112,252,.14)}
.field-hint{font-size:12px;color:var(--muted);margin-top:6px}

/* ============ ALERTS ============ */
.alert{border-radius:12px;padding:14px 18px;font-size:14px;font-weight:500;margin-bottom:20px}
.alert-ok{background:#d1fae5;color:#065f46;border:1px solid #a7f3d0}
.alert-warn{background:#fef3c7;color:#92400e;border:1px solid #fde68a}

/* ============ SWITCH ============ */
.switch{position:relative;display:inline-block;width:48px;height:26px;cursor:pointer;flex-shrink:0}
.switch input{opacity:0;width:0;height:0;position:absolute}
.switch-track{position:absolute;inset:0;background:var(--hairline);border-radius:13px;transition:.25s;display:block}
.switch-thumb{position:absolute;left:3px;top:3px;width:20px;height:20px;background:#fff;border-radius:50%;transition:.25s;box-shadow:0 2px 5px rgba(0,0,0,.2);display:block}
.switch input:checked + .switch-track{background:var(--grad)}
.switch input:checked + .switch-track .switch-thumb{transform:translateX(22px)}

/* ============ AVATARS ============ */
.avatar-sm{width:36px;height:36px;border-radius:50%;object-fit:cover;background:var(--surface-strong);flex-shrink:0}
.avatar-fallback{width:44px;height:44px;border-radius:50%;background:var(--grad);color:#fff;
  display:inline-flex;align-items:center;justify-content:center;font-weight:700;font-size:16px;flex-shrink:0}

/* ============ RESPONSIVE ============ */
@media(max-width:860px){
  .admin-top,.admin-nav,.admin-hero,.admin-wrap,.admin-top{margin-left:12px;margin-right:12px;max-width:calc(100% - 24px)}
  .admin-wrap{margin-left:0;margin-right:0;max-width:100%;padding:0 14px 50px}
  .admin-hero h1{font-size:24px}
  .admin-hero{padding:24px 20px}
  .admin-nav{overflow-x:auto;flex-wrap:nowrap;-webkit-overflow-scrolling:touch}
  .admin-nav a{white-space:nowrap;padding:8px 14px}
  .table-card{overflow-x:auto}
  .data-table{min-width:640px}
  .stat-grid{grid-template-columns:repeat(2,1fr);gap:10px}
  .stat-value{font-size:22px}
  .card{padding:18px 16px}
  .admin-top .user-box span{display:none}
}
@media(max-width:480px){
  .stat-grid{grid-template-columns:1fr 1fr}
  .grid3{grid-template-columns:1fr}
}
