:root {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #1e2925;
  background: #edf2ef;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --green-950: #0c3d32;
  --green-800: #145c4b;
  --green-700: #1d725c;
  --green-100: #dfeee8;
  --ink: #1e2925;
  --muted: #66736d;
  --line: #d4ddd8;
  --line-dark: #b9c6bf;
  --surface: #ffffff;
  --surface-soft: #f4f7f5;
  --warning: #a5630b;
  --danger: #a63d3d;
  --focus: #2a79c7;
}

* { box-sizing: border-box; }
html, body, #root { width: 100%; min-width: 320px; height: 100%; height: 100dvh; margin: 0; }
body { overflow: hidden; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.crm-app { display: grid; grid-template-columns: 64px minmax(0, 1fr); height: 100%; background: var(--surface-soft); }
.app-rail { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 8px; background: var(--green-950); color: #fff; z-index: 40; }
.rail-logo { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 14px; border-radius: 6px; background: #fff; color: var(--green-950); font-weight: 700; }
.rail-button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #bdd8cf; }
.rail-button svg { width: 19px; height: 19px; }
.rail-button:hover, .rail-button.active { background: #1c5a4c; color: #fff; }
.rail-button { position: relative; }

.workspace { display: grid; grid-template-rows: auto auto auto auto auto minmax(0, 1fr); min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.title-block, .top-actions, .commandbar, .filter-strip, .quick-filters, .grid-footer > div, .connection-state, .primary-button, .secondary-button, .cell-action, .add-setting, .reminder-popup header > div { display: flex; align-items: center; }
.title-block h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: 0; }
.title-block p { margin: 4px 0 0; color: var(--muted); font-size: 12px; text-transform: capitalize; }
.live-dot { display: inline-flex; align-items: center; gap: 5px; margin-left: 5px; color: var(--green-700); font-size: 11px; font-weight: 600; vertical-align: 2px; }
.live-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #2e9a75; }
.top-actions { justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.user-switcher { max-width: 230px; }
.mobile-menu { display: none; margin-right: 8px; }

.primary-button, .secondary-button, .icon-button, .text-button { border: 0; border-radius: 5px; min-height: 34px; }
.primary-button, .secondary-button { justify-content: center; gap: 7px; padding: 0 12px; white-space: nowrap; }
.primary-button { background: var(--green-800); color: #fff; }
.primary-button:hover { background: var(--green-700); }
.secondary-button { border: 1px solid var(--line-dark); background: var(--surface); color: var(--ink); }
.secondary-button:hover, .secondary-button.active { border-color: #799189; background: #edf5f1; }
.icon-button { display: inline-grid; place-items: center; width: 34px; padding: 0; border: 1px solid var(--line-dark); background: var(--surface); color: #43514b; }
.icon-button svg { width: 17px; height: 17px; }
.text-button { padding: 0 6px; background: transparent; color: var(--green-700); }
.text-button.danger { color: var(--danger); }

.commandbar { gap: 7px; min-height: 54px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #f8faf9; overflow-x: auto; }
.commandbar select, .filter-strip select, .user-switcher { height: 34px; padding: 0 28px 0 9px; border: 1px solid var(--line-dark); border-radius: 5px; background: var(--surface); color: var(--ink); }
.search-control { display: flex; align-items: center; gap: 7px; flex: 0 1 360px; min-width: 220px; height: 34px; padding: 0 10px; border: 1px solid var(--line-dark); border-radius: 5px; background: var(--surface); color: var(--muted); }
.search-control input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.command-spacer { flex: 1; min-width: 4px; }
.density-switch { display: flex; height: 34px; padding: 2px; border: 1px solid var(--line-dark); border-radius: 5px; background: var(--surface); }
.density-switch button { padding: 0 9px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); font-size: 12px; }
.density-switch button.active { background: var(--green-100); color: var(--green-950); }

.analytics-band { display: grid; grid-template-columns: minmax(330px, 1.7fr) repeat(7, minmax(120px, 1fr)); min-height: 76px; border-bottom: 1px solid var(--line); background: #f1f6f3; overflow-x: auto; }
.analytics-band > button, .analytics-band > label { display: grid; align-content: center; gap: 3px; min-width: 112px; padding: 9px 13px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
.analytics-band > button:hover { background: #e5efea; }
.analytics-band span { color: var(--muted); font-size: 11px; }
.analytics-band b { font-size: 20px; line-height: 1; }
.analytics-band small { color: var(--muted); font-size: 10px; }
.analytics-band select { width: 100%; height: 31px; padding: 0 8px; border: 1px solid var(--line-dark); border-radius: 5px; background: #fff; color: var(--ink); }
.analytics-band.is-loading { display: flex; align-items: center; padding: 0 13px; color: var(--muted); font-size: 12px; }
.danger-value { color: var(--danger); }

.filter-strip { flex-wrap: wrap; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #fff9ef; }
.filter-strip label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.filter-strip select { min-width: 130px; }
.quick-filters { gap: 2px; padding: 7px 12px 0; border-bottom: 1px solid var(--line); background: var(--surface); overflow-x: auto; }
.quick-filters button { display: flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 10px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #56635d; white-space: nowrap; }
.quick-filters button:hover { color: var(--green-800); }
.quick-filters button.active { border-bottom-color: var(--green-700); color: var(--green-800); font-weight: 600; }
.quick-filters button span { min-width: 20px; padding: 2px 5px; border-radius: 10px; background: var(--green-100); text-align: center; font-size: 10px; }

.grid-shell { display: grid; grid-template-rows: minmax(0, 1fr) 38px; min-width: 0; min-height: 0; margin: 0; background: var(--surface); }
.grid-scroll { position: relative; min-width: 0; min-height: 0; overflow: auto; scrollbar-color: #9baba4 #edf1ef; }
.lead-grid { table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.lead-grid th, .lead-grid td { height: 38px; padding: 0; border-right: 1px solid #dce3df; border-bottom: 1px solid #dce3df; background: var(--surface); text-align: left; vertical-align: middle; }
.density-comfortable .lead-grid th, .density-comfortable .lead-grid td { height: 48px; }
.lead-grid thead { position: sticky; top: 0; z-index: 15; }
.lead-grid th { background: var(--table-head, #e9efec); color: #4f5f58; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.lead-grid th button { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 100%; padding: 0 9px; border: 0; background: transparent; color: inherit; text-align: left; text-transform: uppercase; }
.lead-grid th button:hover:not(:disabled) { background: #dfe8e3; color: var(--green-950); }
.lead-grid tbody tr:hover td { background: #f7faf8; }
.lead-grid tbody tr.selected-row td { background: #eef7f3; }
.lead-grid tbody tr.duplicate-row td { background: #e7f2ff; border-bottom-color: #b9d4ee; }
.lead-grid tbody tr.duplicate-row:hover td { background: #dcecff; }
.lead-grid tbody tr.duplicate-row td:first-child { box-shadow: inset 3px 0 0 #2a79c7; }
.lead-grid tbody tr.duplicate-row td.is-pinned, .lead-grid tbody tr.duplicate-row td.pinned-select { background: #e7f2ff; }
.lead-grid .virtual-spacer td { height: auto; padding: 0; border: 0; background: transparent; }
.lead-grid tbody tr:nth-child(even):not(.progress-tinted) td { background: var(--table-stripe, #f7f9f8); }
.lead-grid .row-open-column { position: sticky; right: 0; z-index: 12; width: 44px; min-width: 44px; padding: 0; background: #f4f7f5; box-shadow: -1px 0 0 #b8c7c0; text-align: center; }
.lead-grid th.row-open-column { z-index: 26; background: var(--table-head, #e9efec); }
.lead-grid .row-open-column .icon-button { margin: 0 auto; }
.select-column { width: 42px; min-width: 42px; max-width: 42px; text-align: center !important; }
.pinned-select { position: sticky; left: 0; z-index: 12; background: #f4f7f5 !important; }
thead .pinned-select { z-index: 30; background: #dfe7e3 !important; }
.lead-grid .is-pinned { position: sticky; z-index: 10; box-shadow: 1px 0 0 #b8c7c0; }
.lead-grid th.is-pinned { z-index: 25; background: #dfe7e3; }
.cell-editor { width: 100%; height: 100%; padding: 0 8px; border: 1px solid transparent; border-radius: 0; outline: 0; background: transparent; color: var(--ink); text-overflow: ellipsis; }
.cell-editor:hover { border-color: #b8c8c0; background: #fff; }
.cell-editor:focus { position: relative; z-index: 2; border: 2px solid var(--focus); background: #fff; box-shadow: 0 0 0 2px rgb(42 121 199 / 15%); }
select.cell-editor { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #718078 50%), linear-gradient(135deg, #718078 50%, transparent 50%); background-position: calc(100% - 11px) 48%, calc(100% - 7px) 48%; background-size: 4px 4px; background-repeat: no-repeat; padding-right: 18px; }
.status-editor { font-weight: 600; color: var(--green-800); }
.readonly-cell { display: block; overflow: hidden; padding: 0 8px; color: #4d5b55; text-overflow: ellipsis; white-space: nowrap; }
.cell-action { gap: 5px; height: 27px; margin: 0 7px; padding: 0 8px; border: 1px solid #a9bdb3; border-radius: 4px; background: #f2f8f5; color: var(--green-800); }
.cell-action:hover { background: var(--green-100); }
.empty-grid { position: sticky; left: 0; display: grid; justify-items: center; gap: 4px; width: min(100vw - 100px, 600px); margin: 80px auto; color: var(--muted); text-align: center; }
.empty-grid h3, .empty-grid p { margin: 0; }
.empty-grid h3 { color: var(--ink); font-size: 15px; }
.grid-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 0 12px; border-top: 1px solid var(--line); background: #f5f8f6; color: var(--muted); font-size: 11px; overflow-x: auto; }
.grid-footer > div { gap: 14px; white-space: nowrap; }
.connection-state { gap: 4px; }
.save-indicator.saving { color: var(--warning); }
.save-indicator.saved { color: var(--green-700); }
.save-indicator.error { color: var(--danger); }

.modal-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 18px; background: rgb(11 25 20 / 45%); }
.dialog { display: flex; flex-direction: column; width: min(760px, 100%); max-height: calc(100vh - 36px); overflow: hidden; border: 1px solid #aebbb5; border-radius: 7px; background: var(--surface); box-shadow: 0 24px 70px rgb(9 36 27 / 28%); }
.dialog-header, .panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.dialog-header h2, .panel-header h2, .settings-content h3 { margin: 0; font-size: 16px; }
.dialog-header p, .panel-header p, .settings-content > p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.paste-dialog textarea { min-height: 130px; margin: 14px; padding: 11px; resize: vertical; border: 1px dashed #82988e; border-radius: 5px; background: #f7faf8; color: var(--ink); }
.paste-dialog { width: min(1040px, 100%); }
.paste-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 14px 10px; font-size: 12px; }
.paste-options label { display: flex; align-items: center; gap: 6px; }
.paste-preview { max-height: 250px; margin: 0 14px; overflow: auto; border: 1px solid var(--line); }
.paste-preview table { width: 100%; border-collapse: collapse; font-size: 11px; }
.paste-preview th, .paste-preview td { padding: 7px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.paste-preview th { background: #e9efec; }
.duplicate-preview-table td { vertical-align: top; }
.duplicate-preview-table td:nth-child(2), .duplicate-preview-table td:nth-child(3) { min-width: 190px; }
.duplicate-preview-table small, .duplicate-preview-table td > span, .match-list span { display: block; margin-top: 3px; color: var(--muted); }
.duplicate-preview-table select { min-width: 160px; height: 31px; border: 1px solid var(--line-dark); border-radius: 4px; background: #fff; }
.duplicate-preview-row td { background: #e7f2ff; border-bottom-color: #b9d4ee; }
.duplicate-badge, .new-badge { display: inline-flex !important; align-items: center; gap: 5px; margin: 0 !important; padding: 4px 7px; border-radius: 4px; font-weight: 700; }
.duplicate-badge { background: #d3e8ff; color: #155a99 !important; }
.new-badge { background: #e1f4e8; color: #276b44 !important; }
.match-list { display: grid; gap: 7px; }
.match-list > div { display: grid; }
.muted-copy { color: var(--muted); }
.empty-preview { display: grid; place-items: center; min-height: 90px; color: var(--muted); }
.validation-line { min-height: 35px; padding: 9px 14px 0; color: var(--green-700); font-size: 11px; }
.error-text { color: var(--danger); }
.dialog-actions, .panel-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); background: #f8faf9; }

.side-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 75; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: min(520px, 100%); border-left: 1px solid #9fafa7; background: var(--surface); box-shadow: -18px 0 55px rgb(10 35 27 / 18%); }
.history-panel { width: min(680px, 100%); grid-template-rows: auto minmax(0, 1fr); }
.history-scroll { overflow: auto; }
.history-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: #f7faf8; }
.history-summary > div { display: grid; gap: 4px; min-width: 0; padding: 12px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.history-summary span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.history-summary b { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.duplicate-callout { display: flex; gap: 10px; margin: 14px; padding: 12px; border: 1px solid #9fc6e8; border-left: 3px solid #2a79c7; background: #e7f2ff; color: #174f80; }
.duplicate-callout > div { display: grid; gap: 4px; }
.duplicate-callout span { font-size: 11px; }
.history-section { border-bottom: 1px solid var(--line); }
.history-section > header { display: flex; align-items: flex-start; gap: 9px; padding: 14px 16px 10px; }
.history-section h3, .history-section p { margin: 0; }
.history-section h3 { font-size: 13px; }
.history-section p { margin-top: 3px; color: var(--muted); font-size: 11px; }
.related-leads { display: grid; margin: 0 16px 14px; border: 1px solid var(--line); }
.related-leads button { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, auto); gap: 14px; min-height: 53px; padding: 9px 11px; border: 0; border-bottom: 1px solid var(--line); background: #fff; color: var(--ink); text-align: left; }
.related-leads button:last-child { border-bottom: 0; }
.related-leads button:hover { background: #f1f7f4; }
.related-leads button > span { display: grid; gap: 4px; }
.related-leads button > span:last-child { text-align: right; }
.related-leads small { color: var(--muted); }
.history-empty { margin: 0 16px 14px; padding: 16px; border: 1px dashed var(--line-dark); color: var(--muted); text-align: center; }
.column-panel { width: min(610px, 100%); }
.panel-scroll, .event-list { overflow: auto; }
.column-setting { display: grid; grid-template-columns: 30px minmax(130px, 1fr) 66px 58px 62px; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; border-bottom: 1px solid var(--line); font-size: 12px; }
.drag-handle { color: #83918a; font-variant-numeric: tabular-nums; }
.column-name { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.column-setting label { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.move-buttons { display: flex; gap: 2px; }
.move-buttons button { width: 28px; height: 28px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.event-list { padding: 4px 16px 30px; }
.event-item { display: grid; grid-template-columns: 30px 1fr; gap: 9px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.event-marker { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--green-100); color: var(--green-800); }
.event-title { font-weight: 700; }
.event-change { display: flex; gap: 8px; margin: 6px 0; color: #52615a; }
.event-change span { padding: 3px 6px; border-radius: 3px; background: #f1f4f2; }
.event-meta { color: var(--muted); font-size: 11px; }
.panel-empty { padding: 30px; color: var(--muted); text-align: center; }

.settings-dialog { width: min(900px, 100%); }
.settings-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 480px; overflow: hidden; }
.settings-layout nav { display: flex; flex-direction: column; padding: 8px; border-right: 1px solid var(--line); background: #f4f7f5; overflow: auto; }
.settings-layout nav button { display: flex; align-items: center; gap: 7px; min-height: 37px; padding: 0 9px; border: 0; border-radius: 4px; background: transparent; color: #4e5d56; text-align: left; }
.settings-layout nav button:hover, .settings-layout nav button.active { background: var(--green-100); color: var(--green-950); }
.settings-static { margin-top: 8px; border-top: 1px solid var(--line) !important; border-radius: 0 !important; }
.settings-content { padding: 18px; overflow: auto; }
.settings-values { margin: 16px 0; border-top: 1px solid var(--line); }
.settings-values > div { display: flex; align-items: center; justify-content: space-between; min-height: 39px; border-bottom: 1px solid var(--line); }
.add-setting { gap: 7px; }
.add-setting input { flex: 1; height: 35px; padding: 0 9px; border: 1px solid var(--line-dark); border-radius: 5px; }
.pwa-settings { display: grid; gap: 0; margin-top: 22px; border-top: 1px solid var(--line); }
.pwa-settings > div { display: grid; grid-template-columns: 180px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pwa-settings span { color: var(--muted); }
.ai-settings { display: grid; gap: 13px; margin-top: 24px; padding-top: 18px; border-top: 2px solid var(--line); }
.ai-settings h3, .ai-settings p { margin: 0; }
.ai-settings p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.ai-fields { display: grid; grid-template-columns: 150px minmax(170px, 1fr) minmax(220px, 1.35fr); gap: 10px; }
.ai-fields label, .create-person label { display: grid; gap: 5px; color: #4d5c55; font-size: 12px; font-weight: 600; }
.ai-fields small, .create-person small { color: var(--muted); font-weight: 400; }
.ai-fields input, .ai-fields select, .create-person input, .add-email input { width: 100%; height: 36px; padding: 0 9px; border: 1px solid var(--line-dark); border-radius: 5px; background: #fff; color: var(--ink); }
.ai-settings > .secondary-button { justify-self: start; }

.access-dialog { width: min(920px, 100%); }
.access-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 520px; overflow: hidden; }
.user-list { padding: 8px; border-right: 1px solid var(--line); background: #f4f7f5; overflow: auto; }
.user-list button { display: grid; grid-template-columns: 12px minmax(0, 1fr); align-items: center; gap: 9px; width: 100%; min-height: 54px; padding: 7px 9px; border: 0; border-radius: 5px; background: transparent; color: var(--ink); text-align: left; }
.user-list button:hover, .user-list button.active { background: var(--green-100); }
.user-list button span:last-child { display: grid; gap: 3px; }
.user-list small { color: var(--muted); text-transform: capitalize; }
.role-dot { width: 8px; height: 8px; border-radius: 50%; background: #75837d; }
.role-owner { background: #9a5b15; }
.role-admin { background: #6b55a4; }
.role-manager { background: #2b76a7; }
.role-poc { background: #2a8467; }
.access-content { padding: 18px; overflow: auto; }
.access-person { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.access-person h3, .access-person p { margin: 0; }
.access-person h3 { font-size: 17px; }
.access-person p { margin-top: 4px; color: var(--muted); text-transform: capitalize; }
.role-badge { padding: 4px 8px; border-radius: 4px; background: #edf1ef; color: #44524c; font-size: 11px; text-transform: uppercase; }
.owner-access { display: flex; gap: 11px; margin-top: 18px; padding: 14px; border-left: 3px solid #b27124; background: #fff7e9; }
.owner-access p { margin: 4px 0 0; color: #6f624d; }
.manager-assignment { display: grid; grid-template-columns: 160px minmax(0, 280px); align-items: center; gap: 10px; margin: 16px 0; font-weight: 600; }
.manager-assignment select { height: 35px; padding: 0 9px; border: 1px solid var(--line-dark); border-radius: 5px; background: #fff; }
.permission-list { margin-top: 14px; border-top: 1px solid var(--line); }
.permission-list label { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 49px; padding: 6px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.permission-list label > span { display: grid; gap: 3px; }
.permission-list small { color: var(--muted); font-weight: 400; }
.permission-list input { width: 17px; height: 17px; }
.add-person-button { grid-template-columns: 20px minmax(0, 1fr) !important; margin-bottom: 6px; border: 1px dashed #8da198 !important; background: #fff !important; color: var(--green-800) !important; }
.create-person { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 560px; }
.create-person h3, .create-person p { grid-column: 1 / -1; margin: 0; }
.create-person p { color: var(--muted); font-size: 12px; }
.create-person .primary-button { grid-column: 1 / -1; justify-self: start; }
.report-emails { display: grid; gap: 7px; margin: 18px 0; padding: 13px; border: 1px solid var(--line); background: #f7faf8; }
.report-emails h4, .report-emails p { margin: 0; }
.report-emails p { margin-top: 3px; color: var(--muted); font-size: 11px; }
.email-row, .add-email { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.email-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-email input { flex: 1; min-width: 0; }

.reminder-popup { position: fixed; right: 18px; bottom: 50px; z-index: 100; width: min(390px, calc(100vw - 36px)); overflow: hidden; border: 1px solid #b8a27c; border-radius: 7px; background: var(--surface); box-shadow: 0 18px 55px rgb(58 42 14 / 25%); }
.reminder-popup header { display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; border-bottom: 1px solid #e5d8bf; background: #fff5df; font-weight: 700; }
.reminder-popup header > div { gap: 7px; }
.reminder-body { padding: 13px; }
.reminder-body h3 { margin: 0 0 10px; font-size: 16px; }
.reminder-body dl { display: grid; grid-template-columns: 100px 1fr; gap: 8px; margin: 0; font-size: 12px; }
.reminder-body dt { color: var(--muted); }
.reminder-body dd { margin: 0; }
.reminder-popup footer { display: flex; justify-content: flex-end; gap: 7px; padding: 11px 12px; border-top: 1px solid var(--line); }
.toast { position: fixed; right: 18px; top: 18px; z-index: 120; display: flex; align-items: center; gap: 9px; max-width: min(420px, calc(100vw - 36px)); padding: 10px 13px; border: 1px solid #8bb3a3; border-radius: 6px; background: #eff8f4; color: var(--green-950); box-shadow: 0 12px 32px rgb(11 48 37 / 18%); font-size: 12px; }
.toast.error { border-color: #d19b9b; background: #fff1f1; color: #762b2b; }
.app-loading { display: grid; place-items: center; align-content: center; gap: 12px; height: 100%; background: #edf2ef; color: var(--green-950); }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 7px; background: var(--green-950); color: #fff; font-weight: 700; }
.login-screen { display: grid; place-items: center; min-height: 100%; padding: 20px; background: #edf2ef; }
.login-form { display: grid; gap: 15px; width: min(390px, 100%); padding: 26px; border: 1px solid var(--line-dark); border-radius: 7px; background: #fff; box-shadow: 0 18px 45px rgb(12 61 50 / 12%); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.login-brand h1, .login-brand p { margin: 0; }
.login-brand h1 { font-size: 18px; }
.login-brand p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.login-form label { display: grid; gap: 6px; color: #4d5c55; font-size: 12px; font-weight: 600; }
.login-form input { width: 100%; height: 39px; padding: 0 10px; border: 1px solid var(--line-dark); border-radius: 5px; }
.login-form .primary-button { min-height: 39px; }
.login-error { padding: 9px 10px; border-left: 3px solid var(--danger); background: #fff1f1; color: #762b2b; font-size: 12px; }

@media (max-width: 900px) {
  .crm-app { grid-template-columns: 54px minmax(0, 1fr); }
  .app-rail { padding-inline: 6px; }
  .rail-logo, .rail-button { width: 40px; }
  .topbar { align-items: flex-start; }
  .top-actions { max-width: 66%; }
  .user-switcher { max-width: 180px; }
  .commandbar { flex-wrap: wrap; overflow: visible; }
  .search-control { flex-basis: 100%; }
  .command-spacer { display: none; }
  .workspace { grid-template-rows: auto auto auto auto auto minmax(0, 1fr); }
  .analytics-band { grid-template-columns: repeat(6, minmax(140px, 1fr)); }
}

@media (max-width: 640px) {
  body { overflow: hidden; }
  .crm-app { display: block; }
  .app-rail { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; flex-direction: row; justify-content: space-around; height: 52px; padding: 5px 10px; }
  .rail-logo { display: none; }
  .rail-button { height: 42px; margin: 0; }
  .workspace { height: calc(100% - 52px); }
  .topbar { min-height: 58px; padding: 8px 10px; }
  .title-block h1 { font-size: 16px; }
  .title-block p { max-width: 145px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-menu { display: none; }
  .top-actions { max-width: none; }
  .top-actions .user-switcher, .top-actions .secondary-button { display: none; }
  .top-actions .primary-button { padding: 0 10px; }
  .commandbar { gap: 6px; padding: 7px 8px; }
  .search-control { min-width: 100%; }
  .commandbar select { width: calc(50% - 3px); }
  .commandbar .secondary-button { flex: 1; }
  .commandbar .density-switch, .commandbar > .icon-button { display: none; }
  .filter-strip { max-height: 160px; overflow: auto; }
  .filter-strip label { width: 100%; justify-content: space-between; }
  .filter-strip select { flex: 1; }
  .quick-filters { padding-left: 8px; }
  .grid-shell { grid-template-rows: minmax(0, 1fr) 34px; }
  .grid-footer { padding-inline: 8px; }
  .grid-footer > div:first-child span:not(:first-child), .grid-footer > div:last-child span:last-child, .save-indicator { display: none; }
  .dialog { max-height: calc(100vh - 20px); border-radius: 6px; }
  .modal-backdrop { padding: 10px; }
  .paste-dialog textarea { min-height: 100px; margin: 10px; }
  .paste-options { align-items: flex-start; flex-direction: column; padding-inline: 10px; }
  .paste-preview { margin-inline: 10px; }
  .history-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-layout { grid-template-columns: 1fr; min-height: 0; }
  .settings-layout nav { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .settings-layout nav button { white-space: nowrap; }
  .settings-static { margin-top: 0; border-top: 0 !important; }
  .settings-content { min-height: 330px; }
  .pwa-settings > div { grid-template-columns: 1fr; gap: 3px; }
  .ai-fields, .create-person { grid-template-columns: 1fr; }
  .create-person h3, .create-person p, .create-person .primary-button { grid-column: auto; }
  .access-layout { grid-template-columns: 1fr; min-height: 0; }
  .user-list { display: flex; min-height: 68px; padding: 6px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .user-list button { min-width: 185px; }
  .access-content { min-height: 390px; }
  .manager-assignment { grid-template-columns: 1fr; }
  .column-setting { grid-template-columns: 24px minmax(105px, 1fr) 58px 52px; }
  .move-buttons { display: none; }
  .reminder-popup { right: 10px; bottom: 60px; width: calc(100vw - 20px); }
  .reminder-body dl { grid-template-columns: 88px 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .side-panel, .reminder-popup, .toast { animation: enter .18s ease-out; }
  @keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
}

/* Application navigation and report views */
.rail-spacer { flex: 1; }
.rail-more { display: none; }
.rail-notifications > span { position: absolute; top: 3px; right: 2px; display: grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border: 2px solid var(--green-950); border-radius: 10px; background: #c74c4c; color: #fff; font-size: 9px; font-weight: 700; }
.workspace:not(.view-crm) { display: block; min-width: 0; min-height: 0; overflow: auto; background: #f3f6f4; }
.workspace.view-confirmations { overflow: hidden; }
.report-view, .booking-view { width: min(1500px, 100%); min-height: 100%; margin: 0 auto; padding: 20px 22px 42px; }
.view-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.view-heading h1 { margin: 0; font-size: 23px; line-height: 1.2; }
.view-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.view-loading { display: grid; place-items: center; min-height: 60vh; color: var(--muted); }
.date-range-bar { display: flex; align-items: end; gap: 8px; padding: 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.date-range-bar > div { display: flex; align-items: center; gap: 7px; align-self: center; padding: 0 7px; color: var(--green-800); font-size: 12px; font-weight: 700; }
.date-range-bar label { display: grid; gap: 4px; color: var(--muted); font-size: 10px; }
.date-range-bar input, .crm-range-cell input { height: 32px; padding: 0 7px; border: 1px solid var(--line-dark); border-radius: 5px; background: #fff; color: var(--ink); }
.crm-range-cell > div { display: flex; gap: 5px; }
.crm-range-cell input { min-width: 142px; width: 142px; }
.report-section { margin: 0 0 16px; padding: 0 0 16px; border-bottom: 1px solid var(--line); }
.report-section > header { display: flex; justify-content: space-between; align-items: end; margin-bottom: 10px; }
.report-section h2, .chart-panel h2 { margin: 0; font-size: 15px; }
.report-section header p, .chart-panel header p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.metric-tile { display: grid; align-content: center; min-height: 82px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.metric-tile span { color: var(--muted); font-size: 11px; }
.metric-tile b { margin-top: 5px; font-size: 22px; line-height: 1; }
.metric-tile small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.custom-range-metric { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 8px; margin-top: 8px; }
.custom-range-metric .date-range-bar { min-width: 0; justify-content: flex-start; }
.custom-range-result { display: grid; align-content: center; min-height: 58px; padding: 9px 13px; border: 1px solid var(--line); border-left: 4px solid var(--green-700); border-radius: 7px; background: var(--surface); }
.custom-range-result span { color: var(--muted); font-size: 10px; }
.custom-range-result b { margin-top: 4px; font-size: 20px; }
.poc-analytics-filter { display: grid; gap: 4px; min-width: 180px; color: var(--muted); font-size: 10px; }
.poc-analytics-filter select { height: 34px; padding: 0 30px 0 9px; border: 1px solid var(--line-dark); border-radius: 5px; background: #fff; color: var(--ink); }
.report-filter-controls { display: flex; align-items: end; gap: 8px; }
.insight-dashboard { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0 20px; }
.insight-panel { min-width: 0; padding: 13px 15px; border-top: 3px solid var(--green-700); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.insight-panel > header { margin-bottom: 9px; }
.insight-panel h2 { margin: 0; font-size: 15px; }
.insight-panel header p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.insight-list { margin: 0; }
.insight-list > div, .pipeline-list > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 30px; border-bottom: 1px solid var(--line); }
.insight-list > div:last-child, .pipeline-list > div:last-child { border-bottom: 0; }
.insight-list dt, .pipeline-list span { color: var(--ink); font-size: 11px; }
.insight-list dd { margin: 0; font-size: 12px; font-weight: 700; }
.revenue-list dd { font-variant-numeric: tabular-nums; }
.pipeline-list { max-height: 284px; overflow: auto; }
.pipeline-list b { font-size: 11px; }
.team-performance-panel { grid-column: 1 / -1; }
.team-performance-table { overflow: auto; }
.team-performance-table > div { display: grid; grid-template-columns: minmax(160px, 1.5fr) repeat(3, minmax(100px, 1fr)); align-items: center; min-width: 560px; min-height: 32px; border-bottom: 1px solid var(--line); }
.team-performance-table > div:last-child { border-bottom: 0; }
.team-performance-table span, .team-performance-table b { padding: 0 8px; font-size: 11px; }
.team-performance-head { background: var(--table-head); color: var(--muted); font-weight: 700; }
.metric-tile.danger { border-left: 3px solid var(--danger); background: #fff7f7; }
.metric-tile.warning { border-left: 3px solid #c98b20; background: #fffbf1; }
.metric-tile.good { border-left: 3px solid #27815f; }
.section-link { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; margin-top: 9px; padding: 0; border: 0; background: transparent; color: var(--green-800); font-size: 12px; font-weight: 700; }
.report-two-column, .notification-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.home-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Travel operations */
.operations-view { max-width: 1500px; }
.operations-toolbar { display: flex; align-items: end; gap: 9px; margin: 14px 0; padding: 10px 12px; border-block: 1px solid var(--line); background: var(--surface); }
.operations-toolbar label { display: grid; gap: 4px; min-width: 180px; color: var(--muted); font-size: 10px; }
.operations-toolbar select { height: 34px; padding: 0 30px 0 9px; border: 1px solid var(--line-dark); border-radius: 5px; background: #fff; color: var(--ink); }
.operations-toolbar > div { display: flex; align-items: center; gap: 6px; min-height: 34px; margin-left: auto; color: var(--muted); font-size: 11px; }
.operations-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.operation-panel { min-width: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.operation-panel-wide { grid-column: 1 / -1; }
.operation-panel > header { min-height: 58px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f7faf8; }
.operation-panel > header > div { display: flex; align-items: flex-start; gap: 8px; }
.operation-panel header svg { flex: 0 0 auto; margin-top: 1px; color: var(--green-700); }
.operation-panel h2, .pwa-status-panel h2 { margin: 0; font-size: 13px; }
.operation-panel header p, .pwa-status-panel header p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.operation-table { overflow: auto; }
.operation-table .operation-head, .operation-table > button { display: grid; align-items: center; min-width: 820px; min-height: 44px; border-bottom: 1px solid var(--line); }
.departure-table .operation-head, .departure-table > button { grid-template-columns: 105px minmax(180px, 1.5fr) minmax(130px, 1fr) 115px 80px 115px 72px; }
.action-table .operation-head, .action-table > button { grid-template-columns: 105px minmax(220px, 1.5fr) minmax(180px, 1.2fr) minmax(130px, 1fr) 120px; }
.operation-head { position: sticky; top: 0; z-index: 2; background: var(--table-head, #e9efec); color: #53615b; font-size: 9px; font-weight: 700; text-transform: uppercase; }
.operation-table > button { width: 100%; padding: 0; border: 0; border-bottom: 1px solid var(--line); background: #fff; color: var(--ink); text-align: left; }
.operation-table > button:hover, .operation-queue > button:hover { background: #f2f7f4; }
.operation-table > button.is-risk { background: #fff7f7; }
.operation-table .operation-head > span, .operation-table > button > span, .operation-table > button > time { min-width: 0; padding: 0 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.operation-table > button > span:last-child { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.operation-table span > svg { vertical-align: -2px; }
.operation-table b, .operation-table small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operation-table small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.operation-risk { color: var(--danger); font-weight: 700; }
.operation-queue { max-height: 330px; overflow: auto; }
.operation-queue > button { display: grid; grid-template-columns: 24px minmax(0, 1fr) minmax(115px, auto); align-items: center; gap: 7px; width: 100%; min-height: 52px; padding: 7px 11px; border: 0; border-bottom: 1px solid var(--line); background: #fff; color: var(--ink); text-align: left; }
.operation-queue > button.is-risk { background: #fff7f7; }
.operation-queue > button > svg { color: var(--green-700); }
.operation-queue > button > span:last-child { text-align: right; }
.operation-queue b, .operation-queue small { display: block; }
.operation-queue b { font-size: 11px; }
.operation-queue small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.operation-empty { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 90px; padding: 14px; color: var(--muted); font-size: 11px; text-align: center; }

/* Functional charts */
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.chart-panel { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.chart-panel > header { margin-bottom: 14px; }
.chart-panel-wide { grid-column: 1 / -1; }
.bar-chart { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(86px, 130px) minmax(80px, 1fr) 48px; align-items: center; gap: 8px; min-height: 19px; }
.bar-row > span { overflow: hidden; color: #53615b; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.bar-row > b { font-size: 11px; text-align: right; }
.bar-track { height: 10px; overflow: hidden; border-radius: 3px; background: #e8eeeb; }
.bar-track i { display: block; height: 100%; border-radius: 3px; }
.donut-layout { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 18px; min-height: 180px; }
.donut-chart { display: grid; place-items: center; width: 148px; height: 148px; border-radius: 50%; }
.donut-chart > div { display: grid; place-items: center; width: 88px; height: 88px; border-radius: 50%; background: var(--surface); }
.donut-chart b { font-size: 19px; }
.donut-chart span { color: var(--muted); font-size: 10px; }
.chart-legend { display: grid; gap: 7px; }
.chart-legend > div { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; align-items: center; gap: 7px; font-size: 11px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; }
.chart-empty { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 90px; padding: 16px; color: var(--muted); font-size: 12px; text-align: center; }

/* CRM grid focus, row colors, and transfers */
.grid-focus-mode { position: relative; grid-template-rows: minmax(0, 1fr); }
.grid-focus-mode .grid-shell { grid-row: 1; }
.focus-restore { position: absolute; top: 7px; right: 18px; z-index: 35; opacity: .22; transition: opacity .15s ease; }
.focus-restore:hover, .focus-restore:focus-within { opacity: 1; }
.progress-tinted td { background: color-mix(in srgb, var(--progress-color) 14%, #fff) !important; }
.progress-tinted:hover td { background: color-mix(in srgb, var(--progress-color) 21%, #fff) !important; }
.lead-grid tbody tr.selected-row td { background: #e8f4ef !important; }
.lead-grid tbody tr.duplicate-row td { background: #e7f2ff !important; }
.poc-transfer-cell { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding-right: 4px; }
.icon-button.compact { width: 27px; min-height: 27px; height: 27px; }
.transfer-dialog { width: min(470px, calc(100vw - 24px)); border: 1px solid var(--line-dark); border-radius: 7px; background: var(--surface); box-shadow: 0 24px 70px rgb(9 36 27 / 28%); }
.transfer-body { display: grid; gap: 12px; padding: 16px; }
.transfer-body label { display: grid; gap: 6px; font-size: 12px; font-weight: 700; }
.transfer-body select { height: 38px; padding: 0 9px; border: 1px solid var(--line-dark); border-radius: 5px; background: #fff; }
.transfer-body p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 18px; background: rgb(11 25 20 / 45%); }

/* Booking operations */
.booking-view { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.booking-toolbar { display: flex; align-items: center; gap: 8px; margin: 14px 0 9px; padding: 9px; border: 1px solid var(--line); background: #f8faf9; overflow-x: auto; }
.booking-toolbar .search-control { flex: 1 1 360px; }
.booking-toolbar select { min-width: 145px; height: 34px; padding: 0 28px 0 9px; border: 1px solid var(--line-dark); border-radius: 5px; background: #fff; }
.attention-toggle { display: flex; align-items: center; gap: 6px; white-space: nowrap; color: #6f501a; font-size: 12px; }
.booking-travel-filter { display: flex; align-items: end; gap: 9px; margin: 0 0 9px; padding: 9px; border: 1px solid var(--line); background: #f8faf9; }
.booking-travel-filter > div { display: flex; align-items: center; align-self: center; gap: 7px; margin-right: 5px; color: var(--green-800); font-size: 11px; font-weight: 700; white-space: nowrap; }
.booking-travel-filter label { display: grid; gap: 3px; color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.booking-travel-filter input { width: 150px; height: 34px; padding: 0 8px; border: 1px solid var(--line-dark); border-radius: 5px; background: #fff; color: var(--ink); }
.booking-table-shell { flex: 1 1 auto; min-width: 0; min-height: 160px; overflow: auto; overscroll-behavior: contain; scrollbar-color: #82968d #e7ece9; scrollbar-gutter: stable; border: 1px solid var(--line); background: var(--surface); }
.booking-table-shell::-webkit-scrollbar { width: 13px; height: 13px; }
.booking-table-shell::-webkit-scrollbar-track { background: #e7ece9; }
.booking-table-shell::-webkit-scrollbar-thumb { border: 3px solid #e7ece9; border-radius: 7px; background: #82968d; }
.booking-table-shell::-webkit-scrollbar-thumb:hover { background: #61766d; }
.booking-table { width: 100%; min-width: 1180px; border-collapse: collapse; font-size: 12px; }
.booking-table th { position: sticky; top: 0; z-index: 2; height: 36px; padding: 0 10px; border-bottom: 1px solid var(--line-dark); background: var(--table-head, #e9efec); color: #506059; text-align: left; font-size: 10px; text-transform: uppercase; }
.booking-table td { height: 52px; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.booking-table tr:hover td { background: #f5f9f7; }
.booking-table tr.needs-attention td:first-child { box-shadow: inset 3px 0 0 #c98b20; }
.booking-table td b, .booking-table td small { display: block; }
.booking-table td small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.booking-sheet { table-layout: fixed; }
.booking-sheet th { height: 38px; padding: 0 7px; white-space: nowrap; }
.booking-sheet td { height: 40px; padding: 0; }
.booking-cell-editor { width: 100%; height: 39px; min-width: 0; padding: 0 7px; border: 0; border-radius: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; }
.booking-cell-editor:hover { background: #f1f6f3; }
.booking-cell-editor:focus { background: #fff; box-shadow: inset 0 0 0 2px var(--green-600); }
.booking-cell-editor:disabled { color: var(--muted); cursor: wait; }
.booking-sheet select.booking-cell-editor { padding-right: 24px; }
.booking-readonly { background: #f5f7f6; color: var(--muted); }
.booking-readonly span { display: block; padding: 0 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.booking-balance-cell { color: var(--ink); font-weight: 700; }
.booking-open-cell { position: sticky; right: 0; z-index: 3; width: 54px; min-width: 54px; background: #f4f7f5; box-shadow: -1px 0 0 #b8c7c0; text-align: center; }
.booking-sheet th:last-child { position: sticky; right: 0; z-index: 4; background: var(--table-head, #e9efec); box-shadow: -1px 0 0 #b8c7c0; }
.booking-open-cell .icon-button { margin: 0 auto; }
.muted { color: var(--muted); font-size: 10px; }
.readiness-dots { display: flex; gap: 5px; }
.readiness-dots i { width: 10px; height: 10px; border: 1px solid #ba7c2e; border-radius: 50%; background: #ffe7ba; }
.readiness-dots i.ready { border-color: #27815f; background: #6bd0a7; }
.booking-status { display: inline-flex; align-items: center; min-height: 24px; padding: 0 7px; border: 1px solid var(--line); border-radius: 4px; background: #f1f4f2; font-size: 10px; white-space: nowrap; }
.status-travel-ready, .status-completed { border-color: #83b9a3; background: #e4f5ee; color: #145c4b; }
.status-payment-pending, .status-documents-pending { border-color: #e1b66e; background: #fff6df; color: #7a5313; }
.status-cancelled { border-color: #dfaaaa; background: #fff0f0; color: #913737; }
.booking-footer { flex: 0 0 auto; padding: 9px 2px; color: var(--muted); font-size: 11px; }
.booking-editor { display: flex; flex-direction: column; width: min(760px, 100%); }
.booking-balance { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); background: #f6f9f7; }
.booking-balance > div { display: grid; gap: 4px; padding: 11px 15px; border-right: 1px solid var(--line); }
.booking-balance span { color: var(--muted); font-size: 10px; }
.booking-balance b { font-size: 15px; }
.booking-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; padding: 15px; overflow: auto; }
.booking-form label { display: grid; align-content: start; gap: 5px; min-width: 0; }
.booking-form label > span { color: #53615b; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.booking-form input, .booking-form select, .booking-form textarea { width: 100%; min-width: 0; min-height: 36px; padding: 7px 9px; border: 1px solid var(--line-dark); border-radius: 5px; background: #fff; color: var(--ink); }
.booking-form textarea { min-height: 72px; resize: vertical; }
.booking-form .wide-field { grid-column: 1 / -1; }
.eyebrow { color: var(--green-700); font-size: 10px; font-weight: 700; text-transform: uppercase; }

/* Notifications and user activity */
.pwa-status-panel { margin-bottom: 16px; border: 1px solid var(--line); background: var(--surface); }
.pwa-status-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px; border-bottom: 1px solid var(--line); background: #f7faf8; }
.pwa-status-panel > header > div:first-child, .pwa-actions { display: flex; align-items: center; gap: 8px; }
.pwa-status-panel > header svg { color: var(--green-700); }
.pwa-status-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.pwa-status-grid > div { display: grid; gap: 4px; min-height: 58px; padding: 10px 13px; border-right: 1px solid var(--line); }
.pwa-status-grid > div:last-child { border-right: 0; }
.pwa-status-grid span { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.pwa-status-grid b { font-size: 12px; }
.status-good { color: var(--green-700); }
.status-warn { color: var(--warning); }
.pwa-permission-help { margin: 0; padding: 9px 13px; border-top: 1px solid #ead9b7; background: #fff8e9; color: #76550f; font-size: 11px; }
.task-list { display: grid; border: 1px solid var(--line); background: var(--surface); }
.task-list > div, .task-list > button { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 56px; padding: 8px 11px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
.task-list > button.is-unread { background: #eef7f3; box-shadow: inset 3px 0 0 var(--green-700); }
.task-list > div.task-overdue { background: #fff7f7; }
.task-list b, .task-list span { display: block; }
.task-list span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.task-list time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.presence-dialog { width: min(1180px, 100%); }
.presence-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, .8fr); min-height: 460px; overflow: hidden; }
.presence-table { min-width: 0; overflow: auto; border-right: 1px solid var(--line); }
.presence-row { display: grid; grid-template-columns: minmax(130px, 1.1fr) 76px repeat(3, minmax(130px, 1fr)); align-items: center; width: 100%; min-height: 52px; padding: 0 10px; border: 0; border-bottom: 1px solid var(--line); background: #fff; color: var(--ink); text-align: left; font-size: 11px; }
.presence-row:hover, .presence-row.active { background: #eef5f1; }
.presence-head { position: sticky; top: 0; min-height: 36px; background: #e9efec; color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.presence-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; text-transform: capitalize; }
.presence-online, .presence-offline { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; }
.presence-online { color: #197151; }
.presence-offline { color: #707a75; }
.presence-online::before, .presence-offline::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.session-history { padding: 14px; overflow: auto; background: #f8faf9; }
.session-history h3 { margin: 0 0 10px; font-size: 14px; }
.session-history > div { display: grid; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.session-history b { font-size: 11px; }
.session-history span, .session-history p { color: var(--muted); font-size: 10px; }

.mobile-more-backdrop { position: fixed; inset: 0; z-index: 90; display: none; align-items: end; background: rgb(11 25 20 / 38%); }
.mobile-more-sheet { width: 100%; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-dark); background: #fff; box-shadow: 0 -18px 50px rgb(9 36 27 / 20%); }
.mobile-more-sheet header { display: flex; align-items: center; justify-content: space-between; min-height: 42px; border-bottom: 1px solid var(--line); }
.mobile-more-sheet h2 { margin: 0; font-size: 16px; }
.mobile-more-sheet > button { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 48px; padding: 0 5px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
.mobile-more-sheet > button svg { width: 18px; color: var(--green-700); }

/* Owner appearance settings */
.appearance-colors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 18px; }
.appearance-colors label, .progress-color-list label { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 7px 9px; border: 1px solid var(--line); background: #fff; font-size: 11px; }
.appearance-colors input[type="color"], .progress-color-list input[type="color"] { width: 42px; height: 28px; padding: 1px; border: 1px solid var(--line-dark); background: #fff; }
.settings-content h4 { margin: 15px 0 8px; font-size: 12px; }
.progress-color-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }

@media (max-width: 1000px) {
  .report-two-column, .notification-columns, .chart-grid { grid-template-columns: 1fr; }
  .chart-panel-wide { grid-column: auto; }
  .view-heading { align-items: stretch; flex-direction: column; }
  .date-range-bar { align-self: flex-start; }
  .presence-layout { grid-template-columns: 1fr; }
  .session-history { max-height: 260px; border-top: 1px solid var(--line); }
  .insight-dashboard { grid-template-columns: 1fr 1fr; }
  .team-performance-panel { grid-column: 1 / -1; }
  .operations-layout { grid-template-columns: 1fr; }
  .operation-panel-wide { grid-column: auto; }
}

@media (max-width: 700px) {
  .crm-app { grid-template-columns: 52px minmax(0, 1fr); }
  .app-rail { padding-inline: 5px; }
  .rail-logo, .rail-button { width: 38px; }
  .report-view, .booking-view { padding: 14px 11px 34px; }
  .date-range-bar { width: 100%; align-items: stretch; flex-wrap: wrap; }
  .date-range-bar > div { width: 100%; }
  .date-range-bar label { flex: 1; }
  .date-range-bar input { width: 100%; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .custom-range-metric { grid-template-columns: 1fr; }
  .custom-range-result { min-height: 54px; }
  .report-filter-controls { width: 100%; align-items: stretch; flex-direction: column; }
  .poc-analytics-filter { width: 100%; }
  .insight-dashboard { grid-template-columns: 1fr; }
  .team-performance-panel { grid-column: auto; }
  .metric-tile { min-height: 74px; }
  .metric-tile b { font-size: 19px; }
  .donut-layout { grid-template-columns: 120px minmax(0, 1fr); gap: 10px; }
  .donut-chart { width: 116px; height: 116px; }
  .donut-chart > div { width: 70px; height: 70px; }
  .booking-form { grid-template-columns: 1fr; }
  .booking-form .wide-field { grid-column: auto; }
  .booking-balance > div { padding-inline: 8px; }
  .booking-balance b { font-size: 12px; }
  .booking-toolbar { align-items: stretch; flex-wrap: wrap; }
  .booking-toolbar .search-control { flex-basis: 100%; }
  .booking-travel-filter { align-items: stretch; flex-wrap: wrap; }
  .booking-travel-filter > div { flex-basis: 100%; }
  .booking-travel-filter label { flex: 1; }
  .booking-travel-filter input { width: 100%; }
  .operations-toolbar { align-items: stretch; flex-wrap: wrap; }
  .operations-toolbar label { flex: 1; min-width: 140px; }
  .operations-toolbar > div { flex-basis: 100%; margin-left: 0; }
  .pwa-status-panel > header { align-items: flex-start; flex-direction: column; }
  .pwa-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pwa-status-grid > div:nth-child(2), .pwa-status-grid > div:nth-child(4) { border-right: 0; }
  .pwa-status-grid > div:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .pwa-status-grid > div:last-child { grid-column: 1 / -1; }
  .appearance-colors, .progress-color-list { grid-template-columns: 1fr; }
  .presence-row { grid-template-columns: minmax(120px, 1fr) 70px minmax(130px, 1fr) minmax(130px, 1fr) minmax(130px, 1fr); }
}

@media (max-width: 640px) {
  .crm-app { height: 100dvh; }
  .app-rail { justify-content: stretch; gap: 1px; height: calc(56px + env(safe-area-inset-bottom)); padding: 5px 4px calc(5px + env(safe-area-inset-bottom)); overflow: hidden; }
  .app-rail .rail-primary, .app-rail .rail-more { display: grid; flex: 1 1 0; width: auto; min-width: 40px; max-width: 56px; height: 46px; }
  .app-rail .rail-secondary, .app-rail .rail-spacer { display: none; }
  .rail-more { display: grid; }
  .workspace { height: calc(100dvh - 56px - env(safe-area-inset-bottom)); }
  .mobile-more-backdrop { display: flex; }
  .report-view, .booking-view { padding-bottom: 24px; }
  .operations-view .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .operations-toolbar label { flex-basis: 100%; }
  .operation-queue { max-height: none; }
  .pwa-actions { width: 100%; flex-wrap: wrap; }
  .pwa-actions .primary-button, .pwa-actions .secondary-button { flex: 1; }
}
