/* ================================================================
   SentriScope Portal — Custom Styles
   Adapted from legacy SentriScope design language
   ================================================================ */

/* ── CSS Variables ──────────────────────────────────────────────── */
/* Requires static/css/design_tokens.css loaded first. */
:root {
  /* Layout */
  --topbar-height: 60px;
  --sidebar-width-collapsed: 64px;
  --sidebar-width-expanded: 240px;
  --sidebar-transition-duration: 0.3s;

  /* Portal aliases → global tokens */
  --primary-blue: var(--color-accent-strong);
  --primary-blue-hover: var(--color-accent-strong-hover);
  --border-light: var(--color-border);
  --text-primary: var(--color-text-primary);
  --text-muted: var(--color-secondary);
  --neutral-gray: var(--color-secondary);
  --background-light: var(--color-bg-main);

  /* Sidebar */
  --sidebar-bg: var(--color-primary-dark);
  --sidebar-hover: color-mix(in srgb, var(--color-primary-dark) 82%, #ffffff);
  --sidebar-header-bg: color-mix(in srgb, var(--color-primary-dark) 90%, #000000);
  --sidebar-header-border: rgba(255, 255, 255, 0.12);

  /* Stats Cards — token-derived accents */
  --stat-card-blue: var(--color-secondary);
  --stat-card-teal: var(--color-accent-soft);
  --stat-card-purple: color-mix(in srgb, var(--color-secondary) 65%, var(--color-accent-soft));
  --stat-card-orange: var(--color-accent-strong);
}


/* ── Global Reset / Base ───────────────────────────────────────── */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  background-color: var(--color-bg-main);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  font-size: 13px;
}


/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width-collapsed);
  background-color: var(--sidebar-bg);
  transition: width var(--sidebar-transition-duration) ease;
  z-index: 1040;
  overflow: hidden;
}

.sidebar-expanded .sidebar {
  width: var(--sidebar-width-expanded);
}

.sidebar-header {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--sidebar-header-border);
  background-color: var(--sidebar-header-bg);
  padding: 0 0.75rem;
  overflow: hidden;
}

.sidebar-logo {
  color: var(--color-text-on-dark);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.sidebar-logo:hover {
  color: var(--color-text-on-dark);
  text-decoration: none;
}

/* Logo: explicit size, no transform/bitmap scaling — SVG scales via viewBox for crisp rendering at any DPI */
.sidebar-logo-img {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  display: block;
}
img.sidebar-logo-img {
  object-fit: contain;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0.75rem 0;
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  overflow-x: hidden;
}

/* Scrollbar */
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: var(--sidebar-bg);
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--sidebar-hover);
  border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--color-primary-dark) 70%, #ffffff);
}

/* Nav items */
.sidebar .nav-item {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  padding: 0.55rem 0.75rem;
  color: var(--color-sidebar-link);
  text-decoration: none;
  transition: background-color 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  font-size: 13px;
}

.sidebar .nav-link:hover {
  background-color: var(--sidebar-hover);
  color: var(--color-text-on-dark);
  text-decoration: none;
}

.sidebar .nav-link.active {
  background-color: var(--color-accent-strong);
  color: var(--color-text-on-dark);
}

.sidebar .nav-icon {
  width: 20px;
  margin-right: 0.75rem;
  text-align: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.sidebar .nav-text {
  opacity: 0;
  transition: opacity var(--sidebar-transition-duration) ease;
}

.sidebar-expanded .sidebar .nav-text {
  opacity: 1;
}

/* Section titles */
.sidebar .nav-section-title {
  display: block;
  padding: 0.75rem 0.75rem 0.375rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity var(--sidebar-transition-duration) ease;
}

.sidebar-expanded .nav-section-title {
  opacity: 1;
}

/* Sidebar dropdowns */
.sidebar .nav-dropdown {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar .nav-dropdown > .nav-item > .nav-link {
  position: relative;
  cursor: pointer;
}

.sidebar .nav-dropdown > .nav-item > .nav-link::after {
  content: '\F282';
  font-family: 'bootstrap-icons';
  position: absolute;
  right: 0.75rem;
  font-size: 0.7rem;
  transition: transform 0.2s ease;
  opacity: 0;
}

.sidebar-expanded .nav-dropdown > .nav-item > .nav-link::after {
  opacity: 1;
}

.sidebar .nav-dropdown.open > .nav-item > .nav-link::after {
  transform: rotate(180deg);
}

.sidebar .nav-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background-color: rgba(0, 0, 0, 0.15);
}

.sidebar .nav-dropdown.open .nav-submenu {
  max-height: 500px;
}

.sidebar .nav-submenu .nav-link {
  padding-left: 1rem;
  font-size: 12px;
}


/* ── Main Content ──────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width-collapsed);
  transition: margin-left var(--sidebar-transition-duration) ease;
  min-height: 100vh;
}

.sidebar-expanded .main-content {
  margin-left: var(--sidebar-width-expanded);
}


/* ── Topbar ────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background-color: var(--color-topbar-bg);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  transition: background-color 0.2s ease;
  line-height: 1;
}

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

.page-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* User menu */
.user-menu {
  position: relative;
}

.user-button {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 13px;
  color: var(--text-primary);
}

.user-button:hover {
  background-color: var(--background-light);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--primary-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-on-dark);
  font-weight: 700;
  font-size: 12px;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: var(--color-bg-card);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 220px;
  z-index: 1050;
  display: none;
  margin-top: 0.25rem;
}

.user-dropdown.show {
  display: block;
}

.user-dropdown-info {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

.user-dropdown-info small {
  color: var(--text-muted);
  font-size: 12px;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: background-color 0.15s ease;
  font-size: 13px;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
}

.user-dropdown-item:hover {
  background-color: var(--background-light);
  color: var(--text-primary);
  text-decoration: none;
}

.user-dropdown-item i {
  color: var(--text-muted);
  width: 16px;
  text-align: center;
}

.user-dropdown-divider {
  height: 1px;
  background-color: var(--border-light);
  margin: 0.25rem 0;
}


/* ── Content Area ──────────────────────────────────────────────── */
.content {
  padding: 1.5rem 2rem;
}


/* ── Breadcrumb ────────────────────────────────────────────────── */
.breadcrumb-container {
  background-color: var(--background-light);
  border: 1px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  margin-bottom: 1.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 13px;
}

.breadcrumb-container a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.breadcrumb-container a:hover {
  color: var(--text-primary);
}

.breadcrumb-container .breadcrumb-active {
  color: var(--text-primary);
  font-weight: 600;
}

.breadcrumb-container .breadcrumb-sep {
  color: var(--text-muted);
  margin: 0 0.4rem;
  font-size: 0.75rem;
}

/* Breadcrumb action buttons — keep btn styling visible */
.breadcrumb-container .btn {
  font-size: 12px;
  padding: 0.25rem 0.6rem;
  white-space: nowrap;
}


/* ── Page Header (title row + action button) ───────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.page-header h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}


/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  background-color: var(--background-light);
}

.card-header h6 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.card-header i {
  color: var(--text-muted);
}

.card-body {
  padding: 1.25rem;
}


/* ── KPI / Stats Cards ─────────────────────────────────────────── */

/* Single-row flex container — cards share width equally */
.stats-row {
  display: flex;
  gap: 1rem;
}

.stats-row > .stat-card {
  flex: 1 1 0;
  min-width: 0;
}

/* Grid fallback (legacy) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--border-light);
  border-left-width: 4px;
  border-left-style: solid;
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s ease;
}

.stat-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.stat-card-blue { border-left-color: var(--stat-card-blue); }
.stat-card-teal { border-left-color: var(--stat-card-teal); }
.stat-card-purple { border-left-color: var(--stat-card-purple); }
.stat-card-orange { border-left-color: var(--stat-card-orange); }

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background-color: var(--background-light);
}

.stat-card-blue .stat-icon { color: var(--stat-card-blue); }
.stat-card-teal .stat-icon { color: var(--stat-card-teal); }
.stat-card-purple .stat-icon { color: var(--stat-card-purple); }
.stat-card-orange .stat-icon { color: var(--stat-card-orange); }

.stat-number {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0;
}

/* Legacy KPI card support (Bootstrap grid approach) */
.kpi-card {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  transition: box-shadow 0.2s ease;
}

.kpi-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.kpi-card .kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

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

.kpi-icon {
  font-size: 1.5rem;
  opacity: 0.5;
}


/* ── Tables ────────────────────────────────────────────────────── */
.table-portal {
  font-size: 13px;
}

.table-portal th {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background-color: #e9ecef;
  border-bottom-width: 2px;
}

.table-portal td {
  vertical-align: middle;
}

.table-portal .sort-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.table-portal .sort-link:hover {
  color: var(--primary-blue);
}

/* Sort icon — always visible on the right */
.table-portal .sort-link .sort-icon {
  margin-left: auto;
  font-size: 0.65rem;
  opacity: 0.35;
  flex-shrink: 0;
}

/* Active sort — full opacity */
.table-portal .sort-link.active .sort-icon {
  opacity: 1;
  color: var(--primary-blue);
}

/* Hover on inactive sort — raise opacity */
.table-portal .sort-link:hover .sort-icon {
  opacity: 0.7;
}

.table-hover tbody tr:hover {
  background-color: var(--background-light);
}

/* ── Resizable Table Columns ───────────────────────────────────── */
.table-resizable {
  table-layout: fixed;
  /* Allow the table to grow beyond its container */
  min-width: 100%;
  width: max-content;
}

.table-resizable th {
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-resizable td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Resize handle — invisible by default, appears on hover */
.col-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
  user-select: none;
  -webkit-user-select: none;
}

/* Visible indicator line on hover */
.col-resize-handle::after {
  content: '';
  position: absolute;
  top: 25%;
  right: 2px;
  width: 3px;
  height: 50%;
  border-radius: 2px;
  background-color: transparent;
  transition: background-color 0.15s ease;
}

.col-resize-handle:hover::after {
  background-color: var(--primary-blue);
}

/* Active dragging state */
.col-resize-handle.resizing::after {
  background-color: var(--primary-blue);
  top: 0;
  height: 100%;
}

/* Full-page overlay during drag to keep cursor stable */
.col-resize-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  cursor: col-resize;
  z-index: 9999;
}

/* Guide line that shows across the full table height during drag */
.col-resize-guide {
  position: absolute;
  top: 0;
  width: 2px;
  background-color: var(--primary-blue);
  opacity: 0.5;
  pointer-events: none;
  z-index: 11;
}


/* ── Status Badges ─────────────────────────────────────────────── */
.badge-active { background-color: var(--color-accent-strong) !important; color: var(--color-text-on-dark) !important; }
.badge-suspended { background-color: #dc3545 !important; }
.badge-provisioning { background-color: #ffc107 !important; color: #000 !important; }
.badge-deactivated { background-color: var(--neutral-gray) !important; }

/* Billing status badges */
.badge-trialing { background-color: #0dcaf0 !important; color: #000 !important; }
.badge-past_due { background-color: #fd7e14 !important; }
.badge-canceled { background-color: var(--color-secondary) !important; color: var(--color-text-on-dark) !important; }

/* Invoice status badges */
.badge-draft { background-color: #adb5bd !important; }
.badge-open { background-color: var(--color-accent-soft) !important; color: var(--color-text-primary) !important; }
.badge-paid { background-color: var(--color-accent-strong) !important; color: var(--color-text-on-dark) !important; }
.badge-void { background-color: var(--color-secondary) !important; color: var(--color-text-on-dark) !important; }
.badge-uncollectible { background-color: #dc3545 !important; }


/* ── Buttons (SentriScope Color Schema) ────────────────────────── */
.btn-primary {
  background-color: var(--primary-blue);
  border-color: var(--primary-blue);
  color: var(--color-text-on-dark);
  font-size: 13px;
}

.btn-primary:hover {
  background-color: var(--primary-blue-hover);
  border-color: var(--primary-blue-hover);
  color: var(--color-text-on-dark);
}

.btn-secondary {
  background-color: var(--color-secondary);
  color: var(--color-text-on-dark);
  border: 1px solid var(--color-secondary);
  font-size: 13px;
}

.btn-secondary:hover {
  background-color: color-mix(in srgb, var(--color-secondary) 88%, #000000);
  border-color: color-mix(in srgb, var(--color-secondary) 88%, #000000);
  color: var(--color-text-on-dark);
}


/* ── Forms ──────────────────────────────────────────────────────── */
.portal-form {
  max-width: 640px;
}

.portal-form .form-label,
.form-label {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.form-control,
.form-select {
  font-size: 13px;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  background-color: var(--color-bg-card);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 0.2rem rgba(44, 153, 255, 0.2);
  outline: none;
}

.form-control::placeholder {
  color: var(--text-muted);
}

.portal-form .form-text,
.form-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* Form actions — right-aligned with border-top */
.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding-top: 1rem;
  margin-top: 1.25rem;
  border-top: 1px solid var(--border-light);
}

/* Validation */
.invalid-feedback {
  color: #dc3545;
  font-size: 12px;
  margin-top: 0.25rem;
}

.valid-feedback {
  color: #28a745;
  font-size: 12px;
  margin-top: 0.25rem;
}

.form-control.is-invalid {
  border-color: #dc3545;
}

.form-control.is-valid {
  border-color: #28a745;
}

/* Required field indicator */
.form-label .text-danger,
.required {
  color: #dc3545;
}


/* ── Action Buttons ────────────────────────────────────────────── */
.btn-action {
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
}


/* ── Filter Bar ────────────────────────────────────────────────── */
.filter-bar {
  background: var(--color-bg-card);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.filter-bar .form-control,
.filter-bar .form-select {
  font-size: 13px;
}


/* ── Detail Page ───────────────────────────────────────────────── */
.detail-header {
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

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

.detail-value {
  font-size: 13px;
}


/* ── Empty State ───────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state > i {
  font-size: 3rem;
  opacity: 0.3;
}

.empty-state .btn {
  font-size: 12px;
  padding: 0.25rem 0.6rem;
}


/* ── Pagination ────────────────────────────────────────────────── */
.pagination {
  font-size: 13px;
}

.page-link {
  font-size: 13px;
  background-color: var(--color-bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

.page-link:hover {
  background-color: var(--background-light);
  border-color: var(--primary-blue);
  color: var(--text-primary);
}

.page-item.active .page-link {
  background-color: var(--color-accent-strong);
  border-color: var(--color-accent-strong);
  color: var(--color-text-on-dark);
}


/* ── Flash Messages (toast-style, top-right) ───────────────────── */
.portal-messages {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  max-width: 400px;
}

.portal-messages .alert {
  font-size: 13px;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: 0.5rem;
}


/* ── Links ─────────────────────────────────────────────────────── */
a {
  color: var(--text-primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-blue);
}


/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 992px) {
  .stats-row {
    flex-wrap: wrap;
  }

  .stats-row > .stat-card {
    flex: 1 1 calc(33.333% - 1rem);
    min-width: 140px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar-expanded .sidebar {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0 !important;
  }

  .sidebar-expanded .main-content {
    margin-left: 0 !important;
  }

  .content {
    padding: 1rem;
  }

  .stats-row > .stat-card {
    flex: 1 1 calc(50% - 1rem);
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .stats-row > .stat-card {
    flex: 1 1 100%;
  }
}


/* ================================================================
   Login / Auth Pages
   ================================================================ */

/* ── Login Page ─────────────────────────────────────────────────── */
.login-body {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--color-bg-main) 92%, var(--color-border)) 0%,
    var(--color-bg-main) 100%
  );
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--color-text-primary);
  padding: 20px;
}

.auth-container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.auth-card {
  background: var(--color-bg-card);
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.auth-header {
  background: var(--color-bg-card);
  padding: 2rem 2rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
}

.auth-logo {
  margin-bottom: 1.5rem;
}

.auth-logo h1 {
  color: var(--color-text-primary);
  font-size: 2rem !important;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.5px;
}

/* Logo: explicit size, no transform/bitmap scaling — SVG scales via viewBox for crisp rendering at any DPI */
.auth-logo .auth-logo-img {
  width: 4rem;
  height: 4rem;
  display: block;
  margin: 0 auto 0.5rem;
}
img.auth-logo-img {
  object-fit: contain;
}

.auth-logo p {
  color: var(--color-text-primary);
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
  opacity: 0.8;
}

.auth-body {
  padding: 2rem;
  background: var(--color-bg-card);
}

/* Auth form — consistent spacing between groups */
.auth-form .auth-field {
  margin-bottom: 1.5rem;
}

.auth-form .auth-field:last-of-type {
  margin-bottom: 0;
}

/* Auth form labels with icons */
.auth-body .form-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: #374151;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.auth-body .form-label i {
  color: #6b7280;
  font-size: 0.8rem;
}

/* Auth form inputs — uniform width, larger, rounded */
.auth-body .form-control {
  display: block;
  width: 100%;
  box-sizing: border-box;
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  color: var(--color-text-primary);
}

.auth-body .form-control:focus {
  background-color: var(--color-bg-card);
  border-color: var(--color-accent-strong);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent-strong) 22%, transparent);
  color: var(--color-text-primary);
}

.auth-body .form-control::placeholder {
  color: #9ca3af;
}

/* Password input wrapper for toggle */
.password-input-wrapper {
  position: relative;
  width: 100%;
}

.password-input-wrapper .form-control {
  width: 100%;
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: color 0.2s ease;
  font-size: 1rem;
  line-height: 1;
}

.password-toggle:hover {
  color: #374151;
}

.password-toggle:focus {
  outline: 2px solid var(--color-accent-strong);
  outline-offset: 2px;
}

/* Auth actions — spacing above submit button */
.auth-actions {
  margin-top: 2rem;
}

/* Auth help link below the form */
.auth-help {
  text-align: center;
  margin-top: 1.25rem;
}

.auth-help p {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0;
}

.auth-help a {
  color: var(--color-accent-strong);
  text-decoration: none;
  font-weight: 500;
}

.auth-help a:hover {
  text-decoration: underline;
  color: var(--color-accent-strong-hover);
}

/* Auth submit button */
.btn-auth-submit {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  background-color: var(--color-accent-strong);
  color: var(--color-text-on-dark);
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-auth-submit:hover {
  background-color: var(--color-accent-strong-hover);
  color: var(--color-text-on-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--color-accent-strong) 35%, transparent);
}

.btn-auth-submit:active {
  transform: translateY(0);
}

.btn-auth-submit:focus {
  outline: 2px solid var(--color-accent-strong);
  outline-offset: 2px;
}

.btn-auth-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Auth alert styles */
.auth-body .alert-error,
.auth-body .alert-danger {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.auth-body .alert-warning {
  background-color: #fffbeb;
  border: 1px solid #fed7aa;
  color: #d97706;
}

.auth-body .alert-info {
  background-color: color-mix(in srgb, var(--color-accent-soft) 55%, var(--color-bg-card));
  border: 1px solid color-mix(in srgb, var(--color-accent-soft) 40%, var(--color-border));
  color: var(--color-text-secondary);
}

.auth-body .alert i {
  margin-top: 0.125rem;
  flex-shrink: 0;
}

/* Auth footer */
.auth-footer {
  text-align: center;
  padding: 1.5rem 2rem;
  background: var(--color-bg-main);
  border-top: 1px solid var(--color-border);
}

.auth-footer p {
  margin: 0;
  color: var(--color-text-primary);
  font-size: 0.85rem;
  opacity: 0.8;
}

.auth-footer a {
  color: var(--color-accent-strong);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
  color: var(--color-accent-strong-hover);
}

/* Reset password — invalid link icon */
.auth-body .invalid-link-icon {
  font-size: 3rem;
  color: #dc3545;
}

/* Auth responsive */
@media (max-width: 576px) {
  .auth-container {
    padding: 0;
  }

  .auth-header {
    padding: 1.5rem 1.5rem 1rem;
  }

  .auth-body {
    padding: 1.5rem;
  }

  .btn-auth-submit {
    padding: 0.75rem 1.25rem;
  }
}
