/* Spare Parts ERP — adapted from KR Motors admin design system */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --sp-sidebar-w: 272px;
  --sp-topbar-h: 68px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --primary: #0f2744;
  --primary-light: #1a3a5c;
  --primary-mid: #1e4976;
  --accent: #f59e0b;
  --accent-hover: #d97706;

  --bg: #f0f2f7;
  --bg-subtle: #e8ebf2;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-light: #eef1f6;

  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --shadow-xs: 0 1px 2px rgba(15, 39, 68, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 39, 68, 0.06);
  --shadow-md: 0 4px 20px rgba(15, 39, 68, 0.08);
  --shadow-lg: 0 8px 40px rgba(15, 39, 68, 0.12);
  --shadow-card: 0 1px 3px rgba(15, 39, 68, 0.04), 0 4px 16px rgba(15, 39, 68, 0.06);

  --sidebar-bg: linear-gradient(180deg, #0f2744 0%, #0a1c32 100%);
  --sidebar-text: rgba(255, 255, 255, 0.72);
  --sidebar-text-active: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: rgba(245, 158, 11, 0.12);

  --sp-success: #059669;
  --sp-danger: #dc2626;
  --sp-warning: #d97706;
  --sp-info: #1e4976;

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  /* legacy aliases used by older markup */
  --sp-navy: var(--primary);
  --sp-navy-2: var(--primary-light);
  --sp-steel: var(--primary-mid);
  --sp-accent: var(--accent);
  --sp-accent-2: var(--accent-hover);
  --sp-bg: var(--bg);
  --sp-surface: var(--surface);
  --sp-border: var(--border);
  --sp-text: var(--text);
  --sp-muted: var(--text-muted);
  --sp-radius: var(--radius-md);
  --sp-shadow: var(--shadow-card);
  --font-display: 'Inter', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.app-body { min-height: 100vh; }

a { color: var(--primary-mid); text-decoration: none; }
a:hover { color: var(--accent-hover); }

code, .table-erp code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.84em;
  font-weight: 600;
  color: var(--primary);
}

.app-shell { display: flex; min-height: 100vh; }

/* —— Sidebar —— */
.sidebar {
  width: var(--sp-sidebar-w);
  background: var(--sidebar-bg);
  color: #fff;
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  z-index: 1040;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.sidebar-brand .brand-mark {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  min-width: 0;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.brand-text { min-width: 0; line-height: 1.3; }
.brand-text strong {
  display: block;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text small {
  display: block;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.sidebar-nav {
  padding: 0.75rem 0 1rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.nav-section {
  padding: 1.25rem 1.25rem 0.4rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 600;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  margin: 2px 0.75rem;
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border-left: none;
  position: relative;
  transition: all var(--transition);
}

.sidebar .nav-link i {
  width: 1.25rem;
  text-align: center;
  font-size: 1rem;
  opacity: 0.85;
}

.sidebar .nav-link:hover {
  color: var(--sidebar-text-active);
  background: var(--sidebar-hover);
}

.sidebar .nav-link.active {
  color: var(--sidebar-text-active);
  background: var(--sidebar-active);
  font-weight: 600;
}

.sidebar .nav-link.active::before {
  content: "";
  position: absolute;
  left: -0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sidebar .nav-link.active i {
  color: var(--accent);
  opacity: 1;
}

.sidebar .nav-link.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.sidebar details summary {
  list-style: none;
  cursor: pointer;
}
.sidebar details summary::-webkit-details-marker { display: none; }
.sidebar details summary.nav-link::after {
  content: "\f078";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-left: auto;
  font-size: 0.65rem;
  opacity: 0.45;
  transition: transform 0.15s ease;
}
.sidebar details[open] > summary.nav-link::after {
  transform: rotate(180deg);
}

.sidebar .submenu {
  padding: 0.15rem 0 0.35rem;
  margin: 0 0.75rem 0.25rem 1.75rem;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar .submenu .nav-link {
  margin: 1px 0 1px 0.35rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.8125rem;
}

.sidebar .submenu .nav-link.active::before {
  left: -1.1rem;
}

.sidebar details.nav-group > summary.nav-link.active {
  background: rgba(245, 158, 11, 0.08);
}

/* —— Main —— */
.main-wrap {
  margin-left: var(--sp-sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--sp-topbar-h);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.sidebar-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all var(--transition);
  padding: 0;
}

.sidebar-toggle:hover {
  background: var(--bg);
  color: var(--primary);
}

.topbar-search {
  position: relative;
  max-width: 480px;
  flex: 1;
  min-width: 0;
}

.topbar-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 0.9rem;
  pointer-events: none;
}

.topbar-search input {
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid transparent;
  font-size: 0.875rem;
  transition: all var(--transition);
  width: 100%;
  box-shadow: none;
}

.topbar-search input:focus {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  outline: none;
}

.topbar-search input::placeholder { color: var(--text-light); }

.topbar-actions .dropdown-toggle {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.375rem 0.75rem 0.375rem 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.topbar-actions .dropdown-toggle:hover {
  background: var(--bg);
  border-color: var(--border);
}

.topbar-actions .dropdown-menu {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 0.5rem;
  margin-top: 0.5rem;
}

.topbar-actions .dropdown-item {
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 1rem 0.75rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  margin-top: auto;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 0.5rem;
}

.sidebar-user .avatar-circle {
  width: 36px;
  height: 36px;
  font-size: 0.8rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: var(--primary);
}

.sidebar-user-info { min-width: 0; flex: 1; }
.sidebar-user-info .name {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  color: #fff;
}
.sidebar-user-info .role {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.45);
}

.nav-link-btn {
  cursor: pointer;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
}

.content-area {
  padding: 1.75rem;
  flex: 1;
}

/* —— Page header / welcome —— */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.625rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.03em;
  color: var(--primary);
}

.page-header .page-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0.25rem 0 0;
}

.welcome-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  color: #fff;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.welcome-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.welcome-banner-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.welcome-banner h2 {
  font-size: 1.375rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

.welcome-banner p {
  margin: 0;
  opacity: 0.8;
  font-size: 0.9rem;
}

.welcome-banner .btn-light {
  background: rgba(255, 255, 255, 0.95);
  border: none;
  color: var(--primary);
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1.25rem;
  transition: all var(--transition);
}

.welcome-banner .btn-light:hover {
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  color: var(--primary);
}

/* —— Stat / KPI cards —— */
.stat-card,
.kpi-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.375rem;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  height: 100%;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover,
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.stat-icon.bg-amber,
.stat-icon.bg-warning-subtle { background: rgba(245, 158, 11, 0.12) !important; color: var(--accent-hover) !important; }
.stat-icon.bg-navy,
.stat-icon.bg-primary-subtle { background: rgba(15, 39, 68, 0.08) !important; color: var(--primary-mid) !important; }
.stat-icon.bg-rose,
.stat-icon.bg-danger-subtle { background: rgba(220, 38, 38, 0.1) !important; color: #dc2626 !important; }
.stat-icon.bg-teal,
.stat-icon.bg-success-subtle { background: rgba(5, 150, 105, 0.1) !important; color: #059669 !important; }
.stat-icon.bg-info-subtle { background: rgba(14, 165, 233, 0.12) !important; color: #0284c7 !important; }
.stat-icon.bg-secondary-subtle { background: rgba(100, 116, 139, 0.12) !important; color: #475569 !important; }

.stat-card .stat-value,
.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0;
}

.stat-card .stat-label,
.kpi-label {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  margin-top: 0.125rem;
  text-transform: none;
  letter-spacing: 0;
}

.kpi-hint {
  color: var(--text-light);
  font-size: 0.78rem;
  margin-top: 0.45rem;
}

/* —— Panels —— */
.panel,
.card-panel {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.panel-header,
.card-panel .card-header {
  padding: 1rem 1.375rem;
  border-bottom: 1px solid var(--border-light);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 600;
}

.panel-header h2 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.panel-body,
.card-panel .card-body { padding: 1.375rem; }

.product-more {
  border-top: 1px solid var(--border-light);
  padding-top: 1rem;
}
.product-more > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-muted);
  list-style: none;
  user-select: none;
}
.product-more > summary::-webkit-details-marker { display: none; }
.product-more > summary::before {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.7rem;
  margin-right: 0.5rem;
  display: inline-block;
  transition: transform 0.15s ease;
}
.product-more[open] > summary::before { transform: rotate(180deg); }
.product-more[open] > summary { color: var(--text); margin-bottom: 0.75rem; }

/* —— Tables —— */
.table-erp {
  margin: 0;
  font-size: 0.875rem;
}

.table-erp thead th {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  padding: 0.75rem 1rem;
}

.table-erp td {
  vertical-align: middle;
  border-color: var(--border-light);
  padding: 0.75rem 1rem;
}

.table-erp tbody tr:hover {
  background: rgba(15, 39, 68, 0.03);
}

/* —— Buttons —— */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: all var(--transition);
}

.btn-accent {
  background: var(--accent);
  border: 1px solid var(--accent-hover);
  color: #fff;
}
.btn-accent:hover,
.btn-accent:focus {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.btn-navy,
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
  border: none;
  color: #fff;
  box-shadow: 0 4px 12px rgba(15, 39, 68, 0.2);
}
.btn-navy:hover,
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-mid) 100%);
  color: #fff;
  transform: translateY(-1px);
}

.btn-outline-secondary {
  border-color: var(--border);
  color: var(--text-muted);
  background: var(--surface);
}
.btn-outline-secondary:hover {
  background: var(--bg);
  border-color: var(--border);
  color: var(--primary);
}

.btn-outline-primary {
  border-color: rgba(30, 73, 118, 0.25);
  color: var(--primary-mid);
  background: var(--surface);
}
.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.badge.bg-success-subtle,
.status-badge.bg-success-subtle {
  background: #d1fae5 !important;
  color: #065f46 !important;
}

/* —— Forms —— */
.form-label {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.form-control,
.form-select {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.875rem;
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(30, 73, 118, 0.12);
}

.form-control-sm,
.form-select-sm {
  padding: 0.35rem 0.6rem;
  font-size: 0.84rem;
}

/* —— Choices.js (searchable dropdowns) —— */
.choices {
  margin-bottom: 0;
  font-size: 0.9rem;
}
.choices__inner {
  background-color: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: calc(1.5em + 1.25rem + 2px);
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  vertical-align: middle;
}
.choices__inner:hover {
  border-color: var(--border);
}
.is-focused .choices__inner,
.is-open .choices__inner {
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(30, 73, 118, 0.12);
}
.choices[data-type*='select-one'] .choices__inner {
  padding-bottom: 0.4rem;
}
.choices[data-type*='select-one']::after {
  border-color: var(--text-muted) transparent transparent;
  right: 14px;
}
.choices.is-open[data-type*='select-one']::after {
  border-color: transparent transparent var(--text-muted);
}
.choices__list--single {
  padding: 0.15rem 1.5rem 0.15rem 0;
}
.choices__list--dropdown,
.choices__list[aria-expanded] {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 1080;
}
.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
  background: rgba(30, 73, 118, 0.1);
  color: var(--primary);
}
.choices__input {
  background-color: #fff !important;
  margin-bottom: 0 !important;
  font-size: 0.875rem !important;
}
.choices__list--dropdown .choices__input {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.45rem 0.65rem !important;
  margin: 0.5rem !important;
  width: calc(100% - 1rem) !important;
  display: block !important;
}
.choices__list--dropdown .choices__input:focus {
  border-color: var(--primary-mid) !important;
  box-shadow: 0 0 0 3px rgba(30, 73, 118, 0.12);
  outline: none;
}
.choices__placeholder {
  opacity: 0.65;
}
.choices-sm .choices__inner {
  min-height: calc(1.5em + 0.7rem + 2px);
  padding: 0.2rem 0.5rem;
  font-size: 0.84rem;
}
.choices.is-disabled .choices__inner {
  background: var(--bg);
  opacity: 0.75;
}
/* Hide native select once Choices wraps it */
.choices + .form-select,
select.choices__input {
  display: none !important;
}

/* —— Badges / alerts —— */
.badge {
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.7rem;
  padding: 0.35em 0.55em;
}

.alert {
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.875rem;
  box-shadow: var(--shadow-xs);
}

.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger { background: #fef2f2; color: #991b1b; }
.alert-info { background: #eff6ff; color: #1e40af; }

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  opacity: 0.4;
  color: var(--primary-mid);
}

.pagination .page-link {
  border-radius: var(--radius-sm) !important;
  color: var(--text-muted);
  border-color: var(--border);
  margin: 0 2px;
}
.pagination .page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
}

/* —— Quick actions —— */
.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
}

.quick-action-btn:hover {
  background: var(--bg);
  border-color: var(--primary-mid);
  color: var(--primary);
  transform: translateX(4px);
}

.quick-action-btn i {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(30, 73, 118, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-mid);
  font-size: 0.95rem;
  flex-shrink: 0;
  transition: all var(--transition);
}

.quick-action-btn:hover i {
  background: var(--primary);
  color: #fff;
}

/* —— Auth / Install —— */
.auth-page,
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
}

.auth-page::before,
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, rgba(245, 158, 11, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 20%, rgba(30, 73, 118, 0.4) 0%, transparent 50%);
  pointer-events: none;
}

.auth-page::after,
.login-page::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.auth-card,
.login-card,
.install-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  overflow: hidden;
}

.install-card { max-width: 720px; }

.auth-card-header,
.login-brand,
.install-card-header {
  text-align: center;
  padding: 2.5rem 2rem 0;
  border-bottom: none;
  background: transparent;
}

.auth-card-header .brand-icon,
.login-brand-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 24px rgba(15, 39, 68, 0.25);
  color: var(--accent);
  font-size: 2rem;
}

.auth-card-header h1,
.login-brand h4,
.install-card-header h1 {
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
}

.auth-card-body,
.install-card-body {
  padding: 1.5rem 2rem 2rem;
}

.login-card .input-group-text {
  border-color: var(--border);
  color: var(--text-light);
}
.login-card .input-group .form-control {
  border-color: var(--border);
}
.login-card .input-group:focus-within .input-group-text,
.login-card .input-group:focus-within .form-control {
  border-color: var(--primary-mid);
}
.login-card .input-group:focus-within {
  box-shadow: 0 0 0 3px rgba(30, 73, 118, 0.12);
  border-radius: var(--radius-sm);
}

.install-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background: var(--sidebar-bg);
  position: relative;
}

.step-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.step-pill {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
}
.step-pill.active {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-hover);
}
.step-pill.done {
  background: rgba(5, 150, 105, 0.12);
  color: var(--sp-success);
}

.req-ok { color: var(--sp-success); }
.req-fail { color: var(--sp-danger); }

.toast-container-erp {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  width: min(360px, calc(100vw - 2rem));
}

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .content-area { padding: 1.25rem; }
  .welcome-banner { padding: 1.35rem 1.25rem; }
  .page-header h1 { font-size: 1.35rem; }
}

@media (max-width: 575.98px) {
  .stat-card .stat-value,
  .kpi-value { font-size: 1.25rem; }
}
