:root {
  --ink: #172033;
  --muted: #6f7890;
  --line: #e7eaf1;
  --canvas: #f5f7fb;
  --panel: #ffffff;
  --primary: #5657d9;
  --primary-dark: #4445c2;
  --primary-soft: #ededff;
  --green: #15936b;
  --green-soft: #e6f8f1;
  --red: #df4e58;
  --red-soft: #fff0f1;
  --amber: #c47b10;
  --amber-soft: #fff6df;
  --violet-soft: #f0ecff;
  --sidebar: #171b36;
  --radius: 14px;
  --shadow: 0 12px 38px rgba(27, 35, 66, .08);
}

* { box-sizing: border-box; }

html { min-height: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.login-body { background: #eef1f7; min-height: 100vh; }

.login-shell {
  display: grid;
  grid-template-columns: minmax(410px, 45%) 1fr;
  min-height: 100vh;
}

.login-visual {
  background:
    radial-gradient(circle at 20% 86%, rgba(129, 101, 255, .25), transparent 31%),
    linear-gradient(145deg, #20275b 0%, #343296 49%, #473ab9 100%);
  color: white;
  min-height: 100vh;
  padding: 42px clamp(38px, 6vw, 84px);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.brand, .sidebar-brand, .mobile-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 760;
  letter-spacing: -.4px;
  font-size: 21px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px 10px 10px 3px;
  background: linear-gradient(135deg, #7778f5, #5657d9);
  color: #fff;
  font-weight: 800;
  font-size: 19px;
  box-shadow: 0 8px 22px rgba(57, 56, 172, .3);
}

.brand-on-dark .brand-mark { background: rgba(255,255,255,.16); box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }

.visual-copy {
  position: relative;
  z-index: 2;
  margin: auto 0;
  max-width: 510px;
}

.eyebrow {
  display: block;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.7px;
  margin-bottom: 14px;
}

.eyebrow-light { color: #bfc3ff; }

.visual-copy h1 {
  margin: 0 0 25px;
  font-size: clamp(48px, 5.5vw, 76px);
  line-height: 1.01;
  letter-spacing: -3.5px;
  font-weight: 720;
}

.visual-copy > p {
  max-width: 510px;
  margin: 0;
  color: rgba(255,255,255,.72);
  line-height: 1.72;
  font-size: 17px;
}

.visual-metrics { display: flex; margin-top: 52px; gap: 0; }
.visual-metrics > div { display: flex; flex-direction: column; min-width: 160px; padding-right: 38px; }
.visual-metrics > div + div { padding-left: 38px; border-left: 1px solid rgba(255,255,255,.18); }
.visual-metrics strong { font-size: 28px; margin-bottom: 5px; }
.visual-metrics span { color: rgba(255,255,255,.54); font-size: 12px; }

.visual-orb { position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,.08); }
.orb-one { width: 430px; height: 430px; right: -250px; top: 8%; box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 150px rgba(255,255,255,.018); }
.orb-two { width: 220px; height: 220px; left: -110px; bottom: -70px; background: rgba(255,255,255,.025); }
.visual-foot { margin: 0; color: rgba(255,255,255,.42); font-size: 12px; position: relative; z-index: 2; }

.login-panel { display: flex; align-items: center; justify-content: center; background: #fff; padding: 40px; }
.login-card { width: min(100%, 410px); }
.mobile-brand { display: none; margin-bottom: 48px; }
.login-card h2 { margin: 0 0 9px; font-size: 30px; letter-spacing: -1.1px; }
.subtle { color: var(--muted); margin: 0 0 32px; }

.auth-form { display: grid; gap: 20px; }
.auth-form label, .modal-form label { display: grid; gap: 8px; color: #333c50; font-size: 12px; font-weight: 700; }
.auth-form input, .modal-form input, .modal-form select, .modal-form textarea {
  width: 100%;
  border: 1px solid #dfe3ec;
  border-radius: 9px;
  outline: none;
  color: var(--ink);
  background: #fff;
  padding: 12px 13px;
  transition: border-color .2s, box-shadow .2s;
}
.auth-form input { height: 47px; }
.auth-form input:focus, .modal-form input:focus, .modal-form select:focus, .modal-form textarea:focus { border-color: #8c8ded; box-shadow: 0 0 0 3px rgba(86,87,217,.1); }
.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 58px; }
.password-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: transparent; border: 0; color: var(--primary); font-size: 11px; font-weight: 700; }

.btn { border: 0; border-radius: 9px; min-height: 41px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-weight: 700; transition: transform .15s, box-shadow .15s, background .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: #fff; background: var(--primary); box-shadow: 0 8px 20px rgba(86,87,217,.19); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-light { background: #f3f4f8; color: #4a5266; border: 1px solid var(--line); }
.btn-block { width: 100%; height: 48px; margin-top: 5px; }
.btn-block span { margin-left: auto; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.demo-box { margin-top: 28px; display: flex; gap: 13px; border: 1px solid #dfe3fb; background: #f7f7ff; border-radius: 10px; padding: 14px 15px; color: #4a5266; }
.demo-icon { width: 21px; height: 21px; flex: 0 0 21px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; background: var(--primary); font-size: 12px; font-weight: 800; }
.demo-box strong { display: block; color: var(--ink); font-size: 12px; margin-bottom: 5px; }
.demo-box p { margin: 2px 0; font-size: 11px; }
.login-help { text-align: center; margin: 27px 0 0; color: var(--muted); font-size: 12px; }
.login-help a { color: var(--primary); font-weight: 700; }
.alert { margin: -12px 0 21px; padding: 12px 14px; border-radius: 8px; font-size: 12px; font-weight: 650; }
.alert-error { color: #a5303b; background: var(--red-soft); border: 1px solid #f8cfd2; }
.alert-success { color: #127353; background: var(--green-soft); border: 1px solid #c9ecdf; }

.app-body { background: var(--canvas); min-height: 100vh; }
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 244px;
  flex: 0 0 244px;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: #fff;
  padding: 24px 16px 15px;
}
.sidebar-brand { padding: 0 9px 23px; }
.sidebar-brand .brand-mark { width: 31px; height: 31px; font-size: 17px; }
.sidebar-close { display: none; margin-left: auto; color: #a4aac9; background: transparent; border: 0; font-size: 25px; }

.workspace-pill { display: flex; align-items: center; gap: 9px; padding: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.07); border-radius: 10px; }
.workspace-avatar { display: inline-flex; align-items: center; justify-content: center; width: 31px; height: 31px; flex: 0 0 31px; border-radius: 8px; font-size: 10px; font-weight: 800; color: #e4e2ff; background: #45457c; }
.workspace-pill > span:nth-child(2) { display: grid; min-width: 0; }
.workspace-pill strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.workspace-pill small { color: #888faa; font-size: 9px; margin-top: 3px; }
.workspace-chevron { margin-left: auto; color: #79809e; }

.side-nav { margin-top: 24px; display: flex; flex-direction: column; gap: 3px; }
.nav-label { color: #626a88; font-size: 8px; font-weight: 800; letter-spacing: 1.3px; padding: 12px 12px 5px; }
.nav-link { position: relative; display: flex; align-items: center; gap: 11px; min-height: 42px; border-radius: 8px; padding: 0 11px; color: #aab0c8; font-size: 12px; font-weight: 600; transition: background .15s, color .15s; }
.nav-link:hover { background: rgba(255,255,255,.055); color: #fff; }
.nav-link.active { color: #fff; background: linear-gradient(90deg, rgba(99,100,231,.32), rgba(99,100,231,.13)); }
.nav-link.active::before { content: ''; position: absolute; left: -16px; top: 8px; bottom: 8px; width: 3px; background: #8788ff; border-radius: 0 4px 4px 0; }
.nav-icon { width: 20px; text-align: center; font-size: 16px; color: #8f96b4; }
.nav-link.active .nav-icon { color: #b9baff; }
.nav-count { margin-left: auto; min-width: 21px; height: 18px; display: inline-flex; align-items: center; justify-content: center; background: #303657; border-radius: 9px; color: #b7bdd4; font-size: 9px; }

.sidebar-help { margin: auto 3px 15px; display: flex; gap: 10px; padding: 13px; border: 1px solid #313653; border-radius: 10px; background: #1d2241; }
.help-mark { display: inline-flex; flex: 0 0 25px; width: 25px; height: 25px; align-items: center; justify-content: center; border-radius: 50%; background: #343960; color: #bcc0e9; font-size: 11px; font-weight: 800; }
.sidebar-help strong { display: block; font-size: 10px; }
.sidebar-help p { margin: 4px 0 8px; color: #7f87a5; font-size: 9px; }
.sidebar-help a { color: #a9aaff; font-size: 9px; font-weight: 700; }
.sidebar-user { display: flex; align-items: center; gap: 9px; border-top: 1px solid #2b304d; padding: 14px 6px 0; }
.sidebar-user > span:nth-child(2) { display: grid; min-width: 0; }
.sidebar-user strong { max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
.sidebar-user small { color: #727994; font-size: 9px; margin-top: 3px; }
.sidebar-user form { margin-left: auto; }
.sidebar-user button { background: transparent; border: 0; color: #727994; font-size: 17px; }

.avatar { width: 33px; height: 33px; flex: 0 0 33px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 800; font-size: 9px; letter-spacing: .2px; }
.avatar-indigo { color: #e7e6ff; background: #56578d; }
.avatar-sky { color: #236a93; background: #dff2ff; }
.avatar-mint { color: #18765c; background: #dff6ed; }
.avatar-lilac { color: #6551a4; background: #eee8ff; }

.main-area { margin-left: 244px; width: calc(100% - 244px); min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; height: 67px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 3vw, 39px); background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.menu-button { display: none; border: 0; background: transparent; font-size: 22px; color: var(--ink); }
.top-search { width: min(380px, 45vw); display: flex; align-items: center; gap: 9px; color: #9ba2b4; }
.top-search > span { font-size: 21px; transform: rotate(-15deg); }
.top-search input { min-width: 0; flex: 1; border: 0; background: transparent; outline: none; color: var(--ink); font-size: 12px; }
.top-search kbd { border: 1px solid #dfe2e9; border-radius: 5px; background: #f7f8fa; color: #949bad; padding: 3px 7px; font: 9px inherit; }
.top-actions { display: flex; align-items: center; gap: 15px; }
.icon-button { position: relative; border: 0; background: transparent; color: #525a70; font-size: 22px; }
.notification-dot { position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: #ee5762; box-shadow: 0 0 0 2px #fff; }
.top-divider { width: 1px; height: 26px; background: var(--line); }
.top-user { display: flex; align-items: center; gap: 9px; }
.top-user > span:nth-child(2) { display: grid; min-width: 90px; }
.top-user strong { font-size: 10px; }
.top-user small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.top-user > span:last-child { color: #9ca3b4; }

.content { width: 100%; max-width: 1530px; margin: 0 auto; padding: 30px clamp(20px, 3vw, 40px) 20px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-heading h1 { margin: 5px 0 6px; font-size: 25px; line-height: 1.2; letter-spacing: -.7px; }
.page-heading > div > p:last-child { margin: 0; color: var(--muted); font-size: 11px; }
.breadcrumb { color: #a2a8b6; font-size: 9px; margin: 0; }
.breadcrumb span { color: #656c80; }
.date-chip { display: inline-flex; align-items: center; min-height: 37px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 0 13px; font-size: 10px; color: #6d758a; box-shadow: 0 4px 16px rgba(30,36,61,.03); }
.date-chip::first-letter { color: var(--green); }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 17px; }
.stat-card, .mini-stat, .panel, .summary-strip { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 3px 14px rgba(29,38,70,.025); }
.stat-card { min-height: 155px; padding: 19px 20px 17px; display: flex; flex-direction: column; }
.stat-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 13px; }
.stat-icon, .quick-icon { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; font-weight: 800; }
.stat-icon.blue, .quick-icon.blue { color: #4a65d7; background: #ebefff; }
.stat-icon.green, .quick-icon.green { color: #188664; background: #e6f7f0; }
.stat-icon.violet, .quick-icon.violet { color: #7356c7; background: #f0ebff; }
.stat-icon.red { color: #d44c57; background: #ffedef; }
.stat-icon.amber, .quick-icon.amber { color: #b67616; background: #fff3d8; }
.trend-up, .trend-down, .stat-neutral { font-size: 9px; border-radius: 10px; padding: 4px 7px; font-weight: 700; }
.trend-up { color: var(--green); background: var(--green-soft); }
.trend-down { color: var(--red); background: var(--red-soft); }
.stat-neutral { color: #687088; background: #f1f3f7; }
.stat-label { color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.stat-card > strong { font-size: 24px; letter-spacing: -.6px; margin-bottom: 6px; }
.stat-card > small { color: #a0a6b4; font-size: 9px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(290px, .75fr); gap: 17px; margin-bottom: 17px; }
.panel { min-width: 0; }
.panel-head { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 19px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0 0 4px; font-size: 13px; letter-spacing: -.1px; }
.panel-head p { margin: 0; color: var(--muted); font-size: 9px; }
.select-like { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; color: #70788c; font-size: 9px; }
.chart-wrap { display: flex; height: 226px; padding: 21px 22px 14px 18px; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; padding: 1px 10px 24px 0; color: #9ca3b3; font-size: 8px; text-align: right; }
.chart-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chart-area svg { width: 100%; height: 178px; overflow: visible; }
.chart-grid line { stroke: #eceef3; stroke-width: .5; stroke-dasharray: 2 2; }
.chart-line { fill: none; stroke: #5b5ce2; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.chart-labels { display: flex; justify-content: space-between; color: #9ca3b3; font-size: 8px; padding: 8px 0 0; }

.quick-actions { padding: 5px 16px 10px; }
.quick-actions button, .quick-actions a { width: 100%; display: flex; align-items: center; gap: 11px; padding: 11px 2px; background: transparent; border: 0; border-bottom: 1px solid #f0f1f5; text-align: left; color: var(--ink); }
.quick-actions > :last-child { border-bottom: 0; }
.quick-icon { width: 31px; height: 31px; flex: 0 0 31px; border-radius: 8px; font-size: 13px; }
.quick-actions button > span:nth-child(2), .quick-actions a > span:nth-child(2) { display: grid; gap: 3px; }
.quick-actions strong { font-size: 10px; }
.quick-actions small { color: #9198aa; font-size: 8px; }
.quick-actions b { margin-left: auto; color: #a7adbb; font-size: 18px; font-weight: 400; }

.table-panel { margin-bottom: 17px; overflow: hidden; }
.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { height: 39px; padding: 0 15px; background: #fafbfc; border-bottom: 1px solid var(--line); color: #9097a8; text-align: left; text-transform: uppercase; letter-spacing: .55px; font-size: 8px; font-weight: 800; }
td { height: 58px; padding: 8px 15px; border-bottom: 1px solid #eff1f5; color: #4b5367; font-size: 10px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #fafbff; }
td strong { color: #30384c; }
.person-cell { display: flex; align-items: center; gap: 10px; }
.person-cell > span:last-child, .loan-cell { display: grid; gap: 4px; }
.person-cell strong, .loan-cell strong { font-size: 10px; }
.person-cell small, .loan-cell small, td > small { color: #969dae; font-size: 8px; }
.transaction-icon { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 7px; margin-right: 7px; background: var(--green-soft); color: var(--green); font-weight: 800; }
.loan-id-chip, .method-badge { display: inline-flex; align-items: center; padding: 4px 7px; border-radius: 5px; background: #f1f3f7; color: #687085; font-size: 8px; font-weight: 750; letter-spacing: .3px; }
.amount-positive { color: var(--green); }
.text-link { color: var(--primary); font-size: 9px; font-weight: 750; }
.address-cell { display: block; max-width: 190px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mobile-number { font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 10px; padding: 4px 8px; text-transform: capitalize; font-size: 8px; font-weight: 750; }
.badge i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-verified, .badge-active { color: #14805e; background: var(--green-soft); }
.badge-pending { color: #ad721a; background: var(--amber-soft); }
.badge-overdue, .badge-inactive { color: #c5424d; background: var(--red-soft); }
.badge-closed { color: #687085; background: #eceef3; }
.more-button { border: 0; background: transparent; color: #9299a9; letter-spacing: 1px; padding: 8px; }
.small-pay-button, .small-outline-button, .small-delete-button { min-height: 27px; padding: 0 9px; border: 1px solid #dcdff3; border-radius: 6px; background: #f8f8ff; color: var(--primary); font-size: 8px; font-weight: 750; white-space: nowrap; }
.small-outline-button { color: #697086; background: #fff; border-color: var(--line); }
.small-delete-button { color: #c5424d; background: #fff7f7; border-color: #f3d8da; }
.small-delete-button:hover { background: #ffeded; }
.row-actions { display: flex; align-items: center; gap: 5px; }
.is-loading { opacity: .65; cursor: wait; }
.due-cell { display: block; margin-bottom: 3px; }
.overdue-text { display: block; color: var(--red); margin-top: 4px; }
.empty-state { display: grid; place-items: center; gap: 5px; padding: 32px; color: var(--muted); }
.empty-state strong { font-size: 12px; }
.empty-state span { font-size: 9px; }

.summary-strip { display: flex; padding: 0; margin-bottom: 17px; }
.summary-strip > div { flex: 1; display: grid; gap: 5px; padding: 17px 21px; border-right: 1px solid var(--line); }
.summary-strip > div:last-child { border: 0; }
.summary-strip span { color: var(--muted); font-size: 9px; }
.summary-strip strong { font-size: 19px; }
.stats-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mini-stat { min-height: 88px; padding: 17px 20px; display: flex; align-items: center; gap: 13px; }
.mini-stat > div { display: grid; gap: 5px; }
.mini-stat span:not(.stat-icon) { color: var(--muted); font-size: 9px; }
.mini-stat strong { font-size: 19px; }
.table-search { display: flex; align-items: center; gap: 7px; min-width: 220px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; color: #9ba2b2; }
.table-search input { min-width: 0; width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 9px; }
.inline-form { margin: 0; }
.activity-action { display: inline-flex; align-items: center; border-radius: 10px; padding: 4px 8px; background: #eef0f5; color: #5f687d; font-size: 8px; font-weight: 750; }
.action-created, .action-payment_recorded, .action-login { color: #14805e; background: var(--green-soft); }
.action-updated, .action-status_changed { color: #4d5fc7; background: #edf0ff; }
.action-viewed { color: #4d5fc7; background: #edf0ff; }
.action-deleted, .action-payment_reversed, .action-logout, .action-login_failed, .action-action_failed { color: #c5424d; background: var(--red-soft); }
.log-details { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; color: #6e7689; }

.toast { position: fixed; z-index: 80; right: 24px; top: 84px; display: flex; align-items: center; gap: 9px; max-width: 390px; min-height: 48px; padding: 10px 13px; border-radius: 10px; color: #fff; box-shadow: 0 14px 40px rgba(20,28,50,.2); font-size: 11px; font-weight: 650; animation: toast-in .3s ease-out; }
.toast-success { background: #167d60; }
.toast-error { background: #c1434d; }
.toast > span { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,.16); }
.toast button { margin-left: auto; color: rgba(255,255,255,.8); border: 0; background: transparent; font-size: 18px; }
.toast.hiding { opacity: 0; transform: translateY(-8px); transition: .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

.modal { display: none; position: fixed; z-index: 100; inset: 0; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(16,21,40,.55); backdrop-filter: blur(3px); animation: fade-in .18s ease-out; }
.modal-card { position: relative; z-index: 1; width: min(100%, 520px); max-height: calc(100vh - 40px); overflow-y: auto; background: #fff; border-radius: 15px; box-shadow: 0 24px 75px rgba(16,22,50,.3); animation: modal-in .22s ease-out; }
.modal-card-wide { width: min(100%, 650px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 17px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 3px 0 0; font-size: 19px; letter-spacing: -.5px; }
.modal-kicker { color: var(--primary); font-size: 8px; font-weight: 800; letter-spacing: 1.3px; }
.modal-head > button { align-self: flex-start; width: 30px; height: 30px; border: 0; border-radius: 7px; background: #f1f3f7; color: #737b8e; font-size: 20px; }
.modal-form { padding: 20px 22px 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }
.modal-form textarea { resize: vertical; min-height: 70px; }
.modal-form select { height: 43px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 21px; margin-top: 20px; border-top: 1px solid var(--line); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
body.modal-open { overflow: hidden; }

.footer { display: flex; justify-content: space-between; color: #9aa1b1; font-size: 8px; padding: 8px 2px 2px; }
.sidebar-backdrop { display: none; }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .action-panel .quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
}

@media (max-width: 820px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; padding: 28px 20px; }
  .mobile-brand { display: inline-flex; }
  .sidebar { transform: translateX(-102%); transition: transform .25s ease; box-shadow: 18px 0 45px rgba(12,18,43,.2); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .sidebar-backdrop { position: fixed; z-index: 29; inset: 0; background: rgba(17,22,40,.42); }
  .sidebar.open + .sidebar-backdrop { display: block; }
  .main-area { width: 100%; margin-left: 0; }
  .menu-button { display: block; margin-right: 10px; }
  .topbar { padding: 0 18px; }
  .top-search { width: auto; flex: 1; }
  .top-search kbd { display: none; }
  .top-user > span:not(.avatar) { display: none; }
  .top-divider { display: none; }
  .content { padding: 24px 16px 18px; }
}

@media (max-width: 620px) {
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 22px; }
  .page-heading .date-chip { display: none; }
  .stats-grid, .stats-grid-three { grid-template-columns: 1fr; gap: 10px; }
  .stat-card { min-height: 138px; }
  .mini-stat { min-height: 75px; }
  .panel-head-wrap { align-items: flex-start; flex-direction: column; }
  .table-search { width: 100%; }
  .summary-strip { overflow-x: auto; }
  .summary-strip > div { min-width: 135px; }
  .action-panel .quick-actions { grid-template-columns: 1fr; }
  .chart-wrap { padding-left: 10px; height: 210px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .modal { padding: 10px; align-items: flex-end; }
  .modal-card { max-height: calc(100vh - 20px); border-radius: 15px 15px 10px 10px; }
  .footer { flex-direction: column; gap: 6px; }
  .toast { left: 15px; right: 15px; top: 77px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
