:root {
  --green: #16a34a;
  --green-dark: #15803d;
  --navy: #0f172a;
  --navy-soft: #1e293b;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --amber: #f59e0b;
  --red: #dc2626;
  --blue: #2563eb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; }
.hidden { display: none !important; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 20%, #1e293b, #0f172a 60%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.login-card input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  background: #f8fafc;
}

.login-card input:focus { outline: 2px solid #bbf7d0; border-color: var(--green); }

.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 18px; letter-spacing: -.2px; }
.brand p { font-size: 12px; color: var(--muted); }

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .5px;
}

.error-text { color: var(--red); font-size: 13px; min-height: 18px; }

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

.sidebar {
  background: var(--navy);
  color: #cbd5e1;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand h1 { color: #fff; }
.sidebar .brand p { color: #94a3b8; }

.sidebar nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: #cbd5e1;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
}

.nav-item span { width: 18px; text-align: center; opacity: .8; }
.nav-item:hover { background: rgba(148, 163, 184, .12); }
.nav-item.active { background: var(--green); color: #fff; font-weight: 600; }

.badge {
  margin-left: auto;
  background: #fef3c7;
  color: #92400e;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  padding: 1px 7px;
  font-weight: 700;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #94a3b8;
  border-top: 1px solid rgba(148, 163, 184, .18);
  padding-top: 14px;
}

.dot { width: 8px; height: 8px; border-radius: 50%; background: #64748b; }
.dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }

.link {
  margin-left: auto;
  background: none;
  border: 0;
  color: #93c5fd;
  cursor: pointer;
  font-size: 12px;
}

.main { padding: 22px 28px 60px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar h2 { font-size: 22px; letter-spacing: -.3px; }
.topbar p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.topbar-actions { display: flex; gap: 10px; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 15px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: .15s;
}

.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.btn.ghost { background: #fff; border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: #f8fafc; }
.btn.danger { background: #fee2e2; color: #b91c1c; }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; padding: 12px; }

.icon-btn {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

/* ---------- cards ---------- */
.tab { display: none; }
.tab.active { display: block; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

@media (min-width: 1500px) {
  .stat-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.stat-card .label { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .3px; text-transform: uppercase; }
.stat-card .value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; }
.stat-card .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-card.accent { background: linear-gradient(135deg, var(--green), var(--green-dark)); border: 0; color: #fff; }
.stat-card.accent .label, .stat-card.accent .sub { color: #dcfce7; }

.panel-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.card-head h3 { font-size: 15px; }
.hint { font-size: 11px; color: var(--muted); }

.map { height: 330px; border-radius: 10px; overflow: hidden; }

.list { display: flex; flex-direction: column; gap: 8px; max-height: 330px; overflow: auto; }

.list-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.list-row strong { font-weight: 600; }
.list-row .muted { color: var(--muted); font-size: 12px; }

/* ---------- table ---------- */
.table-card { padding: 6px 6px 10px; overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #f8fafc; }
.table .empty { text-align: center; color: var(--muted); padding: 30px 0; }

.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
}

.pill.green { background: #dcfce7; color: #166534; }
.pill.blue { background: #dbeafe; color: #1d4ed8; }
.pill.amber { background: #fef3c7; color: #92400e; }
.pill.red { background: #fee2e2; color: #991b1b; }
.pill.gray { background: #f1f5f9; color: #475569; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input, .toolbar select { min-width: 180px; }

input, select, textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #bbf7d0; border-color: var(--green); }

/* ---------- kyc ---------- */
.kyc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }

.kyc-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.kyc-card h4 { margin: 0 0 2px; font-size: 15px; }
.kyc-card .phone { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.kyc-rows { display: grid; gap: 4px; font-size: 12.5px; margin-bottom: 10px; }
.kyc-rows div { display: flex; justify-content: space-between; gap: 8px; }
.kyc-rows span:first-child { color: var(--muted); }
.kyc-thumbs { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.kyc-thumbs img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: #f8fafc;
}
.kyc-actions { display: flex; gap: 8px; }

/* ---------- forms ---------- */
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.settings-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.settings-form .field { width: 100%; }
.settings-form .field.full { grid-column: 1 / -1; }
.report-actions { flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }

.kv { display: grid; gap: 8px; font-size: 13px; }
.kv div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border); padding-bottom: 6px; }

/* ---------- rate cards ---------- */
.slab-cell { font-size: 12px; color: var(--muted); line-height: 1.7; }

.quote-result {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  min-height: 30px;
}

.quote-result.small { font-size: 12px; gap: 6px; }
.quote-split { color: var(--muted); font-size: 12px; }

.slab-rows { display: grid; gap: 8px; width: 100%; }

.slab-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.slab-row input { width: 100%; }
.slab-arrow { font-size: 12px; color: var(--muted); }

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}

.modal-card {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}

.modal-head h3 { font-size: 16px; }
.modal-body { padding: 18px 20px 22px; display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.modal-body .field.full { grid-column: 1 / -1; }
.modal-body .actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: var(--navy);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  font-size: 13px;
  z-index: 100;
  max-width: 340px;
}
.toast.error { background: #991b1b; }

@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin: 0; border: 0; padding: 0; width: 100%; }
  .panel-grid { grid-template-columns: 1fr; }
  .main { padding: 16px; }
}
