/* ============================================================
   Bright AI Platform — app.css
   Modern SaaS dashboard, mobile-first, plain CSS
   ============================================================ */

/* ── Custom Properties ─────────────────────────────────────── */
:root {
  --primary:        #2563eb;
  --primary-dark:   #1e40af;
  --primary-light:  #dbeafe;
  --danger:         #dc2626;
  --danger-light:   #fee2e2;
  --success:        #16a34a;
  --success-light:  #dcfce7;
  --warning:        #d97706;
  --warning-light:  #fef3c7;
  --info:           #0891b2;
  --info-light:     #cffafe;

  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --sidebar-w:    240px;
  --sidebar-bg:   #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-hover:#334155;
  --sidebar-active:#2563eb;

  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);

  --transition: 150ms ease;
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Initial spinner (before JS boots) ──────────────────────── */
.initial-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100%;
}

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
.spinner-sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 0;
}

/* ── Layout Shell ───────────────────────────────────────────── */
#app { min-height: 100vh; }

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

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  transform: translateX(0);
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-w)));
}

.sidebar-logo {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo img {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.sidebar-logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-section-label {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gray-500);
  padding: 12px 16px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--sidebar-text);
  font-size: .875rem;
  font-weight: 500;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .7;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
  text-decoration: none;
}
.nav-link:hover svg { opacity: 1; }

.nav-link.active {
  background: rgba(37,99,235,.15);
  color: #93c5fd;
  border-left-color: var(--primary);
}
.nav-link.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-info { overflow: hidden; }

.sidebar-user-name {
  font-size: .8rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: .7rem;
  color: var(--gray-400);
}

/* ── Hamburger / Overlay ───────────────────────────────────── */
.topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--sidebar-bg);
  z-index: 190;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.hamburger {
  background: none;
  border: none;
  color: #fff;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 195;
}
.sidebar-overlay.visible { display: block; }

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page {
  flex: 1;
  padding: 32px;
  max-width: 1200px;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

.page-subtitle {
  font-size: .875rem;
  color: var(--gray-500);
  margin-top: 2px;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.card-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
}

.card-body {
  padding: 20px 24px 24px;
}

.card-body-pad { padding: 24px; }

/* ── Stats Grid ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-500);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
}

.stat-sub {
  font-size: .75rem;
  color: var(--gray-400);
  margin-top: 4px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: .875rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition),
              box-shadow var(--transition), opacity var(--transition);
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(37,99,235,.35);
}

.btn-secondary {
  background: #fff;
  color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); }

.btn-sm {
  padding: 5px 10px;
  font-size: .75rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

.btn-icon {
  padding: 7px;
  border-radius: var(--radius);
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

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

.form-group.span-2 { grid-column: span 2; }
.form-group.span-full { grid-column: 1 / -1; }

label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-700);
}

label .required { color: var(--danger); margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: .875rem;
  color: var(--gray-800);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

input.error,
select.error,
textarea.error {
  border-color: var(--danger);
}

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

.form-hint {
  font-size: .75rem;
  color: var(--gray-400);
}

.form-error {
  font-size: .75rem;
  color: var(--danger);
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* ── Radio Cards ────────────────────────────────────────────── */
.radio-card-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.radio-card {
  position: relative;
}

.radio-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-card-label {
  display: block;
  padding: 14px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: #fff;
}

.radio-card input:checked + .radio-card-label {
  border-color: var(--primary);
  background: var(--primary-light);
}

.radio-card-label:hover { border-color: var(--gray-400); }

.radio-card-name {
  font-weight: 600;
  font-size: .875rem;
  color: var(--gray-800);
  margin-bottom: 4px;
}

.radio-card-detail {
  font-size: .75rem;
  color: var(--gray-500);
  line-height: 1.4;
}

.radio-none-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  font-size: .875rem;
  color: var(--gray-600);
  cursor: pointer;
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  background: #fff;
}

thead th {
  background: var(--gray-50);
  padding: 11px 16px;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }
tbody tr.clickable { cursor: pointer; }

tbody td {
  padding: 13px 16px;
  color: var(--gray-700);
  vertical-align: middle;
}

.td-mono {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: .8rem;
}

.table-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--gray-400);
}
.empty-state p { font-size: .95rem; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.badge-success  { background: var(--success-light); color: #15803d; }
.badge-warning  { background: var(--warning-light); color: #92400e; }
.badge-danger   { background: var(--danger-light);  color: #b91c1c; }
.badge-info     { background: var(--info-light);    color: #0e7490; }
.badge-gray     { background: var(--gray-100);      color: var(--gray-600); }
.badge-primary  { background: var(--primary-light); color: var(--primary-dark); }

/* ── Toast Notifications ───────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .875rem;
  font-weight: 500;
  pointer-events: auto;
  max-width: 360px;
  min-width: 220px;
  animation: toast-in .25s ease;
}

.toast-item.toast-success { background: var(--success); color: #fff; }
.toast-item.toast-error   { background: var(--danger);  color: #fff; }
.toast-item.toast-info    { background: var(--info);    color: #fff; }
.toast-item.toast-warning { background: var(--warning); color: #fff; }

.toast-item.toast-out { animation: toast-out .25s ease forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(8px) scale(.95); }
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fade-in .15s ease;
}

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

.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  animation: modal-in .2s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(.95) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
}

.modal-close {
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 1.4rem;
  line-height: 1;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover { color: var(--gray-700); background: var(--gray-100); }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ── Stepper ─────────────────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 32px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 1;
  min-width: 80px;
}

.step::before {
  content: '';
  position: absolute;
  top: 16px;
  left: calc(-50% + 20px);
  right: calc(50% + 20px);
  height: 2px;
  background: var(--gray-200);
}
.step:first-child::before { display: none; }

.step.completed::before,
.step.active::before { background: var(--primary); }

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: var(--gray-400);
  position: relative;
  z-index: 1;
  transition: all var(--transition);
  flex-shrink: 0;
}

.step.completed .step-dot {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.step.active .step-dot {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,.15);
}

.step-label {
  font-size: .7rem;
  font-weight: 600;
  color: var(--gray-400);
  margin-top: 8px;
  text-align: center;
  line-height: 1.3;
}
.step.active .step-label,
.step.completed .step-label { color: var(--primary-dark); }

/* ── Rooms list in wizard ──────────────────────────────────── */
.room-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.room-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}

.room-item input { flex: 1; margin: 0; }
.room-item input[type="number"] { width: 90px; flex: none; }

.room-remove {
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 1.1rem;
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: color var(--transition), background var(--transition);
}
.room-remove:hover { color: var(--danger); background: var(--danger-light); }

/* ── Calc Result Box ─────────────────────────────────────────── */
.calc-result-box {
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 16px;
}

.calc-result-box h4 {
  font-size: .875rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 10px;
}

.calc-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.calc-result-item label {
  font-size: .7rem;
  color: var(--primary-dark);
  opacity: .7;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.calc-result-item p {
  font-size: .925rem;
  font-weight: 600;
  color: var(--primary-dark);
}

/* ── Info Cards (installer/finance in detail) ─────────────────── */
.info-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--gray-50);
}

.info-card-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-400);
  margin-bottom: 10px;
}

.info-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.info-card dt { font-size: .75rem; color: var(--gray-500); font-weight: 600; }
.info-card dd { font-size: .875rem; color: var(--gray-800); }

/* ── Quote Summary ────────────────────────────────────────────── */
.quote-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.quote-field label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-400);
  display: block;
  margin-bottom: 2px;
}
.quote-field p {
  font-size: .9rem;
  color: var(--gray-800);
  font-weight: 500;
}

.quote-total-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--gray-900);
  color: #fff;
  border-radius: var(--radius);
  margin-top: 12px;
}

.quote-total-label { font-size: .875rem; font-weight: 600; color: var(--gray-300); }
.quote-total-value { font-size: 1.5rem; font-weight: 700; }

/* ── Inline alert ─────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-error   { background: var(--danger-light);  color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: var(--success-light); color: #166534; border: 1px solid #86efac; }
.alert-info    { background: var(--info-light);    color: #155e75; border: 1px solid #67e8f9; }
.alert-warning { background: var(--warning-light); color: #78350f; border: 1px solid #fcd34d; }

/* ── Login ────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gray-900) 0%, #0f172a 100%);
  padding: 16px;
}

.login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -.02em;
}

.login-subtitle {
  font-size: .875rem;
  color: var(--gray-400);
  margin-top: 4px;
}

.login-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 24px;
}

/* ── Proposal (Public) ───────────────────────────────────────── */
.proposal-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 0;
  font-family: var(--font);
}

.proposal-header {
  background: var(--primary);
  color: #fff;
  padding: 32px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.proposal-header-logo img { height: 40px; }
.proposal-header-logo-text { font-size: 1.4rem; font-weight: 800; color: #fff; }

.proposal-header-info { text-align: right; }
.proposal-header-info h1 { font-size: 1.2rem; font-weight: 700; }
.proposal-header-info p { font-size: .875rem; opacity: .85; }

.proposal-body { padding: 40px; }

.proposal-section { margin-bottom: 32px; }
.proposal-section h2 {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gray-400);
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.proposal-address {
  font-size: 1rem;
  color: var(--gray-800);
  font-weight: 500;
}

.proposal-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--gray-900);
  color: #fff;
  padding: 20px 24px;
  border-radius: var(--radius);
  margin-top: 12px;
}
.proposal-total-label { font-size: 1rem; font-weight: 600; }
.proposal-total-value { font-size: 1.75rem; font-weight: 800; }

.proposal-finance-box {
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.proposal-finance-label { font-size: .875rem; color: var(--primary-dark); font-weight: 600; }
.proposal-finance-payment { font-size: 1.3rem; font-weight: 700; color: var(--primary-dark); }

.mass-save-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--success-light);
  border: 1px solid #86efac;
  color: #166534;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .875rem;
}

.proposal-footer {
  text-align: center;
  padding: 24px 40px 40px;
  color: var(--gray-400);
  font-size: .8rem;
  border-top: 1px solid var(--gray-200);
}

/* ── Toggle Switch ─────────────────────────────────────────── */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 22px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  left: 3px;
  top: 3px;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Divider ────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--gray-200);
  margin: 20px 0;
}

/* ── Section header inside card ──────────────────────────────── */
.section-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-400);
  margin-bottom: 12px;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .topbar { display: flex; }

  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
    top: 56px;
  }
  .sidebar.open { transform: translateX(0); }

  .main-content { margin-left: 0; padding-top: 56px; }

  .page { padding: 20px 16px; }

  .form-grid { grid-template-columns: 1fr; }
  .form-group.span-2,
  .form-group.span-full { grid-column: unset; }

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

  .page-header { flex-direction: column; align-items: flex-start; }

  .modal { max-width: 100%; }

  .proposal-header { flex-direction: column; align-items: flex-start; }
  .proposal-header-info { text-align: left; }
  .proposal-body { padding: 24px 20px; }
  .proposal-footer { padding: 20px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .radio-card-group { grid-template-columns: 1fr; }
  .stepper { gap: 0; }
  .step-label { font-size: .6rem; }
}

/* ── Print Styles ───────────────────────────────────────────── */
@media print {
  .sidebar,
  .topbar,
  .sidebar-overlay,
  #toast,
  #modal-container,
  .btn,
  .page-header > .btn,
  .no-print { display: none !important; }

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

  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; }

  .proposal-page { max-width: 100%; }
  .proposal-header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .proposal-total  { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .mass-save-badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  a[href]::after { content: none; }
  thead { display: table-header-group; }
  tr, td { page-break-inside: avoid; }
}

/* ── Utilities ──────────────────────────────────────────────── */
.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.text-sm   { font-size: .875rem; }
.text-xs   { font-size: .75rem; }
.text-muted { color: var(--gray-400); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.font-bold { font-weight: 700; }

.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.gap-16  { gap: 16px; }
.flex-1  { flex: 1; }

.w-full  { width: 100%; }
.hidden  { display: none !important; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; }
