:root {
  --sidebar: #1a0506;
  --sidebar-hover: #2d0a0d;
  --sidebar-active: #B80611;
  --primary: #B80611;
  --primary-dark: #8E050E;
  --primary-light: #fef2f2;
  --primary-border: #fecaca;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #059669;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 8px 24px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

body:has(.app-shell) {
  overflow: hidden;
  height: 100vh;
}

.boot-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #5a0309 0%, #B80611 100%);
}

.boot-splash img,
.boot-splash-logo {
  width: min(340px, 88vw);
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.3));
}

#app {
  min-height: 100vh;
}

/* Auth */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  overflow: hidden;
}

.auth-brand {
  background: linear-gradient(160deg, #5a0309 0%, #B80611 100%);
  color: #fff;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  overflow: auto;
  position: relative;
  z-index: 0;
}

.auth-brand-logo {
  display: block;
  width: 100%;
  max-width: min(100%, 340px);
  height: auto;
  object-fit: contain;
  object-position: left center;
  margin-bottom: 20px;
  border-radius: 12px;
  flex-shrink: 0;
}

.auth-brand-tagline {
  opacity: 0.9;
  max-width: 400px;
  font-size: 1.05rem;
}

.auth-brand p {
  opacity: 0.9;
  max-width: 400px;
  font-size: 1.05rem;
}

.auth-features {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-feature {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.95rem;
}

.auth-feature-icon {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--card);
  min-width: 0;
  position: relative;
  z-index: 1;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-card-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.auth-card-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 28px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #fafafa 0%, #fef2f2 100%);
  border: 1px solid var(--primary-border);
  border-radius: 10px;
}

.auth-card-footer {
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 0.88rem;
  color: #475569;
  cursor: pointer;
  user-select: none;
}

.auth-remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.auth-retry-banner {
  font-size: 0.85rem;
  line-height: 1.5;
}

.auth-retry-link {
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

.auth-retry-link:disabled {
  opacity: 0.6;
  cursor: wait;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 28px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}

.auth-tab.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: var(--shadow);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(184, 6, 17, 0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.85rem;
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.alert-error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.alert-success {
  background: #ecfdf5;
  color: var(--success);
  border: 1px solid #a7f3d0;
}

.hidden {
  display: none !important;
}

/* App shell */
.app-shell {
  display: flex;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 260px;
  height: 100vh;
  background: var(--sidebar);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-brand {
  padding: 16px 12px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.sidebar-brand-logo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center top;
  border-radius: 8px;
  margin-bottom: 8px;
}

.sidebar-brand span {
  font-size: 0.75rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.sidebar-user strong {
  color: #fff;
  display: block;
}

.sidebar-user small {
  color: #94a3b8;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
}

.nav-icon {
  width: 20px;
  text-align: center;
  opacity: 0.9;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.main-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.main-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
}

.main-header p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 2px;
}

.main-content {
  padding: 28px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

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

.stat-card label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 800;
  margin-top: 8px;
  color: var(--text);
}

.stat-card.primary .value {
  color: var(--primary);
}

.stat-card.success .value {
  color: var(--success);
}

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

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.card-header h2 {
  font-size: 1rem;
  font-weight: 700;
}

.card-body {
  padding: 22px;
}

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

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  white-space: nowrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  text-align: left;
  padding: 12px 14px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  padding: 14px;
  border-top: 1px solid var(--border);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-blue {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.badge-green {
  background: #d1fae5;
  color: #047857;
}

.badge-amber {
  background: #ffedd5;
  color: #b45309;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1.1rem;
}

.modal-body {
  padding: 22px;
}

.modal-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.qr-panel {
  text-align: center;
  padding: 24px;
}

.qr-panel img {
  border-radius: 12px;
  border: 1px solid var(--border);
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.qr-card-main {
  max-width: 520px;
  margin: 0 auto;
}

.qr-frame {
  display: inline-block;
  padding: 16px;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 3px solid var(--primary);
}

.qr-fare {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  margin-top: 20px;
}

.qr-hint {
  color: var(--muted);
  margin-top: 8px;
  font-size: 0.9rem;
}

.qr-token {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 8px;
}

.provider-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.provider-admin-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  background: #fff;
}

.provider-admin-card.inactive {
  opacity: 0.55;
}

.provider-logo-wrap {
  width: 72px;
  height: 72px;
  margin: 0 auto 10px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.provider-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.provider-logo-fallback {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--primary);
}

.provider-admin-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.company-branding-panel {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.company-branding-preview {
  width: 240px;
  padding: 8px;
  border-radius: 12px;
  background: linear-gradient(160deg, #5a0309 0%, #B80611 100%);
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.company-branding-logo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

.company-branding-fallback {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--muted);
}

.company-branding-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.company-branding-upload {
  cursor: pointer;
}

.perm-matrix-wrap {
  overflow-x: auto;
}

.perm-matrix td,
.perm-matrix th {
  padding: 10px 12px;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.perm-group {
  margin-bottom: 14px;
}

.perm-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 6px;
}

.perm-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

.perm-matrix-modal {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg);
  border-radius: 8px;
}

/* Dashboard */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.dash-stat {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.dash-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
}

.dash-stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.dash-stat-icon.green { background: #d1fae5; }
.dash-stat-icon.teal { background: #ccfbf1; }
.dash-stat-icon.amber { background: #fef3c7; }

.dash-stat label {
  font-size: 0.8rem;
  color: var(--muted);
  display: block;
}

.dash-stat-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.dash-list {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.dash-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dash-charts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

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

.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chart-card-header {
  padding: 16px 20px 8px;
  border-bottom: 1px solid var(--border);
}

.chart-card-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
}

.chart-card-header p {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 4px 0 0;
}

.chart-wrap {
  position: relative;
  height: 220px;
  padding: 12px 16px 16px;
}

.dash-hero {
  background: linear-gradient(135deg, #8E050E 0%, #B80611 50%, #d40a18 100%);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
  color: #fff;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: 0 12px 40px rgba(184, 6, 17, 0.25);
}

.dash-hero h2 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 6px;
}

.dash-hero p {
  margin: 0;
  opacity: 0.9;
  font-size: 0.9rem;
}

.dash-hero-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.dash-hero-stat {
  text-align: right;
}

.dash-hero-stat label {
  display: block;
  font-size: 0.75rem;
  opacity: 0.85;
}

.dash-hero-stat strong {
  font-size: 1.25rem;
  font-weight: 800;
}

.dash-stat-icon.purple { background: #ede9fe; color: #5b21b6; }

/* Reports — nested under main sidebar */
.nav-reports-block {
  margin: 4px 0 8px;
}

.nav-reports-parent {
  justify-content: flex-start;
}

.nav-reports-parent .nav-chevron {
  margin-left: auto;
  font-size: 0.7rem;
  opacity: 0.75;
}

.nav-reports-sub {
  display: none;
  padding: 4px 0 8px 8px;
  margin-left: 8px;
  border-left: 2px solid rgba(255, 255, 255, 0.1);
}

.nav-reports-block.expanded .nav-reports-sub {
  display: block;
}

.nav-report-group {
  color: #fca5a5;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 12px 4px 14px;
}

.nav-report-item {
  padding: 8px 12px 8px 18px !important;
  font-size: 0.8rem !important;
  font-weight: 500;
  line-height: 1.3;
  white-space: normal;
}

.nav-report-item.active {
  background: var(--sidebar-active);
  color: #fff;
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  align-items: end;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.report-filters .form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.report-filters input,
.report-filters select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
}

.report-phone {
  grid-column: span 1;
}

.report-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.report-summary {
  background: linear-gradient(90deg, var(--primary-light), #f8fafc);
  border: 1px solid var(--primary-border);
  border-radius: 10px;
  padding: 14px 18px;
}

.report-sum-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  font-size: 0.95rem;
}

.report-card .table-wrap {
  max-height: 520px;
  overflow: auto;
}

/* Permissions page */
.perm-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}

.perm-hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
  max-width: 420px;
}

.perm-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.perm-toolbar-right label {
  font-size: 0.85rem;
  font-weight: 600;
}

.perm-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 180px;
}

.perm-table th,
.perm-table td {
  text-align: center;
  vertical-align: middle;
  padding: 12px 10px;
}

.perm-table th:first-child,
.perm-table td:first-child,
.perm-table th:nth-child(2),
.perm-table td:nth-child(2) {
  text-align: left;
}

.perm-na {
  color: var(--muted);
  background: var(--bg);
}

.perm-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.perm-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.perm-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 24px;
  transition: 0.2s;
}

.perm-slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}

.perm-switch input:checked + .perm-slider {
  background: var(--primary);
}

.perm-switch input:checked + .perm-slider::before {
  transform: translateX(20px);
}

.perm-switch input:disabled + .perm-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Roles table */
.roles-table .roles-actions {
  white-space: nowrap;
}

.btn-icon {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  border-radius: 6px;
}

.btn-icon:hover {
  background: var(--bg);
}

.btn-icon.danger:hover {
  background: #fee2e2;
}

code {
  font-size: 0.85rem;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
}

@media (max-width: 900px) {
  .auth-page {
    grid-template-columns: 1fr;
  }
  .auth-brand {
    display: none;
  }
  .auth-panel {
    min-height: 100vh;
  }
  .sidebar {
    width: 72px;
  }
  .sidebar-brand h2,
  .sidebar-brand span,
  .sidebar-user,
  .nav-item span:not(.nav-icon) {
    display: none;
  }
}

/* ── SafeFare dialog system ── */
.sf-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sf-dialog-overlay.sf-dialog-in {
  opacity: 1;
}

.sf-dialog-overlay.sf-dialog-out {
  opacity: 0;
}

.sf-dialog {
  background: var(--card);
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  padding: 28px 28px 22px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25);
  transform: scale(0.92) translateY(12px);
  transition: transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.sf-dialog-in .sf-dialog {
  transform: scale(1) translateY(0);
}

.sf-dialog-out .sf-dialog {
  transform: scale(0.96) translateY(8px);
}

.sf-dialog-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sf-dialog-icon svg {
  width: 28px;
  height: 28px;
}

.sf-dialog-success .sf-dialog-icon {
  background: #d1fae5;
  color: var(--success);
}

.sf-dialog-error .sf-dialog-icon {
  background: #fee2e2;
  color: var(--danger);
}

.sf-dialog-warning .sf-dialog-icon {
  background: #ffedd5;
  color: #d97706;
}

.sf-dialog-info .sf-dialog-icon,
.sf-dialog-confirm .sf-dialog-icon {
  background: var(--primary-light);
  color: var(--primary);
}

.sf-dialog-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
}

.sf-dialog-message {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 22px;
}

.sf-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.sf-dialog-actions .btn {
  min-width: 100px;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
}

.btn-danger:hover {
  background: #b91c1c;
}

/* ── Loading overlay ── */
.sf-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(241, 245, 249, 0.65);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.sf-loading-overlay.sf-loading-visible {
  opacity: 1;
  pointer-events: auto;
}

.sf-loading-card {
  background: var(--card);
  border-radius: 16px;
  padding: 32px 40px;
  box-shadow: var(--shadow), 0 20px 50px rgba(184, 6, 17, 0.12);
  text-align: center;
  border: 1px solid var(--border);
}

.sf-loading-spinner {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.sf-loading-spinner span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  animation: sf-bounce 1.2s ease-in-out infinite;
}

.sf-loading-spinner span:nth-child(2) {
  animation-delay: 0.15s;
}

.sf-loading-spinner span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes sf-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.sf-loading-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sf-spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

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

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 48px;
}

/* Corporate portal */
.page-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 4px 0 0;
}

.corp-help {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 16px;
}

.corp-help--pad {
  padding: 0 22px 12px;
  margin-bottom: 0;
}

.corp-modal-lead {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0 0 18px;
}

.field-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.label-optional {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.85em;
}

.corp-balance-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 24px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
}

.corp-balance-banner__label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #047857;
}

.corp-balance-banner__value {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  color: #065f46;
  margin: 4px 0;
}

.corp-balance-banner__hint {
  display: block;
  font-size: 0.82rem;
  color: #059669;
}

.corp-wallet-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.corp-wallet-summary span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.corp-wallet-summary strong {
  font-size: 1.05rem;
  color: var(--text);
}

.corp-table .phone-code {
  font-size: 0.88rem;
  background: var(--bg);
  padding: 3px 8px;
  border-radius: 6px;
}

.corp-table .wallet-amt {
  font-weight: 700;
  color: var(--primary);
}

.corp-actions {
  white-space: nowrap;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.corp-empty {
  padding: 56px 24px;
}

.corp-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.6;
}

.corp-stats {
  margin-bottom: 20px;
}

.corp-card .card-body {
  padding-top: 8px;
}

.form-group input[type="tel"],
.form-group input[type="number"] {
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.form-group input::placeholder {
  color: #94a3b8;
}

.modal-overlay {
  animation: modal-fade-in 0.2s ease;
}

@keyframes modal-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  animation: modal-slide-in 0.22s ease;
}

@keyframes modal-slide-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
