:root {
  --navy: #0B2545;
  --blue: #1E63E9;
  --violet: #7A3FF2;
  --cyan: #19C3E6;
  --ink: #0E1726;
  --slate: #475569;
  --muted: #94A3B8;
  --line: #E7ECF3;
  --surface: #F6F8FC;
  --white: #fff;
  --success: #0E9F6E;
  --warning: #F59E0B;
  --danger: #E5484D;
  --info: #2E9BF0;
  --radius: 14px;
  --shadow: 0 6px 22px rgba(15, 23, 42, .07);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 11.5px; }
h1, h2, h3 { margin: 0 0 6px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 400px; background: var(--white);
  border-radius: 20px; padding: 32px; box-shadow: var(--shadow);
}
.brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.brand-logo { width: 48px; height: 48px; border-radius: 12px; }
.brand-logo.sm { width: 34px; height: 34px; border-radius: 9px; }
.brand-name { font-weight: 800; font-size: 18px; }
.brand-name.sm { font-size: 15px; }
.brand-tag { font-size: 12px; color: var(--muted); }
label { display: block; font-size: 13px; font-weight: 600; color: var(--slate); margin: 14px 0 0; }
input, select, textarea {
  width: 100%; margin-top: 6px; padding: 11px 13px; font: inherit;
  border: 1.5px solid var(--line); border-radius: 11px; background: var(--white);
  color: var(--ink); outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
textarea { min-height: 84px; resize: vertical; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; border: none;
  border-radius: 11px; padding: 11px 16px; transition: transform .08s, filter .15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--blue), var(--violet)); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--slate); border: 1.5px solid var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.sm { padding: 8px 12px; font-size: 12.5px; }
.btn.block { width: 100%; margin-top: 20px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.alert { margin-top: 14px; padding: 11px 13px; border-radius: 11px; font-size: 13px; }
.alert.error { background: #FDECEC; color: #9F1239; border: 1px solid #F7C9CE; }
.alert.ok { background: #E7F8F1; color: #065F46; border: 1px solid #BCEBD9; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--navy); color: #fff; padding: 18px 14px; display: flex;
  flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand-name { color: #fff; }
.sidebar .brand-tag { color: #9fb2cc; }
#nav { margin-top: 14px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px;
  color: #c7d3e6; font-size: 13.5px; cursor: pointer; user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, var(--blue), var(--violet)); color: #fff; font-weight: 600; }
.nav-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); opacity: .7; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #6f83a1; margin: 14px 6px 4px; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.1); padding-top: 12px; }
.who { font-size: 12px; color: #c7d3e6; margin-bottom: 8px; word-break: break-word; }

.content { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 16px 22px;
  background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.topbar h2 { font-size: 18px; flex: 1; }
.menu-btn { display: none; background: none; border: none; font-size: 20px; cursor: pointer; }
.badge {
  background: #E7F8F1; color: var(--success); font-size: 11.5px; font-weight: 700;
  padding: 4px 10px; border-radius: 20px; text-transform: uppercase;
}
.page { padding: 22px; }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }

.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.stat { display: flex; align-items: center; gap: 14px; }
.stat .ico {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-size: 20px; background: rgba(30,99,233,.1); color: var(--blue);
}
.stat .val { font-size: 22px; font-weight: 800; }
.stat .lbl { font-size: 12.5px; color: var(--muted); }

.section-title { font-size: 14px; font-weight: 700; margin: 4px 0 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700;
  background: var(--surface); color: var(--slate); text-transform: capitalize;
}
.pill.ok { background: #E7F8F1; color: var(--success); }
.pill.warn { background: #FEF4E6; color: #B45309; }
.pill.err { background: #FDECEC; color: var(--danger); }
.pill.blue { background: rgba(30,99,233,.1); color: var(--blue); }
.pill.violet { background: rgba(122,63,242,.1); color: var(--violet); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #FBFCFE; position: sticky; top: 0; }
tbody tr:hover { background: #FBFCFE; }
td.wrap { white-space: normal; max-width: 320px; }
.empty { text-align: center; padding: 40px; color: var(--muted); font-size: 13.5px; }

/* ---------- Integration cards ---------- */
.integration { display: flex; flex-direction: column; gap: 10px; }
.integration .head { display: flex; align-items: center; gap: 10px; }
.integration .head .ico { font-size: 22px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-dot.ok { background: var(--success); }
.status-dot.warn { background: var(--warning); }
.status-dot.err { background: var(--danger); }
.status-dot.off { background: var(--muted); }
.kv { font-size: 12.5px; color: var(--slate); display: flex; justify-content: space-between; gap: 10px; }
.kv .k { color: var(--muted); }
.masked { font-family: ui-monospace, Menlo, monospace; letter-spacing: .05em; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(14,23,38,.5); display: grid; place-items: center;
  padding: 20px; z-index: 50;
}
.modal {
  background: var(--white); border-radius: 18px; padding: 22px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.modal h3 { font-size: 17px; margin-bottom: 4px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- Toast ---------- */
.toast-root { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 80; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 11px; font-size: 13.5px;
  box-shadow: var(--shadow); animation: slideIn .2s ease;
}
.toast.ok { background: var(--success); }
.toast.err { background: var(--danger); }
@keyframes slideIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; transform: translateX(-100%); transition: transform .22s; }
  .sidebar.open { transform: none; }
  .menu-btn { display: block; }
}
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-pad { display: grid; place-items: center; padding: 60px; }

/* ---- KYC & Verification ---- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .input { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 13px; background: var(--white); min-width: 150px; }
.strong { font-weight: 600; }
.muted { color: var(--muted); font-size: 12px; }
.kyc-review { max-height: 66vh; overflow-y: auto; padding-right: 4px; }
.kyc-review h4 { margin: 16px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.kyc-head { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.kyc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 20px; }
.kyc-review .kv { display: flex; gap: 8px; font-size: 13px; align-items: center; }
.kyc-review .kv .k { color: var(--muted); min-width: 112px; }
.kyc-review .kv .v { font-weight: 500; }
.kyc-docs { display: flex; flex-wrap: wrap; gap: 12px; }
.kyc-doc { width: 150px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--white); }
.kyc-thumb { width: 100%; height: 104px; object-fit: cover; border-radius: 7px; background: #EEF1F6; display: block; }
.kyc-thumb.placeholder { display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.kyc-doc .meta .t { font-size: 11.5px; font-weight: 600; margin-top: 6px; }
.kyc-doc .meta .s { font-size: 11px; color: var(--muted); word-break: break-all; }
.kyc-note { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 13px; resize: vertical; }
.kyc-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
