/* ─── Design tokens ─────────────────────────────────────────── */
:root {
  --bg:          #f0f2f5;
  --surface:     #ffffff;
  --surface-2:   #f7f8fa;
  --border:      #e4e7ec;
  --border-2:    #d0d5dd;

  --ink:         #101828;
  --ink-2:       #344054;
  --ink-3:       #667085;
  --ink-4:       #98a2b3;

  --brand:       #2a5af5;
  --brand-dk:    #1e45d1;
  --brand-lt:    #eff3ff;

  --green:       #039855;
  --green-lt:    #d1fadf;
  --red:         #d92d20;
  --red-lt:      #fce9e9;
  --amber:       #b54708;
  --amber-lt:    #fef0c7;
  --purple:      #5925dc;
  --purple-lt:   #ede9fe;
  --teal:        #0e7090;
  --teal-lt:     #cff9fe;

  --nav-w:       232px;
  --radius-sm:   8px;
  --radius:      12px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
  --shadow:      0 4px 16px rgba(16,24,40,.08);
  --shadow-lg:   0 12px 40px rgba(16,24,40,.14);
}

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }
a { text-decoration: none; color: inherit; }

/* ─── Sidebar nav ────────────────────────────────────────────── */
:root {
  --nav-w-collapsed: 64px;
}

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--nav-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-x: hidden;
  overflow-y: auto;
  transition: width .22s cubic-bezier(.4,0,.2,1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Toggle button — fixed so it's never clipped by sidebar overflow */
.sidebar-toggle-btn {
  position: fixed;
  left: calc(var(--nav-w) - 12px);
  top: 26px;
  width: 24px; height: 24px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink-3);
  box-shadow: 0 1px 4px rgba(16,24,40,.14);
  transition: left .22s cubic-bezier(.4,0,.2,1), background .15s, color .15s, border-color .15s;
  z-index: 101;
  padding: 0;
  flex-shrink: 0;
}
.sidebar-toggle-btn:hover {
  background: var(--brand-lt);
  color: var(--brand);
  border-color: var(--brand);
}
.sidebar-toggle-btn svg {
  transition: transform .22s cubic-bezier(.4,0,.2,1);
  flex-shrink: 0;
}

.brand-mark {
  width: 36px; height: 36px;
  background: var(--brand);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: white;
  letter-spacing: -.02em;
  flex-shrink: 0;
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 400;
}

.nav-section {
  padding: 16px 12px 8px;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 0 8px;
  margin-bottom: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  transition: background .15s, color .15s;
  cursor: pointer;
  margin-bottom: 2px;
}

.nav-link svg { flex-shrink: 0; opacity: .7; }

.nav-link:hover {
  background: var(--brand-lt);
  color: var(--brand);
}
.nav-link:hover svg { opacity: 1; }

.nav-link.active {
  background: var(--brand-lt);
  color: var(--brand);
  font-weight: 600;
}
.nav-link.active svg { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

/* Early-init: applied to <html> before body exists to prevent layout flash */
html.nav-collapsed-init .sidebar,
html.nav-collapsed-init .main,
html.nav-collapsed-init .sidebar-toggle-btn { transition: none !important; }
html.nav-collapsed-init .sidebar             { width: var(--nav-w-collapsed); }
html.nav-collapsed-init .main               { margin-left: var(--nav-w-collapsed); }
html.nav-collapsed-init .sidebar-toggle-btn { left: calc(var(--nav-w-collapsed) - 12px); }

/* ─── Collapsed sidebar state ────────────────────────────────── */
body.nav-collapsed .sidebar            { width: var(--nav-w-collapsed); }
body.nav-collapsed .main               { margin-left: var(--nav-w-collapsed); }
body.nav-collapsed .nav-text           { display: none; }
body.nav-collapsed .nav-label          { display: none; }
body.nav-collapsed .sidebar-brand-text { display: none; }
body.nav-collapsed .nav-link           { justify-content: center; padding: 10px; gap: 0; }
body.nav-collapsed .sidebar-footer .nav-link { justify-content: center; padding: 10px; gap: 0; }
body.nav-collapsed .sidebar-toggle-btn        { left: calc(var(--nav-w-collapsed) - 12px); }
body.nav-collapsed .sidebar-toggle-btn svg   { transform: rotate(180deg); }

/* Tooltip for collapsed nav links */
body.nav-collapsed .nav-link[title]:hover::after {
  content: attr(title);
  position: fixed;
  left: calc(var(--nav-w-collapsed) + 8px);
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  z-index: 200;
  box-shadow: var(--shadow);
}

/* ─── Main layout ────────────────────────────────────────────── */
.main {
  margin-left: var(--nav-w);
  min-height: 100vh;
  transition: margin-left .22s cubic-bezier(.4,0,.2,1);
}

.topbar {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 90;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-body {
  padding: 28px;
}

/* ─── Mobile header (hidden on desktop) ─────────────────────── */
.mobile-header { display: none; }
.mobile-container { padding: 16px; }

/* ─── Typography ─────────────────────────────────────────────── */
.page-heading {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.025em;
}

.page-sub {
  font-size: 13.5px;
  color: var(--ink-3);
  margin-top: 3px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 14px;
}

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-pad { padding: 22px; }
.card-pad-lg { padding: 28px; }

/* ─── Stat cards ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--ink);
  line-height: 1;
}

.stat-card.accent-green { border-left: 3px solid var(--green); }
.stat-card.accent-red   { border-left: 3px solid var(--red); }
.stat-card.accent-brand { border-left: 3px solid var(--brand); }
.stat-card.accent-amber { border-left: 3px solid var(--amber); }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s, box-shadow .15s;
  white-space: nowrap;
}

.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--brand);
  color: white;
  box-shadow: 0 1px 4px rgba(42,90,245,.3);
}
.btn-primary:hover { background: var(--brand-dk); }

.btn-secondary {
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-ghost {
  background: transparent;
  color: var(--ink-3);
  border: none;
  box-shadow: none;
  padding: 8px 10px;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--ink-2); transform: none; }

.btn-danger {
  background: var(--red-lt);
  color: var(--red);
  border: 1px solid #fca5a5;
}
.btn-danger:hover { background: #fee2e2; }

.btn-sm { font-size: 12px; padding: 6px 11px; }
.btn-lg { font-size: 15px; padding: 12px 22px; border-radius: var(--radius); }
.btn-full { width: 100%; }

.btn-dashed {
  background: var(--surface-2);
  color: var(--ink-3);
  border: 1.5px dashed var(--border-2);
  box-shadow: none;
  width: 100%;
  margin-bottom: 10px;
  font-size: 14px;
  padding: 12px;
  border-radius: var(--radius);
}
.btn-dashed:hover { background: var(--surface); border-color: var(--ink-4); color: var(--ink-2); transform: none; }

.save-btn { /* alias */ }

/* ─── Form elements ──────────────────────────────────────────── */
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}

/* keep old `label` selector working too */
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}

input:not([type="checkbox"]), select, textarea {
  width: 100%;
  padding: 9px 13px;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
  -webkit-appearance: none;
}

input::placeholder { color: var(--ink-4); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(42,90,245,.1);
  background: var(--surface);
}

input[readonly] {
  background: var(--surface-2);
  color: var(--ink-3);
  cursor: default;
}

textarea { min-height: 100px; resize: vertical; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 34px;
}

.form-group { display: flex; flex-direction: column; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  letter-spacing: .04em;
  text-transform: uppercase;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

/* ─── Filter bar ─────────────────────────────────────────────── */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.filter-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr) auto auto;
  gap: 12px;
  align-items: end;
}

.filter-item { display: flex; flex-direction: column; }
.filter-actions { display: flex; align-items: flex-end; }

/* ─── Table ──────────────────────────────────────────────────── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.table-topbar h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.table-topbar p {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 2px;
}

.table-topbar-sub {
  padding: 6px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  min-height: 28px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.table-wrapper { overflow-x: auto; }

.applications-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.applications-table thead th {
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.applications-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.applications-table tbody tr:hover { background: #fbfcff; }
.applications-table tbody tr:last-child { border-bottom: none; }

.applications-table td {
  padding: 11px 14px;
  color: var(--ink-2);
  vertical-align: middle;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.td-primary { font-weight: 600; color: var(--ink) !important; }
.td-mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; }

/* ─── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green  { background: var(--green-lt);  color: var(--green); }
.badge-red    { background: var(--red-lt);    color: var(--red); }
.badge-amber  { background: var(--amber-lt);  color: var(--amber); }
.badge-brand  { background: var(--brand-lt);  color: var(--brand); }
.badge-purple { background: var(--purple-lt); color: var(--purple); }
.badge-teal   { background: var(--teal-lt);   color: var(--teal); }
.badge-neutral { background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--border); }

/* Status aliases */
.badge.approved     { background: var(--green-lt);  color: var(--green); }
.badge.rejected     { background: var(--red-lt);    color: var(--red); }
.badge.pending      { background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--border); }

/* Type chips */
.type-chip { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--brand-lt); color: var(--brand); }
.customer-chip { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--green-lt); color: var(--green); }

.type-income          { background:#dbeafe; color:#1e40af; }
.type-obc             { background:#fef3c7; color:#92400e; }
.type-ncl             { background: var(--purple-lt); color: var(--purple); }
.type-domicile        { background: var(--green-lt);  color: var(--green); }
.type-ews             { background: var(--teal-lt);   color: var(--teal); }
.type-sc              { background: var(--red-lt);    color: var(--red); }
.type-st              { background:#fef3c7; color:#92400e; }
.type-birth-certificate { background:#e0e7ff; color:#4338ca; }

.customer-client { background: var(--green-lt); color: var(--green); }
.customer-dealer { background: var(--purple-lt); color: var(--purple); }

/* ─── Summary strip (applications page top) ─────────────────── */
.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.summary-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}

.summary-tile .label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}

.summary-tile .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.03em;
  line-height: 1;
}

/* ─── Quick-filter pills ─────────────────────────────────────── */
.quick-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.qf-pill {
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border-2);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: all .15s;
}
.qf-pill:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-lt); }

/* ─── Breakdown lists (dashboard) ───────────────────────────── */
.breakdown-list { display: flex; flex-direction: column; gap: 10px; }

.breakdown-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.breakdown-name {
  font-size: 13px;
  color: var(--ink-2);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breakdown-bar-wrap {
  flex: 2;
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.breakdown-bar {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
}

.breakdown-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  min-width: 28px;
  text-align: right;
}

/* ─── Dashboard quick-action buttons ────────────────────────── */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ─── Password cell ──────────────────────────────────────────── */
.masked-password span {
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: 2px;
  font-size: 12px;
}

.reveal-btn {
  margin-left: 6px;
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--ink-3);
  padding: 2px 7px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  transition: all .12s;
  margin-top: 0 !important;
}
.reveal-btn:hover { background: var(--surface-2); color: var(--brand); border-color: var(--brand); transform: none; }

/* ─── Modal ──────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(16,24,40,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 2000;
  backdrop-filter: blur(2px);
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 780px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink-3);
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
  font-size: 18px;
  margin-top: 0;
  transition: color .15s, background .15s;
}
.modal-close:hover { background: var(--surface-2); color: var(--ink); transform: none; }

.modal-section-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin: 20px 0 12px;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 24px;
}

.modal-field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-4);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.modal-field .val {
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.modal-file-section { margin-top: 20px; }
.modal-file-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

.file-item {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--ink-2);
}
.file-item a { color: var(--brand); font-weight: 500; }
.file-item a:hover { text-decoration: underline; }
.file-empty { font-size: 13px; color: var(--ink-4); }

/* ─── Payment breakdown cell ─────────────────────────────────── */
.payment-breakdown { font-size: 12px; color: var(--ink-3); line-height: 1.7; }

/* ─── Full-btn alias ─────────────────────────────────────────── */
.full-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  background: var(--brand);
  color: white;
  border: none;
  cursor: pointer;
  transition: background .15s, transform .1s;
  text-decoration: none;
}
.full-btn:hover { background: var(--brand-dk); transform: translateY(-1px); }

/* ─── Mobile application cards ───────────────────────────────── */
.applications-list { display: none; }

/* ─── Login page ─────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.login-logo .mark {
  width: 44px; height: 44px;
  background: var(--brand);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: white;
}

.login-logo .name { font-size: 16px; font-weight: 700; color: var(--ink); }
.login-logo .sub  { font-size: 12px; color: var(--ink-3); }

.login-card h2 { font-size: 20px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.login-card p  { font-size: 13.5px; color: var(--ink-3); margin-bottom: 28px; }

.login-field { margin-bottom: 16px; }
.login-submit { width: 100%; margin-top: 8px; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (min-width: 720px) {
  .filter-grid-simple {
    grid-template-columns: repeat(3, minmax(0,1fr));
  }
}

@media (max-width: 1024px) {
  :root { --nav-w: 200px; }
  .filter-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar-toggle-btn { display: none; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .mobile-header {
    display: flex;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .mobile-header .logo {
    width: 32px; height: 32px;
    background: var(--brand);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800; color: white;
  }
  .mobile-header .header-title {
    font-size: 14px; font-weight: 600; color: var(--ink); flex: 1;
  }
  .mobile-header .menu-links {
    display: flex; gap: 6px; flex-wrap: wrap; width: 100%;
  }
  .mobile-header .menu-links a {
    font-size: 12px; font-weight: 500; color: var(--ink-2);
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 999px;
    transition: all .15s;
  }
  .mobile-header .menu-links a:hover { background: var(--brand-lt); color: var(--brand); border-color: var(--brand); }
  .topbar { display: none; }
  .page-body { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .summary-strip { grid-template-columns: 1fr; }
  .modal-grid { grid-template-columns: 1fr; }

  .table-wrapper .applications-table { display: none; }
  .applications-list {
    display: block;
    margin-top: 8px;
  }

  .application-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
  }
  .application-card .card-header {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px;
  }
  .application-card .card-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
  .application-card .card-subtitle { font-size: 13px; color: var(--ink-2); margin-bottom: 2px; }
  .application-card .card-subtext { font-size: 12px; color: var(--ink-3); }
  .application-card .card-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
  .application-card .status-pill { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
  .application-card .status-pending  { background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--border); }
  .application-card .status-approved { background: var(--green-lt); color: var(--green); }
  .application-card .status-rejected { background: var(--red-lt); color: var(--red); }
  .application-card .type-pill { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--brand-lt); color: var(--brand); }
  .application-card .customer-type-pill { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--green-lt); color: var(--green); }
  .application-card .card-detail { font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; }
  .application-card .card-payments { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-top: 10px; }
  .application-card .payment-label { font-size: 10.5px; color: var(--ink-3); margin-bottom: 2px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
  .application-card .payment-value { font-size: 14px; font-weight: 700; color: var(--ink); }
  .application-card .card-actions { display: flex; gap: 8px; margin-top: 12px; }
  .application-card .card-actions .btn { flex: 1; min-height: 40px; }
  .application-card .card-actions a { flex: 1; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
}

@media (max-width: 480px) {
  .filter-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── Column drag-and-drop ───────────────────────────────────── */
.applications-table th.col-draggable {
  cursor: grab;
  user-select: none;
}
.applications-table th.col-draggable:active { cursor: grabbing; }

.col-drag-handle {
  opacity: .35;
  font-size: 11px;
  margin-left: 4px;
  vertical-align: middle;
}
.applications-table th.col-draggable:hover .col-drag-handle { opacity: .7; }

.applications-table th.col-dragging {
  opacity: .35;
}
.applications-table th.col-drop-left  { box-shadow: inset 3px 0 0 var(--brand); }
.applications-table th.col-drop-right { box-shadow: inset -3px 0 0 var(--brand); }

/* ─── Utilities ──────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--ink-3); }
.text-sm { font-size: 13px; }
.font-mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; }

/* dashboard 2-col layout */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* secondary-btn alias */
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--ink-2);
  transition: background .15s;
  text-decoration: none;
}
.secondary-btn:hover { background: var(--surface-2); }

/* page-title alias for pages still using old class */
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.025em;
  margin-bottom: 6px;
}

/* mobile-card alias */
.mobile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.mobile-card h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* dashboard stat-box alias */
.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat-box p {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.stat-box h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--ink);
  line-height: 1;
}

/* summary-row alias */
.summary-row {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.summary-item {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 1px solid var(--border);
}
.summary-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.summary-item div:last-child {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--ink);
  line-height: 1;
}

/* dashboard-grid alias */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

/* card-grid alias for form */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 16px;
}

.field-item { display: flex; flex-direction: column; }

@media (max-width: 600px) {
  .card-grid { grid-template-columns: 1fr; }
  .summary-row { grid-template-columns: 1fr; }
}

/* fill-random alias */
.fill-random-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; font-size: 14px; font-weight: 600;
  padding: 12px; margin-bottom: 10px;
  background: var(--surface-2);
  color: var(--ink-3);
  border: 1.5px dashed var(--border-2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s;
}
.fill-random-btn:hover { background: var(--surface); border-color: var(--ink-4); color: var(--ink-2); transform: none; }

.table-wrapper {
    overflow-x: auto;
}

.dealer-table {
    width: 100%;
    border-collapse: collapse;
}

.dealer-table th {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 2px solid #e5e7eb;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
}

.dealer-table td {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.dealer-table tbody tr:hover {
    background: rgba(0,0,0,0.02);
}

.action-group {
    display: flex;
    gap: 8px;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-disabled {
    background: #fee2e2;
    color: #991b1b;
}

input[type="checkbox"] {
    width: auto !important;
    height: auto;
    margin-right: 8px;
    cursor: pointer;
}

.zone-checkbox {
    width: auto !important;
}