/* Proposal Maker – clean SaaS admin theme (white / light grey / blue) */
:root {
  --pm-primary: #1d4ed8;
  --pm-primary-soft: #eff4ff;
  --pm-bg: #f4f6fa;
  --pm-border: #e6e9ef;
  --pm-text: #1f2937;
  --pm-muted: #6b7280;
  --pm-sidebar-w: 248px;
  --pm-sidebar-w-collapsed: 72px;
  --bs-primary: #1d4ed8;
  --bs-primary-rgb: 29, 78, 216;
  --bs-link-color: #1d4ed8;
  --bs-link-color-rgb: 29, 78, 216;
  --bs-link-hover-color: #1e40af;
  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --bs-body-color: #1f2937;
  --bs-border-radius: .55rem;
  --bs-border-radius-lg: .8rem;
}
body { background: var(--pm-bg); font-size: .925rem; }
.btn-primary { --bs-btn-bg: #1d4ed8; --bs-btn-border-color: #1d4ed8; --bs-btn-hover-bg: #1e40af; --bs-btn-hover-border-color: #1e40af; --bs-btn-active-bg: #1e3a8a; --bs-btn-disabled-bg: #1d4ed8; --bs-btn-disabled-border-color: #1d4ed8; }
.btn-outline-primary { --bs-btn-color: #1d4ed8; --bs-btn-border-color: #1d4ed8; --bs-btn-hover-bg: #1d4ed8; --bs-btn-hover-border-color: #1d4ed8; --bs-btn-active-bg: #1e40af; }
.text-primary { color: #1d4ed8 !important; }
.bg-primary-soft { background: var(--pm-primary-soft) !important; }
.form-control:focus, .form-select:focus { border-color: #93b4f5; box-shadow: 0 0 0 .2rem rgba(29, 78, 216, .12); }
.form-label { font-weight: 500; font-size: .85rem; margin-bottom: .3rem; color: #374151; }
.form-text { font-size: .78rem; }
.required::after { content: ' *'; color: #dc2626; }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--pm-sidebar-w); background: #fff; border-right: 1px solid var(--pm-border);
  position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 1040;
  transition: width .18s ease, transform .18s ease; overflow-x: hidden;
}
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: 1.05rem 1.1rem; text-decoration: none; color: inherit; border-bottom: 1px solid var(--pm-border); min-height: 64px; }
.brand-mark { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px; background: var(--pm-primary); color: #fff; display: grid; place-items: center; font-size: 1.15rem; }
.brand-logo { width: 38px; height: 38px; flex: 0 0 38px; object-fit: contain; border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; overflow: hidden; }
.brand-name { font-weight: 700; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.brand-sub { font-size: .72rem; color: var(--pm-muted); }
.sidebar-nav { padding: .8rem .65rem; flex: 1; overflow-y: auto; }
.sidebar .nav-link { display: flex; align-items: center; gap: .75rem; padding: .58rem .8rem; border-radius: .55rem; color: #4b5563; font-weight: 500; margin-bottom: 2px; white-space: nowrap; }
.sidebar .nav-link i { font-size: 1.08rem; width: 1.3rem; text-align: center; flex: 0 0 1.3rem; }
.sidebar .nav-link:hover { background: #f3f5f9; color: var(--pm-text); }
.sidebar .nav-link.active { background: var(--pm-primary-soft); color: var(--pm-primary); }
.sidebar-footer { padding: .65rem; border-top: 1px solid var(--pm-border); }
.main { flex: 1; margin-left: var(--pm-sidebar-w); min-width: 0; transition: margin-left .18s ease; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1030; height: 64px; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--pm-border); display: flex; align-items: center; gap: .75rem; padding: 0 1.4rem; }
.topbar-title { font-size: 1.08rem; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: .55rem; border: 1px solid var(--pm-border); background: #fff; font-size: 1.2rem; padding: 0; }
.btn-icon:hover { background: #f3f5f9; }
.user-chip { display: flex; align-items: center; gap: .55rem; border: 1px solid var(--pm-border); background: #fff; padding: .25rem .6rem .25rem .3rem; border-radius: 999px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--pm-primary-soft); color: var(--pm-primary); display: grid; place-items: center; font-weight: 700; font-size: .78rem; }
.content { padding: 1.5rem; flex: 1; }
.sidebar-backdrop { display: none; }

/* Collapsed (desktop) */
.app-shell.collapsed .sidebar { width: var(--pm-sidebar-w-collapsed); }
.app-shell.collapsed .main { margin-left: var(--pm-sidebar-w-collapsed); }
.app-shell.collapsed .brand-text, .app-shell.collapsed .sidebar .nav-link span { display: none; }
.app-shell.collapsed .sidebar .nav-link { justify-content: center; padding: .62rem; }
.app-shell.collapsed .sidebar-brand { justify-content: center; padding: 1.05rem .5rem; }

/* Mobile / tablet: sidebar slides in */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); width: var(--pm-sidebar-w); }
  .main, .app-shell.collapsed .main { margin-left: 0; }
  .app-shell.mobile-open .sidebar { transform: none; box-shadow: 0 10px 40px rgba(15,23,42,.18); }
  .app-shell.mobile-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 1035; }
  .app-shell.collapsed .brand-text, .app-shell.collapsed .sidebar .nav-link span { display: inline; }
  .app-shell.collapsed .brand-text { display: flex; }
  .content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
}

/* ---------- Cards, tables ---------- */
.card { border: 1px solid var(--pm-border); border-radius: .8rem; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--pm-border); padding: .9rem 1.2rem; font-weight: 600; border-top-left-radius: .8rem !important; border-top-right-radius: .8rem !important; }
.card-body { padding: 1.2rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1.1rem; }
.page-head h2 { font-size: 1.25rem; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--pm-muted); font-size: .85rem; }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--pm-muted); font-weight: 600; background: #f9fafb; border-bottom: 1px solid var(--pm-border); white-space: nowrap; padding: .7rem .9rem; }
.table > tbody td { padding: .75rem .9rem; vertical-align: middle; border-color: #f0f2f5; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8faff; }
.table-card { overflow: hidden; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--pm-muted); }
.empty-state i { font-size: 2.4rem; color: #c3cad6; display: block; margin-bottom: .6rem; }
.filters .form-control, .filters .form-select { min-width: 150px; }

/* ---------- Dashboard ---------- */
.stat-card { padding: 1.1rem 1.2rem; display: flex; flex-direction: row; gap: .9rem; align-items: center; height: 100%; text-align: left; }
.min-w-0 { min-width: 0; }
.stat-icon { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; }
.stat-label { font-size: .78rem; color: var(--pm-muted); font-weight: 500; }
.stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.2; }
.ic-blue { background: #eff4ff; color: #1d4ed8; } .ic-grey { background: #f1f3f6; color: #4b5563; }
.ic-sky { background: #e8f6fd; color: #0284c7; } .ic-green { background: #e9f8ef; color: #15803d; }
.ic-red { background: #fdeeee; color: #dc2626; } .ic-amber { background: #fff6e5; color: #b45309; }
.chart-box { position: relative; height: 260px; }
.activity-item { display: flex; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid #f0f2f5; }
.activity-item:last-child { border-bottom: 0; }
.activity-dot { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; display: grid; place-items: center; background: var(--pm-primary-soft); color: var(--pm-primary); font-size: .9rem; }

/* ---------- Status badges ---------- */
.status-badge { font-weight: 600; font-size: .72rem; padding: .38em .7em; border-radius: 999px; letter-spacing: .01em; }
.status-draft { background: #eef0f3 !important; color: #4b5563 !important; }
.status-sent { background: #e6eeff !important; color: #1d4ed8 !important; }
.status-viewed { background: #e3f4fb !important; color: #0369a1 !important; }
.status-approved { background: #e3f6ea !important; color: #15803d !important; }
.status-rejected { background: #fde8e8 !important; color: #b91c1c !important; }
.status-expired { background: #fff3db !important; color: #a16207 !important; }

/* ---------- Proposal builder ---------- */
.stepper { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: thin; }
.stepper .step { flex: 1 0 auto; display: flex; align-items: center; gap: .5rem; padding: .55rem .8rem; border-radius: .6rem; border: 1px solid var(--pm-border); background: #fff; color: #4b5563; font-size: .8rem; font-weight: 500; cursor: pointer; white-space: nowrap; }
.stepper .step .num { width: 24px; height: 24px; border-radius: 50%; background: #eef0f3; display: grid; place-items: center; font-size: .75rem; font-weight: 700; }
.stepper .step.active { border-color: var(--pm-primary); color: var(--pm-primary); background: var(--pm-primary-soft); }
.stepper .step.active .num { background: var(--pm-primary); color: #fff; }
.stepper .step.done .num { background: #dcfce7; color: #15803d; }
.stepper .step.has-error { border-color: #fca5a5; }
.stepper .step.has-error .num { background: #fee2e2; color: #b91c1c; }
.step-panel { display: none; }
.step-panel.active { display: block; }
.builder-actions { position: sticky; bottom: 0; background: rgba(244,246,250,.95); backdrop-filter: blur(4px); padding: .8rem 0; margin-top: 1rem; border-top: 1px solid var(--pm-border); z-index: 5; }
.service-pick { border: 1px solid var(--pm-border); border-radius: .6rem; padding: .7rem .85rem; background: #fff; display: flex; gap: .75rem; align-items: flex-start; }
.service-pick + .service-pick { margin-top: .5rem; }
.service-pick .price { font-weight: 600; white-space: nowrap; }
.service-list { max-height: 460px; overflow-y: auto; padding-right: .25rem; }
.items-table td { vertical-align: top; }
.items-table input.form-control, .items-table select.form-select, .items-table textarea.form-control { font-size: .85rem; }
.items-table .line-total { font-weight: 600; white-space: nowrap; padding-top: .9rem; }
.totals-box { background: #fff; border: 1px solid var(--pm-border); border-radius: .8rem; padding: 1rem 1.2rem; }
.totals-box .row-line { display: flex; justify-content: space-between; padding: .38rem 0; border-bottom: 1px dashed #edf0f4; }
.totals-box .row-line:last-child { border-bottom: 0; }
.totals-box .grand { font-size: 1.15rem; font-weight: 700; color: var(--pm-primary); border-top: 2px solid var(--pm-border); border-bottom: 0; margin-top: .3rem; padding-top: .7rem; }
.client-card { background: var(--pm-primary-soft); border: 1px solid #d6e2ff; border-radius: .7rem; padding: 1rem 1.1rem; }
.review-section { border: 1px solid var(--pm-border); border-radius: .7rem; background: #fff; margin-bottom: 1rem; }
.review-section .rs-head { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; border-bottom: 1px solid var(--pm-border); font-weight: 600; }
.review-section .rs-body { padding: .9rem 1rem; }
.review-section .rs-body p:last-child { margin-bottom: 0; }
.pre-wrap { white-space: pre-wrap; }
.pdf-frame { width: 100%; height: 78vh; min-height: 520px; border: 1px solid var(--pm-border); border-radius: .7rem; background: #fff; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: linear-gradient(180deg, #f6f8fc 0%, #eef2f9 100%); }
.auth-card { width: 100%; max-width: 420px; }

.toast-container { z-index: 1090; }
.dl-grid { display: grid; grid-template-columns: 140px 1fr; gap: .45rem 1rem; font-size: .88rem; }
.dl-grid dt { color: var(--pm-muted); font-weight: 500; }
.dl-grid dd { margin: 0; word-break: break-word; }
.nav-tabs .nav-link { color: #4b5563; font-weight: 500; }
.nav-tabs .nav-link.active { color: var(--pm-primary); }
@media print { .sidebar, .topbar, .builder-actions, .no-print { display: none !important; } .main { margin: 0 !important; } }
