/* ============================================================
   AuthPlatform Admin — Design System

   Palette is deliberately grounded in the platform's own domain rather
   than a generic dashboard default: this is a service-partner marketplace
   built around identity verification (Aadhaar/PAN KYC), so the primary
   color is a deep, confident indigo ("verification blue") and the sparing
   accent is a warm saffron/amber — a quiet nod to the Aadhaar card's own
   palette without literally reproducing it. Light-based rather than dark
   mode on purpose: admins here spend real time visually checking KYC
   document/selfie photos, and a dark chrome shifts perceived color on
   exactly the images where accuracy matters most.
   ============================================================ */

:root {
  --bg: #F5F6FA;
  --surface: #FFFFFF;
  --surface-alt: #EEF0F5;
  --border: #DDE1EA;
  --border-strong: #C7CCD9;

  --ink: #12151F;
  --ink-soft: #565D6D;
  --ink-faint: #8891A1;

  --primary: #23306B;
  --primary-hover: #2E3D85;
  --primary-soft: #E9EBF6;
  --primary-line: #C7CDE8;

  --accent: #DB8A2C;
  --accent-soft: #FBEEDC;

  --success: #1E8A5F;
  --success-soft: #E3F5EC;
  --success-line: #B9E4CD;

  --danger: #C4453B;
  --danger-soft: #FBEAE8;
  --danger-line: #F0C4C0;

  --warning: #B9791F;
  --warning-soft: #FBF0DC;

  --neutral: #6B7280;
  --neutral-soft: #EEF0F4;

  --font-display: 'Space Grotesk', 'IBM Plex Sans', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Consolas, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(18, 21, 31, 0.06);
  --shadow-md: 0 6px 20px rgba(18, 21, 31, 0.08);
  --shadow-lg: 0 20px 48px rgba(18, 21, 31, 0.16);

  --sidebar-w: 234px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { cursor: pointer; }

a { color: var(--primary); }

::selection { background: var(--primary-line); }

.mono { font-family: var(--font-mono); }

/* ── Scrollbar (subtle, not load-bearing) ───────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

/* ============================================================
   Login screen
   ============================================================ */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 15%, rgba(35, 48, 107, 0.08), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(219, 138, 44, 0.08), transparent 45%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px 32px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.login-brand .mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--primary), #3B4A9E);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.login-brand .name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16.5px;
}

.login-brand .name small {
  display: block;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 1px;
}

.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .sub { color: var(--ink-soft); font-size: 13px; margin-bottom: 22px; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field input, .field textarea, .field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.field textarea { resize: vertical; min-height: 72px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 13.5px;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-block { width: 100%; }

.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-alt); }

.btn-subtle { background: var(--surface-alt); color: var(--ink); }
.btn-subtle:hover:not(:disabled) { background: var(--border); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #187352; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #A93A31; }

.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }

.error-banner {
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  color: #7E2A22;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.login-foot {
  margin-top: 18px;
  font-size: 12px;
  color: var(--ink-faint);
  text-align: center;
}

/* ============================================================
   App shell
   ============================================================ */

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--primary);
  color: #EDEFF8;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 22px;
}
.sidebar-brand .mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(255,255,255,0.14);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13.5px;
  flex-shrink: 0;
}
.sidebar-brand .name { font-family: var(--font-display); font-weight: 600; font-size: 14.5px; }
.sidebar-brand .name small { display: block; font-weight: 400; font-size: 10.5px; color: #AEB6DE; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  color: #C9CEE9;
  font-size: 13.5px;
  font-weight: 500;
  background: transparent;
  border: none;
  text-align: left;
  width: 100%;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.16); color: #fff; }
.nav-item .icon { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item .count {
  margin-left: auto;
  background: rgba(255,255,255,0.16);
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-family: var(--font-mono);
}
.nav-item.active .count { background: var(--accent); color: #2b1c05; }

.sidebar-foot {
  border-top: 1px solid rgba(255,255,255,0.14);
  padding-top: 12px;
  margin-top: 12px;
}
.sidebar-who {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px 10px;
}
.sidebar-who .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent);
  color: #2b1c05;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.sidebar-who .who-text { min-width: 0; }
.sidebar-who .who-name {
  font-size: 12.5px; font-weight: 500; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-who .who-role { font-size: 10.5px; color: #AEB6DE; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 { font-size: 18px; }
.topbar .sub { color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content { padding: 24px 28px 60px; flex: 1; }

/* ============================================================
   Shared bits: cards, badges, tables, tabs, empty states
   ============================================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-card .label {
  font-size: 12px; color: var(--ink-soft); font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.stat-card .value { font-family: var(--font-display); font-size: 26px; font-weight: 600; }
.stat-card .value.small { font-size: 20px; }
.stat-card .foot { font-size: 11.5px; color: var(--ink-faint); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-neutral { background: var(--neutral-soft); color: var(--ink-soft); }
.badge-accent  { background: var(--accent-soft); color: #8A5814; }
.badge-success { background: var(--success-soft); color: #146643; border-color: var(--success-line); }
.badge-danger  { background: var(--danger-soft);  color: #8F2F27; border-color: var(--danger-line); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.tab {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  display: flex; align-items: center; gap: 7px;
}
.tab:hover { border-color: var(--border-strong); }
.tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.tab .n {
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(0,0,0,0.06);
  padding: 1px 6px;
  border-radius: 10px;
}
.tab.active .n { background: rgba(255,255,255,0.2); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 340px;
}
.search-box input {
  width: 100%;
  padding: 9px 12px 9px 32px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-box .icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--ink-faint); width: 15px; height: 15px; pointer-events: none;
}

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  font-weight: 600;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-alt); }
.cell-name { font-weight: 500; }
.cell-sub { color: var(--ink-faint); font-size: 12px; margin-top: 1px; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--ink-soft);
}
.pagination .controls { display: flex; gap: 6px; }

.empty-state, .loading-state {
  padding: 52px 24px;
  text-align: center;
  color: var(--ink-soft);
}
.empty-state .icon { color: var(--ink-faint); margin-bottom: 10px; }
.empty-state h3 { font-size: 14.5px; margin-bottom: 4px; color: var(--ink); }
.empty-state p { font-size: 13px; }

.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Partner detail drawer
   ============================================================ */

.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(18, 21, 31, 0.36);
  z-index: 30;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(480px, 100vw);
  height: 100vh;
  background: var(--surface);
  z-index: 31;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideIn .18s cubic-bezier(.2,.7,.3,1);
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.drawer-head {
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.drawer-head h2 { font-size: 17px; }
.drawer-head .sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }
.drawer-close {
  background: var(--surface-alt);
  border: none;
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft);
  flex-shrink: 0;
}
.drawer-close:hover { background: var(--border); }

.drawer-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.drawer-foot {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  margin-bottom: 22px;
}
.dl-grid .full { grid-column: 1 / -1; }
.dl-item .k { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); margin-bottom: 3px; }
.dl-item .v { font-size: 13.5px; }
.dl-item .v.mono { font-family: var(--font-mono); font-size: 12.5px; word-break: break-all; }

.doc-section { margin-bottom: 22px; }
.doc-section h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin-bottom: 10px; }
.doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.doc-thumb {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-alt);
  aspect-ratio: 4 / 3;
  position: relative;
}
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-thumb .label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(18,21,31,0.72), transparent);
  color: #fff; font-size: 11px; padding: 16px 10px 6px;
}
.doc-thumb.missing {
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint); font-size: 12px; flex-direction: column; gap: 6px;
}

.action-note {
  background: var(--accent-soft);
  border: 1px solid #EED9B3;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12.5px;
  color: #7A4E0F;
  margin-bottom: 16px;
}

.danger-zone {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--danger);
}
.danger-zone h3 {
  color: var(--danger);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.danger-zone .action-note {
  background: #FBEAE8;
  border-color: #F0C4BF;
  color: #8A2E24;
}

.inline-form { display: none; margin-top: 10px; }
.inline-form.open { display: block; }

/* ============================================================
   Service status cards
   ============================================================ */

.status-summary {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--ink-soft);
}
.status-summary .chip { display: flex; align-items: center; gap: 6px; }

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.service-card {
  padding: 16px 17px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.service-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.service-card .svc-name { font-weight: 600; font-size: 13.5px; }
.service-card .svc-meta { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }
.service-card .svc-error {
  font-size: 11.5px;
  color: #8F2F27;
  background: var(--danger-soft);
  border-radius: 6px;
  padding: 6px 8px;
  font-family: var(--font-mono);
  word-break: break-word;
}
.service-card .svc-latency {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
}

.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}
.dot-up { background: var(--success); }
.dot-down { background: var(--danger); }
.dot-degraded { background: var(--accent); }
.dot-unknown { background: var(--ink-faint); }

/* The one deliberate motion flourish in this UI: a soft radar-style pulse
   ring on healthy status dots, like a heartbeat monitor. Everything else
   in this dashboard stays calm and static on purpose. */
.dot-up::after {
  content: '';
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 1.5px solid var(--success);
  animation: pulse-ring 2.2s cubic-bezier(0.2, 0.7, 0.4, 1) infinite;
}
@keyframes pulse-ring {
  0%   { transform: scale(0.7); opacity: 0.9; }
  75%  { transform: scale(1.9); opacity: 0; }
  100% { transform: scale(1.9); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dot-up::after { animation: none; display: none; }
}

/* ============================================================
   Admins view
   ============================================================ */

.settings-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .settings-grid { grid-template-columns: 1fr; }
}
.panel-title { font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.panel-pad { padding: 18px 20px; }

/* ============================================================
   Toast
   ============================================================ */

.toast-wrap {
  position: fixed;
  bottom: 20px; right: 20px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  max-width: 340px;
  animation: toastIn .18s ease;
  display: flex;
  align-items: center;
  gap: 9px;
}
.toast.success { background: #146643; }
.toast.danger { background: #8F2F27; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 780px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center; padding: 12px 14px;
  }
  .sidebar-brand { padding: 0; margin-right: auto; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav-item .count { display: none; }
  .sidebar-foot { display: none; }
  .content { padding: 18px 16px 40px; }
  .topbar { padding: 14px 16px; }
  .dl-grid { grid-template-columns: 1fr; }
  .doc-grid { grid-template-columns: 1fr; }
  .drawer { width: 100vw; }
}

.hidden { display: none !important; }
.text-soft { color: var(--ink-soft); }
.text-faint { color: var(--ink-faint); }
.mt-0 { margin-top: 0; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
.w-full { width: 100%; }