/* ============================================================
   CSS VARIABLES — DARK / LIGHT THEMES
   ============================================================ */
:root {
  --bg-base:       #0d0f14;
  --bg-surface:    #13161e;
  --bg-elevated:   #1a1e2a;
  --bg-hover:      #1f2436;
  --bg-input:      #1a1e2a;
  --border:        #262b3a;
  --border-light:  #2f3547;
  --text-primary:  #f0f2f8;
  --text-secondary:#9ba3be;
  --text-muted:    #5a6380;
  --accent:        #4f8ef7;
  --accent-hover:  #3a7af5;
  --accent-dim:    rgba(79,142,247,.15);
  --green:         #22c55e;
  --green-dim:     rgba(34,197,94,.15);
  --yellow:        #f59e0b;
  --yellow-dim:    rgba(245,158,11,.15);
  --red:           #ef4444;
  --red-dim:       rgba(239,68,68,.15);
  --purple:        #a855f7;
  --purple-dim:    rgba(168,85,247,.15);
  --cyan:          #06b6d4;
  --cyan-dim:      rgba(6,182,212,.15);
  --sidebar-w:     240px;
  --header-h:      60px;
  --radius:        10px;
  --radius-sm:     6px;
  --shadow:        0 4px 24px rgba(0,0,0,.4);
  --shadow-sm:     0 2px 8px rgba(0,0,0,.3);
  --transition:    0.2s ease;
}
[data-theme="light"] {
  --bg-base:       #f0f2f7;
  --bg-surface:    #ffffff;
  --bg-elevated:   #f8f9fc;
  --bg-hover:      #eef0f6;
  --bg-input:      #ffffff;
  --border:        #e2e6f0;
  --border-light:  #d0d5e8;
  --text-primary:  #0f1221;
  --text-secondary:#4a5270;
  --text-muted:    #8a93b0;
  --accent-dim:    rgba(79,142,247,.1);
  --green-dim:     rgba(34,197,94,.1);
  --yellow-dim:    rgba(245,158,11,.1);
  --red-dim:       rgba(239,68,68,.1);
  --purple-dim:    rgba(168,85,247,.1);
  --cyan-dim:      rgba(6,182,212,.1);
  --shadow:        0 4px 24px rgba(0,0,0,.08);
  --shadow-sm:     0 2px 8px rgba(0,0,0,.06);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
.hidden { display: none !important; }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 1.5rem;
}
.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-card .logo-mark {
  width: 56px; height: 56px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.25rem;
  color: var(--accent);
  font-size: 1.5rem; font-weight: 800;
}
.login-card h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: .25rem; }
.login-card .sub { color: var(--text-secondary); font-size: .88rem; margin-bottom: 1.5rem; }
.login-card input[type="password"] {
  width: 100%; padding: .75rem 1rem;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: .95rem; margin-bottom: .75rem;
  transition: border-color var(--transition);
}
.login-card input[type="password"]:focus { outline: none; border-color: var(--accent); }
.login-error { color: var(--red); font-size: .85rem; margin-top: .5rem; min-height: 1.2em; }
.powered-by {
  margin-top: 2rem; color: var(--text-muted); font-size: .78rem;
  display: flex; align-items: center; justify-content: center; gap: .4rem;
}
.powered-by .oa-badge {
  background: linear-gradient(135deg, #4f8ef7, #a855f7);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  font-weight: 700; font-size: .82rem;
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-header {
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; font-size: .95rem; color: var(--text-primary);
}
.sidebar-logo .logo-icon {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: .85rem; flex-shrink: 0;
}
.sidebar-logo .logo-sub { font-size: .72rem; color: var(--text-muted); font-weight: 400; line-height: 1; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem .75rem; }
.nav-section-label {
  font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted); padding: .75rem .5rem .4rem; margin-top: .25rem;
}
.nav-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: .875rem; font-weight: 500;
  transition: all var(--transition);
  cursor: pointer; border: none; background: none;
  width: 100%; text-align: left;
  position: relative;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}
.nav-item .badge {
  margin-left: auto; background: var(--red);
  color: #fff; font-size: .65rem; font-weight: 700;
  padding: .15rem .4rem; border-radius: 20px; min-width: 18px; text-align: center;
}
.sidebar-footer {
  padding: .75rem; border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.oversight-credit {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem; border-radius: var(--radius-sm);
  font-size: .75rem; color: var(--text-muted);
}
.oversight-credit .oa-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(135deg, #4f8ef7, #a855f7);
  flex-shrink: 0;
}

/* Top Header */
.app-header {
  position: fixed; top: 0;
  left: var(--sidebar-w); right: 0;
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 1.5rem; gap: 1rem;
  z-index: 90;
}
.header-page-title {
  font-size: 1rem; font-weight: 700; color: var(--text-primary);
  flex: 1;
}
.header-page-title span { color: var(--text-muted); font-weight: 400; font-size: .85rem; margin-left: .5rem; }
.header-actions { display: flex; align-items: center; gap: .5rem; }
.theme-toggle {
  width: 36px; height: 36px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: all var(--transition);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 16px; height: 16px; }
.header-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .8rem;
}

/* Main content area */
.app-main {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  padding: 1.75rem;
  min-height: calc(100vh - var(--header-h));
  overflow-x: hidden;
  max-width: calc(100vw - var(--sidebar-w));
  box-sizing: border-box;
}
.page { display: none; }
.page.active { display: block; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1rem; border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 600; border: none;
  transition: all var(--transition); cursor: pointer; white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-ghost { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: var(--green-dim); color: var(--green); border: 1px solid var(--green); }
.btn-success:hover { background: var(--green); color: #fff; }
.btn-sm { padding: .4rem .75rem; font-size: .8rem; }
.btn-xs { padding: .25rem .55rem; font-size: .75rem; }
.btn-icon { padding: .5rem; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.card-title { font-size: .95rem; font-weight: 700; }
.card-subtitle { font-size: .8rem; color: var(--text-muted); margin-top: .1rem; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  position: relative; overflow: hidden;
}
.stat-card .stat-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.stat-card .stat-value { font-size: 2rem; font-weight: 800; margin: .3rem 0 .1rem; line-height: 1; }
.stat-card .stat-sub { font-size: .78rem; color: var(--text-muted); }
.stat-card .stat-icon {
  position: absolute; right: 1rem; top: 1rem;
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.stat-card .stat-icon svg { width: 18px; height: 18px; }
.stat-accent { color: var(--accent); }
.stat-green { color: var(--green); }
.stat-yellow { color: var(--yellow); }
.stat-red { color: var(--red); }
.stat-purple { color: var(--purple); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: .75rem 1rem; text-align: left;
  font-size: .75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
  background: var(--bg-elevated); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody td { padding: .8rem 1rem; font-size: .875rem; vertical-align: middle; }

/* ============================================================
   BADGES / STATUS PILLS
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .65rem; border-radius: 20px;
  font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-blue   { background: var(--accent-dim); color: var(--accent); }
.badge-blue::before   { background: var(--accent); }
.badge-green  { background: var(--green-dim);  color: var(--green); }
.badge-green::before  { background: var(--green); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); }
.badge-yellow::before { background: var(--yellow); }
.badge-red    { background: var(--red-dim);    color: var(--red); }
.badge-red::before    { background: var(--red); }
.badge-purple { background: var(--purple-dim); color: var(--purple); }
.badge-purple::before { background: var(--purple); }
.badge-gray   { background: var(--bg-elevated); color: var(--text-secondary); }
.badge-gray::before   { background: var(--text-muted); }
.badge-cyan   { background: var(--cyan-dim); color: var(--cyan); }
.badge-cyan::before   { background: var(--cyan); }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-field { display: flex; flex-direction: column; gap: .4rem; }
.form-field label { font-size: .8rem; font-weight: 600; color: var(--text-secondary); }
.form-field input, .form-field select, .form-field textarea {
  padding: .65rem .9rem;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: .9rem; transition: border-color var(--transition);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--accent);
}
.form-field select option { background: var(--bg-surface); }
.form-field textarea { resize: vertical; min-height: 80px; }
.req { color: var(--red); }
.form-section-title {
  font-size: .8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted);
  padding: .5rem 0 .25rem; border-bottom: 1px solid var(--border);
  margin-bottom: .25rem; grid-column: 1/-1;
}
.toolbar {
  display: flex; align-items: center; gap: .75rem;
  margin-bottom: 1rem; flex-wrap: wrap;
}
.search-input {
  padding: .6rem 1rem; flex: 1; min-width: 200px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: .875rem; transition: border-color var(--transition);
}
.search-input:focus { outline: none; border-color: var(--accent); }
.filter-select {
  padding: .6rem .9rem;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: .875rem; cursor: pointer;
}
.filter-select option { background: var(--bg-surface); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem; opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 14px; width: 100%; max-width: 680px;
  max-height: 90vh; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  transform: translateY(10px);
  transition: transform var(--transition);
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-secondary); display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700; transition: all var(--transition);
}
.modal-close:hover { background: var(--red-dim); color: var(--red); border-color: var(--red); }
.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 1rem 1.5rem; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: .75rem;
  flex-shrink: 0; background: var(--bg-elevated);
}

/* ============================================================
   SIDE DRAWER
   ============================================================ */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 150; opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.drawer-backdrop.open { opacity: 1; pointer-events: all; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 480px; max-width: 95vw;
  background: var(--bg-surface); border-left: 1px solid var(--border);
  z-index: 160; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform var(--transition);
  box-shadow: var(--shadow);
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-shrink: 0;
}
.drawer-title { font-size: 1rem; font-weight: 700; }
.drawer-subtitle { font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }
.drawer-body { flex: 1; overflow-y: auto; padding: 1.5rem; }
.drawer-footer {
  padding: 1rem 1.5rem; border-top: 1px solid var(--border);
  display: flex; gap: .75rem; background: var(--bg-elevated);
  flex-shrink: 0;
}

/* ============================================================
   DRAG & DROP ZONE
   ============================================================ */
.drop-zone {
  border: 2px dashed var(--border-light); border-radius: var(--radius);
  padding: 2rem; text-align: center; cursor: pointer;
  transition: all var(--transition); color: var(--text-muted);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent); background: var(--accent-dim); color: var(--accent);
}
.drop-zone svg { width: 32px; height: 32px; margin-bottom: .75rem; }
.drop-zone p { font-size: .875rem; }
.drop-zone span { font-size: .8rem; color: var(--text-muted); display: block; margin-top: .25rem; }

/* ============================================================
   PAGE: DASHBOARD
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto;
  gap: 1.25rem;
}
.dash-col-span-2 { grid-column: span 2; }
.dash-col-span-3 { grid-column: 1 / -1; }
.activity-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .75rem 0; border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: .35rem;
}
.activity-text { font-size: .85rem; color: var(--text-primary); }
.activity-time { font-size: .75rem; color: var(--text-muted); margin-top: .15rem; }
.quick-actions-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .75rem;
}
.quick-action {
  display: flex; align-items: center; gap: .65rem;
  padding: .875rem 1rem; border-radius: var(--radius);
  background: var(--bg-elevated); border: 1px solid var(--border);
  cursor: pointer; transition: all var(--transition); color: var(--text-primary);
  font-size: .875rem; font-weight: 500;
}
.quick-action:hover { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.quick-action svg { width: 18px; height: 18px; flex-shrink: 0; }
.oversight-banner {
  background: linear-gradient(135deg, rgba(79,142,247,.1), rgba(168,85,247,.1));
  border: 1px solid rgba(79,142,247,.25);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem;
}
.oversight-banner .oa-logo-text {
  font-size: .95rem; font-weight: 800;
  background: linear-gradient(135deg, #4f8ef7, #a855f7);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.oversight-banner .oa-tagline { font-size: .8rem; color: var(--text-muted); }
.oversight-logo-badge {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #4f8ef7, #a855f7);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 900; font-size: .9rem;
}

/* ============================================================
   PAGE: DEAL MANAGER (Kanban + Table)
   ============================================================ */
.view-toggle {
  display: flex; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 2px;
}
.view-toggle button {
  padding: .4rem .75rem; border-radius: 4px; border: none;
  background: none; color: var(--text-muted); font-size: .8rem; font-weight: 600;
  transition: all var(--transition);
}
.view-toggle button.active { background: var(--accent); color: #fff; }
.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(240px, 1fr));
  gap: 1rem; overflow-x: auto; padding-bottom: 1rem;
}
.kanban-col {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .875rem;
}
.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .875rem;
}
.kanban-col-title {
  font-size: .8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em;
}
.kanban-count {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 20px; font-size: .7rem; font-weight: 700;
  padding: .1rem .45rem; color: var(--text-muted);
}
.kanban-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .875rem;
  margin-bottom: .6rem; cursor: pointer;
  transition: all var(--transition);
}
.kanban-card:hover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.kanban-card-name { font-size: .875rem; font-weight: 600; margin-bottom: .3rem; }
.kanban-card-meta { font-size: .75rem; color: var(--text-muted); }
.kanban-card-price { font-size: .85rem; font-weight: 700; color: var(--green); margin-top: .4rem; }

/* ============================================================
   PAGE: CUSTOMERS
   ============================================================ */
.customer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.customer-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; cursor: pointer;
  transition: all var(--transition);
}
.customer-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.customer-card-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .875rem; }
.customer-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .9rem; flex-shrink: 0;
}
.customer-name { font-weight: 700; font-size: .95rem; }
.customer-id { font-size: .75rem; color: var(--text-muted); }
.customer-details { font-size: .82rem; color: var(--text-secondary); display: flex; flex-direction: column; gap: .2rem; }
.customer-details span { display: flex; align-items: center; gap: .4rem; }
.customer-details svg { width: 12px; height: 12px; color: var(--text-muted); flex-shrink: 0; }

/* ============================================================
   PAGE: DOCUMENTS
   ============================================================ */
.doc-layout { display: grid; grid-template-columns: 220px 1fr; gap: 1.25rem; }
.doc-folders {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.doc-folder-header {
  padding: .875rem 1rem; font-size: .8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted);
  border-bottom: 1px solid var(--border); background: var(--bg-elevated);
}
.doc-folder-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem 1rem; cursor: pointer;
  font-size: .85rem; color: var(--text-secondary);
  border-bottom: 1px solid var(--border); transition: all var(--transition);
}
.doc-folder-item:last-child { border-bottom: none; }
.doc-folder-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.doc-folder-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.doc-folder-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.doc-folder-count { margin-left: auto; font-size: .7rem; color: var(--text-muted); }
.doc-file {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background var(--transition);
}
.doc-file:last-child { border-bottom: none; }
.doc-file:hover { background: var(--bg-hover); }
.doc-file-icon {
  width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
  background: var(--accent-dim); border: 1px solid rgba(79,142,247,.25);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.doc-file-icon svg { width: 16px; height: 16px; }
.doc-file-name { font-size: .875rem; font-weight: 500; }
.doc-file-meta { font-size: .75rem; color: var(--text-muted); margin-top: .1rem; }
.doc-file-actions { margin-left: auto; display: flex; gap: .4rem; opacity: 0; transition: opacity var(--transition); }
.doc-file:hover .doc-file-actions { opacity: 1; }

/* ============================================================
   PAGE: APP PORTAL
   ============================================================ */
.app-portal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.app-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  transition: all var(--transition); cursor: pointer;
}
.app-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.app-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: .875rem; }
.app-card-name { font-weight: 700; font-size: .95rem; }
.app-card-id { font-size: .75rem; color: var(--text-muted); margin-top: .15rem; }
.app-progress { margin-top: 1rem; }
.app-progress-label { display: flex; justify-content: space-between; font-size: .75rem; color: var(--text-muted); margin-bottom: .35rem; }
.progress-bar { height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width .5s ease; }

/* ============================================================
   PAGE: DOCUSIGN
   ============================================================ */
.docusign-header-banner {
  background: linear-gradient(135deg, rgba(6,182,212,.1), rgba(79,142,247,.1));
  border: 1px solid rgba(6,182,212,.25); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.5rem;
}
.docusign-icon {
  width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
  background: var(--cyan-dim); border: 1px solid var(--cyan);
  display: flex; align-items: center; justify-content: center;
  color: var(--cyan);
}
.docusign-icon svg { width: 24px; height: 24px; }
.envelope-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: .75rem;
  transition: all var(--transition);
}
.envelope-card:hover { border-color: var(--border-light); }
.envelope-card.completed { border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.04); }
.envelope-header { display: flex; align-items: flex-start; justify-content: space-between; gap:.5rem; flex-wrap:wrap; }
.envelope-subject { font-weight: 700; font-size: .95rem; }
.envelope-meta { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }
.envelope-recipients { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .875rem; }
.recipient-pill {
  display: flex; align-items: center; gap: .4rem;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 20px; padding: .25rem .65rem; font-size: .75rem;
}
.recipient-status { width: 6px; height: 6px; border-radius: 50%; }
.sig-signed { background: var(--green); }
.sig-pending { background: var(--yellow); }
.sig-declined { background: var(--red); }
.signing-link-box {
  margin-top: .875rem; background: var(--bg-elevated); border: 1px dashed var(--accent);
  border-radius: var(--radius-sm); padding: .6rem .875rem;
  display: flex; align-items: center; gap: .5rem;
}
.signing-link-box { max-width: 100%; overflow: hidden; } .signing-link-box span { font-size: .75rem; color: var(--accent); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.signed-badge { display:inline-flex;align-items:center;gap:.35rem;padding:.25rem .7rem;border-radius:999px;font-size:.72rem;font-weight:700;background:var(--green-dim);color:var(--green);border:1px solid rgba(34,197,94,.3); }

/* ============================================================
   PAGE: ACCOUNTING
   ============================================================ */
.accounting-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem;
}
.acct-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; text-align: center;
}
.acct-card .amount { font-size: 1.6rem; font-weight: 800; }
.acct-card .label { font-size: .78rem; color: var(--text-muted); margin-top: .25rem; text-transform: uppercase; letter-spacing: .06em; }

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state {
  text-align: center; padding: 3rem 2rem;
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 1rem; opacity: .4; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .4rem; }
.empty-state p { font-size: .875rem; line-height: 1.6; }

/* ============================================================
   TABS
   ============================================================ */
.page-tabs {
  display: flex; gap: .25rem; border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem; overflow-x: auto;
}
.page-tab {
  padding: .6rem 1rem; border: none; background: none;
  color: var(--text-muted); font-size: .875rem; font-weight: 500;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all var(--transition); white-space: nowrap;
}
.page-tab:hover { color: var(--text-primary); }
.page-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ============================================================
   DETAIL ROW
   ============================================================ */
.detail-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .6rem 0; border-bottom: 1px solid var(--border); font-size: .875rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); font-weight: 500; }
.detail-value { color: var(--text-primary); font-weight: 600; text-align: right; }

/* ============================================================
   NOTIFICATIONS / TOAST
   ============================================================ */
.toast-container {
  position: fixed; top: 1rem; right: 1rem; z-index: 999;
  display: flex; flex-direction: column; gap: .5rem;
}
.toast {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .875rem 1.25rem;
  box-shadow: var(--shadow); min-width: 280px; max-width: 360px;
  display: flex; align-items: flex-start; gap: .75rem;
  animation: slideIn .25s ease;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.toast-title { font-weight: 600; font-size: .875rem; }
.toast-msg { font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* ============================================================
   FEATURE: LOCK BADGE + ADDON LINE ITEMS + PRINT
   ============================================================ */
.lock-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  background: var(--yellow-dim); color: var(--yellow);
  border: 1px solid var(--yellow);
  padding: .15rem .5rem; border-radius: 20px;
  font-size: .7rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
}
.lock-badge svg { width: 10px; height: 10px; }
.addon-item-row {
  display: grid; grid-template-columns: 1fr 140px 40px;
  gap: .5rem; align-items: center; margin-bottom: .5rem;
}
.addon-item-row input {
  padding: .5rem .75rem;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: .875rem;
}
.addon-item-row input:focus { outline: none; border-color: var(--accent); }
.addon-remove-btn {
  background: var(--red-dim); color: var(--red);
  border: 1px solid var(--red); border-radius: var(--radius-sm);
  padding: .5rem; font-weight: 700; cursor: pointer;
  transition: all var(--transition);
}
.addon-remove-btn:hover { background: var(--red); color: #fff; }
.addon-list-total {
  padding: .5rem .75rem; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .85rem; margin-top: .5rem;
  display: flex; justify-content: space-between;
}
.addon-list-total strong { color: var(--green); }

/* Add-on price catalog */
.addon-group { margin-bottom: .9rem; }
.addon-group-title {
  font-size: .68rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: .35rem; padding-bottom: .2rem;
  border-bottom: 1px solid var(--border);
}
.addon-catalog-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  padding: .35rem .5rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; transition: all var(--transition);
}
.addon-catalog-row:hover { background: var(--bg-elevated); }
.addon-catalog-row.checked { background: var(--bg-elevated); border-color: var(--border); }
.addon-check-wrap {
  display: flex; align-items: center; gap: .5rem; cursor: pointer;
  flex: 1 1 auto; min-width: 180px; font-size: .84rem; color: var(--text-primary);
}
.addon-check-wrap input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.addon-opt {
  padding: .25rem .45rem; font-size: .78rem; border-radius: var(--radius-sm);
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text-primary);
  max-width: 220px;
}
.addon-miles {
  width: 95px; padding: .25rem .45rem; font-size: .78rem; border-radius: var(--radius-sm);
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text-primary);
}
.addon-price {
  font-size: .82rem; font-weight: 700; color: var(--text-secondary);
  min-width: 78px; text-align: right; font-variant-numeric: tabular-nums;
}
.addon-catalog-row.checked .addon-price { color: var(--green); }
.tax-note {
  font-size: .7rem; color: var(--text-muted);
  margin-top: .25rem; font-style: italic;
}
.tax-lookup-row { display: flex; gap: .5rem; }
.tax-lookup-row input { flex: 1; }
.tax-lookup-btn {
  padding: .5rem .75rem; white-space: nowrap;
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  font-size: .8rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition);
}
.tax-lookup-btn:hover { background: var(--accent); color: #fff; }
.tax-lookup-btn:disabled { opacity: .6; cursor: wait; }

/* Purchase Agreement — section blocks + ONE initials box per section */
.pa-doc .pa-block { margin-bottom: 6px; }
.pa-doc .pa-h {
  font-weight: 800; font-size: .92em; text-transform: uppercase;
  letter-spacing: .6px; border-bottom: 2px solid #111;
  padding-bottom: 2px; margin-bottom: 3px;
}
.pa-doc .ini-cell {
  width: 74px; min-width: 74px; border-left: 1px solid #ddd;
  background: #fcfcfc; vertical-align: middle;
}
.pa-doc .ini-ghost { color: #cfcfcf; font-size: .7em; font-style: italic; }
.pa-doc table th, .pa-doc table td { border: none; }
.pa-doc table tr { border-bottom: 1px solid #ddd; }
.pa-doc table thead tr { border-bottom: none; }

/* --- v6: section titles, real bordered tables, one initials box per section --- */
/* --- v8: compact one-page fit — every element scales with the doc font --- */
.pa-doc .printable-doc { line-height: 1.15; }
.pa-doc .printable-doc div,
.pa-doc .printable-doc table,
.pa-doc .printable-doc tr { margin-top: 0 !important; margin-bottom: 0 !important; }
.pa-doc .printable-doc table { width: 100%; border-collapse: collapse; }
.pa-doc .printable-doc table td,
.pa-doc .printable-doc table th { padding: .11em .5em !important; vertical-align: middle; }
.pa-doc .printable-doc input { padding: 0 2px !important; }
.pa-doc table tr { border-bottom: 1px solid #ddd; }
.pa-doc table thead tr { border-bottom: none; }
.pa-doc .pa-sec-title, .pa-doc h2 {
  font-weight: 800; font-size: .95em; text-transform: uppercase;
  letter-spacing: .7px; border-bottom: 2px solid #111;
  padding-bottom: 3px; margin: 10px 0 5px; color: #111;
}
.pa-doc .pa-sec-wrap { border: 1px solid #bbb; padding: 6px; margin-bottom: 8px; background: #fff; }
.pa-doc .pa-sec-strong { border: 1.5px solid #111; }
.pa-doc .pa-tbl { width: 100%; border-collapse: collapse; }
.pa-doc .pa-tbl-box { border: 1px solid #bbb; }
.pa-doc .pa-tblhead th {
  background: #f0f0f0; text-align: left; font-weight: 800;
  text-transform: uppercase; letter-spacing: .8px; padding: 5px 8px;
  border-bottom: 1.5px solid #111;
}
.pa-doc .pa-th {
  background: #111 !important; color: #fff !important; font-weight: 700; text-align: left;
  padding: 5px 8px; letter-spacing: .3px;
}
/* Header row cells: keep the dark bar even when a generic th rule targets them */
.pa-doc .pa-tblhead th.pa-th,
.pa-doc tr.pa-tblhead th,
.pa-doc .pa-tblhead > th {
  background: #111 !important; color: #fff !important;
}
/* But a plain .pa-tblhead th (no .pa-th) stays the light sub-head style */
.pa-doc .pa-tblhead th:not(.pa-th) {
  background: #f0f0f0; color: #111;
}
.pa-doc .pa-tr { border-bottom: 1px solid #e2e2e2; }
.pa-doc .pa-td { padding: 5px 8px; vertical-align: middle; }
.pa-doc .pa-row-bold .pa-td { font-weight: 700; }
.pa-doc .pa-row-total .pa-td { font-weight: 800; border-top: 2px solid #111; background: #f7f7f7; }

/* One initials box — wide enough to actually sign in */
.pa-doc .pa-ini-box {
  width: 120px; min-width: 96px; flex: 0 0 auto;
  border: 1.5px solid #111; display: flex; flex-direction: column;
  justify-content: flex-start; background: #fcfcfc;
}
.pa-doc .pa-ini-label {
  font-size: .62em; text-transform: uppercase; letter-spacing: .8px;
  color: #333; font-weight: 700; text-align: center;
  padding: 3px 4px; border-bottom: 1px solid #ccc; background: #f0f0f0; line-height: 1.2;
}
.pa-doc .pa-ini-space { flex: 1 1 auto; min-height: 34px; }
.pa-doc .pa-payb-ini { display: flex; justify-content: flex-end; margin: -4px 0 8px; }
.pa-doc .pa-payb-ini .pa-ini-box { width: 240px; }
.pa-doc .pa-payb-ini .pa-ini-space { min-height: 30px; }

/* Printable document container (Property Locator / Purchase Agreement) */
.printable-doc {
  background: #fff; color: #111; padding: 40px;
  font-family: 'Times New Roman', Georgia, serif;
  max-width: 7.5in; margin: 0 auto;
  border-radius: 6px;
  min-height: 11px;
}
.printable-doc h1 {
  font-size: 22px; text-align: center; text-transform: uppercase;
  letter-spacing: .1em; margin-bottom: 8px; color: #1a2a4a;
  border-bottom: 3px double #1a2a4a; padding-bottom: 10px;
}
.printable-doc h2 {
  font-size: 14px; text-transform: uppercase; letter-spacing: .08em;
  color: #1a2a4a; margin-top: 20px; margin-bottom: 10px;
  border-bottom: 1px solid #1a2a4a; padding-bottom: 4px;
}
.printable-doc .doc-header {
  text-align: center; margin-bottom: 20px;
}
.printable-doc .doc-header .company {
  font-size: 18px; font-weight: 800; color: #1a2a4a;
}
.printable-doc .doc-header .addr {
  font-size: 11px; color: #555;
}
.printable-doc .doc-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px;
  font-size: 12px; margin-bottom: 10px;
}
.printable-doc .doc-grid .full { grid-column: 1 / -1; }
.printable-doc .doc-grid .field {
  padding: 4px 0;
}
.printable-doc .doc-grid .field label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  color: #777; display: block;
}
.printable-doc .doc-grid .field .val {
  font-size: 13px; font-weight: 600;
  border-bottom: 1px solid #999; padding: 2px 0; min-height: 20px;
}
.printable-doc table {
  width: 100%; border-collapse: collapse; font-size: 12px; margin: 8px 0 12px;
}
.printable-doc table th, .printable-doc table td {
  border: 1px solid #999; padding: 5px 8px;
}
.printable-doc table th {
  background: #eef2f8; font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em; text-align: left;
}
.printable-doc table .row-total td {
  background: #f5f8fc; font-weight: 700;
}
.printable-doc .terms-text {
  font-size: 11px; line-height: 1.6; color: #222;
  white-space: pre-wrap;
  border: 1px solid #ccc; padding: 10px; background: #fafbfd;
  max-height: 300px; overflow: auto;
}
.printable-doc .sig-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  margin-top: 30px;
}
.printable-doc .sig-line {
  border-top: 1px solid #333; padding-top: 6px;
  font-size: 11px; color: #666;
}
.printable-doc .sig-line strong { color: #111; font-size: 12px; }
.printable-doc .footer-note {
  margin-top: 30px; text-align: center;
  font-size: 10px; color: #888;
  border-top: 1px solid #ddd; padding-top: 10px;
}

@media print {
  /* ============================================================
     PRINT PIPELINE — ONE owner per path (rewritten Oct 29, 2026)

     Bug 1 (duplicate pages): the generic rule force-showed EVERY
     .print-target. The on-screen Purchase Agreement carries that class
     AND printPurchaseAgreement() injects a #paPrintMount clone of it,
     so both painted -> every agreement printed twice.

     Bug 2 (blank printout): the first attempt at a fix hid the clone
     instead of the on-screen copy, so nothing painted at all.

     Correct model, stated once:
       - EVERY element starts hidden for print:  body * { hidden }
       - The ONE thing that may paint is the element we deliberately
         selected:  #paPrintMount (Purchase Agreement) or, for the other
         document flows, the .print-target inside #docPrintMount.
       - When body.pa-printing is set the on-screen modal is display:none
         so it can never contribute a second copy.
     ============================================================ */
  body * { visibility: hidden; }
  .no-print { display: none !important; }

  /* --- PA print path: the injected clone is the ONLY thing that paints --- */
  body.pa-printing > *:not(#paPrintMount) { display: none !important; }
  body.pa-printing #paPrintMount,
  body.pa-printing #paPrintMount * { visibility: visible !important; }
  body.pa-printing #paPrintMount {
    position: static !important; left: auto !important; top: auto !important;
    width: 7.25in !important; max-width: 7.25in !important;
    margin: 0 auto !important; padding: 0 !important; overflow: visible !important;
  }

  /* --- Every other document flow: print the .print-target it selected --- */
  body:not(.pa-printing) .print-target,
  body:not(.pa-printing) .print-target * { visibility: visible; }
  body:not(.pa-printing) .print-target {
    position: fixed; left: 0; top: 0; width: 100%; height: auto;
    padding: 0; margin: 0; overflow: visible !important;
  }
  /* Ensure modal containers don't clip printed content */
  .modal-backdrop, .modal, .modal-body {
    overflow: visible !important;
    max-height: none !important;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: none;
  }
  .printable-doc { box-shadow: none; border-radius: 0; padding: 20px; }
  .modal-header, .modal-footer { display: none !important; }
  /* @page margin lives ONLY in the dedicated pa-printing block below.
     A second @page with 0.75in margins here was fighting the 0.4in page box
     the form is fitted to, which threw the fit off. */
}

@media (max-width: 900px) {
  :root { --sidebar-w: 200px; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .accounting-summary { grid-template-columns: 1fr 1fr; }
  .kanban-board { grid-template-columns: repeat(3, minmax(220px, 1fr)); }
}
@media (max-width: 640px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); }
  .sidebar.mobile-open { transform: translateX(0); width: 240px; }
  .app-header { left: 0; }
  .app-main { margin-left: 0; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .accounting-summary { grid-template-columns: 1fr 1fr; }
  .doc-layout { grid-template-columns: 1fr; }
}

/* ============================================================
   PRINT-ONLY COPY
   printPurchaseAgreement() injects a #paPrintMount clone instead of
   opening a popup tab. It is invisible on screen and is the ONLY thing
   that reaches the printer, so there is no about:blank window and no
   empty trailing page. Removed again when the dialog closes.
   ============================================================ */
.pa-print-only { position: absolute; left: -100000px; top: 0; width: 7.25in; }
@media print {
  /* Chrome/Safari both honor -webkit-; Firefox honors plain. Keep colors/borders
     intact so the agreement boxes and shading survive printing. */
  html, body { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  /* FIX (Nov 4, 2026) — the dark CRM theme was bleeding into print: the body
     background (#0d0f14) filled whole pages black and the .pa-th header bars
     (background:#111) printed as solid black bands, wasting ink. Force the
     page white, collapse the body to its content, and lighten the dark bars
     to a light gray (keeps the bar structure, kills the ink drain). */
  html, body { background: #fff !important; background-color: #fff !important; min-height: 0 !important; height: auto !important; }
  body.pa-printing .pa-doc .pa-th,
  body.pa-printing .pa-doc .pa-tblhead th,
  body.pa-printing .pa-doc tr.pa-tblhead th,
  body.pa-printing .pa-doc .pa-tblhead > th,
  body.pa-printing .pa-doc thead tr[style*="background"],
  body.pa-printing .pa-doc [style*="background:#111"],
  body.pa-printing .pa-doc [style*="background: #111"] {
    background: #f0f0f0 !important;
    background-color: #f0f0f0 !important;
    color: #111 !important;
  }
  .pa-print-only { position: static !important; left: auto !important; width: auto !important; }
  body.pa-printing > *:not(#paPrintMount) { display: none !important; }
  body.pa-printing #paPrintMount { display: block !important; }
  /* The generic document mount (Property Locator / Housing Commission /
     Buyer's Guide) reuses whatever styles the source element already had. */
  body.pa-printing #docPrintMount { display: block !important; }
  body.pa-printing #docPrintMount .print-doc-root { padding: 0 !important; margin: 0 !important; }
  body.pa-printing #docPrintMount .print-doc-root > *:first-child { margin-top: 0 !important; }
  /* The form documents are fitted to this exact letter page box — match it in
     print so the fitted font-size actually lands on one page. */
  body.pa-printing #docPrintMount .printable-doc {
    width: 7.5in !important; max-width: none !important;
    box-sizing: border-box !important; background: #fff !important;
    margin: 0 !important; border-radius: 0 !important; box-shadow: none !important;
    padding: 0.4in !important;
  }
  body.pa-printing #docPrintMount .printable-doc[data-form-hardened="1"] {
    break-inside: avoid !important; page-break-inside: avoid !important;
  }
  body.pa-printing #dlrPrintMount { display: block !important; }
  body.pa-printing #paPrintMount .pa-doc {
    width: auto !important; max-width: none !important;
    padding: 0.3in !important; margin: 0 !important;
    box-sizing: border-box !important; background: #fff !important;
  }
  /* Everything is pre-fitted to one letter page, so nothing should break. */
  body.pa-printing .pa-doc, body.pa-printing .pa-doc * {
    break-inside: auto !important; page-break-inside: auto !important;
  }
  /* Kill the browser's own margins so our 0.4in page padding is the only
     margin — otherwise the fitted height is exceeded by the print margin. */
  @page { size: letter; margin: 0; }
}
