/* ==================================================================
   Dawn of Bioinformatics Ltd. — Client & Payment Tracking
   Design system — corporate / finance dashboard aesthetic
   ================================================================== */

:root {
  --navy-950: #0a1a2c;
  --navy-900: #0f2540;
  --navy-800: #16324f;
  --navy-700: #1f4266;
  --navy-100: #eaf0f6;

  --teal-600: #0d9488;
  --teal-500: #14b8a6;
  --teal-50: #ecfdf9;

  --amber-500: #f59e0b;
  --amber-50: #fffbeb;

  --red-500: #e11d48;
  --red-50: #fef2f2;

  --blue-500: #2563eb;
  --blue-50: #eff6ff;

  --ink-900: #101828;
  --ink-700: #344054;
  --ink-500: #667085;
  --ink-400: #98a2b3;
  --ink-200: #e4e7ec;
  --ink-100: #f2f4f7;
  --ink-50: #f9fafb;
  --white: #ffffff;

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

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);

  --sidebar-w: 264px;
  --topbar-h: 68px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink-900);
  background: var(--ink-50);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; }
h1,h2,h3,h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }

/* ---------------- App shell layout ---------------- */
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy-950), var(--navy-900) 60%);
  color: var(--navy-100);
  display: flex; flex-direction: column;
  z-index: 40;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-600));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; color: white; flex: none;
}
.brand-text { line-height: 1.2; }
.brand-text .name { font-size: 13.5px; font-weight: 700; color: white; }
.brand-text .sub { font-size: 11px; color: var(--ink-400); }

.sidebar-nav { padding: 14px 12px; overflow-y: auto; flex: 1; }
.nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--ink-400); text-transform: uppercase;
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; margin: 2px 0;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500;
  color: #c8d5e3;
  transition: background 0.15s, color 0.15s;
}
.nav-item .icon { width: 18px; height: 18px; flex: none; opacity: 0.85; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.nav-item.active {
  background: rgba(20, 184, 166, 0.16);
  color: white;
  box-shadow: inset 3px 0 0 var(--teal-500);
}
.nav-divisions { padding: 4px 10px 10px; }
.division-group { margin-bottom: 2px; }
.division-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 8px; border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 600; color: #d6e2ee;
  cursor: pointer;
}
.division-head:hover { background: rgba(255,255,255,0.06); }
.division-head .chev { transition: transform 0.15s; font-size: 10px; color: var(--ink-400); }
.division-group.open .chev { transform: rotate(90deg); }
.division-depts {
  display: none;
  padding: 2px 0 6px 22px;
}
.division-group.open .division-depts { display: block; }
.dept-link {
  display: block; padding: 6px 8px; font-size: 12px;
  color: var(--ink-400); border-radius: var(--radius-sm);
}
.dept-link:hover { color: white; background: rgba(255,255,255,0.05); }

.sidebar-foot {
  padding: 14px; border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 11px; color: var(--ink-400);
}

/* ---------------- Topbar ---------------- */
.topbar {
  position: fixed; top: 0; right: 0; left: var(--sidebar-w); height: var(--topbar-h);
  background: white; border-bottom: 1px solid var(--ink-200);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; z-index: 30;
}
.topbar-title { font-size: 18px; font-weight: 700; color: var(--ink-900); }
.topbar-sub { font-size: 12.5px; color: var(--ink-500); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.role-switcher {
  display: flex; align-items: center; gap: 8px;
  background: var(--ink-100); border: 1px solid var(--ink-200);
  border-radius: 999px; padding: 5px 6px 5px 12px;
}
.role-switcher label { font-size: 11px; color: var(--ink-500); font-weight: 600; }
.role-switcher select {
  border: none; background: white; border-radius: 999px;
  padding: 5px 10px; font-size: 12.5px; font-weight: 600; color: var(--navy-800);
  box-shadow: var(--shadow-sm);
}

.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-700), var(--navy-900));
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.user-meta { line-height: 1.25; }
.user-meta .uname { font-size: 13px; font-weight: 650; color: var(--ink-900); }
.user-meta .urole { font-size: 11.5px; color: var(--ink-500); }

/* ---------------- Main content ---------------- */
.main {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
}
.page { padding: 26px 28px 60px; max-width: 1360px; }

.badge-scope {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--teal-50); color: var(--teal-600);
  border: 1px solid rgba(13,148,136,0.25);
  padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650;
}

/* ---------------- KPI cards ---------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 20px 0 24px; }
.kpi-card {
  background: white; border: 1px solid var(--ink-200); border-radius: var(--radius-lg);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 12.5px; color: var(--ink-500); font-weight: 600; }
.kpi-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.kpi-value { font-size: 25px; font-weight: 750; margin-top: 10px; color: var(--ink-900); }
.kpi-delta { font-size: 12px; font-weight: 650; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.kpi-delta.up { color: var(--teal-600); }
.kpi-delta.down { color: var(--red-500); }
.kpi-delta.warn { color: var(--amber-500); }

/* ---------------- Cards / panels ---------------- */
.panel {
  background: white; border: 1px solid var(--ink-200); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); margin-bottom: 22px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--ink-100);
}
.panel-head h3 { font-size: 15px; }
.panel-head .hint { font-size: 12px; color: var(--ink-500); margin-top: 2px; font-weight: 400; }
.panel-body { padding: 18px 20px; }
.panel-grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 650; border: 1px solid transparent;
  transition: transform 0.05s, filter 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy-900); color: white; }
.btn-primary:hover { filter: brightness(1.15); }
.btn-accent { background: var(--teal-600); color: white; }
.btn-accent:hover { filter: brightness(1.08); }
.btn-ghost { background: white; color: var(--ink-700); border-color: var(--ink-200); }
.btn-ghost:hover { background: var(--ink-100); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; }

/* ---------------- Filter bar ---------------- */
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--ink-100);
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11px; font-weight: 650; color: var(--ink-500); }
.input, select.input, textarea.input {
  border: 1px solid var(--ink-200); border-radius: var(--radius-sm);
  padding: 8px 11px; font-size: 13px; color: var(--ink-900);
  background: white; min-width: 150px;
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px var(--teal-50);
}
.search-input { position: relative; }
.search-input input { padding-left: 32px; min-width: 220px; }
.search-input::before {
  content: "⌕"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--ink-400); font-size: 15px;
}

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--ink-500);
  padding: 8px 10px; border-bottom: 1px solid var(--ink-200);
  background: var(--ink-50); white-space: nowrap;
}
.data-table tbody td {
  padding: 9px 10px; border-bottom: 1px solid var(--ink-100);
  color: var(--ink-700); white-space: nowrap;
}
.data-table tbody tr:hover { background: var(--ink-50); }
.data-table .cell-strong { color: var(--ink-900); font-weight: 600; }
.data-table .cell-sub { font-size: 11.5px; color: var(--ink-500); }

/* ---------------- Badges / pills ---------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 650;
}
.pill-dot { width: 6px; height: 6px; border-radius: 50%; }
.pill-success { background: var(--teal-50); color: var(--teal-600); }
.pill-success .pill-dot { background: var(--teal-600); }
.pill-pending { background: var(--amber-50); color: #b45309; }
.pill-pending .pill-dot { background: var(--amber-500); }
.pill-danger { background: var(--red-50); color: var(--red-500); }
.pill-danger .pill-dot { background: var(--red-500); }
.pill-info { background: var(--blue-50); color: var(--blue-500); }
.pill-info .pill-dot { background: var(--blue-500); }
.pill-neutral { background: var(--ink-100); color: var(--ink-700); }

.method-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.method-dot { width: 8px; height: 8px; border-radius: 2px; }
.method-cash .method-dot { background: var(--amber-500); }
.method-bank .method-dot { background: var(--blue-500); }
.method-mobile .method-dot { background: var(--teal-500); }

/* ---------------- Alerts ---------------- */
.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius-md);
  border: 1px solid var(--ink-200); background: var(--ink-50);
}
.alert-item.warn { background: var(--amber-50); border-color: rgba(245,158,11,0.3); }
.alert-item.danger { background: var(--red-50); border-color: rgba(225,29,72,0.25); }
a.alert-item { display: flex; }
a.alert-item:hover { filter: brightness(0.98); }
.alert-item .adot {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  background: white; border: 1px solid var(--ink-200);
}
.alert-item strong { font-size: 13px; color: var(--ink-900); }
.alert-item p { margin: 2px 0 0; font-size: 12px; color: var(--ink-500); }

/* ---------------- Charts ---------------- */
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }
.legend-row { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; padding: 0 4px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-500); font-weight: 600; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; }

/* ---------------- Modal ---------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white; border-radius: var(--radius-lg); width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--ink-100);
}
.modal-head h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--ink-400); line-height: 1; }
.modal-body { padding: 20px 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-body .full { grid-column: 1 / -1; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 22px; border-top: 1px solid var(--ink-100);
}

/* ---------------- Login page ---------------- */
.login-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
  background: var(--ink-50);
}
.login-brand {
  background:
    radial-gradient(circle at 20% 20%, rgba(20,184,166,0.25), transparent 45%),
    linear-gradient(160deg, var(--navy-950), var(--navy-900) 70%);
  color: white; display: flex; flex-direction: column; justify-content: space-between;
  padding: 52px;
}
.login-brand .taglines { max-width: 420px; }
.login-brand h1 { font-size: 30px; line-height: 1.25; margin-bottom: 14px; }
.login-brand p { color: #b9c8d8; font-size: 14.5px; line-height: 1.6; }
.login-stats { display: flex; gap: 28px; margin-top: 30px; }
.login-stats div strong { display: block; font-size: 20px; }
.login-stats div span { font-size: 11.5px; color: #93a5b8; }
.login-form-col { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 22px; margin-bottom: 6px; }
.login-card .lead { font-size: 13.5px; color: var(--ink-500); margin-bottom: 26px; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 12.5px; font-weight: 650; color: var(--ink-700); margin-bottom: 6px; }
.login-field .input { width: 100%; padding: 10px 12px; }
.login-submit { width: 100%; justify-content: center; padding: 11px; font-size: 13.5px; margin-top: 6px; }
.divider-line { display: flex; align-items: center; gap: 10px; margin: 22px 0; color: var(--ink-400); font-size: 11.5px; }
.divider-line::before, .divider-line::after { content: ""; flex: 1; height: 1px; background: var(--ink-200); }
.demo-access { display: flex; flex-direction: column; gap: 8px; }
.demo-btn {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border: 1px solid var(--ink-200); border-radius: var(--radius-sm);
  background: white; font-size: 12.5px; font-weight: 600; color: var(--ink-700);
}
.demo-btn:hover { border-color: var(--teal-500); background: var(--teal-50); }
.demo-btn .arrow { color: var(--ink-400); }

/* ---------------- Empty / scope-restricted note ---------------- */
.scope-note {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-500); padding: 10px 20px;
  background: var(--blue-50); border-bottom: 1px solid var(--ink-100);
}

[data-role-only] { }
.hidden { display: none !important; }

/* ---------------- Month filter bar ---------------- */
.month-filter-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(120deg, #7c3aed, #db2777 55%, #f59e0b 120%);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  margin-bottom: 20px;
  color: white;
  box-shadow: var(--shadow-md);
  position: relative;
}
.month-filter-bar .mf-label { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.month-filter-bar .mf-hint { font-size: 11.5px; color: rgba(255,255,255,0.85); margin-top: 2px; }
.mf-toggle {
  background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.35);
  color: white; padding: 8px 16px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 8px;
}
.mf-toggle:hover { background: rgba(255,255,255,0.28); }
.mf-count {
  background: white; color: #7c3aed; border-radius: 999px;
  padding: 1px 8px; font-size: 11px; font-weight: 800;
}
.mf-panel {
  display: none; position: absolute; top: calc(100% + 8px); right: 18px; z-index: 50;
  background: white; border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  border: 1px solid var(--ink-200); padding: 14px; width: 320px; color: var(--ink-900);
}
.mf-panel.open { display: block; }
.mf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-height: 220px; overflow-y: auto; margin-bottom: 12px; }
.mf-chip { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 6px 8px; border-radius: var(--radius-sm); border: 1px solid var(--ink-200); cursor: pointer; }
.mf-chip:hover { background: var(--ink-50); }
.mf-chip input { accent-color: #7c3aed; }
.mf-actions { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--ink-100); padding-top: 10px; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-grid-2 { grid-template-columns: 1fr; }
  .modal-body { grid-template-columns: 1fr; }
}
