/* LoanSakhi.ai — shared styles. Theming is driven by CSS custom properties
   that each tenant overrides at runtime from its branding settings. */
:root {
  --brand: #1a56db;
  --accent: #0e9f6e;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e3e6ea;
  --text: #16202c;
  --muted: #63707e;
  --danger: #c81e1e;
  --warn: #c27803;
  --ok: #0e9f6e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans",
          "Noto Sans Devanagari", "Noto Sans Bengali", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- layout ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.logo .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 14px; font-weight: 800;
}
.topbar .spacer { flex: 1; }
.chip {
  font-size: 12px; padding: 3px 9px; border-radius: 999px;
  background: #eef2f7; color: var(--muted); font-weight: 600; white-space: nowrap;
}

.shell { display: flex; min-height: calc(100vh - 60px); }
.sidebar {
  width: 220px; background: var(--surface); border-right: 1px solid var(--border);
  padding: 14px 10px; flex-shrink: 0;
}
.sidebar button {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 9px 12px; border-radius: 8px; cursor: pointer; color: var(--muted);
  font: inherit; font-weight: 600; font-size: 14px; margin-bottom: 2px;
}
.sidebar button:hover { background: #f1f3f6; color: var(--text); }
.sidebar button.active { background: var(--brand); color: #fff; }
.sidebar .group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: #9aa5b1; padding: 14px 12px 6px; font-weight: 700; }

main { flex: 1; padding: 22px; max-width: 1400px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 26px 0 10px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }

/* ---------- cards ---------- */
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 27px; font-weight: 700; margin-top: 4px; line-height: 1.1; }
.stat .value.sm { font-size: 20px; }
.stat .hint { color: var(--muted); font-size: 12px; margin-top: 3px; }

/* ---------- table ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 9px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid #f0f2f4; vertical-align: middle; }
tbody tr:hover { background: #fafbfc; }
.table-wrap { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }

/* ---------- badges ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.b-ok, .b-VERIFIED, .b-APPROVED, .b-DISBURSED, .b-ACCEPTED, .b-LOW { background: #def7ec; color: #03543f; }
.b-warn, .b-FLAGGED, .b-UNDER_REVIEW, .b-ESCALATED, .b-PENDING, .b-MEDIUM,
.b-MISMATCH, .b-SUBMITTED, .b-KYC_IN_PROGRESS { background: #fdf6b2; color: #723b13; }
.b-bad, .b-REJECTED, .b-KYC_FAILED, .b-UNREADABLE, .b-HIGH, .b-CANCELLED { background: #fde8e8; color: #9b1c1c; }
.b-DRAFT, .b-NOT_STARTED, .b-UPLOADED, .b-neutral { background: #eef2f7; color: #4b5563; }

/* ---------- forms & buttons ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted);
  margin: 12px 0 5px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: 8px; font: inherit; font-size: 14px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26, 86, 219, .12);
}
textarea { min-height: 74px; resize: vertical; }

button.btn {
  background: var(--brand); color: #fff; border: 0; padding: 9px 16px;
  border-radius: 8px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
}
button.btn:hover { filter: brightness(1.07); }
button.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
button.btn.ghost { background: #eef2f7; color: var(--text); }
button.btn.ok { background: var(--ok); }
button.btn.danger { background: var(--danger); }
button.btn.sm { padding: 5px 11px; font-size: 13px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 150px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* ---------- misc ---------- */
.alert { padding: 11px 13px; border-radius: 8px; font-size: 14px; margin: 12px 0; }
.alert.err { background: #fde8e8; color: #9b1c1c; }
.alert.ok { background: #def7ec; color: #03543f; }
.alert.info { background: #e1effe; color: #1e429f; }
.alert.warn { background: #fdf6b2; color: #723b13; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.modal-bg {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45);
  display: grid; place-items: center; z-index: 50; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: 12px; padding: 22px;
  width: min(680px, 100%); max-height: 88vh; overflow-y: auto;
}
.modal h3 { margin: 0 0 4px; font-size: 18px; }

.reasons { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--muted); }
.reasons li { margin: 3px 0; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; font-size: 13px; }
.kv dd { margin: 0; }

.meter { height: 7px; background: #eef2f7; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.meter > span { display: block; height: 100%; background: var(--accent); }

.login-wrap { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: min(410px, 100%); }
.login-card .card { padding: 26px; }

.steps { display: flex; gap: 6px; margin-bottom: 22px; flex-wrap: wrap; }
.steps .step {
  flex: 1; min-width: 90px; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 8px 4px; border-top: 3px solid var(--border); text-align: center;
}
.steps .step.done { border-color: var(--accent); color: var(--accent); }
.steps .step.active { border-color: var(--brand); color: var(--brand); }

.doc-tile {
  border: 1px dashed var(--border); border-radius: 10px; padding: 14px;
  display: flex; align-items: center; gap: 12px; margin-bottom: 10px; background: #fff;
}
.doc-tile.done { border-style: solid; border-color: var(--accent); background: #f3fbf7; }
.doc-tile .name { font-weight: 600; font-size: 14px; }
.doc-tile input[type=file] { font-size: 12.5px; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; display: flex; gap: 4px; overflow-x: auto; padding: 8px; }
  .sidebar .group { display: none; }
  .sidebar button { width: auto; white-space: nowrap; }
  main { padding: 14px; }
  .kv { grid-template-columns: 1fr; }
}
