:root {
  --canvas: #f4f6fa;
  --surface: #ffffff;
  --ink: #1b2b40;
  --muted: #65738a;
  --line: #e2e8f0;
  --sidebar: #172537;
  --sidebar-muted: #a7b6c8;
  --accent: #087e73;
  --accent-dark: #06665e;
  --accent-soft: #e7f4f0;
  --danger: #a52f3a;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  color: var(--ink);
  background: var(--canvas);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; font-size: 14px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 3px solid #26aa9b; outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--ink); line-height: 1.25; }
h1 { margin-bottom: 10px; font-size: clamp(26px, 2.6vw, 34px); font-weight: 650; letter-spacing: -.035em; }
h2 { margin-bottom: 5px; font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
h3 { font-size: 18px; font-weight: 650; }
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 100; padding: 10px 16px; background: var(--surface); border: 1px solid var(--accent); border-radius: 8px; transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }
.app-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; overflow-y: auto; padding: 28px 18px 20px; color: #f6f9fd; background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.brand strong { display: block; font-size: 23px; letter-spacing: -.025em; line-height: 1.15; }
.brand small { display: block; margin-top: 5px; color: var(--sidebar-muted); font-size: 11px; font-weight: 400; }
.brand-symbol { display: grid; grid-template-columns: repeat(2, 13px); grid-template-rows: repeat(2, 13px); gap: 3px; flex: 0 0 29px; transform: rotate(-4deg); }
.brand-symbol span { display: block; border-radius: 3px; background: #55c5ad; }
.brand-symbol span:first-child { background: #e6f8f2; }
.brand-symbol span:last-child { grid-column: 2; background: #2ba591; }
.sidebar > .brand { padding: 0 8px; }
.sidebar-section-label { margin: 43px 12px 12px; color: var(--sidebar-muted); font-size: 10px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }
.main-nav { display: flex; flex-direction: column; gap: 6px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 11px 13px; color: #c3cedd; border-radius: 9px; font-weight: 500; }
.nav-link:hover { color: #fff; background: #22354b; }
.nav-link.is-active { color: #fff; background: #2a4355; box-shadow: inset 3px 0 0 #58c5b0; }
.nav-mark { width: 15px; height: 15px; flex-shrink: 0; border: 1.5px solid currentColor; border-radius: 4px; opacity: .8; }
.sidebar-footer { display: flex; flex-direction: column; gap: 14px; margin-top: auto; padding: 20px 8px 0; border-top: 1px solid #334255; }
.user-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0; color: #b7eadd; background: #294c50; border-radius: 11px; font-size: 14px; font-weight: 650; }
.user-identity-text { min-width: 0; }
.user-identity-text strong { display: block; overflow: hidden; max-width: 148px; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.user-identity-text small { display: block; margin-top: 2px; color: var(--sidebar-muted); font-size: 11px; }
.logout-button { padding: 0; color: #b5c2d3; background: none; border: none; font-size: 12px; }
.logout-button:hover { color: #fff; text-decoration: underline; }
.app-content { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 77px; padding: 20px 38px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-title { font-size: 14px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.workspace-indicator { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.workspace-indicator > span { width: 6px; height: 6px; border-radius: 50%; background: #249c85; }
.page-content { max-width: 1500px; margin: 0 auto; padding: 37px 38px 50px; }
.page-content:focus, .auth-main:focus { outline: none; }
.page-heading, .page-header { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 28px; }
.page-heading > div { min-width: 0; }
.page-heading h1 { overflow-wrap: anywhere; }
.eyebrow { margin-bottom: 9px; color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.page-description { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 10px; min-height: 42px; padding: 10px 17px; border: 1px solid transparent; border-radius: 8px; font-size: 12px; font-weight: 600; line-height: 1.35; text-align: center; text-decoration: none; }
.button-primary { color: #fff; background: var(--accent); box-shadow: 0 3px 6px #087e7310; }
.button-primary:hover { color: #fff; background: var(--accent-dark); }
.button-secondary { color: var(--ink); background: var(--surface); border-color: #ced9e5; }
.button-secondary:hover { background: #f3f7f9; border-color: #b5c5d5; }
.button-ghost { color: var(--muted); background: transparent; }
.button-ghost:hover { color: var(--ink); background: #eaf0f5; }
.button-full { width: 100%; }
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 18px; margin-bottom: 25px; }
.metric-card { min-width: 0; padding: 22px 23px 19px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.metric-label { margin-bottom: 15px; color: var(--muted); font-size: 12px; }
.metric-value { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink); font-size: 32px; font-weight: 650; line-height: 1.2; letter-spacing: -.04em; }
.metric-arrow { display: inline-flex; align-items: center; justify-content: center; width: 29px; height: 29px; color: #7b8ba0; background: #f2f5f9; border-radius: 8px; font-size: 16px; font-weight: 400; }
.metric-value-link:hover { color: var(--accent); }
.metric-value-link:hover .metric-arrow { color: var(--accent); background: var(--accent-soft); }
.panel { margin-bottom: 24px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 23px 25px; border-bottom: 1px solid #edf0f5; }
.panel-header p { margin: 0; color: var(--muted); font-size: 12px; }
.badge { display: inline-flex; align-items: center; max-width: 100%; padding: 5px 9px; border-radius: 6px; font-size: 10px; font-weight: 600; line-height: 1.35; }
.badge-neutral { color: #52647a; background: #f0f3f8; }
.badge-accent { color: #076b61; background: var(--accent-soft); }
.empty-state { max-width: 440px; margin: 0 auto; padding: 42px 24px 47px; text-align: center; }
.empty-state-icon { display: flex; align-items: center; justify-content: center; width: 78px; height: 78px; margin: 0 auto 18px; color: #8597ad; background: #f4f7fa; border-radius: 24px; }
.empty-state h3 { margin-bottom: 9px; }
.empty-state p { margin-bottom: 22px; color: var(--muted); font-size: 12px; line-height: 1.75; }
.empty-state p:last-child { margin-bottom: 0; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
.data-table th { padding: 12px 25px; color: #6b7b91; background: #fbfcfe; border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 600; }
.data-table td { padding: 15px 25px; border-bottom: 1px solid #edf1f5; font-size: 12px; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fcfdfd; }
.table-primary { color: #26384e; font-weight: 600; }
.table-secondary { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; }
.text-right { text-align: right; }
.muted { color: var(--muted); }
.text-error, .errorlist { color: var(--danger); }
.setup-list { margin: 0; padding: 0 25px; list-style: none; }
.setup-list li { display: flex; align-items: center; gap: 12px; padding: 16px 0; border-bottom: 1px solid #edf1f5; }
.setup-list li:last-child { border: none; }
.setup-marker { width: 8px; height: 8px; flex: 0 0 8px; border: 2px solid #a7b8c8; border-radius: 50%; }
.setup-label { flex: 1; font-size: 12px; font-weight: 500; }
.setup-status { color: var(--muted); font-size: 11px; }
.messages { display: grid; gap: 10px; margin-bottom: 20px; }
.message { padding: 12px 15px; color: #145f54; background: #ecf8f3; border: 1px solid #bce2d3; border-radius: 8px; font-size: 12px; }
.message-error { color: #922c37; background: #fff2f3; border-color: #edc6ca; }
.message-warning { color: #805c1a; background: #fff8e9; border-color: #efdaa4; }
.message-info { color: #315780; background: #eef5fd; border-color: #ccddf1; }
.form-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.form-field label, .field-label { color: #35485e; font-size: 12px; font-weight: 600; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea { width: 100%; padding: 11px 12px; color: var(--ink); background: #fff; border: 1px solid #cdd7e3; border-radius: 7px; }
input:hover, select:hover, textarea:hover { border-color: #a0b2c6; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 3px solid #087e7315; outline-offset: 0; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #26aa9b; outline-offset: 2px; }
input[aria-invalid="true"] { border-color: #c87980; }
textarea { min-height: 100px; resize: vertical; }
.helptext, .field-help { color: var(--muted); font-size: 11px; }
.errorlist { margin: 2px 0 0; padding-left: 16px; font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.form-field-wide { grid-column: 1 / -1; }
.form-section { padding: 25px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 20px 25px; border-top: 1px solid var(--line); }
.stack { display: grid; gap: 18px; }
.auth-main { min-height: 100vh; padding: 40px; display: flex; align-items: center; justify-content: center; }
.auth-main > .messages { position: fixed; top: 16px; right: 20px; left: 20px; z-index: 2; }
.login-layout { display: grid; grid-template-columns: 1fr 1fr; width: min(100%, 1080px); min-height: 650px; overflow: hidden; background: var(--surface); border: 1px solid #e0e7ee; border-radius: 22px; box-shadow: 0 18px 70px #1b304710; }
.login-intro { position: relative; display: flex; flex-direction: column; padding: 43px 45px 32px; color: #e0e9f2; background: #172b3c; }
.brand-login strong { font-size: 25px; }
.brand-login small { margin-top: 4px; font-size: 11px; }
.login-intro-copy { padding: 76px 0 60px; }
.login-intro-copy .eyebrow { margin-bottom: 22px; color: #85cbbd; font-size: 9px; letter-spacing: .12em; }
.login-intro-title { margin-bottom: 24px; color: #fff; font-size: clamp(36px, 4vw, 51px); line-height: 1.17; font-weight: 550; letter-spacing: -.04em; }
.login-intro-title span { color: #6bd0b9; }
.login-intro-copy > p:last-child { max-width: 290px; margin-bottom: 0; color: #b1c2d1; font-size: 12px; line-height: 1.9; }
.intro-footer { display: flex; align-items: center; gap: 8px; margin-top: auto; color: #9fb6c8; font-size: 10px; }
.intro-dot { width: 5px; height: 5px; border-radius: 50%; background: #5ec7af; }
.login-form-side { display: flex; align-items: center; justify-content: center; position: relative; padding: 60px 55px; }
.login-card { width: 100%; max-width: 330px; }
.login-icon { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; margin-bottom: 23px; color: var(--accent); background: var(--accent-soft); border-radius: 13px; }
.login-card h1 { margin-bottom: 8px; font-size: 29px; font-weight: 650; letter-spacing: -.04em; }
.login-description { margin-bottom: 29px; color: var(--muted); font-size: 12px; }
.login-form { display: grid; gap: 19px; }
.login-form input { min-height: 46px; }
.login-form .button { justify-content: space-between; min-height: 46px; margin-top: 4px; padding-right: 14px; padding-left: 15px; font-size: 11px; }
.login-form .button span { font-size: 18px; font-weight: 400; }
.login-help { margin: 20px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.login-card > .message { margin-bottom: 20px; }
.login-bottom { position: absolute; right: 30px; bottom: 29px; left: 30px; color: #8794a6; font-size: 10px; text-align: center; }
.page-heading-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.view-switch { display: inline-flex; padding: 3px; background: #e9eef4; border: 1px solid #e0e7ef; border-radius: 9px; }
.view-switch a { padding: 7px 12px; color: #607187; border-radius: 6px; font-size: 11px; font-weight: 600; }
.view-switch a:hover { color: var(--ink); }
.view-switch .is-active { color: var(--ink); background: var(--surface); box-shadow: 0 1px 4px #1c344b10; }
.lead-filters { display: grid; grid-template-columns: minmax(180px, 1.5fr) repeat(3, minmax(130px, 1fr)) auto; align-items: end; gap: 12px; margin-bottom: 23px; padding: 19px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.lead-filters input, .lead-filters select { min-height: 40px; padding: 9px 10px; font-size: 12px; }
.lead-filters label { font-size: 10px; }
.filter-actions { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.filter-actions .button { min-height: 40px; }
.filter-reset { color: var(--muted); font-size: 11px; }
.filter-reset:hover { color: var(--accent); text-decoration: underline; }
.record-id { color: #668197; font-size: 11px; font-weight: 500; }
a.record-id:hover, a.record-link:hover { color: var(--accent); text-decoration: underline; }
.record-link { color: #243b50; font-weight: 600; }
.category-cell { max-width: 220px; white-space: normal; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 17px 25px; border-top: 1px solid var(--line); }
.pagination-summary, .pagination-current { color: var(--muted); font-size: 11px; }
.pagination-controls { display: flex; align-items: center; gap: 12px; }
.pagination .button { min-height: 34px; padding: 7px 10px; font-size: 10px; }
.board-scroll-hint { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 11px; color: var(--muted); font-size: 10px; }
.board-scroll-hint span { font-size: 17px; }
.lead-board { display: grid; grid-auto-flow: column; grid-auto-columns: 275px; gap: 15px; align-items: start; overflow-x: auto; padding: 0 1px 18px; scrollbar-color: #b8c5d2 #e7ecf2; scrollbar-width: thin; }
.board-column { min-width: 0; background: #ecf0f5; border: 1px solid #e0e7ee; border-top: 3px solid #bdc9d5; border-radius: 11px; }
.board-column:first-child { border-top-color: #419b8e; }
.board-column-header { padding: 16px 14px 14px; border-bottom: 1px solid #dfe6ee; }
.board-stage-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.board-stage-heading h2 { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 13px; letter-spacing: -.01em; }
.board-count { display: inline-flex; justify-content: center; align-items: center; min-width: 24px; min-height: 22px; padding: 2px 6px; color: #5f7288; background: #dfe6ed; border-radius: 6px; font-size: 10px; font-weight: 600; }
.board-stage-total { margin-top: 7px; color: #6c7d91; font-size: 11px; }
.board-column-body { display: grid; gap: 10px; min-height: 125px; padding: 11px; }
.lead-card { display: block; min-width: 0; padding: 14px 13px 12px; color: var(--ink); background: var(--surface); border: 1px solid #dde5ed; border-radius: 9px; box-shadow: 0 2px 3px #233a5004; }
.lead-card:hover { border-color: #9fbcb7; box-shadow: 0 3px 9px #203a5210; }
.lead-card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.lead-card-amount { color: #4f647a; font-size: 10px; font-weight: 600; }
.lead-card h3 { margin: 0 0 7px; overflow-wrap: anywhere; font-size: 13px; font-weight: 650; line-height: 1.5; letter-spacing: -.015em; }
.lead-card-contact { overflow-wrap: anywhere; color: #697a90; font-size: 11px; }
.lead-card-categories { margin-top: 13px; padding: 5px 7px; overflow-wrap: anywhere; color: #506f79; background: #edf5f5; border-radius: 5px; font-size: 10px; line-height: 1.5; }
.lead-card-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 13px; padding-top: 10px; color: #7d8ba0; border-top: 1px solid #edf1f5; font-size: 9px; }
.lead-card-footer > span { max-width: 60%; overflow-wrap: anywhere; }
.lead-card-source { text-align: right; }
.board-empty { align-self: center; margin: 0; padding: 22px 12px; color: #7b8b9e; font-size: 11px; text-align: center; }
.board-limit { margin: 3px 2px 5px; color: #6e7e92; font-size: 10px; line-height: 1.7; }
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 23px; color: #7f8da0; font-size: 11px; }
.breadcrumb a { color: #5c7389; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb > span[aria-hidden] { color: #b6c2ce; }
.lead-edit-form { max-width: 930px; }
.form-inline-notice { display: flex; align-items: center; gap: 8px; margin-bottom: 25px; padding: 11px 13px; color: #4f6975; background: #f0f7f7; border: 1px solid #d9e9e6; border-radius: 7px; font-size: 11px; }
.notice-dot { width: 6px; height: 6px; flex-shrink: 0; background: #419b8e; border-radius: 50%; }
.required-mark { color: #9b4350; }
.field-has-error input:not([type="checkbox"]):not([type="radio"]), .field-has-error select, .field-has-error textarea { border-color: #c87980; }
.field-errors .errorlist, .message .errorlist { margin: 0; padding-left: 16px; }
.form-section > .message { margin-bottom: 20px; }
.lead-detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 315px; gap: 24px; align-items: start; }
.lead-detail-layout > div, .lead-detail-sidebar { min-width: 0; }
.detail-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 25px 28px; margin: 0; padding: 25px; }
.detail-fields > div { min-width: 0; }
.detail-fields dt { margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.detail-fields dd { margin: 0; overflow-wrap: anywhere; color: #2d4057; font-size: 13px; font-weight: 500; }
.detail-field-wide { grid-column: 1 / -1; }
.detail-amount { padding-top: 20px; border-top: 1px solid var(--line); }
.detail-amount dd { font-size: 25px; font-weight: 650; letter-spacing: -.035em; }
.detail-amount dd > span { font-size: 17px; font-weight: 500; }
.detail-amount dd > span.muted { font-size: 13px; font-weight: 400; letter-spacing: 0; }
.current-stage { margin-bottom: 22px; padding: 7px 10px; font-size: 11px; }
.stage-form { display: grid; gap: 13px; }
.stage-help { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.linked-deal-panel .muted { margin-bottom: 18px; font-size: 12px; line-height: 1.7; }
.deal-filters { grid-template-columns: minmax(220px, 1.6fr) minmax(180px, 1fr) auto; }
.deal-card-contact-name { margin-bottom: 5px; color: #50647b; font-size: 11px; }
.linked-records { padding: 2px 25px; }
.linked-record-link { position: relative; display: block; padding: 17px 24px 17px 0; border-bottom: 1px solid #edf1f5; }
.linked-record-link:last-child { border-bottom: none; }
.linked-record-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.linked-record-link strong { display: block; overflow-wrap: anywhere; color: #2d4d61; font-size: 12px; font-weight: 600; }
.linked-record-link:hover strong { color: var(--accent); text-decoration: underline; }
.linked-record-arrow { position: absolute; top: 22px; right: 0; color: #8da0b0; font-size: 17px; }
@media (min-width: 1600px) { .page-content { padding-top: 45px; } }
@media (max-width: 1200px) {
  .lead-filters:not(.deal-filters) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lead-filters:not(.deal-filters) .lead-filter-search { grid-column: span 2; }
}
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 212px minmax(0, 1fr); }
  .sidebar { padding-right: 14px; padding-left: 14px; }
  .topbar { padding-right: 26px; padding-left: 26px; }
  .page-content { padding: 30px 26px 40px; }
  .login-intro { padding-right: 32px; padding-left: 32px; }
  .login-form-side { padding-right: 35px; padding-left: 35px; }
  .lead-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lead-filter-search { grid-column: span 2; }
  .lead-detail-layout { grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; padding: 17px 20px 13px; }
  .sidebar > .brand { padding: 0; }
  .brand strong { font-size: 20px; }
  .brand small { margin-top: 3px; font-size: 10px; }
  .sidebar-section-label { display: none; }
  .main-nav { flex-direction: row; gap: 7px; overflow-x: auto; margin-top: 18px; padding-bottom: 4px; }
  .nav-link { flex-shrink: 0; min-height: 38px; padding: 9px 12px; font-size: 12px; }
  .nav-mark { width: 12px; height: 12px; }
  .nav-link.is-active { box-shadow: none; }
  .sidebar-footer { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; padding: 13px 0 0; }
  .user-avatar { width: 29px; height: 29px; border-radius: 8px; font-size: 11px; }
  .user-identity-text strong { max-width: 220px; font-size: 11px; }
  .user-identity-text small { font-size: 10px; }
  .topbar { min-height: 58px; padding: 16px 20px; }
  .workspace-indicator { font-size: 10px; }
  .page-content { padding: 26px 20px 35px; }
  .page-heading, .page-header { align-items: flex-start; flex-direction: column; gap: 17px; margin-bottom: 23px; }
  h1 { font-size: 27px; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
  .metric-card { padding: 18px; }
  .metric-label { margin-bottom: 12px; }
  .metric-value { font-size: 28px; }
  .panel-header { padding: 20px; }
  .panel-header h2 { font-size: 16px; }
  .panel-header p { font-size: 11px; }
  .data-table th, .data-table td { padding-right: 20px; padding-left: 20px; }
  .setup-list { padding: 0 20px; }
  .setup-status { max-width: 105px; text-align: right; }
  .form-grid { grid-template-columns: 1fr; gap: 18px; }
  .form-section { padding: 20px; }
  .form-actions { padding: 18px 20px; }
  .auth-main { padding: 24px; }
  .login-layout { grid-template-columns: 1fr; max-width: 440px; min-height: auto; border-radius: 17px; }
  .login-intro { padding: 24px 30px; }
  .login-intro-copy, .intro-footer { display: none; }
  .login-form-side { padding: 35px 30px 62px; }
  .login-card { max-width: none; }
  .login-icon { margin-bottom: 18px; }
  .login-card h1 { font-size: 27px; }
  .login-bottom { bottom: 22px; }
  .lead-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; padding: 17px; }
  .lead-filters:not(.deal-filters) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lead-filter-search { grid-column: 1 / -1; }
  .lead-filters:not(.deal-filters) .lead-filter-search { grid-column: 1 / -1; }
  .filter-actions { align-self: end; }
  .page-heading-actions { width: 100%; gap: 10px; }
  .page-heading-actions > .button { margin-left: auto; }
  .pagination { align-items: flex-start; flex-direction: column; gap: 12px; padding: 16px 20px; }
  .pagination-controls { width: 100%; justify-content: space-between; }
  .lead-board { grid-auto-columns: 265px; }
  .lead-detail-layout { grid-template-columns: 1fr; gap: 0; }
  .detail-fields { gap: 23px 20px; padding: 20px; }
  .breadcrumb { margin-bottom: 19px; }
  .deal-filter-search { grid-column: 1 / -1; }
  .linked-records { padding-right: 20px; padding-left: 20px; }
}
@media (max-width: 390px) {
  .page-content { padding-right: 15px; padding-left: 15px; }
  .metrics-grid { grid-template-columns: 1fr; }
  .workspace-indicator { display: none; }
  .auth-main { padding: 15px; }
  .login-form-side { padding-right: 24px; padding-left: 24px; }
  .lead-filters { grid-template-columns: 1fr; }
  .lead-filters:not(.deal-filters) { grid-template-columns: 1fr; }
  .lead-filter-search { grid-column: auto; }
  .lead-filters:not(.deal-filters) .lead-filter-search { grid-column: auto; }
  .filter-actions { justify-content: flex-start; }
  .detail-fields { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }

/* Shared workspaces and record drawer. */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.crm-common-search { display: flex; align-items: center; flex: 1; min-width: 180px; max-width: 590px; overflow: hidden; background: #f5f7fa; border: 1px solid #dfe6ee; border-radius: 8px; }
.crm-common-search input:not([type=hidden]) { flex: 1; min-width: 0; width: 0; padding: 9px 11px; background: transparent; border: none; border-radius: 0; font-size: 12px; }
.crm-common-search select { width: 148px; padding: 8px 5px; background: transparent; border: none; border-left: 1px solid #dde5ed; border-radius: 0; font-size: 10px; }
.crm-search-submit { align-self: stretch; width: 35px; color: var(--accent); background: transparent; border: none; font-size: 22px; }
.crm-workspace-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 18px; }
.crm-toolbar-buttons, .crm-collection-totals { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.crm-collection-totals strong { color: #344b60; font-size: 13px; font-weight: 650; }
.crm-collection-totals > span { color: #63768b; font-size: 12px; }
.crm-collection-totals > small { font-size: 10px; }
.crm-filter-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 0 0 19px; }
.crm-filter-chip, .crm-sort-chip { max-width: 100%; padding: 5px 8px; overflow-wrap: anywhere; color: #506c7e; background: #eaf1f5; border: 1px solid #dce7ec; border-radius: 6px; font-size: 10px; text-align: left; }
.crm-filter-chip:hover { color: var(--accent); border-color: #a9cec4; }
.crm-sort-chip { color: #68798e; background: transparent; border-color: #e1e7ef; }
.crm-inline-button { padding: 4px 0; color: var(--accent); background: transparent; border: 0; font-size: 11px; font-weight: 600; text-align: left; }
.crm-inline-button:hover { text-decoration: underline; }
#crm-section-content[aria-busy=true] { opacity: .65; pointer-events: none; }
.crm-record-table { min-width: 100%; table-layout: fixed; }
.crm-record-table th { position: relative; padding: 11px 15px; vertical-align: middle; }
.crm-record-table td { padding: 15px; overflow-wrap: anywhere; vertical-align: top; white-space: normal; }
.crm-record-table tbody tr { cursor: pointer; }
.crm-record-table .record-link { display: inline-block; line-height: 1.6; }
.crm-column-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.crm-sort-button { display: inline; padding: 0; color: inherit; background: none; border: 0; font: inherit; font-weight: 600; line-height: 1.6; text-align: left; white-space: normal; }
.crm-sort-button:hover { color: var(--accent); }
.crm-column-filter { flex: 0 0 18px; padding: 0; color: #7c8e9f; background: none; border: 0; font-size: 16px; line-height: 1.2; }
.crm-column-filter:hover { color: var(--accent); }
.crm-column-resizer { position: absolute; z-index: 1; top: 0; right: 0; width: 9px; height: 100%; cursor: col-resize; touch-action: none; }
.crm-column-resizer::after { position: absolute; top: 25%; right: 3px; width: 2px; height: 50%; background: #d6e1e9; content: ''; }
.crm-column-resizer:hover::after, .crm-column-resizer:focus::after { background: var(--accent); }
.crm-is-resizing, .crm-is-resizing * { cursor: col-resize !important; user-select: none !important; }
.crm-action-summary { display: grid; gap: 4px; max-width: 100%; line-height: 1.5; }
.crm-action-summary strong { font-size: 11px; font-weight: 550; }
.crm-action-summary small { color: #718296; font-size: 10px; }
.crm-action-summary.is-overdue { color: #a33741; }
.crm-action-summary .crm-action-overdue, .crm-action-overdue { color: #a33741; font-size: 11px; font-weight: 600; }
.crm-kanban { grid-auto-columns: 286px; padding-bottom: 22px; }
.crm-kanban-card { position: relative; cursor: grab; user-select: none; }
.crm-kanban-card a { user-select: text; }
.crm-kanban-card.is-dragging { opacity: .4; }
.crm-kanban-card.is-stage-pending { opacity: .55; pointer-events: none; cursor: progress; }
.crm-stage-column { min-height: 230px; transition: border-color .12s ease, background .12s ease; }
.crm-stage-column.is-drop-target { background: #e1f3ec; border-color: #4fa590; box-shadow: inset 0 0 0 1px #4fa590; }
.crm-card-action { margin-top: 12px; padding: 10px 0 0; border-top: 1px solid #edf1f5; }
.crm-card-action .muted { font-size: 10px; }
.crm-card-menu { position: relative; margin-left: auto; }
.crm-card-menu summary { display: flex; align-items: center; justify-content: center; width: 25px; height: 20px; margin: -2px -4px 0 0; color: #75899b; border-radius: 4px; cursor: pointer; list-style: none; font-size: 18px; }
.crm-card-menu summary::-webkit-details-marker { display: none; }
.crm-card-menu summary:hover { color: var(--accent); background: #edf4f5; }
.crm-card-menu > button { position: absolute; z-index: 4; top: 23px; right: -2px; min-width: 155px; padding: 11px 13px; color: #314e61; background: #fff; border: 1px solid #d7e3e9; border-radius: 7px; box-shadow: 0 5px 18px #243b5420; font-size: 11px; text-align: left; }
.crm-kanban .pagination { display: block; padding: 10px 1px; border: 0; }
.crm-kanban .pagination-summary { display: block; margin-bottom: 9px; font-size: 10px; }
.crm-kanban .pagination-controls { display: flex; justify-content: space-between; gap: 7px; }
.crm-kanban .pagination .button { padding: 5px 7px; font-size: 10px; }
.crm-panel-open { overflow: hidden; padding-right: var(--crm-scrollbar-gap, 0); }
.crm-drawer-overlay { position: fixed; z-index: 100; inset: 0; display: flex; justify-content: flex-end; }
.crm-drawer-scrim { position: absolute; inset: 0; background: #10243666; }
.crm-record-drawer { position: relative; width: min(750px, 100vw); height: 100vh; height: 100dvh; max-width: 100%; overflow: hidden; background: var(--surface); box-shadow: -14px 0 55px #10243625; }
#crm-record-content { height: 100%; }
.crm-panel-form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; min-height: 0; margin: 0; overflow: hidden; }
.crm-panel-header { position: relative; z-index: 2; padding: 20px 27px 19px; background: #fff; border-bottom: 1px solid var(--line); }
.crm-panel-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.crm-panel-toolbar .crm-panel-header-actions { margin-left: auto; }
.crm-panel-type { color: #78899b; font-size: 11px; font-weight: 600; }
.crm-panel-header-actions { display: flex; align-items: center; gap: 5px; }
.crm-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 32px; min-width: 32px; height: 32px; padding: 0; color: #6c8095; background: transparent; border: 1px solid transparent; border-radius: 7px; font-size: 22px; line-height: 1; }
.crm-icon-button:hover { color: var(--accent); background: #edf5f3; }
.crm-icon-button:disabled { opacity: .35; }
.crm-panel-back { min-height: 30px; padding: 5px 9px; margin-left: -9px; font-size: 11px; }
.crm-panel-header h2 { max-width: 100%; margin: 0 0 10px; overflow-wrap: anywhere; color: #263f55; font-size: 23px; font-weight: 650; line-height: 1.4; letter-spacing: -.025em; }
.crm-panel-header h2:focus { outline: none; }
.crm-panel-scroll { min-height: 0; overflow-y: auto; padding: 26px 28px 20px; overscroll-behavior: contain; }
.crm-panel-scroll .detail-fields { padding: 0; }
.crm-record-fieldset { min-width: 0; margin: 0 0 30px; padding: 0; border: 0; }
.crm-record-fieldset legend, .crm-record-fieldset h3 { display: block; width: 100%; margin: 0 0 17px; padding: 0 0 13px; color: #344d62; border-bottom: 1px solid #e7edf2; font-size: 15px; font-weight: 650; }
.crm-record-fieldset .form-grid { gap: 19px; }
.crm-record-fieldset .form-field label { font-size: 11px; }
.crm-record-fieldset input:not([type=hidden]), .crm-record-fieldset select, .crm-record-fieldset textarea { font-size: 13px; }
.crm-record-fieldset textarea { min-height: 95px; }
.crm-panel-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 27px; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 15px #233c5205; }
.crm-panel-save-status { flex: 1; color: #7d8c9f; font-size: 10px; }
.crm-panel-feedback { margin-bottom: 22px; }
.crm-panel-relations { display: grid; gap: 9px; }
.crm-panel-relations a { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 12px 13px; overflow-wrap: anywhere; color: #287c70; background: #edf7f3; border: 1px solid #dcece5; border-radius: 7px; font-size: 12px; font-weight: 550; }
.crm-standalone-note { margin: -8px 0 25px; color: var(--muted); font-size: 11px; }
.crm-record-history { margin: 0; padding: 0; list-style: none; }
.crm-record-history > li { position: relative; margin-left: 4px; padding: 0 0 23px 19px; border-left: 1px solid #dce6ed; }
.crm-record-history > li::before { position: absolute; top: 4px; left: -4px; width: 7px; height: 7px; background: #a8c7bd; border: 1px solid #fff; border-radius: 50%; content: ''; }
.crm-record-history > li:last-child { padding-bottom: 0; border-left-color: transparent; }
.crm-history-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 7px; color: #7a8c9f; font-size: 10px; }
.crm-record-history p { margin-bottom: 7px; color: #415a70; font-size: 12px; line-height: 1.7; }
.crm-record-history ul { margin: 5px 0 8px; padding-left: 17px; color: #6b7f92; font-size: 11px; line-height: 1.8; overflow-wrap: anywhere; }
.crm-record-history > li > a { font-size: 11px; }
.crm-record-history .crm-history-empty { margin-left: 0; padding-left: 0; color: #7c8c9f; border: 0; font-size: 12px; }
.crm-record-history .crm-history-empty::before { display: none; }
.crm-duplicates { margin: -4px 0 27px; padding: 16px; background: #fffaf0; border: 1px solid #eddfbb; border-radius: 9px; }
.crm-duplicates h3 { margin-bottom: 7px; color: #86662c; font-size: 13px; }
.crm-duplicates > p { margin-bottom: 13px; color: #8a795b; font-size: 11px; line-height: 1.7; }
.crm-duplicates .crm-search-result { margin-bottom: 7px; padding: 11px; background: #fff; }
.crm-dialog { width: min(640px, calc(100vw - 30px)); max-height: calc(100vh - 45px); max-height: calc(100dvh - 45px); padding: 0; overflow: hidden; color: var(--ink); background: var(--surface); border: 1px solid #d8e3eb; border-radius: 13px; box-shadow: 0 18px 70px #122b4040; }
.crm-dialog[open] { display: flex; flex-direction: column; }
.crm-dialog::backdrop { background: #10243666; }
.crm-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.crm-dialog-header h2 { margin: 0; font-size: 18px; }
.crm-dialog-body { min-height: 0; overflow-y: auto; padding: 24px; }
.crm-dialog-body > p { color: var(--muted); font-size: 12px; line-height: 1.8; }
.crm-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 17px 24px; border-top: 1px solid var(--line); }
.crm-filter-dialog > form { display: flex; flex-direction: column; min-height: 0; }
.crm-stage-options { margin: 0; padding: 13px 15px; background: #f8fafc; border: 1px solid #e2e9ef; border-radius: 8px; }
.crm-stage-options legend { padding: 0 5px; color: #536b80; font-size: 11px; font-weight: 600; }
.crm-check-option { display: inline-flex; align-items: center; gap: 8px; margin: 6px 14px 6px 0; color: #536a7f; font-size: 11px; cursor: pointer; }
.crm-check-option input { accent-color: var(--accent); }
.crm-dirty-dialog { max-width: 520px; }
.crm-dirty-actions { display: grid; grid-template-columns: 1fr; gap: 9px; }
.crm-dirty-actions .button { width: 100%; }
.crm-column-options { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.crm-column-option { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 8px; background: #f8fafc; border: 1px solid #e1e9ef; border-radius: 7px; }
.crm-column-drag-handle { color: #a3b2c0; cursor: grab; }
.crm-column-option-label { flex: 1; min-width: 0; font-size: 11px; }
.crm-column-option input[type=checkbox] { accent-color: var(--accent); }
.crm-column-option input[type=number] { flex: 0 0 70px; width: 70px; padding: 7px; font-size: 11px; }
.crm-column-option .crm-icon-button { width: 27px; min-width: 27px; height: 27px; font-size: 16px; }
.crm-search-dialog { width: min(700px, calc(100vw - 30px)); }
.crm-global-query-wrap { display: flex; align-items: center; gap: 6px; position: sticky; z-index: 1; top: -24px; margin: -4px 0 19px; padding: 4px 0 12px; background: #fff; }
.crm-search-result { display: block; margin-bottom: 9px; padding: 15px; color: #354f65; background: #fbfcfe; border: 1px solid #dfe7ef; border-radius: 8px; }
.crm-search-result:hover { background: #f0f8f5; border-color: #b5d5ca; }
.crm-search-result-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 9px; color: #7a8c9f; font-size: 10px; }
.crm-search-result > strong { display: block; overflow-wrap: anywhere; font-size: 13px; font-weight: 600; }
.crm-search-result > small { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }
.crm-search-empty, .crm-loading { padding: 28px 10px; color: var(--muted); font-size: 12px; text-align: center; }
.bukvion-contact { padding: 16px 0; border-top: 1px solid var(--line); }
.crm-legacy-number { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; font-weight: 400; overflow-wrap: anywhere; }
.bukvion-contact h4 { margin: 0 0 14px; }
.crm-panel-load-error { padding: 25px 0; }
.crm-panel-load-error p { color: var(--muted); font-size: 13px; line-height: 1.8; }
.crm-toasts { position: fixed; z-index: 130; right: 24px; bottom: 24px; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; pointer-events: none; }
.crm-panel-open .crm-toasts { bottom: calc(98px + env(safe-area-inset-bottom, 0px)); max-height: min(50vh, calc(100dvh - 200px)); }
.crm-toast { position: relative; padding: 16px 38px 16px 18px; color: #355f54; background: #f1faf6; border: 1px solid #bcdccb; border-radius: 10px; box-shadow: 0 8px 27px #193e5520; pointer-events: auto; }
.crm-toast.is-error { color: #943a44; background: #fff5f5; border-color: #e8c3c7; }
.crm-toast p { margin: 0; font-size: 12px; line-height: 1.7; }
.crm-toast > a, .crm-toast > .crm-inline-button { display: inline-block; margin-top: 8px; font-size: 11px; }
.crm-toast-close { position: absolute; top: 7px; right: 8px; width: 25px; height: 25px; color: inherit; background: transparent; border: 0; border-radius: 5px; font-size: 19px; }
.crm-canonical-record { height: 85vh; margin-top: 25px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
@media (max-width: 1200px) { .topbar-actions .workspace-indicator { display: none; } .crm-common-search { max-width: none; } }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 11px; }
  .topbar-title { order: 1; }
  .topbar-actions { order: 2; margin-left: auto; }
  .crm-common-search { order: 3; flex-basis: 100%; max-width: none; }
  .crm-common-search select { width: 132px; font-size: 9px; }
  .crm-common-search input:not([type=hidden]) { font-size: 11px; }
  .crm-workspace-heading .page-heading-actions { align-items: center; }
  .crm-workspace-toolbar { align-items: flex-start; flex-direction: column; gap: 13px; }
  .crm-toolbar-buttons { width: 100%; gap: 8px; }
  .crm-toolbar-buttons .button { min-height: 38px; padding: 8px 11px; font-size: 10px; }
  .crm-kanban { grid-auto-columns: 265px; }
  .crm-record-drawer { width: 100vw; }
  .crm-panel-header { padding: 16px 20px; }
  .crm-panel-header h2 { font-size: 20px; }
  .crm-panel-scroll { padding: 22px 20px; }
  .crm-panel-footer { gap: 8px; padding: 13px 20px; padding-bottom: max(13px, env(safe-area-inset-bottom)); }
  .crm-panel-save-status { max-width: 120px; font-size: 9px; }
  .crm-panel-footer .button { min-height: 40px; padding: 9px 12px; font-size: 11px; }
  .crm-dialog-header { padding: 17px 18px; }
  .crm-dialog-body { padding: 20px 18px; }
  .crm-dialog-actions { padding: 15px 18px; }
  .crm-global-query-wrap { top: -20px; }
  .crm-toasts { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) { .crm-stage-column { transition: none; } }
