/* ==========================================================
   Bravo × Bot2Do — Shared Design System
   ========================================================== */

:root {
  /* Brand */
  --bot2do-blue: #0F44B1;
  --bot2do-blue-700: #0A357F;
  --bot2do-blue-50:  #EAF1FF;

  --bravo-gold:   #C99A2E;
  --bravo-gold-700: #8C6A1C;
  --bravo-gold-50:  #FBF3DC;

  --navy-900: #0A1530;
  --navy-800: #0F1E40;
  --navy-700: #16284F;
  --navy-50:  #EEF2F8;

  --teal-500: #06B6D4;
  --emerald-500: #10B981;
  --rose-500: #F43F5E;
  --amber-500: #F59E0B;

  /* Surface & text */
  --bg:          #F4F6FB;
  --surface:     #FFFFFF;
  --surface-2:   #F8FAFC;
  --border:      #E5E9F2;
  --border-2:    #EEF2F7;

  --text:        #0B1530;
  --text-2:      #475467;
  --text-3:      #98A2B3;

  /* Effects */
  --shadow-xs: 0 1px 2px rgba(13,28,69,.06);
  --shadow-sm: 0 1px 2px rgba(13,28,69,.05), 0 2px 6px rgba(13,28,69,.05);
  --shadow:    0 6px 18px rgba(13,28,69,.08), 0 2px 4px rgba(13,28,69,.04);
  --shadow-lg: 0 24px 48px -12px rgba(13,28,69,.18);
  --ring:      0 0 0 4px rgba(15,68,177,.15);

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-feature-settings: "cv11", "ss01", "ss03";
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, .display {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  letter-spacing: -0.02em;
  margin: 0;
  font-weight: 700;
  color: var(--text);
}

a { color: var(--bot2do-blue); text-decoration: none; }
a:hover { color: var(--bot2do-blue-700); }

/* ============== App shell ============== */
.app {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--navy-900), var(--navy-800));
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 18px 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 12px;
}
.sidebar .brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--bot2do-blue), var(--teal-500));
  display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(15,68,177,.45);
}
.sidebar .brand-mark svg { width: 22px; height: 22px; color: white; }
.sidebar .brand-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800; letter-spacing: -.01em; font-size: 15px;
}
.sidebar .brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,.55);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.nav-group { margin-top: 14px; }
.nav-group-title {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  padding: 6px 12px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  color: rgba(255,255,255,.78);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: linear-gradient(135deg, rgba(15,68,177,.55), rgba(6,182,212,.25));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.nav-item .badge {
  margin-left: auto;
  background: var(--bravo-gold);
  color: #1A1100;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
}
.sidebar .footer-card {
  margin-top: auto;
  background: rgba(255,255,255,.05);
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
}
.sidebar .footer-card h5 {
  color: #fff; font-size: 13px; margin-bottom: 4px;
}
.sidebar .footer-card p { font-size: 12px; color: rgba(255,255,255,.55); margin: 0 0 10px 0; }
.sidebar .footer-card .btn-upgrade {
  display: block; text-align: center;
  padding: 8px 12px; border-radius: 8px; font-size: 12px; font-weight: 600;
  background: var(--bravo-gold); color: #1A1100;
}

/* ============== Top bar ============== */
.main {
  display: flex; flex-direction: column;
  min-width: 0;
}
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar .search {
  flex: 1; max-width: 520px;
  position: relative;
}
.topbar .search input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 10px 14px 10px 40px;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all .15s ease;
}
.topbar .search input:focus {
  background: #fff;
  border-color: var(--bot2do-blue);
  box-shadow: var(--ring);
}
.topbar .search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-3);
}
.topbar .actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn .dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--rose-500);
  box-shadow: 0 0 0 2px #fff;
}
.avatar {
  width: 38px; height: 38px; border-radius: 999px;
  background: linear-gradient(135deg, var(--bot2do-blue), var(--bravo-gold));
  display: grid; place-items: center;
  color: white; font-weight: 700; font-size: 13px;
}

/* ============== Page ============== */
.page { padding: 28px 32px 60px; }
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 24px;
}
.page-header h1 { font-size: 28px; }
.page-header .crumb {
  font-size: 12px; color: var(--text-3); text-transform: uppercase;
  letter-spacing: .14em; margin-bottom: 6px;
}
.page-header .sub { color: var(--text-2); margin-top: 6px; }

/* ============== Buttons ============== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  font-family: inherit;
  cursor: pointer; border: 0;
  transition: all .15s ease;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--bot2do-blue);
  color: #fff;
  box-shadow: 0 4px 12px rgba(15,68,177,.3);
}
.btn-primary:hover { background: var(--bot2do-blue-700); transform: translateY(-1px); }
.btn-gold {
  background: linear-gradient(135deg, var(--bravo-gold), #E2B447);
  color: #1A1100;
}
.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-dark {
  background: var(--navy-900); color: #fff;
}

/* ============== Cards ============== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.card-pad { padding: 20px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border-2);
}
.card-header h3 {
  font-size: 15px; font-weight: 700;
}
.card-header .h-actions { display: flex; align-items: center; gap: 6px; }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  padding: 4px 9px; border-radius: 999px;
  letter-spacing: .02em;
}
.tag-blue   { background: var(--bot2do-blue-50); color: var(--bot2do-blue-700); }
.tag-gold   { background: var(--bravo-gold-50); color: var(--bravo-gold-700); }
.tag-green  { background: #D1FAE5; color: #047857; }
.tag-red    { background: #FFE4E6; color: #B91C1C; }
.tag-amber  { background: #FEF3C7; color: #92400E; }
.tag-gray   { background: #EEF2F7; color: #475467; }
.tag-purple { background: #EDE9FE; color: #5B21B6; }
.tag .tag-dot {
  width: 6px; height: 6px; border-radius: 999px; background: currentColor;
}

/* ============== KPI tiles ============== */
.kpis {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative; overflow: hidden;
}
.kpi::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--bot2do-blue);
}
.kpi.gold::before { background: var(--bravo-gold); }
.kpi.green::before { background: var(--emerald-500); }
.kpi.amber::before { background: var(--amber-500); }
.kpi .label {
  font-size: 12px; color: var(--text-2); text-transform: uppercase;
  letter-spacing: .08em; font-weight: 600;
}
.kpi .value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 28px; font-weight: 800; margin-top: 6px;
  letter-spacing: -.02em;
}
.kpi .value .unit { font-size: 14px; color: var(--text-2); margin-left: 4px; font-weight: 600; }
.kpi .delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; margin-top: 8px;
}
.kpi .delta.up { color: var(--emerald-500); }
.kpi .delta.down { color: var(--rose-500); }
.kpi .spark {
  position: absolute; right: 14px; bottom: 14px; width: 100px; height: 36px; opacity: .85;
}

/* ============== Tables ============== */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td {
  text-align: left; padding: 14px 20px; font-size: 14px;
  border-bottom: 1px solid var(--border-2);
}
.tbl th {
  font-size: 11px; color: var(--text-2); text-transform: uppercase;
  letter-spacing: .1em; font-weight: 600;
  background: var(--surface-2);
}
.tbl tr:hover td { background: var(--surface-2); }
.tbl .borrower {
  display: flex; align-items: center; gap: 12px;
}
.tbl .borrower .ava {
  width: 32px; height: 32px; border-radius: 999px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: white;
  background: linear-gradient(135deg, #818CF8, #6366F1);
}
.tbl .borrower .meta { display: flex; flex-direction: column; }
.tbl .borrower .name { font-weight: 600; font-size: 14px; }
.tbl .borrower .sub  { font-size: 12px; color: var(--text-2); }

/* progress bar inline */
.progress {
  background: var(--border-2); border-radius: 999px; height: 6px; min-width: 90px;
  overflow: hidden;
}
.progress > span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--bot2do-blue), var(--teal-500));
}

/* ============== Section ============== */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ============== Misc ============== */
.divider { height: 1px; background: var(--border-2); margin: 12px 0; }
.muted { color: var(--text-2); }
.kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; padding: 2px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-2);
}

@media (max-width: 1100px) {
  .app { grid-template-columns: 80px 1fr; }
  .sidebar .nav-item span:not(.badge) { display: none; }
  .sidebar .brand-name, .sidebar .brand-sub, .nav-group-title, .footer-card { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
