:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --sidebar: #0f172a;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #d97706;
  --accent-soft: #fef3c7;
  --emerald: #059669;
  --emerald-soft: #d1fae5;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --slate-soft: #f1f5f9;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }

.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(circle at top right, #1e293b, #0f172a); }
.auth-card { width: 100%; max-width: 460px; background: var(--surface); border-radius: 20px; padding: 32px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45); }
.brand-badge { display: inline-flex; align-items: center; gap: 10px; background: #0f172a; color: #fff; padding: 8px 14px; border-radius: 12px; font-weight: 800; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 18px; }
.brand-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--accent); display: inline-block; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 270px; background: var(--sidebar); color: #fff; display: flex; flex-direction: column; flex-shrink: 0; border-right: 1px solid rgba(255,255,255,0.08); }
.sidebar-head { padding: 22px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-title { font-size: 16px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.sidebar-sub { font-size: 11px; color: #fbbf24; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin-top: 2px; }
.sidebar-nav { padding: 14px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.nav-link { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-radius: 12px; color: rgba(255,255,255,0.78); font-weight: 600; transition: all .15s; }
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active { background: rgba(255,255,255,0.16); color: #fff; font-weight: 700; }
.sidebar-foot { padding: 16px 18px; border-top: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar h1 { margin: 0; font-size: 19px; font-weight: 800; }
.content { padding: 26px 28px; max-width: 1440px; width: 100%; margin: 0 auto; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.kpi-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kpi-val { font-size: 28px; font-weight: 800; margin-top: 6px; color: var(--text); font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px; margin-bottom: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-title { margin: 0; font-size: 15px; font-weight: 800; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.info-list { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; font-size: 13px; }
.info-list dt { color: var(--muted); font-weight: 600; }
.info-list dd { margin: 0; font-weight: 600; word-break: break-word; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #f8fafc; white-space: nowrap; }
tr:hover td { background: #f8fafc; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge-active { background: var(--emerald-soft); color: #065f46; }
.badge-pending { background: var(--accent-soft); color: #92400e; }
.badge-suspended { background: var(--danger-soft); color: #991b1b; }
.badge-expired { background: #e2e8f0; color: #334155; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--text); font-weight: 700; font-size: 12px; cursor: pointer; transition: all .15s; }
.btn:hover { background: #f1f5f9; }
.btn-primary { background: #0f172a; color: #fff; border-color: #0f172a; }
.btn-primary:hover { background: #1e293b; }
.btn-success { background: var(--emerald); color: #fff; border-color: var(--emerald); }
.btn-success:hover { background: #047857; }
.btn-warning { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-warning:hover { background: #b45309; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 10px; font-size: 11px; border-radius: 8px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.input, .select, .textarea { width: 100%; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 10px; font-size: 13px; background: #fff; color: var(--text); font-family: inherit; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: #0f172a; }
.textarea { min-height: 90px; resize: vertical; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

.filters-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filters-bar .input { max-width: 280px; }
.filters-bar .select { max-width: 190px; }

.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; font-size: 13px; border: 1px solid transparent; }
.alert-success { background: var(--emerald-soft); color: #065f46; border-color: #a7f3d0; }
.alert-error { background: var(--danger-soft); color: #991b1b; border-color: #fecaca; }
.alert-warning { background: var(--accent-soft); color: #92400e; border-color: #fde68a; }

.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 14px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55); display: none; align-items: center; justify-content: center; padding: 18px; z-index: 999; }
.modal-backdrop.open { display: flex; }
.modal-box { background: #fff; border-radius: 18px; width: 100%; max-width: 520px; padding: 24px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.35); max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-title { margin: 0; font-size: 16px; font-weight: 800; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.mobile-menu-btn { display: none; }
@media (max-width: 920px) {
  .sidebar { position: fixed; left: -280px; top: 0; bottom: 0; z-index: 500; transition: left .2s; }
  .sidebar.open { left: 0; }
  .mobile-menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
}
