/* Custom Color Palette */
:root {
    /* Primary Colors */
    --bs-primary: #5B4BFF;
    --bs-primary-rgb: 91, 75, 255;
    --bs-primary-light: #E9E6FF;
    --bs-primary-dark: #4639D2;
    
    /* Secondary Colors */
    --bs-secondary: #6C757D;
    --bs-secondary-rgb: 108, 117, 125;
    
    /* Semantic Colors */
    --bs-success: #20C997;
    --bs-success-rgb: 32, 201, 151;
    --bs-info: #4DC0E8;
    --bs-info-rgb: 77, 192, 232;
    --bs-warning: #FFB84D;
    --bs-warning-rgb: 255, 184, 77;
    --bs-danger: #F05252;
    --bs-danger-rgb: 240, 82, 82;
    
    /* Background and Text Colors */
    --bs-light: #F8F9FB;
    --bs-dark: #212529;
    --bs-disabled: #C5C7CD;
    --bs-active: #4639D2;
    
    /* Text Colors */
    --bs-text-color: #1C1C28;
    --bs-heading-color: #0F0F23;
    --bs-muted-color: #6C6C80;
    
    /* Background Gradient */
    --bs-background-gradient: linear-gradient(180deg, #F8F9FB 0%, #E9E6FF 100%);
    
    /* Legacy color mappings for backward compatibility */
    --color-lightest: #F8F9FB;
    --color-light: #E9E6FF;
    --color-medium: #6C6C80;
    --color-dark: #4639D2;
    --color-darkest: #0F0F23;
}

/* Background Colors */
.bg-primary {
  background-color: var(--bs-primary) !important;
}

.bg-secondary {
  background-color: var(--bs-secondary) !important;
}

.bg-lightest {
  background-color: var(--color-lightest) !important;
}

.bg-light-custom {
  background-color: var(--color-light) !important;
}

.bg-medium {
  background-color: var(--color-medium) !important;
}

.bg-dark {
  background-color: var(--bs-dark) !important;
}

.bg-darkest {
  background-color: var(--color-darkest) !important;
}

/* Button Styles */
.btn-primary {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--bs-primary-dark);
  border-color: var(--bs-primary-dark);
  color: white;
}

.btn-primary:focus {
  background-color: var(--bs-primary-dark);
  border-color: var(--bs-primary-dark);
  box-shadow: 0 0 0 0.2rem rgba(91, 75, 255, 0.25);
}

.btn-primary:active {
  background-color: var(--bs-active);
  border-color: var(--bs-active);
}

.btn-secondary {
  background-color: var(--bs-secondary);
  border-color: var(--bs-secondary);
  color: white;
}

.btn-secondary:hover {
  background-color: var(--bs-dark);
  border-color: var(--bs-dark);
  color: white;
}

.btn-success {
  background-color: var(--bs-success);
  border-color: var(--bs-success);
  color: white;
}

.btn-success:hover {
  background-color: #1BA085;
  border-color: #1BA085;
  color: white;
}

.btn-info {
  background-color: var(--bs-info);
  border-color: var(--bs-info);
  color: white;
}

.btn-info:hover {
  background-color: #3BA8D1;
  border-color: #3BA8D1;
  color: white;
}

.btn-warning {
  background-color: var(--bs-warning);
  border-color: var(--bs-warning);
  color: var(--bs-dark);
}

.btn-warning:hover {
  background-color: #FFA726;
  border-color: #FFA726;
  color: var(--bs-dark);
}

.btn-danger {
  background-color: var(--bs-danger);
  border-color: var(--bs-danger);
  color: white;
}

.btn-danger:hover {
  background-color: #E53E3E;
  border-color: #E53E3E;
  color: white;
}

.btn-outline-primary {
  color: var(--bs-primary);
  border-color: var(--bs-primary);
}

.btn-outline-primary:hover {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
  color: white;
}

.btn-outline-secondary {
  color: var(--bs-secondary);
  border-color: var(--bs-secondary);
}

.btn-outline-secondary:hover {
  background-color: var(--bs-secondary);
  border-color: var(--bs-secondary);
  color: white;
}

.btn-outline-success {
  color: var(--bs-success);
  border-color: var(--bs-success);
}

.btn-outline-success:hover {
  background-color: var(--bs-success);
  border-color: var(--bs-success);
  color: white;
}

.btn-outline-info {
  color: var(--bs-info);
  border-color: var(--bs-info);
}

.btn-outline-info:hover {
  background-color: var(--bs-info);
  border-color: var(--bs-info);
  color: white;
}

.btn-outline-warning {
  color: var(--bs-warning);
  border-color: var(--bs-warning);
}

.btn-outline-warning:hover {
  background-color: var(--bs-warning);
  border-color: var(--bs-warning);
  color: var(--bs-dark);
}

.btn-outline-danger {
  color: var(--bs-danger);
  border-color: var(--bs-danger);
}

.btn-outline-danger:hover {
  background-color: var(--bs-danger);
  border-color: var(--bs-danger);
  color: white;
}

/* Solid buttons turn grey when disabled; outline buttons keep their outline (Bootstrap fades them) */
.btn:disabled:not([class*="btn-outline"]) {
  background-color: var(--bs-disabled);
  border-color: var(--bs-disabled);
  color: var(--bs-muted-color);
}

/* Border Colors */
.border-primary {
  border-color: var(--bs-primary) !important;
}

.border-secondary {
  border-color: var(--bs-secondary) !important;
}

.border-lightest {
  border-color: var(--color-lightest) !important;
}

.border-light-custom {
  border-color: var(--color-light) !important;
}

.border-medium {
  border-color: var(--color-medium) !important;
}

.border-dark {
  border-color: var(--color-dark) !important;
}

.border-darkest {
  border-color: var(--color-darkest) !important;
}

/* Text Colors */
.text-primary {
  color: var(--bs-primary) !important;
}

.text-secondary {
  color: var(--bs-secondary) !important;
}

.text-lightest {
  color: var(--color-lightest) !important;
}

.text-light-custom {
  color: var(--color-light) !important;
}

.text-medium {
  color: var(--color-medium) !important;
}

/* Keep Bootstrap's meaning: dark text, not brand purple */
.text-dark {
  color: var(--bs-dark) !important;
}

.text-darkest {
  color: var(--color-darkest) !important;
}

/* Badge Colors */
/* Use rgba so Bootstrap bg-opacity-* utilities still work (solid !important was forcing full primary behind text-primary). */
.badge.bg-primary {
  background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity, 1)) !important;
}

/* Solid primary badges: white label. Skip when using text-primary for soft (tinted) badges. */
.badge.bg-primary:not(.text-primary) {
  color: #fff !important;
}

.badge.bg-secondary {
  background-color: rgba(var(--bs-secondary-rgb), var(--bs-bg-opacity, 1)) !important;
}

.badge.bg-secondary:not(.text-secondary) {
  color: #fff !important;
}

.badge.bg-lightest {
  background-color: var(--color-lightest) !important;
  color: var(--color-darkest) !important;
}

.badge.bg-light-custom {
  background-color: var(--color-light) !important;
  color: var(--color-darkest) !important;
}

.badge.bg-medium {
  background-color: var(--color-medium) !important;
  color: var(--color-lightest) !important;
}

.badge.bg-dark {
  background-color: var(--bs-dark) !important;
  color: var(--color-lightest) !important;
}

.badge.bg-darkest {
  background-color: var(--color-darkest) !important;
  color: var(--color-lightest) !important;
}

.badge.bg-success {
  background-color: var(--bs-success) !important;
  color: var(--color-lightest) !important;
}

.badge.bg-info {
  background-color: var(--bs-info) !important;
  color: var(--color-lightest) !important;
}

/* Dark label: white on amber fails contrast */
.badge.bg-warning {
  background-color: var(--bs-warning) !important;
  color: var(--bs-dark) !important;
}

.badge.bg-danger {
  background-color: var(--bs-danger) !important;
  color: var(--color-lightest) !important;
}

/* Alert Colors */
.alert-primary {
  background-color: var(--bs-primary-light);
  border-color: var(--bs-primary);
  color: var(--bs-text-color);
}

.alert-secondary {
  background-color: var(--bs-light);
  border-color: var(--bs-secondary);
  color: var(--bs-text-color);
}

.alert-success {
  background-color: rgba(32, 201, 151, 0.1);
  border-color: var(--bs-success);
  color: var(--bs-text-color);
}

.alert-info {
  background-color: rgba(77, 192, 232, 0.1);
  border-color: var(--bs-info);
  color: var(--bs-text-color);
}

.alert-warning {
  background-color: rgba(255, 184, 77, 0.1);
  border-color: var(--bs-warning);
  color: var(--bs-text-color);
}

.alert-danger {
  background-color: rgba(240, 82, 82, 0.1);
  border-color: var(--bs-danger);
  color: var(--bs-text-color);
}

/* Form Controls */
.form-control:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.2rem rgba(91, 75, 255, 0.25);
}

.form-select:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.2rem rgba(91, 75, 255, 0.25);
}

/* Links */
a {
  color: var(--bs-primary);
}

a:hover {
  color: var(--bs-primary-dark);
}



/* Card Styles */
.card {
  border-color: var(--bs-primary-light);
}

.card-header {
  background-color: var(--bs-primary-light);
  border-bottom-color: var(--bs-primary);
}

/* Table Styles */
.table-primary {
  background-color: var(--bs-primary-light);
  color: var(--bs-text-color);
}

.table-secondary {
  background-color: var(--bs-light);
  color: var(--bs-text-color);
}

.table-success {
  background-color: rgba(32, 201, 151, 0.1);
  color: var(--bs-text-color);
}

.table-info {
  background-color: rgba(77, 192, 232, 0.1);
  color: var(--bs-text-color);
}

.table-warning {
  background-color: rgba(255, 184, 77, 0.1);
  color: var(--bs-text-color);
}

.table-danger {
  background-color: rgba(240, 82, 82, 0.1);
  color: var(--bs-text-color);
}

/* Modal Styles */
.modal-content {
  border: none;
  border-radius: var(--app-radius-lg, 20px);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.modal-header {
  background-color: #fff;
  border-bottom: 1px solid var(--app-divider, #eef0f4);
  padding: 1rem 1.25rem;
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  background-color: #fff;
  border-top: 1px solid var(--app-divider, #eef0f4);
  padding: 0.85rem 1.25rem;
  gap: 0.5rem;
}

.modal-footer > * {
  margin: 0;
}

/* Normal, consistent modal title size (was oversized vs body on some pages) */
.modal-title {
  font-size: 1.125rem !important;
  font-weight: 600 !important;
  line-height: 1.4;
  margin-bottom: 0;
}

/*
 * Colored modal headers: global --bs-heading-color forces dark text on h5.modal-title.
 * Force white text + icons when using Bootstrap bg-* + text-white on the header.
 */
.modal-header.bg-primary.text-white,
.modal-header.bg-success.text-white,
.modal-header.bg-danger.text-white,
.modal-header.bg-dark.text-white,
.modal-header.bg-info.text-white {
  --bs-heading-color: #ffffff;
  color: #ffffff !important;
}

.modal-header.bg-primary.text-white .modal-title,
.modal-header.bg-success.text-white .modal-title,
.modal-header.bg-danger.text-white .modal-title,
.modal-header.bg-dark.text-white .modal-title,
.modal-header.bg-info.text-white .modal-title,
.modal-header.bg-primary.text-white .modal-title *,
.modal-header.bg-success.text-white .modal-title *,
.modal-header.bg-danger.text-white .modal-title *,
.modal-header.bg-dark.text-white .modal-title *,
.modal-header.bg-info.text-white .modal-title * {
  color: #ffffff !important;
}

.modal-header.bg-primary.text-white .bi,
.modal-header.bg-success.text-white .bi,
.modal-header.bg-danger.text-white .bi,
.modal-header.bg-dark.text-white .bi,
.modal-header.bg-info.text-white .bi {
  color: #ffffff !important;
}

/* Colored card headers (e.g. Logout confirmation) — same heading-color issue as modals */
.card-header.bg-primary.text-white,
.card-header.bg-success.text-white,
.card-header.bg-danger.text-white,
.card-header.bg-dark.text-white {
  --bs-heading-color: #ffffff;
  color: #ffffff !important;
}

.card-header.bg-primary.text-white h1,
.card-header.bg-primary.text-white h2,
.card-header.bg-primary.text-white h3,
.card-header.bg-primary.text-white h4,
.card-header.bg-primary.text-white h5,
.card-header.bg-primary.text-white h6,
.card-header.bg-success.text-white h1,
.card-header.bg-success.text-white h2,
.card-header.bg-success.text-white h3,
.card-header.bg-success.text-white h4,
.card-header.bg-success.text-white h5,
.card-header.bg-success.text-white h6,
.card-header.bg-danger.text-white h1,
.card-header.bg-danger.text-white h2,
.card-header.bg-danger.text-white h3,
.card-header.bg-danger.text-white h4,
.card-header.bg-danger.text-white h5,
.card-header.bg-danger.text-white h6,
.card-header.bg-dark.text-white h1,
.card-header.bg-dark.text-white h2,
.card-header.bg-dark.text-white h3,
.card-header.bg-dark.text-white h4,
.card-header.bg-dark.text-white h5,
.card-header.bg-dark.text-white h6 {
  color: #ffffff !important;
  font-size: 1.125rem !important;
  font-weight: 600 !important;
  margin-bottom: 0 !important;
  line-height: 1.4;
}

/* Progress Bars */
.progress-bar {
  background-color: var(--bs-primary);
}

/* Dropdown Styles */
.dropdown-menu {
  background-color: var(--bs-light);
  border-color: var(--bs-primary-light);
}

.dropdown-item:hover {
  background-color: var(--bs-primary-light);
  color: var(--bs-text-color);
}

.dropdown-item.active {
  background-color: var(--bs-primary);
  color: white;
}

/* Pagination Styles */
.page-link {
  color: var(--bs-primary);
  background-color: var(--bs-light);
  border-color: var(--bs-primary-light);
}

.page-link:hover {
  color: var(--bs-text-color);
  background-color: var(--bs-primary-light);
  border-color: var(--bs-primary);
}

.page-item.active .page-link {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
  color: white;
}

/* List Group Styles */
.list-group-item {
  background-color: var(--bs-light);
  border-color: var(--bs-primary-light);
  color: var(--bs-text-color);
}

.list-group-item:hover {
  background-color: var(--bs-primary-light);
}

.list-group-item.active {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
  color: white;
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus-visible, .btn-link.nav-link:focus-visible, .form-check-input:focus-visible {
  box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem rgba(91, 75, 255, 0.45);
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 0;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ========================================
   TENANT APP DESIGN SYSTEM
   Consistent typography, spacing, buttons, and components
   ======================================== */

/* Page Headers - Unified across all tenant pages */
.tenant-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(91, 75, 255, 0.1);
}

.tenant-page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--bs-heading-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.tenant-page-header h1 i {
    font-size: 1.5rem;
    color: var(--bs-primary);
}

.tenant-page-header .page-subtitle {
    font-size: 0.9rem;
    color: var(--bs-muted-color);
    margin: 0.35rem 0 0;
    display: block;
}

/* Consistent Button Styles */
.btn-tenant-primary {
    background: var(--bs-primary);
    border: none;
    color: white;
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.btn-tenant-primary:hover {
    background: var(--bs-primary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(91, 75, 255, 0.25);
}

.btn-tenant-back {
    border: 1.5px solid rgba(108, 117, 125, 0.3);
    color: var(--bs-secondary);
    background: white;
    font-weight: 500;
    padding: 0.45rem 1rem;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.btn-tenant-back:hover {
    border-color: var(--bs-secondary);
    background: var(--bs-secondary);
    color: white;
    transform: translateY(-1px);
}

.btn-tenant-action {
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.btn-tenant-action:hover {
    transform: translateY(-1px);
}

/* Icon buttons for edit/delete */
.btn-icon-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-icon-action:hover {
    transform: translateY(-2px);
}

/* Form Cards - Consistent add/edit forms */
.tenant-form-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 16px rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(91, 75, 255, 0.12);
    overflow: hidden;
    margin-bottom: 1.75rem;
}

.tenant-form-card .form-card-header {
    padding: 1.15rem 1.35rem;
    background: linear-gradient(135deg, rgba(91, 75, 255, 0.08) 0%, rgba(91, 75, 255, 0.02) 100%);
    border-bottom: 1px solid rgba(91, 75, 255, 0.12);
}

/* Card titles: one size everywhere (form cards, list cards, dashboard cards, create-order sections) */
.tenant-form-card .form-card-header h2 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: var(--bs-heading-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tenant-form-card .form-card-header h2 i {
    color: var(--bs-primary);
    font-size: 1rem;
}

.tenant-form-card .form-card-body {
    padding: 1.5rem 1.35rem;
}

/* List/Content Cards */
.tenant-list-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 16px rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(91, 75, 255, 0.12);
    padding: 1.35rem;
}

.tenant-list-card .list-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-wrap: wrap;
}

.tenant-list-card .list-card-header h2 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--bs-heading-color);
}

.tenant-list-card .list-card-header h2 i {
    color: var(--bs-primary);
    font-size: 1rem;
}

/* Form Labels - Consistent across all forms */
.tenant-form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #334155;
    margin-bottom: 0.4rem;
}

/* Form Controls - Consistent styling */
.tenant-form-control,
.tenant-form-select {
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    padding: 0.55rem 0.85rem;
    transition: all 0.2s ease;
}

.tenant-form-control:focus,
.tenant-form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 3px rgba(91, 75, 255, 0.1);
}

/* Tables - Consistent styling */
.tenant-table {
    margin-bottom: 0;
}

.tenant-table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid rgba(91, 75, 255, 0.1);
    padding: 0.85rem 0.75rem;
    background: rgba(248, 249, 251, 0.6);
}

.tenant-table tbody td {
    vertical-align: middle;
    padding: 0.85rem 0.75rem;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.tenant-table tbody tr:hover {
    background-color: rgba(91, 75, 255, 0.02);
}

.tenant-table tbody tr:last-child td {
    border-bottom: none;
}

/* Empty States */
.tenant-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #64748b;
}

.tenant-empty-state i {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 1rem;
    display: block;
}

.tenant-empty-state h5 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.tenant-empty-state p {
    font-size: 0.9rem;
    color: #94a3b8;
    margin: 0;
}

/* Alerts - Consistent styling */
.tenant-alert {
    border-radius: 12px;
    border: none;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.tenant-alert.alert-success {
    background: linear-gradient(135deg, rgba(32, 201, 151, 0.1) 0%, rgba(32, 201, 151, 0.05) 100%);
    border-left: 4px solid var(--bs-success);
}

.tenant-alert.alert-danger {
    background: linear-gradient(135deg, rgba(240, 82, 82, 0.1) 0%, rgba(240, 82, 82, 0.05) 100%);
    border-left: 4px solid var(--bs-danger);
}

.tenant-alert.alert-info {
    background: linear-gradient(135deg, rgba(77, 192, 232, 0.1) 0%, rgba(77, 192, 232, 0.05) 100%);
    border-left: 4px solid var(--bs-info);
}

.tenant-alert.alert-warning {
    background: linear-gradient(135deg, rgba(255, 184, 77, 0.1) 0%, rgba(255, 184, 77, 0.05) 100%);
    border-left: 4px solid var(--bs-warning);
}

/* Badges - Consistent count badges */
.tenant-count-badge {
    background: rgba(91, 75, 255, 0.1);
    color: var(--bs-primary);
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
}

/* Color swatch — vertical bars for single or multi-color */
.color-swatch {
    display: inline-flex;
    flex-direction: row;
    overflow: hidden;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    vertical-align: middle;
    flex-shrink: 0;
}

.color-swatch-bar {
    flex: 1 1 0;
    min-width: 3px;
    height: 100%;
}

.color-swatch--xs {
    width: 14px;
    height: 14px;
    margin-right: 4px;
}

.color-swatch--sm {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

.color-swatch--md {
    width: 40px;
    height: 40px;
    margin-right: 10px;
}

.color-swatch--lg {
    width: 56px;
    height: 56px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Legacy alias used on Products page */
.color-square {
    display: inline-flex;
    flex-direction: row;
    overflow: hidden;
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid var(--bs-primary-light, rgba(0, 0, 0, 0.12));
    margin-right: 8px;
    vertical-align: middle;
}

.color-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: inherit;
    vertical-align: middle;
}

.color-label .color-swatch--xs,
.color-label .color-swatch--sm {
    margin-right: 0;
}

/* Responsive adjustments */
@media (max-width: 767.98px) {
    .tenant-page-header h1 {
        font-size: 1.5rem;
    }
    
    .tenant-page-header h1 i {
        font-size: 1.35rem;
    }
    
    .tenant-form-card .form-card-body,
    .tenant-list-card {
        padding: 1.25rem 1rem;
    }
}

/* ============================================================
   App shell (sidebar, header, mobile bottom navigation)
   ============================================================ */
:root {
  /* Layout */
  --app-sidebar-width: 240px;
  --app-bottom-nav-height: 64px;
  --app-topbar-height: 56px;
  --app-bottom-offset: calc(var(--app-bottom-nav-height) + env(safe-area-inset-bottom));

  /* Color */
  --app-primary: #5b4bff;
  --app-primary-soft: #eeebff;
  --app-text: #0f172a;
  --app-text-2: #334155;
  --app-muted: #64748b;
  --app-subtle: #94a3b8;
  --app-bg: #f5f6fa;
  --app-surface: #ffffff;
  --app-surface-2: #f8f9fb;
  --app-border: rgba(91, 75, 255, 0.08);
  --app-divider: #eef0f4;
  --app-input-border: #dfe3ea;
  --app-success: #16a34a;
  --app-success-soft: #e7f7ee;
  --app-warning: #c2710c;
  --app-warning-soft: #fff4e0;
  --app-danger: #dc2626;
  --app-danger-soft: #fdecec;

  /* Shape */
  --app-radius-sm: 10px;
  --app-radius: 14px;
  --app-radius-lg: 20px;
  --app-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --app-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(91, 75, 255, 0.06);
  --app-shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14);

  /* Touch */
  --app-tap: 44px;
  --app-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.app-body {
  min-height: 100vh;
  background: var(--app-bg);
  color: var(--app-text);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

@media (min-width: 992px) {
  body.app-body {
    background: linear-gradient(135deg, #f5f3ff 0%, #f8f9fb 45%, #eef2ff 100%) fixed;
  }

  :root {
    --app-bottom-offset: 0px;
  }
}

.app-shell {
  min-height: 100vh;
}

/* Sidebar */
aside.app-sidebar {
  --bs-offcanvas-width: 280px;
}

.app-sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  padding: 1.25rem 1rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  overflow-y: auto;
}

.app-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding: 0 0.25rem;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  max-width: 100%;
}

.app-brand-pill {
  display: inline-block;
  max-width: 180px;
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #6d5dfc 0%, #5b4bff 100%);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 12px rgba(91, 75, 255, 0.3);
}

.app-brand-logo {
  max-height: 40px;
  max-width: 170px;
  object-fit: contain;
}

.app-brand-logo--sm {
  max-height: 32px;
  max-width: 140px;
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.app-nav-link i {
  font-size: 1.1rem;
  width: 1.25rem;
  text-align: center;
}

.app-nav-link:hover {
  background: rgba(91, 75, 255, 0.06);
  color: var(--bs-primary);
}

.app-nav-link.active {
  background: #ebe8ff;
  color: var(--bs-primary);
  font-weight: 600;
}

.app-upgrade-card {
  margin-top: auto;
  padding: 1rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--app-border);
  box-shadow: var(--app-shadow);
}

.app-upgrade-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: #0f172a;
}

.app-upgrade-title i {
  color: #f59e0b;
  font-size: 1.1rem;
}

.app-upgrade-text {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0.4rem 0 0.85rem;
  line-height: 1.45;
}

.app-upgrade-btn {
  display: block;
  text-align: center;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #6d5dfc 0%, #5b4bff 100%);
  color: #fff !important;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(91, 75, 255, 0.3);
}

.app-upgrade-btn:hover {
  filter: brightness(1.05);
}

/* Desktop header */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 2rem;
  background: rgba(248, 249, 251, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--app-border);
}

.app-search {
  position: relative;
  flex: 0 1 420px;
}

.app-search i {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.9rem;
}

.app-search input {
  width: 100%;
  height: 40px;
  padding: 0 1rem 0 2.4rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  font-size: 0.875rem;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-search input:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 3px rgba(91, 75, 255, 0.12);
}

.app-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.25rem 0.5rem 0.25rem 0.25rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #0f172a;
  font-size: 0.875rem;
}

.app-user-btn:hover {
  background: rgba(91, 75, 255, 0.06);
}

.app-user-btn .bi-chevron-down {
  font-size: 0.75rem;
  color: #64748b;
}

.app-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
  color: var(--bs-primary);
  font-weight: 700;
}

.app-user-menu {
  border: 1px solid var(--app-border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  padding: 0.4rem;
  font-size: 0.875rem;
}

.app-user-menu .dropdown-item {
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

/* Mobile header */
.app-mobile-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-height: calc(var(--app-topbar-height) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 0.5rem 0;
  background: rgba(245, 246, 250, 0.92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.app-mobile-topbar.is-scrolled {
  border-bottom-color: var(--app-divider);
  background: rgba(255, 255, 255, 0.94);
}

.app-mobile-title {
  flex: 1;
  min-width: 0;
  margin: 0 0.25rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--app-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-mobile-title:first-child {
  margin-left: 0.5rem;
}

.app-mobile-brand {
  color: var(--app-text) !important;
  text-decoration: none;
}

.app-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--app-tap);
  height: var(--app-tap);
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--app-text);
  font-size: 1.35rem;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.app-icon-btn:hover,
.app-icon-btn:active {
  background: rgba(15, 23, 42, 0.06);
  color: var(--app-text);
}

/* Main content */
.app-main {
  padding: 0.75rem 0.75rem calc(var(--app-bottom-offset) + 1.5rem);
  animation: app-page-in 0.25s var(--app-ease);
}

@keyframes app-page-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .app-main { animation: none; }
}

.app-main--guest {
  padding-bottom: 1.5rem;
}

/* Mobile bottom navigation */
.app-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1030;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  height: calc(var(--app-bottom-nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid #eef0f4;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.05);
}

.app-bottom-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 500;
  text-decoration: none;
}

.app-bottom-link i {
  font-size: 1.2rem;
}

.app-bottom-link.active {
  color: var(--bs-primary);
  font-weight: 600;
}

@media (min-width: 992px) {
  aside.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1030;
    border-right: 1px solid var(--app-border);
  }

  .app-sidebar-inner {
    width: var(--app-sidebar-width);
  }

  .app-content {
    margin-left: var(--app-sidebar-width);
    min-height: 100vh;
  }

  .app-main {
    padding: 1.5rem 2rem 2rem;
  }
}

@media print {
  .app-sidebar,
  .app-topbar,
  .app-mobile-topbar,
  .app-bottom-nav,
  .app-fab,
  .app-toast-stack,
  .app-progress {
    display: none !important;
  }

  body.app-body {
    background: #fff !important;
  }

  .app-content {
    margin-left: 0 !important;
  }

  .app-main {
    padding: 0 !important;
  }
}

/* ============================================================
   Mobile app design system
   Tokens live in :root above (--app-*). Components below are
   mobile-first and scale up at 768px / 992px.
   ============================================================ */

/* ---------- Typography ---------- */
.app-body h1, .app-body h2, .app-body h3, .app-body h4, .app-body h5, .app-body h6 {
  letter-spacing: -0.02em;
}

.app-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--app-muted);
  margin: 1.25rem 0.25rem 0.5rem;
}

/* ---------- Tap feedback ---------- */
.app-body a,
.app-body button,
.app-body .btn {
  touch-action: manipulation;
}

.app-body .btn:active:not(:disabled),
.app-tappable:active {
  transform: scale(0.98);
}

/* ---------- Buttons ---------- */
.app-body .btn {
  border-radius: var(--app-radius-sm);
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.app-body .btn-tenant-primary:hover,
.app-body .btn-tenant-back:hover,
.app-body .btn-tenant-action:hover,
.app-body .btn-icon-action:hover {
  transform: none;
}

.app-btn-ghost {
  background: var(--app-surface-2);
  border: 1px solid var(--app-divider);
  color: var(--app-text-2);
}

.app-btn-ghost:hover {
  background: #eef0f4;
  color: var(--app-text);
}

.btn.is-loading {
  pointer-events: none;
  opacity: 0.85;
}

/* ---------- Forms ---------- */
.app-body .form-control,
.app-body .form-select {
  border-radius: var(--app-radius-sm);
  border: 1px solid var(--app-input-border);
  color: var(--app-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-body .form-control:focus,
.app-body .form-select:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px rgba(91, 75, 255, 0.14);
}

.app-body .form-label,
.app-body .tenant-form-label {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--app-text-2);
  margin-bottom: 0.35rem;
}

.app-body .form-text {
  font-size: 0.78rem;
  color: var(--app-muted);
}

.app-body .input-group-text {
  background: var(--app-surface-2);
  border-color: var(--app-input-border);
  color: var(--app-muted);
}

.app-body .form-check-input:checked {
  background-color: var(--app-primary);
  border-color: var(--app-primary);
}

.app-body .form-switch .form-check-input {
  width: 2.75em;
  height: 1.5em;
  cursor: pointer;
}

@media (max-width: 767.98px) {
  /* 16px inputs stop iOS from zooming on focus; 44px meets touch-target guidance */
  .app-body .form-control,
  .app-body .form-select,
  .app-body textarea {
    font-size: 16px;
  }

  .app-body .form-control:not(textarea):not(.form-control-color):not([type="file"]),
  .app-body .form-select {
    min-height: var(--app-tap);
  }

  .app-body .btn:not(.btn-sm):not(.btn-close):not(.app-icon-btn) {
    min-height: var(--app-tap);
  }

  .app-body .btn-sm {
    min-height: 36px;
  }
}

/* ---------- Page header ---------- */
@media (max-width: 991.98px) {
  /* The mobile top bar shows the title and back arrow */
  .app-body--auth .tenant-page-header {
    margin-bottom: 0.75rem;
    padding-bottom: 0;
    border-bottom: none;
    gap: 0.5rem;
  }

  .app-body--auth .tenant-page-header h1,
  .app-body--auth .tenant-page-header .btn-tenant-back,
  .app-body--auth .app-hide-mobile {
    display: none !important;
  }

  .app-body--auth .tenant-page-header .page-subtitle {
    margin: 0 0.25rem;
    font-size: 0.82rem;
  }
}

/* ---------- Cards / surfaces ---------- */
.app-card {
  background: var(--app-surface);
  border-radius: var(--app-radius);
  border: 1px solid var(--app-border);
  box-shadow: var(--app-shadow-sm);
}

@media (max-width: 767.98px) {
  .app-body .tenant-form-card,
  .app-body .tenant-list-card {
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-sm);
    margin-bottom: 1rem;
  }

  /* visible overflow lets .app-sticky-actions stick to the viewport */
  .app-body .tenant-form-card {
    overflow: visible;
  }

  .app-body .tenant-form-card .form-card-header {
    padding: 0.85rem 1rem;
    background: var(--app-surface);
    border-radius: var(--app-radius) var(--app-radius) 0 0;
  }

  .app-body .tenant-list-card .list-card-header {
    margin-bottom: 0.5rem;
    padding-bottom: 0.65rem;
  }
}

/* ---------- Mobile content width ----------
   Every page sits in .app-main > .container-fluid. On phones and tablets .app-main already gives a 12px side
   gutter, so the container's own 12px padding only stacked on top of it (plus the card's padding), leaving
   about a fifth of a phone screen as empty margin. Drop the duplicate and trim card padding a little. */
@media (max-width: 991.98px) {
  .app-body--auth .app-main > .container-fluid {
    padding-left: 0;
    padding-right: 0;
    padding-top: 0.5rem !important; /* overrides py-3; .app-main already adds space under the top bar */
  }
}

@media (max-width: 575.98px) {
  .app-body .tenant-form-card .form-card-header {
    padding: 0.8rem 0.85rem;
  }

  .app-body .tenant-form-card .form-card-body,
  .app-body .tenant-list-card {
    padding: 1rem 0.85rem;
  }

  .app-body .app-setting-row {
    padding: 0.75rem 0.85rem;
  }
}

/* ---------- Alerts ---------- */
.app-body .tenant-alert {
  box-shadow: none;
  border-radius: var(--app-radius-sm);
  font-size: 0.875rem;
}

/* ---------- List (iOS-style grouped rows) ---------- */
.app-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--app-surface);
  border-radius: var(--app-radius);
  border: 1px solid var(--app-border);
  overflow: hidden;
}

.app-list--flush {
  border: none;
  border-radius: 0;
  background: transparent;
}

.app-list-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 60px;
  padding: 0.75rem 0.85rem;
  color: inherit;
  text-decoration: none;
  background: var(--app-surface);
  transition: background-color 0.15s ease;
}

.app-list--flush .app-list-item {
  padding-left: 0;
  padding-right: 0;
  background: transparent;
}

.app-list-item + .app-list-item {
  border-top: 1px solid var(--app-divider);
}

a.app-list-item:hover,
a.app-list-item:active,
button.app-list-item:active {
  background: var(--app-surface-2);
  color: inherit;
}

button.app-list-item {
  width: 100%;
  border: none;
  text-align: left;
}

.app-list-media {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--app-primary-soft);
  color: var(--app-primary);
  font-size: 1.2rem;
  overflow: hidden;
}

.app-list-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-list-media--lg {
  width: 56px;
  height: 56px;
}

.app-list-body {
  flex: 1;
  min-width: 0;
}

.app-list-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--app-text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-list-sub {
  font-size: 0.8rem;
  color: var(--app-muted);
  line-height: 1.35;
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-list-trailing {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--app-muted);
  text-align: right;
}

.app-list-chevron {
  color: var(--app-subtle);
  font-size: 0.9rem;
}

.app-list-empty {
  padding: 2.5rem 1rem;
  text-align: center;
}

/* Icon button used inside list rows */
.app-row-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--app-muted);
  font-size: 1.1rem;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.app-row-btn:hover,
.app-row-btn:active {
  background: rgba(15, 23, 42, 0.06);
  color: var(--app-text);
}

.app-row-btn.is-danger:hover,
.app-row-btn.is-danger:active {
  background: var(--app-danger-soft);
  color: var(--app-danger);
}

/* ---------- Hub (settings-style navigation) ---------- */
.app-hub {
  display: flex;
  flex-direction: column;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  overflow: hidden;
}

.app-hub-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1rem;
  min-height: 68px;
  color: inherit;
  text-decoration: none;
  background: var(--app-surface);
  border: none;
  width: 100%;
  text-align: left;
  transition: background-color 0.15s ease;
}

.app-hub-item + .app-hub-item {
  border-top: 1px solid var(--app-divider);
}

a.app-hub-item:hover,
a.app-hub-item:active,
button.app-hub-item:hover,
button.app-hub-item:active {
  background: var(--app-surface-2);
  color: inherit;
}

.app-hub-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: var(--app-primary-soft);
  color: var(--app-primary);
}

.app-hub-icon--blue { background: #e6efff; color: #2f6bf2; }
.app-hub-icon--green { background: #e3f7ec; color: #15803d; }
.app-hub-icon--orange { background: #fff1de; color: #d97706; }
.app-hub-icon--pink { background: #fde8f1; color: #db2777; }
.app-hub-icon--teal { background: #e0f6f5; color: #0f8f89; }
.app-hub-icon--gray { background: #eef0f4; color: #334155; }

.app-hub-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-hub-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--app-text);
}

.app-hub-desc {
  font-size: 0.8rem;
  color: var(--app-muted);
  line-height: 1.35;
  margin-top: 0.1rem;
}

.app-hub-trailing {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--app-subtle);
}

@media (min-width: 768px) {
  .app-hub {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
  }

  .app-hub-item {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-sm);
    padding: 1.1rem 1.15rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  }

  .app-hub-item + .app-hub-item {
    border-top: 1px solid var(--app-border);
  }

  a.app-hub-item:hover,
  button.app-hub-item:hover {
    background: var(--app-surface);
    border-color: rgba(91, 75, 255, 0.35);
    box-shadow: var(--app-shadow);
  }
}

/* ---------- Settings: modal header, toggle row, preview ---------- */
.app-modal-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.app-modal-title .app-hub-icon {
  width: 38px;
  height: 38px;
  font-size: 1.05rem;
}

.app-modal-title .modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
  color: var(--app-text);
}

.app-modal-sub {
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
  color: var(--app-muted);
  line-height: 1.35;
}

.app-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0.95rem;
  margin-bottom: 1rem;
  background: var(--app-surface-2);
  border: 1px solid var(--app-divider);
  border-radius: var(--app-radius-sm);
}

.app-setting-row .form-label {
  margin-bottom: 0;
  color: var(--app-text);
}

.app-setting-row .form-text {
  margin-top: 0.1rem;
}

.app-setting-row .form-switch {
  margin: 0;
  padding-left: 2.75em;
  min-height: auto;
}

.app-preview-box {
  padding: 1rem;
  background: var(--app-surface-2);
  border: 1px dashed var(--app-input-border);
  border-radius: var(--app-radius-sm);
  font-size: 0.9rem;
  color: var(--app-text-2);
  line-height: 1.6;
}

.app-preview-box img {
  max-width: 100%;
  max-height: 150px;
  object-fit: contain;
}

.app-preview-empty {
  text-align: center;
  color: var(--app-muted);
  font-size: 0.85rem;
  padding: 0.75rem 0;
}

.app-preview-empty i {
  display: block;
  font-size: 1.75rem;
  color: var(--app-subtle);
  margin-bottom: 0.35rem;
}

.app-form-note {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--app-muted);
}

@media (min-width: 992px) {
  .app-aside-sticky {
    position: sticky;
    top: 1rem;
  }
}

/* ---------- Form sections & collapsible form card ---------- */
.app-form-section {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--app-muted);
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--app-divider);
}

.app-form-section:first-child {
  margin-top: 0;
}

.app-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 0.5rem;
}

@media (max-width: 575.98px) {
  .app-form-actions .btn {
    flex: 1;
  }
}

.app-inline-options {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 42px;
}

.app-inline-options .form-check {
  margin-bottom: 0;
}

.app-color-picker {
  flex: 0 0 56px;
  max-width: 56px;
  padding: 0.3rem;
  border-top-right-radius: var(--app-radius-sm) !important;
  border-bottom-right-radius: var(--app-radius-sm) !important;
}

.form-card-toggle {
  display: none;
}

@media (max-width: 767.98px) {
  .tenant-form-card--collapsible .form-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
  }

  .tenant-form-card--collapsible .form-card-header:has(+ .collapse:not(.show)) {
    border-bottom: none;
  }

  .tenant-form-card--collapsible .form-card-toggle {
    display: inline-flex;
    color: var(--app-muted);
    transition: transform 0.2s ease;
  }

  .tenant-form-card--collapsible .form-card-header[aria-expanded="true"] .form-card-toggle {
    transform: rotate(180deg);
  }
}

@media (min-width: 768px) {
  .tenant-form-card--collapsible > .collapse:not(.show) {
    display: block;
  }
}

/* Lists inside cards drop their own frame */
.tenant-list-card .app-list,
.tenant-form-card .app-list {
  border: none;
  border-radius: 0;
  background: transparent;
}

.tenant-list-card .app-list .app-list-item,
.tenant-form-card .app-list .app-list-item {
  padding-left: 0;
  padding-right: 0;
  background: transparent;
}

/* ---------- Chips (horizontal scroller) ---------- */
.app-chips {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  padding: 0.1rem 0.1rem 0.25rem;
  margin: 0 -0.1rem;
}

.app-chips::-webkit-scrollbar {
  display: none;
}

.app-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 36px;
  padding: 0 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--app-input-border);
  background: var(--app-surface);
  color: var(--app-text-2);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  scroll-snap-align: start;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.app-chip:hover {
  border-color: rgba(91, 75, 255, 0.4);
  color: var(--app-primary);
}

.app-chip.active {
  background: var(--app-text);
  border-color: var(--app-text);
  color: #fff;
}

/* ---------- Status pills ---------- */
.app-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  background: #f1f5f9;
  color: #475569;
}

.app-pill--success { background: var(--app-success-soft); color: var(--app-success); }
.app-pill--warning { background: var(--app-warning-soft); color: var(--app-warning); }
.app-pill--danger { background: var(--app-danger-soft); color: var(--app-danger); }
.app-pill--info { background: #e6f4fb; color: #0b7fae; }
.app-pill--primary { background: var(--app-primary-soft); color: var(--app-primary); }

/* ---------- Floating action button ---------- */
.app-fab {
  position: fixed;
  right: 1rem;
  bottom: calc(var(--app-bottom-offset) + 1rem);
  z-index: 1025;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 56px;
  height: 56px;
  padding: 0 1.25rem;
  border: none;
  border-radius: 18px;
  background: var(--app-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 8px 24px rgba(91, 75, 255, 0.4);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.app-fab i {
  font-size: 1.35rem;
}

.app-fab:hover,
.app-fab:active {
  color: #fff;
  box-shadow: 0 10px 28px rgba(91, 75, 255, 0.5);
}

.app-fab:active {
  transform: scale(0.96);
}

@media (min-width: 992px) {
  .app-fab {
    display: none;
  }
}

/* ---------- Sticky action bar (form submit / totals) ---------- */
@media (max-width: 991.98px) {
  .app-sticky-actions {
    position: sticky;
    bottom: calc(var(--app-bottom-offset) + 0.5rem);
    z-index: 1010;
    margin-top: 1rem;
    padding: 0.65rem;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--app-divider);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-lg);
  }

  .app-sticky-actions .btn {
    flex: 1;
  }
}

/* ---------- Empty state ---------- */
.app-body .tenant-empty-state {
  padding: 2.5rem 1rem;
}

.app-body .tenant-empty-state i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 0.85rem;
  border-radius: 20px;
  background: var(--app-primary-soft);
  color: var(--app-primary);
  font-size: 1.75rem;
  opacity: 1;
}

.app-body .tenant-empty-state h5 {
  color: var(--app-text);
  font-size: 1rem;
}

.app-body .tenant-empty-state .btn {
  margin-top: 1rem;
}

/* ---------- Bottom sheets (all modals on phones) ---------- */
@media (max-width: 575.98px) {
  .app-body .modal:not(.modal-keep-center) .modal-dialog {
    margin: 0;
    max-width: none;
    width: 100%;
    min-height: 100%;
    display: flex;
    align-items: flex-end;
  }

  .app-body .modal:not(.modal-keep-center) .modal-content {
    width: 100%;
    max-height: calc(100vh - 2rem - env(safe-area-inset-top));
    border-radius: var(--app-radius-lg) var(--app-radius-lg) 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .app-body .modal:not(.modal-keep-center) .modal-content::before {
    content: "";
    display: block;
    width: 40px;
    height: 5px;
    margin: 8px auto 0;
    border-radius: 999px;
    background: #d6d9e0;
    flex-shrink: 0;
  }

  .app-body .modal:not(.modal-keep-center) .modal-body {
    overflow-y: auto;
  }

  .app-body .modal.fade:not(.modal-keep-center) .modal-dialog {
    transform: translateY(100%);
    transition: transform 0.32s var(--app-ease);
  }

  .app-body .modal.show:not(.modal-keep-center) .modal-dialog {
    transform: none;
  }

  .app-body .modal-footer {
    flex-wrap: nowrap;
  }

  .app-body .modal-footer > .btn,
  .app-body .modal-footer > form,
  .app-body .modal-footer > a.btn {
    flex: 1;
  }

  .app-body .modal-footer > form .btn {
    width: 100%;
  }
}

/* ---------- Confirm sheet ---------- */
.app-confirm {
  padding: 1.5rem 1.25rem 1.25rem;
  text-align: center;
}

.app-confirm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 0.85rem;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--app-primary-soft);
  color: var(--app-primary);
  font-size: 1.5rem;
}

.app-confirm-icon.is-danger {
  background: var(--app-danger-soft);
  color: var(--app-danger);
}

.app-confirm-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: var(--app-text);
}

.app-confirm-message {
  font-size: 0.9rem;
  color: var(--app-muted);
  margin: 0;
  white-space: pre-line;
}

.app-confirm-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.35rem;
}

.app-confirm-actions .btn {
  flex: 1;
  min-height: var(--app-tap);
}

@media (min-width: 576px) {
  .app-sheet .modal-dialog {
    max-width: 400px;
  }
}

/* ---------- Action sheet ---------- */
.app-action-sheet {
  padding: 0.75rem 0.75rem 0.85rem;
}

.app-action-sheet-head {
  padding: 0.35rem 0.5rem 0.75rem;
  text-align: center;
}

.app-action-sheet-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--app-text);
}

.app-action-sheet-subtitle {
  font-size: 0.8rem;
  color: var(--app-muted);
  margin-top: 0.1rem;
}

.app-action-list {
  display: flex;
  flex-direction: column;
  background: var(--app-surface-2);
  border-radius: var(--app-radius);
  overflow: hidden;
}

.app-action {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  min-height: 54px;
  padding: 0.6rem 0.9rem;
  border: none;
  background: transparent;
  color: var(--app-text);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.app-action + .app-action {
  border-top: 1px solid var(--app-divider);
}

.app-action:hover,
.app-action:active {
  background: #eef0f4;
  color: var(--app-text);
}

.app-action-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--app-primary);
  font-size: 1.05rem;
}

.app-action-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-action-hint {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--app-muted);
}

.app-action.is-danger,
.app-action.is-danger:hover {
  color: var(--app-danger);
}

.app-action.is-danger .app-action-icon {
  color: var(--app-danger);
  background: var(--app-danger-soft);
}

.app-action.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- Toasts ---------- */
.app-toast-stack {
  position: fixed;
  left: 50%;
  bottom: calc(var(--app-bottom-offset) + 0.85rem);
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: min(420px, calc(100vw - 1.5rem));
  pointer-events: none;
}

.app-toast {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.7rem 0.5rem 0.7rem 0.95rem;
  border-radius: var(--app-radius);
  background: #1e1b3a;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.28);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s var(--app-ease);
}

.app-toast.is-visible {
  opacity: 1;
  transform: none;
}

.app-toast > .bi {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.app-toast--success > .bi { color: #4ade80; }
.app-toast--error > .bi { color: #f87171; }
.app-toast--warning > .bi { color: #fbbf24; }
.app-toast--info > .bi { color: #a5b4fc; }

.app-toast-text {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}

.app-toast-action {
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: #c7c2ff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.4rem 0.7rem;
  white-space: nowrap;
}

.app-toast-action:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.app-toast-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.app-toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

@media (min-width: 992px) {
  .app-toast-stack {
    left: auto;
    right: 1.5rem;
    bottom: 1.5rem;
    transform: none;
    align-items: flex-end;
  }
}

/* ---------- Navigation progress bar ---------- */
.app-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2100;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, #8b7dff, var(--app-primary));
  box-shadow: 0 0 8px rgba(91, 75, 255, 0.5);
  opacity: 0;
  pointer-events: none;
}

.app-progress.is-active {
  opacity: 1;
  width: 85%;
  transition: width 8s cubic-bezier(0.1, 0.7, 0.2, 1), opacity 0.1s ease;
}

.app-progress.is-done {
  width: 100%;
  opacity: 0;
  transition: width 0.2s ease, opacity 0.3s ease 0.15s;
}

/* ---------- Skeleton ---------- */
.app-skeleton {
  display: block;
  border-radius: 8px;
  background: linear-gradient(90deg, #eef0f4 25%, #f6f7fa 37%, #eef0f4 63%);
  background-size: 400% 100%;
  animation: app-skeleton 1.4s ease infinite;
}

@keyframes app-skeleton {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---------- Pagination ---------- */
.app-body .pagination {
  gap: 0.35rem;
  flex-wrap: wrap;
}

.app-body .page-link {
  border-radius: var(--app-radius-sm) !important;
  border: 1px solid var(--app-divider);
  background: var(--app-surface);
  color: var(--app-text-2);
  min-width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

.app-body .page-item.active .page-link {
  background: var(--app-primary);
  border-color: var(--app-primary);
  color: #fff;
}

.app-body .page-item.disabled .page-link {
  background: var(--app-surface-2);
  color: var(--app-subtle);
}

/* ---------- Dropdowns ---------- */
.app-body .dropdown-menu {
  background: var(--app-surface);
  border: 1px solid var(--app-divider);
  border-radius: 12px;
  box-shadow: var(--app-shadow-lg);
  padding: 0.35rem;
}

.app-body .dropdown-item {
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

/* ---------- Select2 (product / color pickers) — match native inputs ---------- */
.app-body .select2-container .select2-selection--single {
  height: 42px;
  border: 1px solid var(--app-input-border);
  border-radius: var(--app-radius-sm);
  background: var(--app-surface);
  display: flex;
  align-items: center;
}

.app-body .select2-container .select2-selection--single .select2-selection__rendered {
  line-height: 1.4;
  padding: 0 2rem 0 0.85rem;
  color: var(--app-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.app-body .select2-container .select2-selection--single .select2-selection__arrow {
  height: 100%;
  top: 0;
  right: 0.5rem;
}

/* Clear (×) button: the selection is a flex row, which ignores Select2's float, so pin it beside the arrow */
.app-body .select2-container .select2-selection--single .select2-selection__clear {
  position: absolute;
  top: 50%;
  right: 2rem;
  transform: translateY(-50%);
  margin: 0;
  padding: 0 0.25rem;
  height: auto;
  line-height: 1;
  font-size: 1.1rem;
  color: var(--app-muted);
  background: transparent;
  border: none;
  z-index: 1;
}

.app-body .select2-container .select2-selection--single .select2-selection__clear:hover {
  color: var(--app-danger);
}

/* leave room on the right for the × and the arrow */
.app-body .select2-container .select2-selection--single:has(.select2-selection__clear) .select2-selection__rendered {
  padding-right: 3.25rem;
}

.app-body .select2-container .select2-selection__placeholder {
  color: var(--app-subtle);
}

.app-body .select2-container--open .select2-selection--single,
.app-body .select2-container--focus .select2-selection--single {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px rgba(91, 75, 255, 0.14);
}

.app-body .select2-dropdown {
  border: 1px solid var(--app-divider);
  border-radius: var(--app-radius-sm);
  box-shadow: var(--app-shadow-lg);
  overflow: hidden;
}

.app-body .select2-search--dropdown .select2-search__field {
  border: 1px solid var(--app-input-border);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
}

.app-body .select2-results__option {
  padding: 0.5rem 0.75rem;
}

.app-body .select2-container--default .select2-results__option--highlighted[aria-selected],
.app-body .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background-color: var(--app-primary-soft);
  color: inherit;
}

.app-body .select2-container--default .select2-results__option[aria-selected=true],
.app-body .select2-container--default .select2-results__option--selected {
  background-color: rgba(91, 75, 255, 0.12);
  color: inherit;
}

@media (max-width: 767.98px) {
  .app-body .select2-container .select2-selection--single {
    height: var(--app-tap);
    font-size: 16px;
  }

  .app-body .select2-search--dropdown .select2-search__field {
    font-size: 16px;
  }
}

/* ---------- Floating action button clearance ---------- */
@media (max-width: 991.98px) {
  /* Keep the last row / pagination scrollable out from under the FAB */
  body:has(.app-fab) .app-main {
    padding-bottom: calc(var(--app-bottom-offset) + 5.5rem);
  }

  .app-fab.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
  }
}

/* ---------- Segmented control (period switchers) ---------- */
.app-segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--app-surface-2);
  border: 1px solid var(--app-divider);
  border-radius: 999px;
}

.app-segmented button {
  border: none;
  background: transparent;
  color: var(--app-muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.app-segmented button:hover {
  color: var(--app-text);
}

.app-segmented button.active {
  background: var(--app-surface);
  color: var(--app-primary);
  box-shadow: var(--app-shadow-sm);
}

@media (max-width: 767.98px) {
  .app-segmented button {
    padding: 0.55rem 0.7rem;
  }
}

/* ---------- Status pages (logout, error) ---------- */
.app-status-page {
  max-width: 420px;
  margin: 2rem auto;
}

@media (max-width: 767.98px) {
  .app-status-page {
    margin: 1rem auto;
  }
}

/* ============================================================
   Auth pages (sign in, forgot / reset password)
   Standalone pages without the app shell
   ============================================================ */
body.auth-shell {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, #f8f9fb 0%, #f1efff 55%, #e9e6ff 100%);
  color: var(--app-text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.auth-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(0.9rem + env(safe-area-inset-top)) 1.5rem 0.9rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.auth-brand {
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  color: var(--app-primary);
  text-decoration: none;
}

.auth-brand:hover {
  color: var(--bs-primary-dark);
}

/* Ordelo logo (480x120 source; multiply hides its white background on the tinted top bar) */
.auth-brand-logo {
  display: block;
  height: 32px;
  width: auto;
  mix-blend-mode: multiply;
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem 3rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 2rem;
  background: var(--app-surface);
  border-radius: var(--app-radius-lg);
  border: 1px solid var(--app-border);
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 24px 48px -12px rgba(91, 75, 255, 0.14);
}

.auth-badge {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.1rem;
  border-radius: var(--app-radius-lg);
  background: var(--app-primary-soft);
  color: var(--app-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 1.75rem;
  font-weight: 800;
}

.auth-badge img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  padding: 0.5rem;
  background: #fff;
}

.auth-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--app-text);
  margin: 0 0 0.3rem;
}

.auth-sub {
  font-size: 0.9rem;
  color: var(--app-muted);
  margin: 0 0 1.5rem;
}

.auth-card .form-label {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--app-text-2);
  margin-bottom: 0.35rem;
}

.auth-card .form-control {
  min-height: var(--app-tap);
  border-radius: var(--app-radius-sm);
  border: 1px solid var(--app-input-border);
  padding: 0.6rem 0.9rem;
  font-size: 16px; /* prevents iOS zoom on focus */
}

.auth-card .form-control:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px rgba(91, 75, 255, 0.14);
}

.auth-card .btn {
  min-height: var(--app-tap);
  border-radius: var(--app-radius-sm);
  font-weight: 600;
}

.auth-card .alert {
  border: none;
  border-radius: var(--app-radius-sm);
  font-size: 0.875rem;
}

.auth-link {
  color: var(--app-primary);
  font-weight: 600;
  text-decoration: none;
}

.auth-link:hover {
  color: var(--bs-primary-dark);
  text-decoration: underline;
}

/* Verify email result */
.auth-verify-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  font-weight: 800;
}

.auth-verify-icon--ok { background: #dcfce7; color: #16a34a; }
.auth-verify-icon--warn { background: #fef3c7; color: #b45309; }

/* "Continue with Google" (Google brand guidelines: white button, coloured G, dark label) */
.auth-google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 44px;
  background: #fff;
  color: #1f1f1f;
  font-weight: 600;
  border: 1px solid #dadce0;
  border-radius: var(--app-radius-sm, 10px);
}

.auth-google-btn:hover,
.auth-google-btn:focus-visible {
  background: #f8f9fb;
  color: #1f1f1f;
  border-color: #c6cbd3;
}

.auth-or {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  font-size: 0.8125rem;
  color: var(--app-muted);
}

.auth-or::before,
.auth-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--app-divider);
}

.auth-divider {
  text-align: center;
  font-size: 0.875rem;
  color: var(--app-muted);
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--app-divider);
}

.auth-footer {
  flex-shrink: 0;
  padding: 1.25rem 1.5rem calc(1.5rem + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 0.8125rem;
  color: var(--app-muted);
}

.auth-footer p {
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 575.98px) {
  .auth-main {
    align-items: flex-start;
    padding: 1.25rem 1rem 2rem;
  }

  .auth-card {
    padding: 1.5rem 1.25rem;
  }
}

/* ============================================================
   Product tour (appTour in site.js)
   Above modals and the bottom nav, below toasts.
   ============================================================ */
.app-tour {
  position: fixed;
  inset: 0;
  z-index: 1900;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.app-tour.is-open { opacity: 1; }

/* Swallows clicks on the page while the tour is open */
.app-tour-blocker {
  position: absolute;
  inset: 0;
}

/* Spotlight: a hole in the dimmed page around the target */
.app-tour-spot {
  position: fixed;
  pointer-events: none;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.6);
  transition: top 0.35s var(--app-ease), left 0.35s var(--app-ease), width 0.35s var(--app-ease),
    height 0.35s var(--app-ease), border-radius 0.35s var(--app-ease);
}

.app-tour-spot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 2px solid rgba(255, 255, 255, 0.95);
  animation: app-tour-pulse 1.8s ease-out infinite;
}

.app-tour-spot.is-empty::after { display: none; }

@keyframes app-tour-pulse {
  0% { box-shadow: 0 0 0 0 rgba(139, 125, 255, 0.55); }
  70% { box-shadow: 0 0 0 12px rgba(139, 125, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(139, 125, 255, 0); }
}

/* Coach card */
.app-tour-card {
  position: fixed;
  width: min(360px, calc(100vw - 24px));
  padding: 1.15rem 1.15rem 1rem;
  border-radius: var(--app-radius-lg);
  background: var(--app-surface);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  color: var(--app-text);
  outline: none;
  transition: top 0.35s var(--app-ease), left 0.35s var(--app-ease);
}

.app-tour-card.is-center {
  top: 50%;
  left: 50%;
  width: min(420px, calc(100vw - 24px));
  transform: translate(-50%, -50%);
}

.app-tour-card.is-changing .app-tour-head,
.app-tour-card.is-changing .app-tour-body {
  animation: app-tour-in 0.3s var(--app-ease);
}

@keyframes app-tour-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Arrow pointing at the target */
.app-tour-arrow {
  position: absolute;
  display: none;
  width: 14px;
  height: 14px;
  background: var(--app-surface);
  transform: rotate(45deg);
  margin: -7px 0 0 -7px;
}

.app-tour-card.is-right .app-tour-arrow { display: block; left: 0; margin-left: -7px; }
.app-tour-card.is-left .app-tour-arrow { display: block; left: auto !important; right: -7px; margin: -7px 0 0; }
.app-tour-card.is-bottom:not(.is-sheet) .app-tour-arrow { display: block; top: 0; margin-top: -7px; }
.app-tour-card.is-top:not(.is-sheet) .app-tour-arrow { display: block; top: auto !important; bottom: -7px; margin: 0 0 0 -7px; }

/* Phones: a sheet at the bottom (or the top, when the target is low on the screen) */
.app-tour-grip { display: none; }

.app-tour-card.is-sheet {
  left: 12px !important;
  right: 12px;
  width: auto;
  max-height: 62vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-top: 0.85rem;
}

.app-tour-card.is-sheet.is-bottom {
  top: auto !important;
  bottom: calc(12px + env(safe-area-inset-bottom));
}

.app-tour-card.is-sheet.is-top {
  top: calc(12px + env(safe-area-inset-top)) !important;
}

.app-tour-card.is-sheet .app-tour-grip {
  display: block;
  width: 36px;
  height: 4px;
  margin: 0 auto 0.7rem;
  border-radius: 999px;
  background: var(--app-divider);
}

/* Step progress: one segment per step */
.app-tour-progress {
  display: flex;
  gap: 4px;
  margin-bottom: 0.9rem;
}

.app-tour-progress span {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--app-divider);
  transition: background-color 0.3s ease;
}

.app-tour-progress span.is-done { background: #c4bcff; }
.app-tour-progress span.is-active { background: var(--app-primary); }

.app-tour-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.65rem;
}

.app-tour-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #8b7dff 0%, var(--app-primary) 100%);
  color: #fff;
  font-size: 1.1rem;
}

.app-tour-count {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--app-muted);
}

.app-tour-close {
  margin-left: auto;
  width: var(--app-tap);
  height: var(--app-tap);
  margin-right: -0.6rem;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--app-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-tour-close:hover,
.app-tour-close:focus-visible { background: var(--app-surface-2); color: var(--app-text); }

.app-tour-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 0 0 0.35rem;
  color: var(--app-text);
}

.app-tour-text {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--app-text-2);
  margin: 0;
}

.app-tour-points {
  list-style: none;
  padding: 0;
  margin: 0.65rem 0 0;
  display: grid;
  gap: 0.45rem;
}

.app-tour-points li {
  display: flex;
  gap: 0.5rem;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--app-text-2);
}

.app-tour-points i {
  color: var(--app-success);
  font-size: 0.9rem;
  line-height: 1.45;
}

/* Welcome and finish steps */
.app-tour-card.is-hero .app-tour-head {
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
}

.app-tour-card.is-hero .app-tour-icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  font-size: 1.7rem;
  margin: 0.25rem auto 0.1rem;
  box-shadow: 0 10px 24px rgba(91, 75, 255, 0.35);
}

.app-tour-card.is-hero .app-tour-count {
  position: absolute;
  top: 0;
  left: 0;
}

.app-tour-card.is-hero .app-tour-close {
  position: absolute;
  top: -0.6rem;
  right: 0;
}

.app-tour-card.is-hero .app-tour-body { text-align: center; }
.app-tour-card.is-hero .app-tour-title { font-size: 1.2rem; }

/* Footer: "don't show again" + actions */
.app-tour-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--app-divider);
}

.app-tour-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: var(--app-tap);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--app-muted);
  cursor: pointer;
  user-select: none;
}

.app-tour-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--app-primary);
  cursor: pointer;
}

.app-tour-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.app-tour-actions .btn {
  min-height: var(--app-tap);
  padding: 0.45rem 1rem;
  border-radius: var(--app-radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .app-tour-foot {
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .app-tour-actions {
    width: 100%;
  }

  .app-tour-actions .btn { flex: 1; }
  .app-tour-actions .app-tour-back[hidden] + .app-tour-next { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .app-tour,
  .app-tour-spot,
  .app-tour-card { transition: none; }

  .app-tour-spot::after,
  .app-tour-card.is-changing .app-tour-head,
  .app-tour-card.is-changing .app-tour-body { animation: none; }
}