/* ============================================================================
   BankOs SuperAdmin — design system
   Built around the brand spectrum: navy → purple → blue → cyan → green
   ========================================================================== */

:root {
  /* brand */
  --navy: #0c1f6e;
  --navy-deep: #0a1652;
  --navy-ink: #081230;
  --indigo: #221a8c;
  --purple: #7c12fd;
  --blue: #0463fd;
  --cyan: #00a8e8;
  --green: #22c55e;
  --rail: linear-gradient(90deg, #0c1f6e 0%, #3a1d9e 22%, #7c12fd 42%, #0463fd 62%, #00a8e8 80%, #22c55e 100%);
  --rail-soft: linear-gradient(90deg, #7c12fd, #0463fd 45%, #00a8e8 75%, #22c55e);

  /* neutrals (cool, faintly blue to sit with navy) */
  --ink: #0f1734;
  --s-900: #131a36;
  --s-800: #1f2747;
  --s-700: #3a4467;
  --s-600: #56608a;
  --s-500: #7a85ad;
  --s-400: #9aa3c4;
  --s-300: #c3c9de;
  --s-200: #e2e6f1;
  --s-100: #eef1f8;
  --s-50:  #f6f8fc;
  --white: #ffffff;

  /* status */
  --ok: #16a34a;  --ok-bg: #ecfdf3; --ok-bd: #bbf7d0;
  --warn: #d97706; --warn-bg: #fffbeb; --warn-bd: #fde68a;
  --err: #dc2626; --err-bg: #fef2f2; --err-bd: #fecaca;
  --info-bg: #eef4ff; --info-bd: #c7d7fe; --info-tx: #1e3aa8;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(12,31,110,.06), 0 1px 3px rgba(12,31,110,.05);
  --shadow-md: 0 10px 30px rgba(12,31,110,.10);
  --shadow-lg: 0 24px 60px rgba(12,31,110,.16);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --display: 'Sora', var(--font);
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background:
    radial-gradient(1100px 460px at 88% -8%, rgba(124,18,253,.05), transparent 60%),
    radial-gradient(1000px 440px at 0% 0%, rgba(4,99,253,.05), transparent 55%),
    var(--s-100);
  color: var(--s-800);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* ── Brand wordmark ──────────────────────────────────────────────────────── */
.wordmark { font-family: var(--display); font-weight: 800; letter-spacing: -.5px; line-height: 1; }
.wordmark .b { color: currentColor; }
.wordmark .o { color: var(--purple); }
.wordmark .s { color: var(--green); }
/* gradient wordmark for light surfaces */
.wordmark-grad {
  font-family: var(--display); font-weight: 800; letter-spacing: -.5px;
  background: var(--rail); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ── Top nav ─────────────────────────────────────────────────────────────── */
.nav {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.nav::after { content: ''; display: block; height: 3px; background: var(--rail); }
.nav-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 24px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.nav-brand img { height: 34px; width: 34px; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0,0,0,.3)); }
.nav-brand .name { color: #fff; font-size: 19px; }
.nav-badge {
  font-family: var(--font); font-size: 9.5px; font-weight: 800; letter-spacing: 1.2px;
  color: #d7e0ff; padding: 3px 9px; border-radius: 50px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
}
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-link {
  position: relative; color: rgba(255,255,255,.66); font-size: 13px; font-weight: 500;
  padding: 8px 13px; border-radius: 9px; text-decoration: none;
  display: flex; align-items: center; gap: 7px; transition: all .15s;
}
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active { color: #fff; background: rgba(255,255,255,.10); }
.nav-link.active::after {
  content: ''; position: absolute; left: 13px; right: 13px; bottom: -3px; height: 2.5px;
  border-radius: 3px; background: var(--rail-soft);
}
.nav-link.danger { color: #fca5a5; }
.nav-link.danger:hover { background: rgba(220,38,38,.16); color: #fecaca; }
.nav-div { width: 1px; height: 22px; background: rgba(255,255,255,.14); margin: 0 6px; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.main { max-width: 1280px; margin: 0 auto; padding: 34px 24px 64px; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-title { font-family: var(--display); font-size: 25px; font-weight: 800; color: var(--ink); letter-spacing: -.4px; display: flex; align-items: center; gap: 11px; }
.page-subtitle { font-size: 13.5px; color: var(--s-500); margin-top: 5px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--purple); margin-bottom: 8px; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert { padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 13.5px; display: flex; align-items: flex-start; gap: 11px; border: 1px solid; line-height: 1.5; }
.alert i { margin-top: 1px; font-size: 14px; }
.alert-success { background: var(--ok-bg); border-color: var(--ok-bd); color: #166534; }
.alert-error { background: var(--err-bg); border-color: var(--err-bd); color: #991b1b; }
.alert-info { background: var(--info-bg); border-color: var(--info-bd); color: var(--info-tx); }
.alert-warning { background: #fffbeb; border-color: #fcd34d; color: #92400e; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card { background: #fff; border-radius: var(--radius); border: 1px solid var(--s-200); box-shadow: var(--shadow-sm); }
.card-header { padding: 18px 22px; border-bottom: 1px solid var(--s-100); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-family: var(--display); font-weight: 700; font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 9px; }
.card-title .dot { width: 9px; height: 9px; border-radius: 3px; background: var(--rail-soft); }
.card-body { padding: 22px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; font-family: var(--font); font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all .16s; text-decoration: none; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 13px 22px; font-size: 14.5px; border-radius: 12px; }
.btn-block { width: 100%; }

.btn-primary { color: #fff; background: var(--navy); box-shadow: 0 6px 18px rgba(12,31,110,.22); }
.btn-primary:hover { background: #0e2585; box-shadow: 0 10px 26px rgba(12,31,110,.3); }

/* signature gradient CTA — used sparingly for the single most important action */
.btn-brand { color: #fff; background: var(--rail); background-size: 180% 100%; background-position: 0 0; box-shadow: 0 8px 22px rgba(68,30,180,.32); transition: background-position .5s ease, box-shadow .2s, transform .16s; }
.btn-brand:hover { background-position: 60% 0; box-shadow: 0 12px 30px rgba(68,30,180,.42); }

.btn-secondary { background: #fff; color: var(--s-700); border-color: var(--s-200); }
.btn-secondary:hover { background: var(--s-50); border-color: var(--s-300); }
.btn-ghost { background: transparent; color: var(--s-600); }
.btn-ghost:hover { background: var(--s-100); color: var(--s-800); }
.btn-danger { background: var(--err-bg); color: var(--err); border-color: var(--err-bd); }
.btn-danger:hover { background: #fee2e2; }
.btn-warning { background: var(--warn-bg); color: #92400e; border-color: var(--warn-bd); }
.btn-warning:hover { background: #fef3c7; }
.btn-success { background: var(--ok-bg); color: #065f46; border-color: var(--ok-bd); }
.btn-success:hover { background: #d1fae5; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 11px; font-weight: 700; color: var(--s-600); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 7px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--s-200); border-radius: 10px;
  font-size: 14px; font-family: var(--font); outline: none; transition: border-color .15s, box-shadow .15s;
  background: #fff; color: var(--ink);
}
.form-input::placeholder { color: var(--s-400); }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(4,99,253,.10); }
.form-hint { font-size: 11.5px; color: var(--s-400); margin-top: 5px; }
.input-mono { font-family: var(--mono); letter-spacing: .2px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--s-700); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--blue); }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 50px; }
.badge i { font-size: 6px; }
.badge-active { background: var(--ok-bg); color: #15803d; }
.badge-inactive { background: var(--s-100); color: var(--s-600); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11.5px; color: var(--s-600); background: var(--s-50); border: 1px solid var(--s-200); padding: 4px 9px; border-radius: 8px; }

/* ── Stat cards ──────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 30px; }
.stat { position: relative; background: #fff; border-radius: var(--radius); border: 1px solid var(--s-200); padding: 18px 20px; box-shadow: var(--shadow-sm); overflow: hidden; }
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.stat.v-blue::before { background: var(--blue); }
.stat.v-green::before { background: var(--green); }
.stat.v-purple::before { background: var(--purple); }
.stat.v-slate::before { background: var(--s-400); }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 17px; }
.stat-value { font-family: var(--display); font-size: 30px; font-weight: 800; line-height: 1; margin-top: 14px; color: var(--ink); }
.stat-label { font-size: 12px; color: var(--s-500); margin-top: 5px; font-weight: 500; }

/* ── Tenant cards ────────────────────────────────────────────────────────── */
.tenant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px,1fr)); gap: 20px; }
.tenant { background: #fff; border-radius: var(--radius); border: 1px solid var(--s-200); box-shadow: var(--shadow-sm); overflow: hidden; transition: box-shadow .2s, transform .2s, border-color .2s; }
.tenant:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: var(--s-300); }
.tenant.inactive { opacity: .72; }
.tenant-top { position: relative; padding: 18px 20px 16px; border-bottom: 1px solid var(--s-100); }
.tenant-top::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--rail); }
.tenant-name { font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--ink); }
.tenant-id { font-family: var(--mono); font-size: 11px; color: var(--s-400); margin-top: 3px; }
.tenant-body { padding: 14px 20px; }
.row-kv { display: flex; align-items: center; justify-content: space-between; padding: 5px 0; font-size: 13px; }
.row-kv .k { color: var(--s-500); }
.row-kv .v { font-weight: 600; color: var(--s-800); }
.tenant-foot { padding: 12px 16px; background: var(--s-50); border-top: 1px solid var(--s-100); display: flex; gap: 7px; flex-wrap: wrap; }
.icon-btn { width: 34px; height: 34px; padding: 0; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--s-200); }
table.data { width: 100%; border-collapse: collapse; }
table.data thead th { background: var(--s-50); padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; color: var(--s-500); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--s-200); white-space: nowrap; }
table.data tbody td { padding: 11px 14px; font-size: 13px; color: var(--s-700); border-bottom: 1px solid var(--s-100); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--s-50); }
.kv-table { width: 100%; }
.kv-table td { padding: 9px 0; font-size: 13.5px; vertical-align: top; }
.kv-table td:first-child { color: var(--s-500); width: 42%; }
.kv-table td:last-child { font-weight: 600; color: var(--s-800); }

/* ── Empty / loading ─────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 64px 28px; }
.empty img { width: 84px; height: 84px; opacity: .9; margin-bottom: 18px; }
.empty-title { font-family: var(--display); font-size: 19px; font-weight: 700; color: var(--s-700); margin-bottom: 6px; }
.empty-text { font-size: 14px; color: var(--s-400); }
.spinner { width: 20px; height: 20px; border: 2.5px solid var(--s-200); border-top-color: var(--blue); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ── Chat ────────────────────────────────────────────────────────────────── */
.chat-msgs { height: 480px; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; background: var(--s-50); }
.msg { max-width: 78%; padding: 12px 15px; border-radius: 14px; font-size: 13.5px; line-height: 1.55; }
.msg-user { background: var(--navy); color: #fff; border-bottom-right-radius: 3px; align-self: flex-end; }
.msg-bot { background: #fff; color: var(--s-700); border: 1px solid var(--s-200); border-bottom-left-radius: 3px; align-self: flex-start; box-shadow: var(--shadow-sm); }
.msg-bot .who { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.msg-bot .who .ava { width: 22px; height: 22px; border-radius: 50%; background: var(--rail-soft); display: grid; place-items: center; color: #fff; font-size: 11px; }
.msg-bot .who span { font-size: 11px; font-weight: 700; color: var(--purple); }
.chat-input-row { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--s-200); background: #fff; }
.chat-input { flex: 1; padding: 11px 14px; border: 1.5px solid var(--s-200); border-radius: 10px; font-size: 13.5px; font-family: inherit; outline: none; }
.chat-input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(4,99,253,.10); }
.typing { display: flex; gap: 5px; align-items: center; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--purple); animation: pulse 1s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }

/* ── DB viewer ───────────────────────────────────────────────────────────── */
.db { display: flex; overflow: hidden; min-height: 540px; }
.db-side { width: 230px; min-width: 230px; border-right: 1px solid var(--s-200); padding: 16px; background: var(--s-50); }
.db-side .section-label { font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--s-400); margin-bottom: 12px; }
.db-tbtn { width: 100%; text-align: left; padding: 8px 11px; border-radius: 8px; border: none; cursor: pointer; font-family: var(--mono); font-size: 12px; color: var(--s-600); background: transparent; transition: all .12s; display: flex; align-items: center; gap: 8px; }
.db-tbtn:hover { background: #fff; color: var(--blue); }
.db-tbtn.active { background: var(--navy); color: #fff; }
.db-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.db-bar { padding: 14px 18px; border-bottom: 1px solid var(--s-100); background: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.section-label { font-size: 11px; font-weight: 700; color: var(--s-400); text-transform: uppercase; letter-spacing: 1px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 720px) {
  .nav-link span.txt { display: none; }
  .nav-inner { padding: 0 16px; }
  .main { padding: 22px 16px 48px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .db { flex-direction: column; }
  .db-side { width: 100%; min-width: 0; border-right: none; border-bottom: 1px solid var(--s-200); }
  .page-title { font-size: 21px; }
}

/* accessibility */
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
