/* AtlasCrawler - Minimal, functional styles */
:root {
    --sidebar-width: 220px;
    --sidebar-width-collapsed: 56px;
    --header-height: 48px;
    --bg: #f5f5f5;
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
    --sidebar-active: #3498db;
    --border: #ddd;
    --text: #333;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); height: 100vh; background: var(--sidebar-bg); color: var(--sidebar-text); flex-shrink: 0; transition: width 0.2s ease; overflow: hidden; position: sticky; top: 0; display: flex; flex-direction: column; }
.app.sidebar-collapsed .sidebar { width: var(--sidebar-width-collapsed); }
.sidebar-header { padding: 0; border-bottom: 1px solid rgba(255,255,255,0.1); flex-shrink: 0; display: flex; flex-direction: column; overflow: hidden; }
.sidebar-brand { display: block; width: 100%; padding: 12px 12px 8px; font-weight: 700; text-decoration: none; color: var(--sidebar-text) !important; flex-shrink: 0; box-sizing: border-box; }
.sidebar-brand:hover { color: var(--sidebar-text) !important; opacity: 0.95; }
.sidebar-brand:not(:has(.sidebar-logo-wrap)) { display: flex; align-items: center; gap: 10px; }
.sidebar-logo-wrap { display: block; width: 100%; height: 72px; flex-shrink: 0; overflow: hidden; line-height: 0; }
.sidebar-logo-wrap .sidebar-logo { display: block !important; width: 100% !important; height: 100% !important; object-fit: cover !important; object-position: center center; }
.sidebar-header-user-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px 12px; flex-wrap: wrap; min-width: 0; }
.sidebar-header .user-name { font-size: 12px; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.sidebar-header .logout { font-size: 12px; color: var(--sidebar-text); display: inline-flex; align-items: center; gap: 6px; text-decoration: none; flex-shrink: 0; }
.sidebar-header .logout:hover { opacity: 0.9; }
.app.sidebar-collapsed .sidebar-brand { padding: 12px; justify-content: center; }
.app.sidebar-collapsed .sidebar-logo-wrap { height: 40px; width: 100%; }
.app.sidebar-collapsed .sidebar-header-user-row { padding: 8px 12px; justify-content: center; }
.app.sidebar-collapsed .sidebar-header .user-name { display: none; }
.app.sidebar-collapsed .sidebar-header .logout .nav-label { display: none; }
.sidebar-nav { padding: 8px 0 0 0; flex: 1; min-height: 0; overflow-y: auto; }
.sidebar-nav .nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: var(--sidebar-text); text-decoration: none; white-space: nowrap; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,0.08); }
.sidebar-nav .nav-link.active { background: var(--sidebar-active); color: #fff; }
.nav-icon { display: inline-flex; flex-shrink: 0; width: 24px; height: 24px; align-items: center; justify-content: center; }
.nav-icon-svg { width: 20px; height: 20px; }
.app.sidebar-collapsed .nav-label { display: none; }
.app.sidebar-collapsed .sidebar-nav .nav-link { justify-content: center; padding: 12px; }
.app.sidebar-collapsed .sidebar-brand { justify-content: center; }
.app.sidebar-collapsed .sidebar-header { padding: 12px; text-align: center; }
.sidebar-toggle { flex-shrink: 0; height: 40px; border: none; background: rgba(0,0,0,0.2); color: var(--sidebar-text); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s; margin-top: auto; }
.sidebar-toggle:hover { background: rgba(0,0,0,0.3); }
.sidebar-toggle-chevron { width: 20px; height: 20px; transition: transform 0.2s ease; }
.app.sidebar-collapsed .sidebar-toggle-chevron { transform: rotate(180deg); }
.app.sidebar-collapsed .sidebar-submenu { display: none; }
.main { flex: 1; padding: 20px; overflow: auto; display: flex; flex-direction: column; }
.app-footer { margin-top: auto; padding: 12px 20px; font-size: 12px; color: var(--text-muted, #666); border-top: 1px solid var(--border); text-align: center; position: sticky; bottom: 0; background: var(--bg); z-index: 5; }
.app-footer-copyright { display: block; }
.page-title { margin: 0 0 20px; font-size: 20px; }
table { width: 100%; border-collapse: collapse; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f8f9fa; font-weight: 600; }
.departments-table th,
.departments-table td { padding: 4px 10px; }
.sort-header { color: var(--text); text-decoration: none; cursor: pointer; }
.sort-header:hover { text-decoration: underline; }
.sort-header.sort-asc::after { content: " \2191"; font-size: 0.85em; opacity: 0.8; }
.sort-header.sort-desc::after { content: " \2193"; font-size: 0.85em; opacity: 0.8; }
.btn { display: inline-block; padding: 8px 14px; font-size: 13px; border: 1px solid var(--border); background: #fff; cursor: pointer; border-radius: 4px; text-decoration: none; color: var(--text); }
.btn:hover { background: #f0f0f0; }
.btn-primary { background: #3498db; color: #fff; border-color: #3498db; }
.btn-primary:hover { background: #2980b9; }
.btn-danger { background: #e74c3c; color: #fff; border-color: #e74c3c; }
.btn-sm { padding: 5px 10px; font-size: 12px; margin-right: 4px; }
.btn-disabled { opacity: 0.5; cursor: default; pointer-events: none; }
input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="number"], select, textarea { padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 14px; width: 100%; max-width: 400px; }
label { display: block; margin-bottom: 4px; font-weight: 500; }
.form-group { margin-bottom: 14px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }
.form-row.two-col .form-group { flex: 1; min-width: 180px; }
.form-row.three-col .form-group { flex: 1; min-width: 140px; }
.form-hint { font-size: 13px; color: #666; margin: -4px 0 12px; }
.form-hint code { font-size: 12px; background: #eee; padding: 2px 6px; border-radius: 3px; }
.dept-profile-section { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 20px 24px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.dept-profile-section h2 { margin: 0 0 16px; font-size: 16px; font-weight: 600; color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.dept-profile-section .form-group:last-child { margin-bottom: 0; }
.dept-contact-row .form-row.three-col { max-width: 720px; }
.alert { padding: 12px; border-radius: 4px; margin-bottom: 16px; }
.alert-error { background: #fde8e8; border: 1px solid #e74c3c; color: #c0392b; }
.alert-success { background: #e8f8f5; border: 1px solid #1abc9c; color: #16a085; }
.toolbar { margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: #fff; padding: 24px; border-radius: 8px; max-width: 600px; width: 90%; max-height: 90vh; overflow: auto; }
.modal h2 { margin-top: 0; }
.drop-zone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  background: #fafafa;
}
.drop-zone.drop-zone-has-pdf { padding: 8px 12px 16px; text-align: left; }
.drop-zone.dragover { border-color: #3498db; background: #e8f4fc; }

/* Upload progress overlay – centered inside the drop box only */
.upload-progress-wrap {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 8px;
}
.upload-progress-inner {
  position: relative;
  width: 85%;
  max-width: 100%;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  box-sizing: border-box;
}
.upload-progress-text { margin: 0 0 12px 0; font-weight: 600; color: var(--text); }
.upload-progress-bar {
  height: 12px;
  background: #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}
.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: #3498db;
  border-radius: 6px;
  transition: width 0.15s ease;
}
.upload-progress-percent { margin: 0 0 12px 0; font-size: 14px; color: #555; }
.upload-progress-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.upload-progress-actions .btn { margin-left: 8px; }

/* Upload skipped / not uploaded list (Report Review) */
.upload-skipped-wrap {
  margin-top: 12px;
  padding: 12px;
  background: #fff8e6;
  border: 1px solid #e0c000;
  border-radius: 8px;
  font-size: 13px;
}
.upload-skipped-title { margin: 0 0 8px 0; font-size: 14px; color: #666; }
.upload-skipped-list { margin: 0; padding-left: 20px; }
.two-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.two-panel-single .two-panel-span { grid-column: 1 / -1; }
@media (max-width: 900px) { .two-panel { grid-template-columns: 1fr; } }
.notes-popover { position: relative; }
.notes-popover .popover-content { display: none; position: absolute; left: 0; top: 100%; margin-top: 4px; background: #fff; border: 1px solid var(--border); padding: 12px; min-width: 280px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 100; }
.notes-popover.open .popover-content { display: block; }

/* Dropdown / popover (department edit, admin) */
.dropdown-wrap { position: relative; display: inline-block; }
.dropdown-popover { display: none; position: absolute; left: 0; top: 100%; margin-top: 4px; background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 12px; min-width: 200px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 50; }
.dropdown-popover.open { display: block; }
/* Department list Actions column: open dropdown to the left so it doesn't go off the right edge */
.departments-table td.actions-cell { position: relative; }
.departments-table td.actions-cell .dropdown-wrap { position: static; }
.departments-table td.actions-cell .dropdown-popover { left: auto; right: 0; }
.dropdown-section { margin-bottom: 10px; }
.dropdown-section .btn-block { display: block; width: 100%; margin-bottom: 6px; text-align: center; text-decoration: none; box-sizing: border-box; }
.dropdown-section .btn-block:last-child { margin-bottom: 0; }
.dept-notes-in-menu { margin: 8px 0; padding: 8px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.dept-notes-in-menu strong { display: block; margin-bottom: 4px; font-size: 12px; }
.dept-notes-text { margin: 0; font-size: 12px; white-space: pre-wrap; max-height: 80px; overflow-y: auto; color: #555; }
.departments-table .btn-icon { width: 28px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.notes-popover-box { position: absolute; background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 12px; min-width: 280px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 1000; }
.notes-popover-box textarea { display: block; margin: 8px 0; }
.notes-popover-box .btn { margin-right: 8px; }
.date-cell { min-width: 100px; }
.date-cell-input { max-width: 120px; padding: 2px 6px; font-size: 13px; }
.btn-generate-request { white-space: nowrap; }
.form-inline-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.form-inline-row .checkbox-inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.form-inline-row .checkbox-inline input { width: auto; max-width: none; }
/* Match document body size: same as .letter-page-edit (8.5in, 0.5in padding) */
.letterhead-preview-wrap { width: 8.5in; max-width: 100%; margin-top: 12px; box-sizing: border-box; }
.letterhead-preview-content { padding: 0.5in; background: #fff; border: 1px solid var(--border); box-shadow: 0 1px 4px rgba(0,0,0,0.1); box-sizing: border-box; }
.letterhead-preview-content .letterhead { margin-bottom: 12px; }
.letterhead-preview-content .letterhead:last-child { margin-bottom: 0; }
.letterhead-preview-empty { color: #666; font-style: italic; margin: 0; }

/* Report Review sub-menu */
.sidebar-submenu-wrap { position: relative; }
.sidebar-parent { display: block; }
.sidebar-submenu { overflow: hidden; max-height: 0; opacity: 0; transition: max-height 0.25s ease-out, opacity 0.2s ease-out; }
.sidebar-submenu-wrap.open .sidebar-submenu { max-height: 100px; opacity: 1; transition: max-height 0.3s ease-in, opacity 0.25s ease-in; }
.sidebar-submenu a { display: block; padding: 8px 16px 8px 28px; font-size: 13px; color: var(--sidebar-text); text-decoration: none; }
.sidebar-submenu a:hover { background: rgba(255,255,255,0.08); }
.sidebar-submenu a.active { background: var(--sidebar-active); color: #fff; }
.add-more-zone { background: #f0f8ff; border-color: #3498db; }

/* Report Review – PDF gets more space, mailing list condensed */
.report-review-layout .report-viewer { min-width: 0; }
.report-review-layout .report-pdf-iframe { width: 100%; height: 90vh; min-height: 780px; }
.report-review-layout .mailing-entry { min-width: 0; overflow: auto; }

/* Mailing list table – condensed ~50%, single row per address, narrow Type column */
.mailing-list-table { font-size: 12px; table-layout: fixed; width: 100%; max-width: 100%; }
.mailing-list-table th, .mailing-list-table td { padding: 3px 4px; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; }
.mailing-list-table .col-name { width: 24%; min-width: 96px; }
.mailing-list-table .col-street { width: 20%; min-width: 70px; }
.mailing-list-table .col-city { width: 14%; min-width: 50px; }
.mailing-list-table .col-state { width: 14%; min-width: 90px; }
.mailing-list-table .col-zip { width: 12%; min-width: 52px; }
.mailing-list-table .col-letter-type { width: 18%; min-width: 220px; }
.mailing-list-table .col-magnify { width: 36px; min-width: 36px; text-align: center; padding: 2px; }
.mailing-list-table .col-menu { width: 40px; min-width: 40px; text-align: center; padding: 2px; overflow: visible; }
.mailing-list-table .btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 4px; background: #fff; color: #555; cursor: pointer; }
.mailing-list-table .btn-icon:hover { background: #f0f8ff; border-color: #3498db; color: #3498db; }
.mailing-list-table .btn-icon .icon-magnify { flex-shrink: 0; }
.mailing-list-table input[type="text"], .mailing-list-table select { width: 100%; max-width: 100%; padding: 3px 4px; font-size: 12px; box-sizing: border-box; }
.mailing-list-table select { padding: 2px 4px; }
.mailing-list-actions { margin-bottom: 12px; }

/* Row menu (hamburger dropdown) */
.mailing-list-table .row-menu-wrap { position: relative; display: inline-block; }
.mailing-list-table .row-menu-dropdown { display: none; position: absolute; right: 0; top: 100%; margin-top: 2px; min-width: 140px; background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 999; padding: 4px 0; }
.mailing-list-table .row-menu-wrap.open .row-menu-dropdown { display: block; }
.mailing-list-table .row-menu-dropdown[hidden] { display: none !important; }
.mailing-list-table .row-menu-item { display: block; width: 100%; padding: 8px 14px; font-size: 13px; text-align: left; text-decoration: none; color: var(--text); background: none; border: none; cursor: pointer; font-family: inherit; }
.mailing-list-table .row-menu-item:hover { background: #f0f8ff; color: #2980b9; }
.mailing-list-table .row-menu-item.row-menu-edit { width: 100%; }

/* Address entry popover (larger view) */
.address-popover-overlay { position: fixed; inset: 0; background: transparent; pointer-events: none; z-index: 1000; opacity: 0; visibility: hidden; transition: opacity 0.2s ease, visibility 0.2s ease; }
.address-popover-overlay.address-popover-open { opacity: 1; visibility: visible; }
.address-popover-overlay .address-popover { pointer-events: auto; }
.address-popover { position: fixed; background: #fff; border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,0.2); width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; z-index: 1001; }
.address-popover-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.address-popover-header h3 { margin: 0; font-size: 18px; font-weight: 600; }
.address-popover-close { background: none; border: none; font-size: 24px; line-height: 1; color: #666; cursor: pointer; padding: 0 4px; }
.address-popover-close:hover { color: var(--text); }
.address-popover-form { padding: 20px; }
.address-popover-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.address-popover-fields .form-group { margin-bottom: 0; }
.address-popover-fields .form-row-2 { grid-column: span 1; }
.address-popover-fields .form-group:first-child { grid-column: 1 / -1; }
.address-popover-fields .form-group:nth-child(2) { grid-column: 1 / -1; }
.address-popover-fields .form-group:nth-child(6) { grid-column: 1 / -1; }
.address-popover-input { width: 100%; padding: 10px 12px; font-size: 16px; border: 1px solid var(--border); border-radius: 6px; box-sizing: border-box; }
.address-popover-input:focus { outline: none; border-color: #3498db; box-shadow: 0 0 0 2px rgba(52,152,219,0.2); }
.address-popover-fields label { font-size: 14px; font-weight: 500; margin-bottom: 4px; display: block; }
.address-popover-footer { display: flex; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.address-popover-footer .btn-primary { flex: 1; }

/* Letter page 8.5 × 11 and letterhead */
.form-hint { font-size: 12px; color: #666; margin: 4px 0 8px; }
.radio-label { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; font-weight: normal; }
.radio-label input { width: auto; max-width: none; }
.letterhead-image-options { margin-top: 8px; }
.letterhead-options { margin-top: 12px; }
.letterhead-panel { background: #f8f9fa; border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-top: 8px; }
.letterhead-panel label { display: block; margin-bottom: 6px; font-weight: 500; }
.letterhead-panel textarea { min-height: 120px; }
.letterhead-drop-zone { border: 2px dashed var(--border); border-radius: 8px; padding: 24px; text-align: center; background: #fafafa; cursor: pointer; color: #666; transition: border-color 0.15s, background 0.15s; }
.letterhead-drop-zone:hover, .letterhead-drop-zone.dragover { border-color: #3498db; background: #e8f4fc; color: var(--text); }
.letterhead-preview { margin-top: 12px; margin-bottom: 12px; }
/* 8.5×11 letter preview: header zone (letterhead image) + body zone */
.letterhead-letter-preview { width: 8.5in; max-width: 100%; min-height: 120px; background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); overflow: hidden; margin-bottom: 12px; }
.letterhead-header-zone { position: relative; width: 100%; min-height: 1.2in; max-height: 2in; background: #f5f5f5; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--border); }
.letterhead-header-zone.dragover { background: #e8f4fc; }
.letterhead-header-zone .letterhead-drop-zone { margin: 8px; flex: 1; min-height: 80px; }
.letterhead-header-zone #letterhead-preview-img { max-width: 100%; max-height: 1.8in; width: auto; height: auto; display: block; object-fit: contain; }
.letterhead-header-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; pointer-events: none; }
.letterhead-header-zone.dragover .letterhead-header-overlay { pointer-events: auto; background: rgba(52,152,219,0.5); }
.letterhead-delete-btn { position: absolute; top: 8px; right: 8px; z-index: 2; }
.letterhead-body-zone { min-height: 2in; background: #fafafa; }

/* Image mode: shrink to just the drop-zone / header area (no blank body) */
.letterhead-image-options .letterhead-letter-preview { min-height: 0; }
.letterhead-image-options .letterhead-header-zone { min-height: 100px; max-height: 180px; border-bottom: none; }
.letterhead-image-options .letterhead-header-zone .letterhead-drop-zone { min-height: 72px; padding: 16px; }
.letterhead-image-options .letterhead-body-zone { display: none; }
.firm-address-block { margin-bottom: 16px; }
.firm-address-block > label { display: block; margin-bottom: 6px; font-weight: 500; }
.form-row-compact .form-group { margin-bottom: 0; }
.form-row-compact .form-group label { margin-bottom: 2px; }
.letter-page { width: 8.5in; max-width: 100%; min-height: 11in; background: #fff; border: 1px solid var(--border); box-shadow: 0 1px 4px rgba(0,0,0,0.1); padding: 0.5in; margin-bottom: 12px; }
.letter-page-edit { width: 8.5in; max-width: 100%; height: 11in; min-height: 11in; background: #fff; border: 1px solid var(--border); padding: 0.5in; box-sizing: border-box; }
.letter-body-textarea { width: 100%; max-width: none; min-height: 10in; height: 100%; font-family: inherit; display: block; box-sizing: border-box; }
.letter-body-editor { width: 100%; max-width: none; min-height: 10in; height: 100%; font-family: Georgia, serif; font-size: 12pt; line-height: 1.5; display: block; box-sizing: border-box; outline: none; overflow-y: auto; }
.letter-body-editor:empty::before { content: attr(data-placeholder); color: #999; }
.formatting-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.formatting-toolbar .formatting-btn { min-width: 32px; }
.formatting-toolbar .formatting-sep { color: var(--border); margin: 0 4px; width: 1px; background: var(--border); height: 20px; }
.formatting-toolbar .formatting-sep:empty { padding: 0; }
.formatting-toolbar .formatting-label { font-size: 12px; margin-right: 4px; }
.formatting-toolbar .formatting-select { padding: 4px 8px; font-size: 12px; }
.formatting-toolbar-word { background: var(--bg-subtle, #f5f5f5); border: 1px solid var(--border); border-radius: 4px; padding: 4px 8px; }
.formatting-toolbar-word .formatting-label-sm { font-size: 11px; color: var(--text-muted, #666); margin-right: 4px; }
.formatting-toolbar-word .formatting-select-size { width: 52px; padding: 2px 4px; font-size: 11px; }
.formatting-toolbar-word .formatting-select-font { min-width: 120px; max-width: 160px; font-size: 11px; }
.letter-preview { padding: 0.5in; }
.letterhead { margin-bottom: 12px; }
.letterhead-text { font-size: 14px; line-height: 1.4; color: var(--text); }
.letterhead-image { margin-bottom: 0; }
.letterhead-image img { max-width: 100%; height: auto; display: block; }
.letter-preview-body { font-size: 14px; line-height: 1.5; color: var(--text); padding-top: 8px; }
.letter-preview-body-html p { margin: 0.5em 0; }
.letter-preview-body-html ul, .letter-preview-body-html ol { margin: 0.5em 0; padding-left: 1.5em; }
.merge-fields-hint { margin-bottom: 4px; }
.merge-fields-buttons { margin-top: 4px; margin-bottom: 8px; }
.merge-fields-buttons .btn-sm { margin-right: 6px; margin-bottom: 4px; }

/* Coverage area dual-pane: cities | Add/Remove | in coverage, close together, same height */
.coverage-area-section { margin-top: 20px; }
.coverage-dual-pane { display: flex; align-items: stretch; gap: 0; margin-top: 8px; justify-content: flex-start; }
.coverage-pane { flex: 0 0 auto; min-width: 0; display: flex; flex-direction: column; }
.coverage-pane:first-of-type { width: 280px; }
.coverage-pane:last-of-type { width: 280px; margin-left: 0.5in; }
.coverage-pane-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--text); }
.coverage-dual-pane .coverage-select { width: 100%; height: 400px; min-height: 400px; padding: 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; box-sizing: border-box; }
.coverage-dual-pane .zone-coverage-display { height: 400px; min-height: 400px; overflow-y: auto; padding: 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: #fff; box-sizing: border-box; }
.coverage-dual-pane .zone-available-list { height: 400px; min-height: 400px; overflow-y: auto; padding: 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: #fff; box-sizing: border-box; }
.zone-available-county { padding: 4px 6px; cursor: pointer; font-weight: 600; margin-top: 6px; }
.zone-available-county:first-child { margin-top: 0; }
.zone-available-county.zone-county-add-selected { background: rgba(0, 0, 0, 0.08); }
.zone-available-city { padding: 2px 6px 2px 1em; cursor: pointer; }
.zone-available-city.zone-city-selected { background: rgba(0, 0, 0, 0.08); }
.coverage-buttons { display: flex; flex-direction: column; align-items: center; align-self: stretch; min-height: 400px; flex-shrink: 0; margin-left: 0.5in; }
.coverage-buttons-spacer { flex: 1; min-height: 0; }
.coverage-buttons-primary { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; }
.coverage-buttons-bulk { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.coverage-buttons .btn-sm { white-space: nowrap; }

/* Edit zone page */
.zone-section { margin-bottom: 24px; }
.zone-section h2 { font-size: 1.1rem; margin-bottom: 8px; }
.zone-coverage-centered { max-width: max-content; margin-left: auto; margin-right: auto; }
.zone-state-picker { margin: 12px 0; }
.zone-state-picker label { display: block; font-weight: 500; margin-bottom: 4px; }
.zone-state-select { min-width: 220px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; }
.zone-cities-section { margin-top: 16px; }

/* Cities currently selected (by state and county) */
.zone-selected-section { margin-bottom: 28px; }
.zone-coverage-list { margin-top: 12px; }
.zone-state-block { margin-bottom: 16px; }
.zone-state-block:last-child { margin-bottom: 0; }
.zone-state-name { font-size: 1rem; margin: 0 0 8px 0; color: var(--text); }
.zone-county-block { margin-bottom: 8px; padding-left: 12px; }
.zone-county-block:last-child { margin-bottom: 0; }
.zone-county-name { font-size: 13px; }
.zone-city-list { font-size: 13px; color: var(--text); margin-left: 4px; }
.zone-none { color: #666; font-style: italic; margin: 0; }

/* In coverage: hierarchical list (state → county → cities) */
.zone-display-state { margin: 8px 0 4px 0; padding-left: 0; }
.zone-display-state:first-child { margin-top: 0; }
.zone-display-county { margin: 2px 0; padding-left: 1em; }
.zone-display-county-selectable { cursor: pointer; }
.zone-display-county-selectable.zone-county-remove-selected { background: rgba(0, 0, 0, 0.08); }
.zone-display-city { margin: 1px 0; padding-left: 2em; }
.zone-display-city-selectable { cursor: pointer; }
.zone-display-city-selectable.zone-coverage-selected { background: rgba(0, 0, 0, 0.08); }
.btn-link { background: none; border: none; cursor: pointer; font: inherit; }
.sending-firm-trigger { color: var(--link-color, #0a6ed1); text-decoration: none; padding: 0; min-width: 1em; min-height: 1.2em; display: inline-block; }
.sending-firm-trigger:hover { text-decoration: underline; }
.sending-firm-trigger.sending-firm-placeholder { color: #999; }
.sending-firm-trigger.sending-firm-placeholder:hover { color: #666; }
.sending-firm-cell { cursor: pointer; min-width: 100px; }
.sending-firm-cell .dropdown-wrap { position: relative; }
.sending-firm-header-cell { white-space: nowrap; }
.sending-firm-header-wrap { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.sending-firm-bulk-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 1px solid var(--border); border-radius: 4px; background: #fff; cursor: pointer; font-size: 14px; line-height: 1; color: #666; }
.sending-firm-bulk-icon:hover { background: #f0f0f0; color: var(--text); }
.sending-firm-header-wrap .sending-firm-bulk-dropdown { display: none; position: absolute; left: 0; top: 100%; margin-top: 4px; min-width: 160px; z-index: 60; }
.sending-firm-header-wrap .sending-firm-bulk-dropdown.open { display: block; }
.sending-firm-header-wrap .sending-firm-bulk-dropdown .dropdown-section { max-height: 240px; overflow-y: auto; }
.sending-firm-bulk-title { margin: 0 0 8px 0; padding: 0; font-size: 12px; font-weight: 600; color: #555; }
.assigned-header-cell { white-space: nowrap; }
.assigned-header-wrap { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.assigned-bulk-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 1px solid var(--border); border-radius: 4px; background: #fff; cursor: pointer; font-size: 14px; line-height: 1; color: #666; }
.assigned-bulk-icon:hover { background: #f0f0f0; color: var(--text); }
.assigned-header-wrap .assigned-bulk-dropdown { display: none; position: absolute; left: 0; top: 100%; margin-top: 4px; min-width: 160px; z-index: 60; }
.assigned-header-wrap .assigned-bulk-dropdown.open { display: block; }
.assigned-header-wrap .assigned-bulk-dropdown .dropdown-section { max-height: 240px; overflow-y: auto; }
.assigned-bulk-title { margin: 0 0 8px 0; padding: 0; font-size: 12px; font-weight: 600; color: #555; }
.dept-filter-form { display: inline-flex; align-items: center; gap: 8px; flex-wrap: nowrap; white-space: nowrap; }
.dept-filter-value-wrap { display: inline-flex; flex-shrink: 0; }
.dept-filter-form .dept-filter-field { padding: 4px 8px; font-size: 13px; flex-shrink: 0; }
.dept-filter-form .dept-filter-value { padding: 4px 8px; font-size: 13px; min-width: 120px; max-width: 180px; }
.dept-filter-label { margin: 0; font-size: 13px; flex-shrink: 0; }
.dept-filter-apply { flex-shrink: 0; }
.sending-firm-cell .dropdown-popover .dropdown-section { max-height: 240px; overflow-y: auto; }

/* System History – editable Status, Cost, Paid, Follow-up */
.system-history-table .history-status-select { padding: 4px 8px; font-size: 13px; border: 1px solid var(--border); border-radius: 4px; background: #fff; min-width: 120px; cursor: pointer; }
.system-history-table .history-cost-cell { cursor: pointer; min-width: 72px; }
.system-history-table .history-cost-cell:hover .history-cost-display { text-decoration: underline; }
.system-history-table .history-cost-display { display: inline-block; min-width: 2em; min-height: 1.2em; }
.system-history-table .history-cost-cell .history-cost-input { cursor: text; }
.system-history-table .history-followup-input { width: 130px; padding: 4px 8px; font-size: 13px; border: 1px solid var(--border); border-radius: 4px; }
.system-history-table .history-paid-date-input { width: 130px; padding: 4px 8px; font-size: 13px; border: 1px solid var(--border); border-radius: 4px; }
.system-history-table .history-paid-btn { min-width: 44px; }
.system-history-table .history-paid-no { background: #c9302c; color: #fff; border-color: #ac2925; }
.system-history-table .history-paid-no:hover { background: #ac2925; color: #fff; }
.system-history-table .history-paid-yes { background: #5cb85c; color: #fff; border-color: #4cae4c; }
.system-history-table .history-paid-yes:hover { background: #4cae4c; color: #fff; }
.system-history-table .history-paid-empty { color: #999; }

/* Firm profile page – card layout, contact fields */
.card-section { max-width: 720px; }
.card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.card-title { font-size: 1.1rem; margin: 0 0 16px 0; padding-bottom: 8px; border-bottom: 1px solid var(--border); color: var(--text); }
.form-grid-contact { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; }
.form-grid-contact .form-group-full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid-contact { grid-template-columns: 1fr; } }
.form-group { margin-bottom: 0; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: #555; margin-bottom: 6px; }
.form-group input, .form-group textarea { width: 100%; padding: 8px 10px; font-size: 14px; border: 1px solid var(--border); border-radius: 4px; box-sizing: border-box; }
.form-group textarea { min-height: 100px; resize: vertical; }
.form-row-inline { display: flex; gap: 10px; flex-wrap: wrap; }
.form-row-inline input { flex: 1; min-width: 0; }
.form-row-inline .input-state { width: 72px; min-width: 72px; flex: 0; }
.form-row-inline input[placeholder="ZIP"] { width: 88px; min-width: 88px; flex: 0; }
.input-margin-top { margin-top: 8px; }
.form-actions { margin: 16px 0 0 0; padding-top: 12px; border-top: 1px solid var(--border); }
.firm-picker-select { padding: 6px 10px; font-size: 13px; border: 1px solid var(--border); border-radius: 4px; background: #fff; min-width: 180px; }
.firm-profile-form .card, .firm-letterhead-section .card { margin-bottom: 20px; }
.card-templates { margin-top: 8px; }
.card-letterhead .letterhead-options { margin-top: 10px; }

/* Firm profile – stacked down the page, slightly spaced from the left */
.firm-profile-tile { margin-bottom: 24px; }
.firm-profile-tile h2 { font-size: 1.1rem; margin: 0 0 12px 0; }
.firm-info-form { background: #f8f9fa; border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.firm-tile-grid { display: flex; flex-direction: column; gap: 14px; margin-left: 0.5rem; max-width: 640px; }
.firm-tile-cell { min-width: 0; }
.firm-tile-cell label { display: block; font-size: 12px; font-weight: 500; color: #555; margin-bottom: 2px; }
.firm-tile-cell input[type="text"], .firm-tile-cell input[type="email"], .firm-tile-cell textarea { width: 100%; max-width: 400px; padding: 5px 8px; font-size: 13px; border: 1px solid var(--border); border-radius: 4px; box-sizing: border-box; }
.firm-tile-cell.firm-tile-address input { display: block; margin-bottom: 4px; }
.firm-tile-cell.firm-tile-address input[type="text"] { max-width: 400px; }
.firm-tile-inline { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.firm-tile-inline input { flex: 1; min-width: 0; max-width: 200px; }
.firm-tile-state { width: 52px; min-width: 52px; }
.firm-tile-zip { width: 72px; min-width: 72px; }
.firm-tile-cell.firm-tile-signature textarea { min-height: 44px; resize: vertical; max-width: 100%; }
.firm-tile-cell.firm-tile-letterhead { width: 100%; }
.firm-tile-radios { display: flex; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; align-items: center; }
.firm-tile-letterhead .letterhead-options { margin-top: 6px; }
.firm-tile-letterhead .letterhead-drop-zone { padding: 12px; font-size: 12px; }
.firm-tile-actions { margin: 12px 0 0 0; }
.firm-new-save-notice { margin-top: 10px; }
.letter-templates-section { margin-top: 4px; }

/* Letterhead text editor – sized to letter header (8.5×11 header area) */
.letterhead-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.letterhead-toolbar-select { padding: 4px 8px; font-size: 12px; border: 1px solid var(--border); border-radius: 4px; }
.letterhead-toolbar-btn { min-width: 28px; padding: 4px 8px; font-size: 13px; font-weight: bold; border: 1px solid var(--border); border-radius: 4px; background: #fff; cursor: pointer; }
.letterhead-toolbar-btn:hover { background: #f0f0f0; }
.letterhead-toolbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.letterhead-editor-area { width: 8.5in; max-width: 100%; min-height: 1.5in; padding: 0.25in; border: 1px solid var(--border); border-radius: 6px; background: #fff; font-family: Georgia, serif; font-size: 12pt; line-height: 1.4; color: var(--text); box-sizing: border-box; outline: none; }
.letterhead-editor-area:empty::before { content: attr(data-placeholder); color: #999; }
.letterhead-editor-area:focus { border-color: #3498db; }

/* Roles Management – privilege grid and cards */
.roles-card { max-width: 720px; margin-bottom: 24px; }
.roles-card .card-title { font-size: 1.1rem; margin: 0 0 16px 0; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.roles-priv-section { margin: 16px 0; }
.roles-priv-heading { font-size: 13px; font-weight: 600; color: var(--text); margin: 0 0 10px 0; }
.roles-priv-group { margin-bottom: 20px; }
.roles-priv-group:last-child { margin-bottom: 0; }
.roles-priv-group-title { font-size: 12px; font-weight: 600; color: #555; margin: 0 0 8px 0; text-transform: uppercase; letter-spacing: 0.02em; }
.roles-priv-table { width: 100%; border-collapse: collapse; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; font-size: 14px; }
.roles-priv-table th { text-align: left; padding: 10px 12px; background: var(--bg-subtle, #f5f5f5); font-weight: 600; font-size: 12px; color: #555; border-bottom: 1px solid var(--border); }
.roles-priv-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.roles-priv-table tbody tr:last-child td { border-bottom: 0; }
.roles-priv-table tbody tr:hover { background: rgba(0,0,0,0.02); }
.roles-priv-col-check { width: 72px; text-align: center; }
.roles-priv-col-check input[type="checkbox"] { margin: 0; vertical-align: middle; width: 16px; height: 16px; cursor: pointer; }
.roles-priv-col-label { }
.roles-priv-col-label label { margin: 0; cursor: pointer; font-weight: 400; display: block; }
.roles-list-table { width: 100%; }
/* Roles Management – side-by-side Create | Custom roles */
.roles-two-col { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 24px; }
.roles-two-col-left { flex: 1 1 380px; min-width: 0; }
.roles-two-col-right { flex: 1 1 380px; min-width: 0; }
.roles-two-col .roles-card { margin-bottom: 0; }
@media (max-width: 860px) { .roles-two-col { flex-direction: column; } }
.roles-edit-modal-inner { max-width: 520px; max-height: 85vh; overflow-y: auto; }
.roles-edit-modal-inner .roles-priv-section { margin-top: 12px; }
.roles-edit-modal-inner .form-actions { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
/* Shared modal (roles + admin) */
.modal-wrapper { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-wrapper .modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); cursor: pointer; }
.modal-wrapper .modal-inner { position: relative; background: #fff; padding: 24px; border-radius: 8px; width: 90%; box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
.modal-wrapper .modal-inner h3 { margin-top: 0; }
