/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  background: #f5f5f5;
  color: #0a0a0a;
  min-height: 100vh;
}

/* ── Typography ── */
.tag {
  font-size: 11px; font-weight: 700; letter-spacing: 3px;
  text-transform: uppercase; color: #aaa;
}
.tnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.4s ease both; }

/* ═══════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #0a0a0a;
}
.login-box {
  background: #fff;
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  animation: fadeUp 0.5s ease both;
}
.login-logo { margin-bottom: 36px; }
.login-logo img { height: 32px; }
.login-title {
  font-size: 24px; font-weight: 800; letter-spacing: -0.5px;
  margin-bottom: 6px;
}
.login-sub { font-size: 14px; color: #888; margin-bottom: 32px; }
.login-field { margin-bottom: 20px; }
.login-label {
  display: block; font-size: 13px; font-weight: 600;
  color: #0a0a0a; margin-bottom: 7px;
}
.login-input {
  width: 100%; border: 1.5px solid #e4e4e4; border-radius: 10px;
  background: #fafafa; font-family: inherit; font-size: 15px;
  color: #0a0a0a; padding: 12px 14px; outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.login-input:focus { border-color: #0a0a0a; background: #fff; }
.login-btn {
  width: 100%; background: #0a0a0a; color: #fff; border: none;
  font-family: inherit; font-size: 14px; font-weight: 700;
  letter-spacing: 0.5px; padding: 14px; border-radius: 10px;
  cursor: pointer; margin-top: 8px; transition: background 0.2s;
}
.login-btn:hover { background: #222; }
.login-btn:disabled { background: #ccc; cursor: not-allowed; }
.login-error {
  font-size: 13px; color: #dc2626; margin-top: 14px;
  text-align: center; display: none;
}
.login-error.visible { display: block; }

/* ═══════════════════════════════════════
   ADMIN SHELL
═══════════════════════════════════════ */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  padding: 28px 0 24px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}
.sidebar-logo {
  padding: 0 24px 32px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 16px;
}
.sidebar-logo img { height: 28px; filter: invert(1); }
.sidebar-label {
  font-size: 10px; font-weight: 700; letter-spacing: 2.5px;
  text-transform: uppercase; color: rgba(255,255,255,0.25);
  padding: 0 24px; margin-bottom: 6px; margin-top: 12px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 24px; font-size: 14px; font-weight: 500;
  color: rgba(255,255,255,0.55); text-decoration: none;
  border-radius: 0; transition: color 0.15s, background 0.15s;
  cursor: pointer; border: none; background: none; width: 100%;
  text-align: left; font-family: inherit;
}
.sidebar-link:hover { color: #fff; background: rgba(255,255,255,0.06); }
.sidebar-link.active { color: #fff; background: rgba(255,255,255,0.1); }
.sidebar-link svg { flex-shrink: 0; opacity: 0.6; }
.sidebar-link.active svg { opacity: 1; }
.sidebar-bottom {
  margin-top: auto;
  padding: 0 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 20px;
}
.sidebar-user { font-size: 13px; color: rgba(255,255,255,0.45); margin-bottom: 12px; }
.sidebar-user strong { color: rgba(255,255,255,0.8); display: block; font-size: 14px; }
.logout-btn {
  font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.4);
  background: none; border: none; cursor: pointer; padding: 0;
  font-family: inherit; transition: color 0.15s;
}
.logout-btn:hover { color: #fff; }

/* Main content area */
.main-content {
  margin-left: 220px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.main-topbar {
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  padding: 18px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.main-body { padding: 32px 36px; flex: 1; }

/* ═══════════════════════════════════════
   STATS BAR
═══════════════════════════════════════ */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px 22px;
}
.stat-card-label {
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: #aaa; margin-bottom: 8px;
}
.stat-card-value {
  font-size: 26px; font-weight: 800; letter-spacing: -0.5px;
  color: #0a0a0a;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.stat-card-sub {
  font-size: 12px; color: #bbb; margin-top: 4px;
}

/* ═══════════════════════════════════════
   DATA TABLE
═══════════════════════════════════════ */
.table-card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
}
.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f5f5f5;
}
.table-card-title {
  font-size: 15px; font-weight: 700; letter-spacing: -0.2px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: #bbb;
  padding: 10px 24px; text-align: left;
  border-bottom: 1.5px solid #f5f5f5;
  white-space: nowrap;
}
.data-table td {
  font-size: 14px; font-weight: 500; color: #333;
  padding: 14px 24px; border-bottom: 1px solid #f9f9f9;
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #fafafa; }
.data-table td.bold { font-weight: 700; color: #0a0a0a; }
.data-table .tnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ═══════════════════════════════════════
   BADGES
═══════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; padding: 4px 10px; border-radius: 20px;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; }
.badge-confirmed { background: rgba(34,197,94,0.1); color: #16a34a; }
.badge-confirmed::before { background: #22c55e; }
.badge-pending { background: rgba(251,191,36,0.1); color: #b45309; }
.badge-pending::before { background: #fbbf24; }
.badge-none { background: #f5f5f5; color: #aaa; }
.badge-none::before { background: #ddd; }

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 16px; border-radius: 8px; cursor: pointer;
  border: none; white-space: nowrap; transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: #0a0a0a; color: #fff; }
.btn-primary:hover { background: #222; }
.btn-secondary { background: #f5f5f5; color: #0a0a0a; border: 1px solid #e8e8e8; }
.btn-secondary:hover { background: #ebebeb; }
.btn-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fee2e2; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { font-size: 12px; padding: 5px 12px; }
.btn-ghost {
  background: none; border: none; padding: 4px 8px;
  color: #888; font-size: 13px; font-weight: 600;
}
.btn-ghost:hover { color: #0a0a0a; }

/* ═══════════════════════════════════════
   MODAL
═══════════════════════════════════════ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 500;
  align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 18px;
  padding: 32px 36px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  animation: fadeUp 0.25s ease both;
  position: relative;
}
.modal-title {
  font-size: 20px; font-weight: 800; letter-spacing: -0.4px;
  margin-bottom: 24px;
}
.modal-close {
  position: absolute; top: 20px; right: 20px;
  background: #f5f5f5; border: none; border-radius: 50%;
  width: 32px; height: 32px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #888; transition: background 0.15s;
}
.modal-close:hover { background: #ebebeb; color: #0a0a0a; }
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 28px;
}
.modal-error {
  font-size: 13px; color: #dc2626; margin-top: 10px; display: none;
}
.modal-error.visible { display: block; }

/* ═══════════════════════════════════════
   FORM FIELDS (in modals)
═══════════════════════════════════════ */
.field { margin-bottom: 18px; }
.field:last-of-type { margin-bottom: 0; }
.field-label {
  display: block; font-size: 13px; font-weight: 600;
  color: #0a0a0a; margin-bottom: 6px;
}
.field-label .req { color: #dc2626; margin-left: 2px; }
.field-input {
  width: 100%; border: 1.5px solid #e4e4e4; border-radius: 8px;
  background: #fafafa; font-family: inherit; font-size: 15px;
  color: #0a0a0a; padding: 10px 12px; outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.field-input:focus { border-color: #0a0a0a; background: #fff; }
.field-input::placeholder { color: #ccc; }
.field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-helper { font-size: 12px; color: #aaa; margin-top: 4px; }
.field-select {
  width: 100%; border: 1.5px solid #e4e4e4; border-radius: 8px;
  background: #fafafa; font-family: inherit; font-size: 15px;
  color: #0a0a0a; padding: 10px 12px; outline: none; appearance: none;
  transition: border-color 0.2s;
}
.field-select:focus { border-color: #0a0a0a; }

/* ═══════════════════════════════════════
   CLIENT DETAIL PAGE
═══════════════════════════════════════ */
.client-header {
  background: #fff; border-radius: 14px;
  padding: 24px 28px; margin-bottom: 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.client-header-left { display: flex; align-items: center; gap: 18px; }
.client-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: #0a0a0a; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; letter-spacing: -0.5px;
  flex-shrink: 0;
}
.client-name { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.client-meta { font-size: 13px; color: #888; margin-top: 3px; }
.client-meta span { margin-right: 16px; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 1.5px solid #f0f0f0; margin-bottom: 24px; }
.tab-btn {
  font-family: inherit; font-size: 14px; font-weight: 600; color: #aaa;
  background: none; border: none; padding: 10px 20px 12px;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: #555; }
.tab-btn.active { color: #0a0a0a; border-bottom-color: #0a0a0a; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Back link ── */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: #888;
  text-decoration: none; margin-bottom: 24px;
  transition: color 0.15s;
}
.back-link:hover { color: #0a0a0a; }

/* ── Info grid ── */
.info-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; margin-bottom: 24px;
}
.info-card {
  background: #fff; border-radius: 12px; padding: 18px 20px;
}
.info-card-label {
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: #bbb; margin-bottom: 6px;
}
.info-card-value {
  font-size: 16px; font-weight: 700; color: #0a0a0a;
}

/* ── Linked account card (in admin) ── */
.linked-mini {
  background: #0a0a0a; border-radius: 12px;
  padding: 18px 22px; display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 12px;
}
.linked-mini-info { display: flex; flex-direction: column; gap: 4px; }
.linked-mini-type { font-size: 13px; font-weight: 700; color: #fff; }
.linked-mini-nums { font-size: 12px; color: rgba(255,255,255,0.45); }
.linked-mini-nums .num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.linked-mini-actions { display: flex; gap: 8px; }

/* ── Empty state ── */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: #bbb; font-size: 14px;
}
.empty-state-icon { font-size: 32px; margin-bottom: 12px; }
