/* Visual layer for the local ФИНИШРЕМОНТ workspace. */
:root {
  --bg: #f5f2ec;
  --paper: #fffefa;
  --ink: #24211d;
  --text: #332e28;
  --muted: #665f55;
  --line: #ddd7cc;
  --soft: #f4f0e8;
  --green: #3d584d;
  --deep: #22211e;
  --mint: #eaf1eb;
  --accent: #a6432d;
  --orange: var(--accent);
  --accent-hover: #85321f;
  --accent-soft: #fbebe4;
  --shadow: 0 12px 36px rgba(48, 37, 24, .07);
  --sidebar-width: 226px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

body { background: var(--bg); color: var(--text); }
button, select, input, textarea { font-family: inherit; }
:where(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Navigation and page hierarchy */
.sidebar {
  width: var(--sidebar-width);
  background: var(--deep);
  color: #f9f4e9;
  border-right: 1px solid #3a3732;
  padding: 20px 15px 17px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #706a5f transparent;
}
.sidebar .brand {
  justify-content: flex-start;
  padding: 0 2px 13px;
  margin: 0 0 24px;
  border-bottom: 1px solid #454139;
}
.brand-mark {
  flex: none;
  width: 173px;
  height: 66px;
  border: 0;
  border-radius: 0;
  background: url('/assets/logo-finishremont.png') center / 118% auto no-repeat;
  filter: grayscale(1) brightness(0) invert(1);
  font-size: 0;
}
.brand-copy { display: none; }
.nav-label { color: #b9b1a3; font-size: 10px; padding: 0 12px; letter-spacing: .12em; }
.sidebar .nav { gap: 4px; }
.sidebar .nav button,
.sidebar .guide-nav {
  color: #dfd8cb;
  font-size: 13px;
  font-weight: 530;
  min-height: 41px;
  padding: 9px 12px;
  gap: 10px;
  border-radius: 7px;
}
.sidebar .nav button:hover,
.sidebar .guide-nav:hover { background: #35322c; color: #fffaf0; }
.sidebar .nav button.active { background: #f5ebdb; color: #2b251d; font-weight: 670; }
.sidebar .nav button.active::before {
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.sidebar .nav button.active svg { color: var(--accent); }
.sidebar .nav .nav-count { background: #49443b; color: #f9ecda; font-size: 11px; }
.sidebar .nav button.active .nav-count { background: #ead7c3; color: #563c2d; }
.sidebar :is(button, a):focus-visible { outline-color: #f4b38d; }
.sidebar-bottom { padding-top: 14px; }
.sidebar-bottom .local-note {
  margin: 0 0 16px;
  padding: 11px 12px;
  border-radius: 7px;
  border-color: #474238;
  background: #2b2823;
  color: #c4baaa;
  font-size: 11px;
}
.local-note .line { color: #eee4d4; }
.user-block { border-top-color: #454139; padding: 13px 2px 0; }
.user-block .avatar { color: #2e251a; background: #e2c8a6; }
.user-info strong { font-size: 12px; color: #fff7e9; }
.user-info small, .user-block .icon-button { color: #c9beac; }
.workspace { width: calc(100% - var(--sidebar-width)); margin-left: var(--sidebar-width); background: var(--bg); }
.topbar {
  min-height: 67px;
  height: auto;
  padding: 10px clamp(24px, 3vw, 44px);
  background: #f9f7f1;
}
.breadcrumb { color: var(--muted); font-size: 12px; }
.breadcrumb strong { color: var(--ink); font-weight: 620; }
.top-date { color: var(--muted); font-size: 12px; }
.search-box {
  width: min(310px, 27vw);
  min-height: 42px;
  border-radius: 8px;
  border-color: #cfc7bb;
  background: var(--paper);
}
.search-box input { font-size: 13px; }
.search-box input::placeholder { color: #71685d; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px #a6432d29; }
.main-content { max-width: 1800px; padding: 31px clamp(24px, 3vw, 44px) 50px; }
.eyebrow { color: #874833; font-size: 10px; font-weight: 680; letter-spacing: .13em; }
.page-head { margin-bottom: 24px; }
.page-head h1 {
  color: var(--ink);
  font-size: clamp(28px, 3vw, 39px);
  font-weight: 730;
  line-height: 1.13;
  letter-spacing: -.045em;
}
.page-head p { color: var(--muted); font-size: 13px; line-height: 1.55; max-width: 62ch; }
.head-actions { flex-wrap: wrap; justify-content: flex-end; }

/* Reusable controls, data panels and readable status chips */
.btn {
  min-height: 41px;
  padding: 9px 13px;
  border-radius: 7px;
  border-color: #cfc6b9;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 630;
  line-height: 1.2;
  text-align: center;
}
.btn:hover { background: #f0eae0; border-color: #b9aa96; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 3px 9px rgba(113, 49, 27, .17);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-soft { background: #eee9df; border-color: #e2d9cc; color: var(--ink); }
.btn-small { min-height: 34px; padding: 7px 10px; font-size: 12px; }
.btn:disabled { cursor: not-allowed; box-shadow: none; opacity: .54; }
.text-link { color: #843e2c; font-weight: 620; }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.icon-button { min-width: 36px; min-height: 36px; border-radius: 8px; }
.filters select {
  min-height: 36px;
  max-width: 100%;
  padding: 6px 28px 6px 10px;
  background-color: var(--paper);
  color: var(--text);
  font-size: 12px;
  border-color: #cfc7bb;
}
.stats { gap: 14px; }
.stat, .board-panel, .content-panel {
  background: var(--paper);
  border-color: var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.stat { min-width: 0; min-height: 111px; padding: 15px 17px; }
.stat-value { color: var(--ink); font-size: clamp(22px, 2.4vw, 31px); font-weight: 710; font-variant-numeric: tabular-nums; }
.stat-top, .stat-bottom { color: var(--muted); font-size: 12px; }
.stat-bottom.positive { color: #365741; }
.stat-bottom.warning { color: #8f3024; }
.stat-icon { color: var(--accent); background: var(--accent-soft); border-radius: 7px; }
.panel-header { padding: 16px 20px; gap: 12px; flex-wrap: wrap; }
.panel-header h2 { color: var(--ink); font-size: 16px; font-weight: 690; }
.panel-subtitle, .muted, .small { color: var(--muted); }
.panel-subtitle, .small { font-size: 12px; line-height: 1.45; }
.section-title { color: #534a3f; font-size: 12px; font-weight: 700; }
.badge, .due-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #eee9df;
  color: #554b3e;
  font-size: 11px;
  font-weight: 630;
  line-height: 1.35;
  white-space: normal;
}
.badge :is(svg), .due-chip svg { width: 13px; height: 13px; flex: none; }
.badge:is(.assigned, .call, .contacted, .qualification) { background: #eaf0f6; color: #284861; }
.badge:is(.meeting, .meeting_done, .estimate, .estimate_ready, .presentation, .negotiation, .contract) { background: #f0eafa; color: #533d6c; }
.badge:is(.won, .handoff, .preparation, .in_progress, .completed, .review, .accepted) { background: #e8f0e8; color: #31563e; }
.badge:is(.paused, .no_answer, .pending, .queued) { background: #fbefd8; color: #70490c; }
.badge:is(.lost, .failed, .blocked, .unknown) { background: #fbe8e3; color: #8c3026; }
.badge.sending { background: #e9f0f6; color: #30536d; }
.due-chip { color: #374e64; background: #ebf0f5; font-variant-numeric: tabular-nums; }
.due-chip.today { color: #6b470c; background: #faefd3; }
.due-chip.overdue { color: #8e3026; background: #fbe6e0; }
.due-chip.none { color: #594f43; background: #efeae0; }
.demo-notice, .route-summary, .messages-intro {
  border-color: #dfd6c9;
  background: #f2ebe0;
  color: #5b5144;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
}
.route-summary strong, .messages-intro strong { color: var(--ink); font-size: 13px; }
.route-summary .text-link, .messages-intro .text-link { font-size: 12px; }
.messages-intro span { color: var(--muted); font-size: 12px; }
.empty-state h3 { color: var(--ink); font-size: 17px; }
.empty-state p { color: var(--muted); font-size: 13px; }

/* Pipeline and client list */
.phase-tabs { padding: 12px 15px 0; gap: 5px; }
.phase-tab { color: #605447; font-size: 13px; min-height: 37px; padding: 7px 10px; }
.phase-tab span { font-size: 11px; color: #625346; background: #ede5d8; }
.phase-tab.active { background: var(--accent-soft); color: #823820; }
.phase-tab.active span { background: #efd1c1; color: #713820; }
.view-tab { color: var(--muted); font-size: 13px; }
.view-tab.active { color: var(--ink); }
.view-tab .tiny-count { background: var(--accent-soft); color: #873d26; }
.board-tools { padding: 10px 15px; }
.board-wrap { min-height: 340px; background: #efebe3; padding: 17px 15px 23px; }
.board-wrap, .table-scroll {
  scrollbar-color: #a79b8c #efe9df;
  scrollbar-width: thin;
  overscroll-behavior-inline: contain;
}
.board.route-board { grid-auto-columns: minmax(215px, 1fr); gap: 12px; min-width: calc(var(--columns) * 229px); }
.column-head { border-bottom-color: #aa8d75; gap: 7px; padding: 0 2px 10px; }
.column-title { color: var(--ink); font-size: 13px; font-weight: 690; line-height: 1.3; }
.column-head .count { background: #e4dacf; color: #574b3d; font-size: 11px; }
.column-sum, .board-bottom { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.column-empty { color: var(--muted); font-size: 12px; }
.lead-card {
  padding: 13px 12px 11px;
  background: var(--paper);
  border-color: #dcd3c6;
  border-radius: 9px;
  box-shadow: 0 2px 5px rgba(50, 42, 29, .045);
}
.lead-card:hover { border-color: #b37b63; box-shadow: 0 6px 16px rgba(50, 42, 29, .1); transform: none; }
.card-top { margin-bottom: 8px; }
.partner-chip { color: #68523e; background: #eee7da; font-size: 10px; }
.partner-chip.priority-source { color: #6c490e; background: #f9ecd2; }
.demo-tag { color: #67594b; background: #f7f2e9; font-size: 10px; }
.card-name { color: var(--ink); font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.card-stage { margin: 7px 0 9px; }
.card-stage .badge { font-size: 11px; }
.card-property, .card-task { color: #5f5549; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.card-budget { margin: 10px 0; color: var(--ink); font-size: 15px; font-weight: 660; }
.card-budget small, .sale-marker { color: var(--muted); font-size: 11px; }
.card-task { padding: 8px 0 9px; border-top-color: #eae2d6; }
.card-footer .avatar { background: #eee3d5; color: #654c37; }
.table-scroll table { font-size: 13px; color: var(--text); }
.table-scroll th { color: #574c40; background: #f4efe6; font-size: 11px; font-weight: 650; }
.table-scroll td { color: var(--text); font-size: 13px; line-height: 1.45; }
.table-scroll tbody tr:nth-child(even) { background: #faf7f0; }
.table-scroll tbody tr.clickable:hover { background: #f6ede0; }
.clients-panel .table-scroll table { min-width: 760px; }
.clients-panel :is(th, td):first-child { position: sticky; left: 0; z-index: 1; background: var(--paper); }
.clients-panel th:first-child { z-index: 2; background: #f4efe6; }
.clients-panel tbody tr:nth-child(even) td:first-child { background: #faf7f0; }
.clients-panel tbody tr.clickable:hover td:first-child { background: #f6ede0; }
.clients-panel td:is(:first-child, :nth-child(2), :nth-child(5), :nth-child(6)) { white-space: normal; overflow-wrap: anywhere; max-width: 32ch; }
.clients-panel .table-name { display: inline-block; padding: 0; text-align: left; color: var(--ink); font-size: 14px; }
.clients-panel .table-sub { color: var(--muted); font-size: 12px; }
.task-list .task-row { align-items: center; }
.task-title, .activity-title { color: var(--text); font-size: 14px; line-height: 1.5; }
.task-sub, .activity-meta { color: var(--muted); font-size: 12px; }
.activity-icon { color: #8f4936; background: var(--accent-soft); }

/* Modal forms and the lead drawer */
.modal-backdrop, .drawer-backdrop { background: rgba(38, 32, 24, .49); }
.modal, .drawer { background: var(--paper); box-shadow: 0 24px 72px rgba(37, 28, 18, .23); }
.modal { border-radius: 12px; scroll-padding-block: 85px 70px; }
.modal-head, .drawer-head { background: var(--paper); border-bottom-color: var(--line); }
.modal-head { z-index: 4; padding: 16px 23px; }
.modal-head h2 { color: var(--ink); font-size: 23px; font-weight: 700; }
.modal-body { padding: 20px 23px 21px; }
.modal-sub, .privacy-note { color: var(--muted); font-size: 13px; line-height: 1.55; }
.form-grid, .mapping-grid { gap: 14px 16px; }
.field { gap: 6px; }
.field label { color: #4a4034; font-size: 13px; font-weight: 640; }
.field :is(input:not([type='checkbox']):not([type='radio']), select, textarea) {
  min-height: 43px;
  padding: 9px 11px;
  border: 1px solid #cfc5b7;
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
}
.field textarea { min-height: 70px; resize: vertical; }
.field :is(input, textarea)::placeholder { color: #74695c; }
.field :is(input:not([type='checkbox']):not([type='radio']), select, textarea):focus { border-color: var(--accent); outline: 2px solid #a6432d38; outline-offset: 0; }
.field :is([type='checkbox'], [type='radio']) { accent-color: var(--accent); }
.field .check-label { font-size: 13px; line-height: 1.45; }
.field small, .field .optional-label { color: var(--muted); font-size: 12px; line-height: 1.45; font-weight: 400; }
.field.required-missing > label { color: #744418; }
.field.required-missing :is(input:not([type='checkbox']):not([type='radio']), select, textarea),
:is(input:not([type='checkbox']):not([type='radio']), select, textarea).required-missing {
  border-color: #ac7635;
  background: #fff7e6;
}
.intake-form [type='checkbox'].required-missing { outline: 2px solid #ac7635; outline-offset: 2px; }
.error-text { color: #8e3026 !important; }
.field input.invalid-input { border-color: #a93b31 !important; background: #fff3ef; }
.form-error { border: 1px solid #e7bbaf; color: #8e3026; background: #fceae4; font-size: 13px; line-height: 1.5; }
.modal .form-error:not(:empty) { position: sticky; top: 69px; z-index: 3; }
.form-actions { border-top-color: var(--line); }
.modal-body > form > .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--paper);
  margin: 20px -23px -21px;
  padding: 12px 23px max(12px, env(safe-area-inset-bottom));
  box-shadow: 0 -7px 18px rgba(37, 28, 18, .045);
}
.facts-section, .client-drawer .drawer-facts {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 12px 0;
  background: #fcfaf5;
}
.facts-section > summary, .client-drawer .drawer-facts > summary {
  min-height: 42px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  background: #f4efe6;
  font-size: 13px;
  font-weight: 660;
  list-style: none;
  cursor: pointer;
}
.facts-section > summary::-webkit-details-marker,
.client-drawer .drawer-facts > summary::-webkit-details-marker { display: none; }
.facts-section > summary::before { content: none; }
.facts-section > summary::after, .client-drawer .drawer-facts > summary::after {
  content: '';
  width: 7px;
  height: 7px;
  margin: 0 2px 3px auto;
  flex: none;
  border: solid #776552;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.facts-section[open] > summary::after, .client-drawer .drawer-facts[open] > summary::after { transform: rotate(225deg); margin-bottom: -2px; }
.facts-section:has(.required-missing) > summary { box-shadow: inset 3px 0 #ac7635; }
.facts-section > .form-grid, .facts-section > .route-facts { padding: 13px; }
.facts-section > .route-facts { margin: 0; }
.transition-fields { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 15px; }
.transition-fields h3 { color: var(--ink); font-size: 15px; margin-bottom: 11px; }
.transition-criteria { color: #68491f; background: #fff6e6; border-color: #e6d2ae; }
.transition-criteria h3, .transition-criteria li, .transition-criteria p { color: #68491f; font-size: 12px; }
.help-note { color: #5b4d3f; background: #f3ede2; font-size: 12px; }
.intake-form [hidden] { display: none !important; }
.client-drawer { width: min(585px, 100%); }
.client-drawer .drawer-head { padding: 17px 23px; position: sticky; top: 0; z-index: 2; }
.drawer-kicker { color: var(--muted); font-size: 11px; margin-bottom: 9px; }
.drawer-title h2 { color: var(--ink); font-size: 26px; line-height: 1.13; overflow-wrap: anywhere; }
.drawer-title > div { min-width: 0; flex: 1; }
.drawer-title .avatar { color: #674930; background: #efe0cb; }
.drawer-phone > span { color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.drawer-phone .btn { min-height: 30px; font-size: 11px; }
.drawer-phone-note { color: var(--muted); font-size: 11px; max-width: 35ch; }
.drawer-stage-label { color: var(--muted); margin-top: 13px; }
.drawer-stage-label .badge { font-size: 12px; }
.drawer-stage-label .text-link { min-height: 36px; font-size: 13px; }
.client-drawer .drawer-body { padding: 17px 23px 28px; }
.client-drawer .next-task-box { margin: 0 0 15px; }
.next-task-box { background: #f4f3e9; border: 1px solid #dfd8c7; border-radius: 9px; }
.next-task-box.overdue { background: #fff4ef; border-color: #e9c6ba; }
.next-task-head { color: #625646; font-size: 12px; font-weight: 650; flex-wrap: wrap; }
.next-task-box p { color: var(--ink); font-size: 17px; font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; }
.next-task-foot small { color: var(--muted); font-size: 12px; }
.client-drawer .drawer-actions { gap: 7px; margin-bottom: 17px; }
.client-drawer .drawer-actions .btn { min-height: 38px; font-size: 12px; }
.client-drawer .drawer-body > .details-grid { padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #faf7f0; }
.detail-item small { color: var(--muted); font-size: 11px; }
.detail-item strong { color: var(--text); font-size: 13px; font-weight: 620; }
.client-drawer .drawer-facts { padding: 0; overflow: hidden; }
.client-drawer .drawer-facts > :not(summary) { margin: 11px 13px; }
.client-drawer .drawer-facts .details-grid { padding: 0; }
.client-drawer .drawer-section-head h3 { color: var(--ink); font-size: 14px; }
.client-drawer .drawer-section-head .text-link { font-size: 12px; }
.client-drawer .activity-title { font-size: 13px; }
.client-drawer .activity-meta { color: var(--muted); font-size: 11px; }
.notes-text { color: var(--text); font-size: 13px; }
.notes-text p { white-space: pre-wrap; margin-top: 5px; overflow-wrap: anywhere; }

/* Secondary work areas and sign-in */
.route-intro { background: #2c2923; border-color: #2c2923; border-radius: 10px; }
.route-intro .eyebrow { color: #dfad94; }
.route-intro h2 { color: #fff7ea; font-family: inherit; font-weight: 690; }
.route-intro p { color: #e0d6c7; font-size: 13px; }
.route-step, .template-card { border-color: var(--line); border-radius: 9px; background: var(--paper); }
.route-step h2, .template-head h3, .messenger-config-head h3 { color: var(--ink); }
.route-step-num { color: #a5533a; }
.route-owner, .route-goal, .route-step li, .route-step p, .template-meta, .template-body,
.integration-desc, .integration-status small, .message-job-meta, .message-job-text, .message-receipt-note,
.message-job-date, .channel-label, .analytics-note, .funnel-label, .funnel-value, .rop-summary small {
  color: var(--muted);
  font-size: 12px;
}
.route-intro p { color: #e0d6c7; }
.route-step :is(.route-exit, .route-next, .route-failure) strong { color: #654e39; }
.message-job-title { color: var(--ink); font-size: 14px; }
.personalized-message, .message-preview-top, .provider-payload { color: var(--text); }
.message-blockers, .message-job-error { color: #813b29; }
.channel-choice { color: #55483a !important; }
.channel-choice:has(input:checked) { background: #f9e9e1; border-color: #c79683; }
.channel-choice input:checked { background: var(--accent); border-color: var(--accent); }
.auth-page { background: var(--bg); }
.auth-art { background: radial-gradient(ellipse at 80% 4%, #4b4034 0, #302b25 42%, #24211d 100%); }
.auth-art .brand-mark { width: 218px; height: 96px; }
.auth-art .brand-copy { display: none; }
.auth-art h1 { color: #fff8eb; font-family: inherit; font-size: clamp(37px, 4.5vw, 60px); font-weight: 680; letter-spacing: -.045em; }
.auth-art p, .auth-art-footer { color: #e2d6c5; font-size: 13px; }
.auth-art::before, .auth-art::after { border-color: #e8b89a24; }
.auth-form-wrap { background: var(--bg); }
.auth-form { max-width: 420px; padding: 26px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.auth-form h2 { color: var(--ink); }
.auth-form > p, .auth-foot { color: var(--muted); font-size: 13px; }
.initial-loading .brand-mark { width: 183px; height: 82px; border: 0; filter: none; }

@media (max-width: 1130px) {
  :root { --sidebar-width: 197px; }
  .sidebar { padding-inline: 12px; }
  .sidebar .brand-mark { width: 156px; height: 59px; }
  .sidebar .nav button, .sidebar .guide-nav { font-size: 12px; }
  .main-content { padding-inline: 24px; }
}
@media (max-width: 900px) {
  :root { --sidebar-width: 74px; }
  .sidebar { padding: 17px 9px 11px; }
  .sidebar .brand { justify-content: center; margin-bottom: 16px; }
  .sidebar .brand-mark { width: 55px; height: 33px; }
  .sidebar .nav button, .sidebar .guide-nav { justify-content: center; padding-inline: 0; }
  .sidebar-bottom .local-note { display: none; }
  .search-box { width: min(255px, 38vw); }
  .main-content { padding: 24px 20px 35px; }
  .stat { padding: 12px; }
}
@media (max-height: 815px) {
  .sidebar .brand { margin-bottom: 15px; padding-bottom: 9px; }
  .sidebar-bottom .local-note { display: none; }
}
@media (max-width: 700px) {
  :root { --sidebar-width: 0px; }
  .app-shell { display: block; }
  .sidebar {
    position: sticky;
    inset: 0 auto auto;
    top: 0;
    display: grid;
    grid-template: 'brand user' auto 'nav nav' auto / minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid #454139;
    padding: 5px 10px 4px;
    overflow: visible;
  }
  .sidebar .brand { grid-area: brand; justify-content: flex-start; border: 0; margin: 0; padding: 0 1px; }
  .sidebar .brand-mark { width: 109px; height: 39px; }
  .sidebar .nav-label { display: none; }
  .sidebar .nav { grid-area: nav; flex-direction: row; overflow-x: auto; gap: 4px; padding: 2px 1px 5px; scrollbar-width: thin; scrollbar-color: #84796a transparent; }
  .sidebar .nav > div { display: none; }
  .sidebar .nav button, .sidebar .guide-nav { min-height: 40px; padding: 8px 9px; margin: 0; white-space: nowrap; flex: none; font-size: 12px; gap: 6px; }
  .sidebar .nav button span, .sidebar .guide-nav span { display: inline; }
  .sidebar .nav button svg, .sidebar .guide-nav svg { width: 16px; height: 16px; }
  .sidebar .nav button.active::before { display: none; }
  .sidebar-bottom { grid-area: user; padding: 0; margin: 0; }
  .sidebar .user-block { border: 0; padding: 0; flex-direction: row; gap: 6px; }
  .sidebar .user-info { display: none; }
  .sidebar .user-block .icon-button { min-width: 39px; min-height: 39px; }
  .workspace { width: 100%; margin-left: 0; }
  .topbar { min-height: 57px; padding: 8px 15px; }
  .breadcrumb { display: none; }
  .header-right { width: 100%; }
  .search-box { width: 100%; max-width: none; min-height: 40px; }
  .main-content { padding: 20px 14px 34px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 13px; margin-bottom: 18px; }
  .page-head h1 { font-size: clamp(25px, 6vw, 31px); }
  .page-head p { font-size: 13px; }
  .head-actions { width: 100%; justify-content: flex-start; }
  .head-actions .btn { min-height: 43px; font-size: 13px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 15px; }
  .stat { min-height: 91px; padding: 10px 11px; }
  .stat-top, .stat-bottom { font-size: 11px; }
  .stat-value { font-size: 24px; }
  .phase-tabs { padding: 10px 9px 0; }
  .phase-tab { font-size: 12px; padding: 6px 8px; }
  .board-tools { padding: 9px; }
  .board-wrap { padding: 12px 9px 17px; }
  .board.route-board { grid-auto-columns: minmax(204px, 1fr); min-width: calc(var(--columns) * 216px); }
  .clients-panel .table-scroll table { min-width: 680px; }
  .clients-panel :is(th, td):first-child { min-width: 118px; max-width: 150px; }
  .table-scroll :is(th, td) { padding-inline: 11px; }
  .panel-header { padding: 12px 14px; }
  .panel-header .filters { min-width: 0; }
  .task-list .task-row { flex-wrap: wrap; gap: 9px; }
  .task-list .task-row .task-details { min-width: 50%; }
  .task-list .task-row .due-chip { max-width: none; font-size: 11px; }
  .modal-backdrop { padding: 8px; }
  .modal, .modal.wide { max-height: calc(100dvh - 16px); }
  .modal-head { padding: 13px 14px; }
  .modal-head h2 { font-size: 20px; }
  .modal-body { padding: 15px 14px 17px; }
  .modal .form-error:not(:empty) { top: 63px; }
  .modal-body > form > .form-actions { margin: 18px -14px -17px; padding: 10px 14px max(10px, env(safe-area-inset-bottom)); }
  .modal-body > form > .form-actions .btn { min-height: 44px; white-space: normal; }
  .field :is(input:not([type='checkbox']):not([type='radio']), select, textarea) { font-size: 16px; }
  .client-drawer .drawer-head { position: static; padding: 13px 15px; }
  .client-drawer .drawer-body { padding: 14px 15px 21px; }
  .drawer-title { flex-wrap: wrap; }
  .drawer-title h2 { font-size: 23px; }
  .drawer-title > [data-action='edit-lead'] { margin: 0; }
  .drawer-phone-note { max-width: 100%; }
  .client-drawer .drawer-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .client-drawer .drawer-actions .btn { min-height: 42px; white-space: normal; }
  .client-drawer .drawer-body > .details-grid { gap: 11px; }
  .auth-art .brand-mark { width: 157px; height: 64px; }
  .auth-art h1 { font-size: 34px; }
  .auth-form { padding: 21px; }
}
@media (max-width: 370px) {
  .head-actions .btn { padding-inline: 8px; font-size: 12px; }
  .route-summary .text-link, .messages-intro .text-link { font-size: 11px; }
  .drawer-title .avatar { width: 35px; height: 35px; }
}

/* Premium dark workspace — graphite, brass and terracotta. */
:root {
  --bg: #111315;
  --paper: #191c1f;
  --ink: #f4efe7;
  --text: #ded8ce;
  --muted: #9b9a94;
  --line: #303337;
  --soft: #202428;
  --deep: #0b0d0f;
  --mint: #202a28;
  --accent: #d47855;
  --orange: #d47855;
  --accent-hover: #e38b65;
  --accent-soft: #3a2824;
  --shadow: 0 18px 52px rgba(0,0,0,.28);
}
body { background: #111315; color: var(--text); }
.sidebar { background: linear-gradient(180deg,#0a0c0e 0%,#111416 100%); border-right-color: #292c2f; }
.sidebar .brand { border-bottom-color: #292c2f; }
.sidebar .nav button, .sidebar .guide-nav { color: #b9b7b0; }
.sidebar .nav button:hover, .sidebar .guide-nav:hover { background: #24282b; color: #fffaf1; }
.sidebar .nav button.active { background: #302522; color: #fff5ec; }
.sidebar .nav button.active::before { background: var(--accent); }
.sidebar .nav button.active svg { color: var(--accent); }
.sidebar .nav .nav-count { background: #34373a; color: #f2d3c5; }
.sidebar-bottom .local-note { background: #171a1c; border-color: #303336; color: #969791; }
.local-note .line { color: #ddd5c9; }
.user-block { border-top-color: #303336; }
.user-block .avatar { color: #241714; background: #d59a7d; }
.user-info strong { color: #f6f0e8; }
.user-info small, .user-block .icon-button { color: #a6a5a0; }
.workspace { background: #111315; }
.topbar { background: rgba(20,23,25,.92); border-bottom-color: #2b2f32; }
.breadcrumb, .top-date { color: #8e918e; }
.breadcrumb strong { color: #e8e0d7; }
.search-box { background: #1a1d20; border-color: #35393c; }
.search-box input { color: #f0ebe3; }
.search-box input::placeholder { color: #858883; }
.main-content { background: radial-gradient(circle at 92% 0%, rgba(212,120,85,.08), transparent 30%); }
.eyebrow { color: #d58a6b; }
.page-head h1, .panel-header h2, .drawer-title h2, .empty-state h3, .section-title { color: #f5efe6; }
.page-head p, .panel-subtitle, .muted, .small { color: #9a9a95; }
.btn { background: #1c2023; border-color: #3a3e41; color: #eee8df; }
.btn:hover { background: #282c2f; border-color: #5a5d60; }
.btn-primary { background: linear-gradient(135deg,#c76448,#df8a63); border-color: #d47757; color: #fff9f3; box-shadow: 0 8px 22px rgba(197,91,62,.23); }
.btn-primary:hover { background: linear-gradient(135deg,#d47757,#e59a73); }
.btn-soft, .badge, .due-chip { background: #24282b; border-color: #34383b; color: #d9d3c9; }
.text-link { color: #e49a79; }
.stat, .board-panel, .content-panel { background: linear-gradient(145deg,#1b1f22,#171a1d); border-color: #303438; box-shadow: var(--shadow); }
.stat { position: relative; overflow: hidden; }
.stat::after { content: ''; position:absolute; right:-28px; bottom:-34px; width:110px; height:110px; border:1px solid rgba(212,120,85,.22); border-radius:50%; box-shadow:0 0 0 14px rgba(212,120,85,.045),0 0 0 29px rgba(212,120,85,.025); }
.stat-value { color: #fff7ed; }
.stat-top, .stat-bottom { color: #979995; }
.stat-icon { color: #e19370; background: #3a2723; border: 1px solid #5a3930; }
.panel-header { border-bottom-color: #2b2f32; }
.phase-tabs, .view-tabs { background: #171a1d; border-color: #2e3235; }
.phase-tab, .view-tab { color: #a6a59f; }
.phase-tab.active { background: #3a2824; color: #f0aa8e; }
.phase-tab span, .view-tab .tiny-count { background: #2b2f32; color: #d7a28d; }
.board-wrap { background: #111416; }
.board-column { background: #181c1f; border-color: #303438; }
.board-column-head { color: #c7c3ba; border-bottom-color: #303438; }
.lead-card, .task-row, .activity-item, .template-card, .route-step { background: #1b1f22; border-color: #303438; box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.lead-card:hover, .task-row:hover, .template-card:hover { border-color: #8a5140; transform: translateY(-1px); }
.lead-card h3, .task-title, .activity-title, .template-head h3, .route-step h2 { color: #f2ece3; }
.lead-card small, .task-sub, .activity-meta, .template-meta, .template-body, .route-owner, .route-goal, .route-step li, .route-step p { color: #9b9b95; }
.table-scroll table { color: #ddd8cf; }
.table-scroll th { color: #9d9c97; background: #171a1d; border-bottom-color: #34383b; }
.table-scroll td { border-bottom-color: #292d30; }
.table-scroll tr:hover td { background: #202427; }
.badge:is(.assigned, .call, .contacted, .qualification) { background:#202f3a; color:#a6cae4; border-color:#2b4859; }
.badge:is(.meeting, .meeting_done, .estimate, .estimate_ready, .presentation, .negotiation, .contract) { background:#312641; color:#d0b5ef; border-color:#4c3960; }
.badge:is(.won, .handoff, .preparation, .in_progress, .completed, .review, .accepted) { background:#1f3530; color:#a8d5c0; border-color:#315448; }
.badge:is(.paused, .no_answer, .pending, .queued) { background:#3a3020; color:#e6c28a; border-color:#5b472d; }
.badge:is(.lost, .failed, .blocked, .unknown) { background:#402522; color:#f0a597; border-color:#623a35; }
.due-chip { color:#b9cfe1; background:#202b34; }
.due-chip.today { color:#e9c68e; background:#3a3020; }
.due-chip.overdue { color:#f2aa9b; background:#402522; }
.demo-notice, .route-summary, .messages-intro, .help-note { background:#282722; border-color:#4a4336; color:#c6bdaf; }
.route-intro { background: linear-gradient(135deg,#25272a,#3a2925); border-color:#4f3730; }
.route-intro .eyebrow { color:#efaa8b; }
.route-intro h2 { color:#fff5ec; }
.route-intro p { color:#c9c0b6; }
.funnel-track { background:#2b3033 !important; box-shadow: inset 0 1px 2px rgba(0,0,0,.35); }
.funnel-bar { background: linear-gradient(90deg,#a94f38,#e2906d) !important; box-shadow: 0 0 13px rgba(212,120,85,.22); }
.funnel-label, .funnel-value, .analytics-note, .rop-summary small { color:#a5a59f; }
.amount-breakdown strong, .rop-summary strong { color:#e39773; }
.next-task-box { background:#202a2a; border-color:#34514a; }
.next-task-box.overdue { background:#382522; border-color:#6b3e35; }
.next-task-head, .next-task-foot small { color:#aaa9a2; }
.next-task-box p { color:#f1ebe1; }
.client-drawer, .modal { background:#181b1e; border-color:#363a3d; box-shadow:0 24px 80px rgba(0,0,0,.5); }
.drawer-kicker, .drawer-phone-note, .detail-item small { color:#92948f; }
.drawer-stage-label { color:#aaa9a2; }
.client-drawer .drawer-body > .details-grid { background:#1d2124; border-color:#303438; }
.detail-item strong, .notes-text, .personalized-message, .message-preview-top, .provider-payload { color:#e1dbd2; }
.facts-section, .client-drawer .drawer-facts { background:#181c1f; border-color:#303438; }
.facts-section > summary, .client-drawer .drawer-facts > summary { background:#222629; color:#eee8df; }
.facts-section > summary::after, .client-drawer .drawer-facts > summary::after { border-color:#d59a7d; }
.form-error { background:#402522; border-color:#74443b; color:#f3b0a2; }
.field label, .check-label { color:#d7d2c9; }
.field :is(input:not([type='checkbox']):not([type='radio']), select, textarea) { color:#eee9e1; background:#141719; border-color:#383d40; }
.field :is(input,select,textarea)::placeholder { color:#777b78; }
.field :is(input,select,textarea):focus { border-color:#d47757; box-shadow:0 0 0 3px rgba(212,120,85,.16); }
.integration-card, .message-job, .import-preview { background:#1b1f22; border-color:#303438; }
.auth-page, .auth-form-wrap { background:#111315; }
.auth-art { background: radial-gradient(ellipse at 80% 4%,#553329 0,#242426 46%,#0d0f10 100%); }
.auth-form { background:#1b1f22; border-color:#363a3d; }
.auth-form h2 { color:#f7f0e7; }
.auth-form > p, .auth-foot, .auth-art p, .auth-art-footer { color:#aaa9a3; }
.toast { background:#24282b; color:#f6efe6; border:1px solid #4b5053; }
@media (max-width: 700px) {
  .sidebar { background:#0a0c0e; border-bottom-color:#2c3033; }
  .topbar { background:#15181a; }
}
