:root {
    --ink: #172033; --muted: #6b7280; --line: #e5e7eb; --surface: #ffffff;
    --canvas: #f6f7fb; --navy: #101827; --blue: #275fe8; --blue-soft: #eaf0ff;
    --green: #16a36a; --red: #dc4747; --amber: #d99113; --radius: 18px;
    --shadow: 0 20px 60px rgba(20, 31, 56, .12);
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; min-height: 100%; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--canvas); }
  button, input, select, textarea { font: inherit; }
  button { cursor: pointer; }
  .hidden { display: none !important; }
  .service-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; padding: 16px 20px; background: #fff5f3; border: 1px solid #f0b9b2; border-radius: 14px; color: #8e3027; }
  .service-banner p { margin: 6px 0 0; font-size: 13px; line-height: 1.5; }
  .service-banner.warning { background: #fffaf0; border-color: #eed7a6; color: #785515; }
  .service-banner .button-row { flex-shrink: 0; }
  .form-feedback { margin: 14px 0 0; padding: 12px 14px; border-radius: 10px; line-height: 1.5; font-size: 13px; overflow-wrap: anywhere; }
  .form-feedback:empty { display: none; }
  .form-feedback.error { background: #fff0ee; border: 1px solid #f1c1ba; color: #9a3026; }
  .form-feedback.pending { background: #edf7f4; border: 1px solid #beded5; color: #155e51; }
  label.required-label { position: relative; }
  label.required-label > input, label.required-label > select, label.required-label > textarea { border-left: 3px solid #148373; }
  input:user-invalid, select:user-invalid, textarea:user-invalid { border-color: #cf493c; background: #fffafa; }
  @media (max-width: 760px) { .service-banner { flex-direction: column; align-items: stretch; padding: 14px; } .service-banner .button-row { flex-wrap: wrap; } .service-banner .btn { flex: 1; min-height: 44px; } .modal-actions { position: sticky; bottom: 0; background: white; padding: 14px 0; border-top: 1px solid #e5ebe8; z-index: 2; } }
  .muted { color: var(--muted); }
  .eyebrow { margin: 0 0 5px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
  .brand-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; color: white; background: linear-gradient(145deg, #326cff, #7047d8); font-weight: 900; font-size: 27px; box-shadow: 0 14px 30px rgba(39,95,232,.28); }
  .brand-mark.small { width: 38px; height: 38px; border-radius: 12px; font-size: 18px; box-shadow: none; }

  .auth-screen { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 540px) minmax(0, 440px); align-content: center; justify-content: center; gap: 24px; padding: 32px; background: radial-gradient(circle at 10% 15%, #e3ebff 0, transparent 38%), #f5f7fb; }
  .auth-card { min-width: 0; width: 100%; align-self: center; padding: 36px; background: white; border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 16px 50px rgba(20,31,56,.07); }
  .auth-card h1 { margin: 10px 0 8px; font-size: 28px; letter-spacing: -.035em; }
  .auth-copy { color: var(--muted); line-height: 1.6; font-size: 14px; margin: 0 0 22px; }
  .auth-story { min-width: 0; padding: 40px; border-radius: 24px; background: linear-gradient(145deg,#142442,#254586); color: white; }
  .auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 46px; font-size: 18px; }
  .auth-story .eyebrow { color: #abc7ff; font-size: 10px; }
  .auth-story h2 { font-size: clamp(30px,3vw,42px); line-height: 1.15; margin: 14px 0 18px; letter-spacing: -.04em; }
  .auth-story > p:not(.eyebrow) { max-width: 380px; color: #c0cee6; line-height: 1.65; font-size: 14px; }
  .auth-features { display: grid; gap: 16px; margin: 30px 0; }
  .auth-features > span { display: flex; align-items: center; gap: 18px; color: #8eafe5; font-size: 12px; }
  .auth-features strong { color: #e7efff; font-size: 13px; font-weight: 600; }
  .auth-story .auth-story-footer { border-top: 1px solid #46618e; padding-top: 20px; font-size: 11px !important; margin: 32px 0 0; }
  .auth-mobile-brand { display: none; }
  .portal-switch { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; padding: 5px; margin-bottom: 24px; background: #f0f3f9; border: 1px solid #e9edf5; border-radius: 12px; }
  .portal-switch button { min-height: 42px; border: 0; border-radius: 8px; background: transparent; color: #58657c; font-size: 13px; font-weight: 750; }
  .portal-switch button[aria-pressed="true"] { color: #2556c8; background: white; box-shadow: 0 2px 7px #17203312; }
  .portal-switch button:disabled { cursor: wait; }
  .login-note { font-size: 12px; line-height: 1.6; color: var(--muted); margin: 0 0 18px; }
  .first-run { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; margin-bottom: 18px; border-radius: 13px; background: var(--blue-soft); }
  .first-run span { color: var(--muted); font-size: 13px; }
  .version { margin: 24px 0 0; text-align: center; color: #9ca3af; font-size: 12px; }
  .auth-portal-link { display: block; text-align: center; margin-top: 18px; font-size: 12px; font-weight: 700; color: var(--blue); text-decoration: none; }
  .portal-nav-link { text-decoration: none; }
  a.shortcut-card { text-decoration: none; color: var(--ink); }
  body[data-workspace="SALES"] { --blue: #087f72; --blue-soft: #e7f6f1; --navy: #102a29; --canvas: #f5f8f7; }
  body[data-workspace="SALES"] .brand-mark { background: linear-gradient(145deg,#169e87,#076557); }
  body[data-workspace="SALES"] .auth-story { background: linear-gradient(145deg,#123c37,#126f60); }
  body[data-workspace="SALES"] .auth-story .eyebrow, body[data-workspace="SALES"] .auth-features > span { color: #93d7c5; }
  body[data-workspace="SALES"] .auth-story > p:not(.eyebrow) { color: #c7e5dd; }
  body[data-workspace="SALES"] .auth-features strong { color: #e6f8f2; }
  body[data-workspace="SALES"] .auth-story-footer { border-color: #4b8d80; }
  body[data-workspace="SALES"] .portal-switch button[aria-pressed="true"] { color: #087f72; }
  body[data-workspace="SALES"] .btn.primary:hover { background: #066b5e; }
  body[data-workspace="SALES"] .nav-item.active { background: #244d46; }
  body[data-workspace="SALES"] .nav-item.active span { color: #9be0cc; }
  .sales-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 22px; padding: 30px; border-radius: 22px; color: white; background: linear-gradient(115deg,#123c37,#197c68); }
  .sales-hero .eyebrow { color: #a4e5d1; }
  .sales-hero h1 { margin: 10px 0; font-size: clamp(28px,3vw,38px); line-height: 1.15; letter-spacing: -.04em; }
  .sales-hero p:not(.eyebrow) { max-width: 550px; margin: 0 0 16px; color: #d4eee4; font-size: 13px; line-height: 1.6; }
  .sales-hero .btn.primary { flex-shrink: 0; background: white; color: #076557; }
  .sales-connection { display: inline-block; font-size: 11px; color: #c2e9db; padding-top: 4px; }
  .sales-home-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
  .sales-home-toolbar label { width: 210px; margin: 0; }
  .metric-grid.sales-home-metrics { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .sales-home-metrics .metric strong { font-size: clamp(18px,2.2vw,28px); overflow-wrap: anywhere; }
  .sales-home-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.2fr); gap: 18px; margin-bottom: 18px; }
  .priority-row { display: flex; align-items: center; width: 100%; gap: 14px; padding: 16px 20px; border: 0; border-top: 1px solid var(--line); background: white; color: var(--ink); text-align: left; }
  .priority-row:hover { background: #f5faf8; }
  .priority-count { display: grid; place-items: center; min-width: 42px; min-height: 42px; padding: 5px; border-radius: 12px; font-weight: 800; font-size: 19px; color: #087f72; background: #e7f6f1; }
  .priority-count.attention { color: #b57217; background: #fff5e1; }
  .priority-copy { flex: 1; min-width: 0; }
  .priority-copy strong, .priority-copy small { display: block; }
  .priority-copy strong { font-size: 13px; }
  .priority-copy small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.5; }
  .sales-context { margin: 8px 20px 20px; padding: 14px; border-radius: 12px; background: #f2f7f5; font-size: 12px; line-height: 1.8; color: #506861; }
  .performance-row { padding: 16px 20px; border-top: 1px solid var(--line); }
  .performance-head, .performance-detail { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
  .performance-head strong { font-size: 13px; overflow-wrap: anywhere; }
  .performance-head span { font-size: 11px; color: var(--blue); font-weight: 700; }
  .performance-track { height: 6px; margin: 11px 0 8px; background: #eef3f1; border-radius: 10px; overflow: hidden; }
  .performance-track span { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
  .performance-detail { font-size: 11px; color: var(--muted); }
  .sales-work-panel { margin-bottom: 22px; }
  .sales-work-filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px 16px; }
  .sales-work-filters button { padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--muted); font-size: 11px; }
  .sales-work-filters button[aria-pressed="true"] { color: var(--blue); background: var(--blue-soft); border-color: #b6dcd3; font-weight: 800; }
  .sales-work-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; padding: 20px; border-top: 1px solid var(--line); }
  .sales-work-row > div:first-child { flex: 1; min-width: 180px; }
  .sales-work-row h4 { margin: 9px 0 4px; font-size: 15px; overflow-wrap: anywhere; }
  .sales-work-row p { font-size: 12px; color: var(--muted); margin: 4px 0 8px; line-height: 1.7; overflow-wrap: anywhere; }
  .sales-work-row small { font-size: 10px; color: var(--muted); }
  .work-label { display: inline-block; font-size: 9px; font-weight: 800; color: #087f72; background: #e7f6f1; padding: 4px 8px; border-radius: 6px; }
  .work-label.overdue { color: #a05910; background: #fff3dc; }
  #sales-work-status { margin: 0; padding: 12px 20px; border-top: 1px solid var(--line); }
  .sales-monthly-disclosure { padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: white; }
  .sales-monthly-disclosure > summary { cursor: pointer; font-size: 14px; font-weight: 800; color: var(--ink); }
  .sales-monthly-disclosure > summary span { display: block; margin: 6px 0 0 17px; color: var(--muted); font-size: 11px; font-weight: 400; }
  .sales-monthly-disclosure[open] > summary { margin-bottom: 24px; }
  .sales-step-links { display: flex; gap: 7px; padding: 0 22px 20px; }
  .sales-step-links button { flex: 1; padding: 10px 6px; font-size: 11px; font-weight: 800; border: 1px solid #cce5dd; border-radius: 9px; color: var(--blue); background: var(--blue-soft); }
  .sales-lead-workflow { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 20px; padding: 0 22px 22px; }
  .sales-result-column { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
  .sales-chat-section, .sales-result-form { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 14px; }
  .sales-chat-section > h3, .sales-result-form > h3 { margin: 0 0 12px; font-size: 14px; }
  .sales-chat-section > p { font-size: 12px; line-height: 1.7; color: var(--muted); }
  .sales-result-form { background: #f5faf8; }
  .sales-result-form fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
  .sales-result-form label { font-size: 12px; }
  .sales-result-form input, .sales-result-form select, .sales-result-form textarea { font-size: 13px; }
  .next-step-fields { margin: 18px 0; padding-top: 16px; border-top: 1px solid #dbeae5; }
  .next-step-fields > strong { display: block; font-size: 11px; margin-bottom: 14px; }
  .sales-opportunity-panel { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: white; }
  .sales-opportunity-panel > h3 { margin: 0 0 10px; font-size: 14px; }
  .sales-opportunity-panel .won-readiness { margin: 12px 0; }
  .sales-more-actions { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
  .sales-more-actions > summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 800; }
  .sales-more-actions[open] > summary { margin-bottom: 16px; }
  .sales-chat-toolbar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
  .sales-chat-toolbar label { flex: 1; min-width: 150px; margin: 0; font-size: 12px; }
  .sales-chat-toolbar select { font-size: 12px; }
  .sales-chat-toolbar .btn { font-size: 12px; }
  .sales-chat-timeline { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #f7f9fd; max-height: 320px; min-height: 180px; overflow-y: auto; }
  .sales-chat-section .inbox-composer { padding: 15px 0; border-top: 0; }
  .sales-chat-section .composer-footer { flex-wrap: wrap; }
  .sales-contact-fallback { margin: 18px 0; padding: 16px; border-radius: 10px; background: #f4f7fa; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
  .won-readiness, .deal-guide { margin: 14px 0; padding: 15px; border: 1px solid #d9e8e3; border-radius: 12px; background: #f5faf8; font-size: 12px; line-height: 1.65; }
  .won-readiness strong, .deal-guide strong { display: block; margin-bottom: 4px; }
  .won-readiness.missing, .deal-guide.missing { border-color: #f0d39a; background: #fff8e9; }
  .won-readiness .btn { margin-top: 12px; }
  .detail-disclosure { padding: 18px 22px; border-top: 1px solid var(--line); }
  .detail-disclosure summary { cursor: pointer; font-size: 13px; font-weight: 800; }
  .detail-disclosure[open] summary { margin-bottom: 18px; }
  #sales-result-form, #sales-chat-display { scroll-margin-top: 15px; }
  @media (max-width: 760px) {
    .sales-lead-workflow { grid-template-columns: minmax(0,1fr); padding: 0 14px 18px; gap: 14px; }
    .sales-step-links { padding: 0 14px 16px; }
    .sales-step-links button { font-size: 10px; }
    .sales-chat-section, .sales-result-form, .sales-opportunity-panel { padding: 14px; }
    .sales-work-row .button-row { width: 100%; }
    .sales-monthly-disclosure { padding: 14px; }
  }

  label { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; color: #3d4658; font-size: 13px; font-weight: 700; }
  input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; color: var(--ink); background: white; outline: none; transition: border-color .15s, box-shadow .15s; }
  input:focus, select:focus, textarea:focus { border-color: #80a2ff; box-shadow: 0 0 0 4px rgba(39,95,232,.1); }
  textarea { resize: vertical; }
  .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 9px 15px; border: 1px solid transparent; border-radius: 11px; font-weight: 750; font-size: 13px; text-decoration: none; transition: transform .12s, background .12s, border-color .12s; }
  .btn:active { transform: translateY(1px); }
  .btn.primary { color: white; background: var(--blue); }
  .btn.primary:hover { background: #1d51cf; }
  .btn.secondary { color: #26314a; background: white; border-color: var(--line); }
  .btn.secondary:hover, .btn.ghost:hover { background: #f0f3f8; }
  .btn.ghost { color: #566076; background: transparent; }
  .btn.danger-text { color: var(--red); background: #fff5f5; }
  .btn.full { width: 100%; }
  button:focus-visible, a:focus-visible { outline: 3px solid #8aabff; outline-offset: 3px; }
  button:disabled { opacity: .65; }
  input[readonly] { background: #f5f7fb; color: #667085; }
  .link-btn { padding: 0; color: var(--blue); background: transparent; border: 0; font-size: 13px; font-weight: 750; }
  .icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 10px; color: #596174; background: #f2f4f8; font-size: 20px; }

  .app-shell { min-height: 100vh; display: flex; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 230px; height: 100vh; height: 100dvh; display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 20px 14px; color: #d7dfed; background: var(--navy); }
  .brand { display: flex; flex: 0 0 auto; align-items: center; gap: 12px; padding: 0 8px 20px; }
  .brand strong, .brand span { display: block; }
  .brand strong { color: white; }
  .brand span { margin-top: 2px; color: #8490a5; font-size: 11px; }
  #nav { display: flex; flex: 1 1 0; min-height: 0; flex-direction: column; gap: 5px; overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: #66738b var(--navy); padding: 3px; -webkit-overflow-scrolling: touch; }
  #nav::-webkit-scrollbar { width: 7px; }
  #nav::-webkit-scrollbar-thumb { background: #66738b; border-radius: 8px; }
  .nav-group { display: flex; flex: 0 0 auto; flex-direction: column; gap: 5px; }
  .nav-item { flex-shrink: 0; min-height: 44px; width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 0; border-radius: 10px; color: #a9b4c7; background: transparent; text-align: left; font-size: 13px; font-weight: 700; }
  .nav-item span { width: 20px; color: #7f8ba0; font-size: 17px; text-align: center; }
  .nav-item:hover { color: white; background: #192439; }
  .nav-item.active { color: white; background: #253554; }
  .nav-item.active span { color: #7ea2ff; }
  .sidebar-footer { flex: 0 0 auto; display: flex; flex-direction: column; gap: 5px; padding-top: 10px; margin-top: auto; border-top: 1px solid #253554; }
  .sidebar .nav-item:focus-visible, #nav:focus-visible { outline: 2px solid #a7c2ff; outline-offset: -2px; }
  .nav-close { margin-left: auto; flex-shrink: 0; }
  .nav-backdrop { display: none; }

  .workspace { min-width: 0; width: calc(100% - 230px); margin-left: 230px; }
  .topbar { height: 76px; position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 26px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(14px); }
  .topbar h2 { margin: 0; font-size: 17px; }
  .company-line { max-width: 620px; margin: 2px 0 0; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
  .top-actions { display: flex; align-items: center; gap: 10px; }
  .search-box { width: 260px; position: relative; margin: 0; }
  .search-box span { position: absolute; left: 12px; top: 10px; color: #8d96a8; font-size: 18px; }
  .search-box input { padding-left: 36px; background: #f6f7fa; }
  .content { padding: 28px; }
  .nav-section { flex-shrink: 0; margin: 15px 12px 5px; font-size: 9px; font-weight: 800; letter-spacing: .13em; color: #7f8ba0; }
  .crm-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 30px; margin-bottom: 24px; border: 1px solid #dae5fc; border-radius: 22px; background: linear-gradient(115deg,#eef3ff,#fff); }
  .crm-hero h1 { margin: 10px 0; font-size: 32px; line-height: 1.2; letter-spacing: -.04em; }
  .crm-hero p:not(.eyebrow) { max-width: 530px; margin-bottom: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
  .crm-operations { margin-bottom: 24px; }
  .priority-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
  .priority-card { display: flex; flex-direction: column; gap: 7px; text-align: left; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: white; color: var(--ink); }
  .priority-card strong { font-size: 30px; letter-spacing: -.03em; }
  .priority-card span { font-size: 12px; font-weight: 700; }
  .priority-card small { color: var(--muted); font-size: 11px; }
  .priority-card.attention { border-color: #f3d9a2; background: #fffbf2; }
  .priority-card:hover { border-color: var(--blue); }
  .inbox-workspace { display: grid; grid-template-columns: 250px minmax(0,1fr) 285px; height: min(740px,calc(100dvh - 225px)); min-height: 550px; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: white; }
  .inbox-queue { min-height: 0; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #fafbfe; }
  .queue-toolbar { padding: 16px 14px 0; }
  .queue-toolbar label, .inbox-composer label { font-size: 11px; }
  .queue-toolbar input, .queue-toolbar select { font-size: 12px; }
  #inbox-list { min-height: 0; overflow-y: auto; flex: 1; padding: 0 8px; }
  .conversation-row { width: 100%; display: block; padding: 14px 11px; margin-bottom: 5px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--ink); text-align: left; }
  .conversation-row:hover { background: #f0f4fc; }
  .conversation-row.selected { border-color: #c9d8ff; background: var(--blue-soft); }
  .conversation-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 10px; color: var(--muted); }
  .conversation-meta strong { font-size: 12px; color: var(--ink); overflow-wrap: anywhere; }
  .conversation-meta small { flex-shrink: 0; }
  .conversation-row p { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin: 9px 0; font-size: 12px; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }
  .draft-badge { flex-shrink: 0; padding: 3px 6px; border-radius: 6px; background: #fff0c9; color: #8b5400; font-weight: 700; }
  .queue-footnote { padding: 10px 14px; margin: 0; border-top: 1px solid var(--line); font-size: 10px; line-height: 1.6; color: var(--muted); }
  .inbox-thread { min-height: 0; min-width: 0; display: flex; flex-direction: column; background: #f7f9fd; }
  .inbox-welcome { margin: auto; padding: 40px 24px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.7; }
  .inbox-welcome > span { color: var(--blue); font-size: 36px; }
  .thread-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px; border-bottom: 1px solid var(--line); background: white; }
  .thread-header h3, .context-header h3 { margin: 0 0 6px; font-size: 14px; overflow-wrap: anywhere; }
  .thread-header p { margin: 0; font-size: 10px; line-height: 1.5; color: var(--muted); }
  .thread-header .btn { flex-shrink: 0; font-size: 10px; padding: 9px; }
  .thread-messages { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; padding: 20px 16px; }
  .chat-message { max-width: 93%; padding: 13px; border: 1px solid var(--line); border-radius: 14px 14px 14px 3px; background: white; align-self: flex-start; }
  .chat-message.outgoing { align-self: flex-end; background: #eaf0ff; border-color: #d5e0ff; border-radius: 14px 14px 3px 14px; }
  .chat-message.draft-message { width: 100%; max-width: 100%; background: #fffbeb; border-color: #eddbab; border-style: dashed; }
  .chat-message p { font-size: 12px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; margin: 9px 0; }
  .chat-message-meta { display: flex; flex-wrap: wrap; gap: 7px; justify-content: space-between; font-size: 9px; color: var(--muted); }
  .chat-message small { display: block; font-size: 9px; line-height: 1.6; color: var(--muted); }
  .chat-message .btn { margin-top: 10px; font-size: 11px; }
  .inbox-composer { padding: 15px 17px; border-top: 1px solid var(--line); background: white; }
  .inbox-composer textarea { resize: vertical; min-height: 80px; max-height: 180px; font-size: 12px; }
  .composer-footer { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
  .composer-footer small { max-width: 250px; font-size: 9px; line-height: 1.6; color: var(--muted); }
  .composer-footer .btn { font-size: 11px; flex-shrink: 0; }
  .inbox-context { min-height: 0; min-width: 0; overflow-y: auto; border-left: 1px solid var(--line); }
  .context-header { padding: 18px; }
  .context-header .eyebrow { font-size: 9px; }
  .context-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 12px 12px; border-bottom: 1px solid var(--line); }
  .context-tabs button { flex: 1; border: 0; padding: 8px 4px; font-size: 10px; border-radius: 7px; color: var(--muted); background: #f4f6fa; }
  .context-tabs button[aria-pressed="true"] { color: var(--blue); background: var(--blue-soft); font-weight: 700; }
  .context-body { padding: 18px; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
  .context-fields > div { margin-bottom: 16px; }
  .context-fields small { color: var(--muted); font-size: 10px; }
  .context-fields p { margin: 3px 0 0; }
  .context-body .btn { font-size: 11px; }
  .context-item { padding: 15px 0; border-bottom: 1px solid var(--line); }
  .context-item strong, .context-item small { display: block; }
  .context-item small { color: var(--muted); font-size: 10px; }
  .context-item p { white-space: pre-wrap; }
  .contact-toolbar { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 20px; padding: 18px; }
  .contact-toolbar label { flex: 1; min-width: 200px; margin: 0; }
  .contact-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
  .contact-card { padding: 22px; overflow-wrap: anywhere; }
  .contact-card h3 { margin: 12px 0 5px; font-size: 16px; }
  .contact-card .category { font-size: 9px; letter-spacing: .12em; color: var(--blue); font-weight: 800; }
  .studio-navigation { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 24px; }
  .contact-card p { color: var(--muted); font-size: 12px; }
  .contact-card > small { color: var(--muted); font-size: 10px; }
  .contact-leads { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
  .contact-leads .btn { font-size: 11px; }
  .status-pill.verified { color: #087747; background: #e2f6eb; }
  .status-pill.rejected { color: #a8261d; background: #fee9e7; }
  .customer-summary-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 12px; }
  .customer-summary-bar > span { padding: 7px 10px; border: 1px solid var(--line); border-radius: 99px; background: white; color: var(--muted); font-size: 11px; }
  .customer-summary-bar strong { color: var(--ink); }
  .customer-summary-bar .pending { color: #8b5900; background: #fff9ea; border-color: #f2deb0; }
  .customer-summary-bar .verified { color: #087747; background: #effaf4; border-color: #ccebd9; }
  .customer-summary-bar .rejected { color: #a8261d; background: #fff4f2; border-color: #f5d3cf; }
  .customer-table-panel { overflow: hidden; }
  .customer-table { min-width: 1100px; }
  .customer-table th, .customer-table td { padding: 11px 14px; vertical-align: middle; }
  .customer-table td { font-size: 12px; }
  .customer-table td > strong, .customer-table td > span, .customer-table td > small { display: block; }
  .customer-table td > small { max-width: 220px; margin-top: 4px; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
  .customer-table .customer-note { color: #a8261d; }
  .table-actions { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
  .table-actions .btn { padding: 7px 9px; font-size: 10px; }
  .table-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
  .table-pagination .btn { padding: 8px 10px; font-size: 11px; }
  .compact-select { min-width: 145px; padding: 8px 28px 8px 9px; font-size: 11px; }
  .visit-table, .forecast-table { min-width: 1180px; }
  .visit-table td, .forecast-table td { vertical-align: top; }
  .visit-table td > strong, .visit-table td > small, .forecast-table td > strong, .forecast-table td > small { display: block; }
  .visit-table td > small, .forecast-table td > small { margin-top: 4px; color: var(--muted); font-size: 10px; }
  .lead-filter-tools label { display: flex; min-width: 135px; margin: 0; color: var(--muted); font-size: 10px; flex-direction: column; gap: 4px; }
  .lead-filter-tools label input { min-width: 140px; }
  #view-forecast > .contact-toolbar { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)) auto; }
  #view-forecast > .contact-toolbar label { min-width: 0; }
  #forecast-summary { grid-template-columns: repeat(4,minmax(0,1fr)); }
  #view-forecast > .panel, #forecast-summary > .metric { min-width: 0; }
  .forecast-panel { margin-bottom: 18px; overflow: hidden; }
  .forecast-calendar-scroller { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
  .forecast-calendar-scroller:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
  .forecast-scroll-help { display: none; }
  .forecast-calendar { display: grid; grid-template-columns: repeat(7,minmax(130px,1fr)); min-width: 980px; }
  .forecast-weekday { padding: 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #f8fafc; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-align: center; text-transform: uppercase; }
  .forecast-day { min-height: 128px; padding: 9px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: white; }
  .forecast-day.is-empty { background: #f8fafc; }
  .forecast-day.has-event { background: #fbfefd; }
  .forecast-day-number { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 800; }
  .forecast-chip { margin: 0 0 5px; padding: 6px 7px; border-left: 3px solid #0e7490; border-radius: 6px; background: #ecfeff; font-size: 9px; line-height: 1.35; }
  .forecast-chip.is-won { border-color: #087747; background: #effaf4; }
  .forecast-chip.is-visit { border-color: #b7791f; background: #fff9ea; }
  .forecast-chip strong, .forecast-chip span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .forecast-chip span { margin-top: 2px; color: var(--muted); }
  .visit-card-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
  .visit-card-head h3 { margin: 10px 0 3px; font-size: 17px; }
  .visit-card-head p { margin: 0; color: var(--muted); font-size: 12px; }
  .visit-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
  .visit-card { padding: 20px; }
  .visit-date { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; color: var(--muted); font-size: 11px; text-align: right; }
  .visit-date strong { color: var(--ink); font-size: 12px; }
  .visit-details { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
  .visit-details div { min-width: 0; }
  .visit-details span, .visit-details strong { display: block; }
  .visit-details span { color: var(--muted); font-size: 10px; }
  .visit-details strong { margin-top: 4px; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
  .visit-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
  .conversation-row:focus-visible, .context-tabs button:focus-visible, .priority-card:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
  @media (max-width: 1180px) {
    .inbox-workspace { grid-template-columns: 220px minmax(0,1fr); height: auto; }
    .inbox-queue, .inbox-thread { height: 650px; }
    .inbox-context { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); max-height: 450px; }
    .contact-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .crm-hero { align-items: flex-start; flex-direction: column; }
  }
  @media (max-width: 760px) {
    .crm-hero { padding: 22px; }
    .crm-hero h1 { font-size: 27px; }
    .priority-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .inbox-workspace { grid-template-columns: minmax(0,1fr); }
    .inbox-queue { height: 330px; border-right: 0; border-bottom: 1px solid var(--line); }
    .inbox-thread { height: 640px; }
    .inbox-context { max-height: none; }
    .thread-header { flex-wrap: wrap; }
    .composer-footer { align-items: flex-start; flex-direction: column; }
    .contact-grid { grid-template-columns: minmax(0,1fr); }
  }
  .view { max-width: 1500px; margin: 0 auto; }
  .page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
  .page-heading h1 { margin: 0; font-size: 27px; letter-spacing: -.035em; }
  .page-heading p:not(.eyebrow) { color: var(--muted); margin: 7px 0 0; }

  .metric-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 13px; margin-bottom: 18px; }
  .metric { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: white; }
  .metric span { color: var(--muted); font-size: 12px; font-weight: 650; }
  .metric strong { display: block; margin: 8px 0 4px; font-size: 28px; letter-spacing: -.035em; }
  .metric small { color: #8a94a7; }
  .dashboard-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; }
  .panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 3px 12px rgba(22,34,57,.035); }
  .panel.wide { grid-column: 1 / -1; }
  .panel-head { display: flex; align-items: center; justify-content: space-between; padding: 19px 20px 12px; }
  .panel-head > .status-pill { flex-shrink: 0; white-space: nowrap; margin-left: 12px; }
  .panel h3 { margin: 0; font-size: 16px; }
  .panel-head p, .form-help { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
  .stage-chart { min-height: 210px; display: flex; align-items: flex-end; gap: 13px; padding: 18px 22px 24px; overflow-x: auto; }
  .bar-item { min-width: 75px; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
  .bar-track { width: 100%; height: 140px; display: flex; align-items: flex-end; border-radius: 9px; background: #f3f5f9; overflow: hidden; }
  .bar-fill { width: 100%; min-height: 3px; border-radius: 8px 8px 0 0; background: linear-gradient(#7192f2, #275fe8); }
  .bar-item strong { font-size: 13px; }
  .bar-item span { min-height: 28px; color: var(--muted); font-size: 10px; text-align: center; }

  .list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 20px; border-top: 1px solid #edf0f4; }
  .list-row:first-child { border-top: 0; }
  .list-row-main { min-width: 0; }
  .list-row strong, .list-row span { display: block; }
  .list-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
  .list-row span { margin-top: 3px; color: var(--muted); font-size: 11px; }
  .empty-state { padding: 36px 24px; color: var(--muted); text-align: center; }

  .pipeline-board { display: grid; grid-template-columns: repeat(9, minmax(235px, 1fr)); gap: 13px; padding-bottom: 16px; overflow-x: auto; }
  .pipeline-column { min-height: 520px; border: 1px solid var(--line); border-radius: 15px; background: #eef1f6; }
  .column-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 14px; border-bottom: 1px solid #dfe3ea; border-radius: 15px 15px 0 0; background: #f7f8fa; }
  .column-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; }
  .stage-dot { width: 8px; height: 8px; border-radius: 99px; }
  .count-badge { padding: 3px 7px; border-radius: 99px; color: #687286; background: #e5e8ee; font-size: 10px; font-weight: 800; }
  .column-body { padding: 9px; }
  .lead-card { margin-bottom: 8px; padding: 13px; border: 1px solid #e0e4eb; border-radius: 12px; background: white; box-shadow: 0 2px 8px rgba(18,29,51,.04); }
  .lead-card:hover { border-color: #b9caff; box-shadow: 0 8px 18px rgba(35,67,136,.09); }
  .lead-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
  .lead-card h4 { margin: 0; font-size: 13px; }
  .lead-card p { height: 34px; margin: 8px 0; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.5; }
  .lead-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #7b8496; font-size: 10px; }
  .lead-card select { margin-top: 10px; padding: 7px; font-size: 10px; }
  .temperature { display: inline-flex; padding: 3px 7px; border-radius: 99px; font-size: 9px; font-weight: 850; }
  .temperature.HOT { color: #b42318; background: #fee4e2; }
  .temperature.WARM { color: #a15c04; background: #fff0c2; }
  .temperature.COLD { color: #3562b0; background: #e3ecff; }

  .table-panel { overflow: hidden; }
  .table-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table-tools select { width: 210px; }
  .table-wrap { overflow: auto; }
  table { width: 100%; border-collapse: collapse; }
  th { padding: 12px 16px; color: #687286; background: #f8f9fb; font-size: 10px; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
  td { padding: 13px 16px; border-top: 1px solid #edf0f4; font-size: 12px; vertical-align: middle; }
  tbody tr { cursor: pointer; }
  tbody tr:hover { background: #f8faff; }
  .person strong, .person span { display: block; }
  .person span { margin-top: 3px; color: var(--muted); font-size: 10px; }
  .stage-pill, .status-pill { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 99px; color: #3159b3; background: #e8efff; font-size: 10px; font-weight: 800; }

  .knowledge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .knowledge-card { padding: 18px; }
  .knowledge-card .category { color: var(--blue); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
  .knowledge-card h3 { margin: 10px 0 7px; line-height: 1.4; }
  .knowledge-card p { display: -webkit-box; margin: 0; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.6; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
  .knowledge-actions { display: flex; justify-content: space-between; margin-top: 16px; }

  .settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
  .settings-grid > *, .dashboard-grid > * { min-width: 0; }
  .form-help, .data-item strong { overflow-wrap: anywhere; }
  .form-panel { padding: 22px; }
  .provider-fields { min-width: 0; padding: 20px 0 0; margin: 16px 0; border: 0; border-top: 1px solid var(--line); }
  .provider-fields > .btn { margin-bottom: 16px; }
  .sales-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; padding: 18px; margin-bottom: 18px; }
  .sales-filters label { flex: 1 1 180px; margin: 0; min-width: 0; }
  .sales-kpi-table { min-width: 1600px; }
  .sales-kpi-table td { white-space: nowrap; }
  .management-sales-table { min-width: 1320px; }
  .management-detail-table { min-width: 1250px; }
  .management-sales-table td, .management-detail-table td { white-space: nowrap; }
  .report-metric-grid { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .report-section { margin-bottom: 18px; }
  .report-print-header { display: none; }
  .report-tabs { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
  #view-reports .report-tabs .btn.active { background: #0d8074; color: white; border-color: #0d8074; }
  .reports-hub-heading { margin-bottom: 20px; }
  .reports-hub-heading h1 { margin: 4px 0 8px; font-size: 28px; letter-spacing: -.03em; }
  .reports-hub-heading > p:last-child { color: var(--muted); margin: 0; font-size: 13px; line-height: 1.6; }
  #view-reports > .report-tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; padding: 8px; border: 1px solid #e1e9e5; border-radius: 14px; background: #eef3f0; }
  #view-reports .report-tabs .btn { text-align: left; min-height: 44px; white-space: normal; font-size: 12px; box-shadow: none; }
  #view-reports .page-heading h2 { font-size: 23px; margin: 0; letter-spacing: -.025em; }
  #view-reports .form-help { margin-bottom: 12px; overflow-wrap: anywhere; }
  .operational-report-filters { flex-wrap: wrap; }
  .operational-report-table { min-width: 1450px; }
  .operational-report-table td { max-width: 260px; white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
  .operational-report-table .report-description { min-width: 160px; }
  .report-lead-link { padding: 0; font-size: inherit; font-weight: 700; text-align: left; }
  .customer-report-table { min-width: 1480px; }
  .customer-report-table td { white-space: nowrap; }
  .customer-report-table td:nth-child(2), .customer-report-table td:nth-child(3) { white-space: normal; min-width: 150px; max-width: 250px; }
  .customer-report-table small { display: block; color: #6b778c; }
  #customer-report-summary { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .sales-id { display: block; margin-top: 4px; font-size: 10px; }
  #sales-summary .metric strong { font-size: clamp(18px, 1.9vw, 28px); overflow-wrap: anywhere; }
  .kpi-warning { color: #b42318; font-weight: 800; background: #fff4f2; }
  .team-roster { margin-bottom: 20px; overflow: hidden; }
  .team-forms { align-items: stretch; }
  .team-forms .form-panel { display: flex; flex-direction: column; }
  .form-section-head { display: flex; align-items: flex-start; gap: 12px; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid #edf0f5; }
  .section-number { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 11px; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 800; }
  .form-panel .form-section-head h3 { margin: 0; line-height: 1.4; }
  .form-section-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
  .form-context { padding: 12px 14px; margin: 12px 0 16px; border: 1px solid #e8edf5; border-radius: 10px; background: #f8faff; color: #657087; font-size: 12px; line-height: 1.6; }
  .form-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; margin-top: auto; padding-top: 14px; border-top: 1px solid #edf0f5; }
  .master-data-panel { padding: 22px; }
  .master-data-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
  .master-data-card { min-width: 0; padding: 16px; border: 1px solid #e7ebf2; border-radius: 14px; background: #fbfcff; }
  .master-data-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
  .master-data-head strong, .master-data-head small { display: block; }
  .master-data-head small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.45; }
  .master-add-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; margin-bottom: 12px; }
  .master-add-form input { min-width: 0; padding: 9px 10px; font-size: 11px; }
  .master-add-form .btn { padding: 9px 11px; font-size: 10px; }
  .master-chip-list { display: grid; gap: 8px; }
  .master-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; border: 1px solid #dbe5f7; border-radius: 10px; background: #fff; }
  .master-item.inactive { background: #f6f7f9; border-color: #e3e6eb; }
  .master-item > div:first-child { min-width: 0; }
  .master-item strong, .master-item small { display: block; overflow-wrap: anywhere; }
  .master-item strong { color: #263d63; font-size: 11px; }
  .master-item small { margin-top: 3px; color: var(--muted); font-size: 9px; }
  .master-item.inactive strong { color: #7a8495; }
  .master-item-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
  .master-item-actions .link-btn { padding: 4px 6px; font-size: 9px; }
  .master-item-edit input { min-width: 0; flex: 1; padding: 8px 9px; font-size: 11px; }
  .maintenance-panel { margin-top: 20px; padding: 22px; }
  .maintenance-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin: 18px 0; }
  .maintenance-stat { min-width: 0; padding: 15px; border: 1px solid #e3ebe8; border-radius: 12px; background: #f8fbfa; }
  .maintenance-stat span, .maintenance-stat strong, .maintenance-stat small { display: block; overflow-wrap: anywhere; }
  .maintenance-stat span { color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
  .maintenance-stat strong { margin: 7px 0 4px; color: #123c37; font-size: 16px; }
  .maintenance-stat small { color: var(--muted); font-size: 10px; line-height: 1.45; }
  .maintenance-status-detail { border-top: 1px solid var(--line); }
  .maintenance-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; border-top: 1px solid var(--line); }
  .maintenance-actions .form-help { max-width: 620px; margin: 0; }
  .maintenance-error { padding: 12px 14px; border-radius: 10px; color: #9a271f; background: #fff4f2; font-size: 11px; line-height: 1.55; }
  .primary-text { color: var(--blue); font-weight: 800; }
  .inline-confirm { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px; color: #9a271f; font-size: 10px; font-weight: 750; }
  .inline-confirm .btn { padding: 7px 9px; font-size: 10px; }
  .admin-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 28px; margin-bottom: 20px; border-radius: 20px; border: 1px solid #dae5ff; background: linear-gradient(115deg,#edf3ff,#f7f9ff); }
  .admin-hero h1 { margin: 8px 0; font-size: 30px; letter-spacing: -.035em; }
  .admin-hero p:not(.eyebrow) { color: #64738e; font-size: 14px; line-height: 1.6; }
  .admin-access-badge { display: inline-flex; padding: 6px 10px; color: #3b5b96; border-radius: 8px; background: #dde8ff; font-size: 11px; }
  .admin-metrics { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .admin-shortcuts { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; margin: 20px 0; }
  .shortcut-card { display: flex; flex-direction: column; align-items: flex-start; padding: 22px; text-align: left; color: var(--ink); transition: border-color .15s, transform .15s; }
  .shortcut-card:hover { border-color: #a9c0f5; transform: translateY(-2px); }
  .shortcut-icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 18px; border-radius: 12px; background: #edf3ff; color: var(--blue); font-size: 20px; }
  .shortcut-card p { color: var(--muted); font-size: 12px; line-height: 1.6; }
  .shortcut-link { display: block; margin-top: auto; padding-top: 18px; color: var(--blue); font-size: 12px; font-weight: 750; }
  .operation-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid #edf0f5; font-size: 13px; }
  .operation-row:last-of-type { border: 0; }
  .status-pill.ready { background: #e2f6eb; color: #087747; }
  .status-pill.pending { background: #fff1cf; color: #8b5900; }
  .form-panel h3 { margin-bottom: 20px; }
  .form-panel hr { margin: 24px 0; border: 0; border-top: 1px solid var(--line); }
  .button-row { display: flex; gap: 9px; flex-wrap: wrap; }

  .modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(10,17,31,.52); backdrop-filter: blur(5px); }
  body:has(.modal-backdrop:not(.hidden)) { overflow: hidden; }
  .modal { width: min(720px, 100%); max-height: 90vh; padding: 24px; overflow: auto; border-radius: 22px; background: white; box-shadow: var(--shadow); }
  .modal.compact { width: min(520px, 100%); }
  .modal.drawer { position: fixed; inset: 0 0 0 auto; width: min(610px, 100%); max-height: none; border-radius: 0; overscroll-behavior-y: contain; }
  body[data-workspace="SALES"] #modal-detail.drawer { width: min(1000px, 100%); }
  body[data-workspace="SALES"] .detail-hero { background: linear-gradient(145deg,#123c37,#126f60); }
  .modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
  .modal-head h2 { margin: 0; font-size: 23px; }
  .form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 15px; }
  .visit-new-customer-fields { margin: 10px 0 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; }
  .span-2 { grid-column: span 2; }
  .modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 8px; }
  .detail-hero { margin: -24px -24px 20px; padding: 24px; color: white; background: linear-gradient(135deg, #17233c, #284b94); }
  .detail-hero .modal-head { margin-bottom: 18px; }
  .detail-hero .icon-btn { color: white; background: rgba(255,255,255,.12); }
  .detail-hero h2 { margin: 0; }
  .detail-hero p { margin: 5px 0 0; color: #c6d4f4; }
  .detail-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
  .detail-kpi { padding: 10px; border-radius: 11px; background: rgba(255,255,255,.1); }
  .detail-kpi span, .detail-kpi strong { display: block; }
  .detail-kpi span { color: #c9d6f1; font-size: 9px; text-transform: uppercase; }
  .detail-kpi strong { margin-top: 4px; font-size: 14px; }
  .detail-section { padding: 18px 0; border-top: 1px solid var(--line); }
  .detail-section:first-of-type { border-top: 0; }
  .detail-section h3 { margin: 0 0 12px; }
  .data-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .data-item span, .data-item strong { display: block; }
  .data-item span { color: var(--muted); font-size: 10px; }
  .data-item strong { margin-top: 3px; font-size: 12px; }
  .timeline { display: flex; flex-direction: column; gap: 10px; }
  .timeline-item { padding: 11px 13px; border-left: 3px solid #9bb3f4; border-radius: 0 10px 10px 0; background: #f7f9fd; }
  .timeline-item strong, .timeline-item span { display: block; }
  .timeline-item span { margin-top: 4px; color: var(--muted); font-size: 10px; }
  .ai-box { padding: 14px; border: 1px solid #cfdcff; border-radius: 13px; background: #f2f6ff; }
  .ai-result { margin-top: 12px; padding: 12px; border-radius: 10px; background: white; font-size: 12px; line-height: 1.55; }

  .loading-panel { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 120px; color: var(--muted); }
  .spinner { width: 18px; height: 18px; border: 2px solid #d7deed; border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
  .toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: 400px; padding: 12px 16px; border-radius: 12px; color: white; background: #172033; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; font-size: 13px; }
  .toast.show { opacity: 1; transform: translateY(0); }
  .toast.error { background: #b42318; }
  .forecast-conflicts { margin-bottom: 18px; border-color: #f4d59a; background: #fffdf8; overflow: hidden; }
  .forecast-conflicts > .panel-head { align-items: flex-start; gap: 12px; padding: 20px; }
  .forecast-conflicts .panel-head > div { min-width: 0; }
  .forecast-conflicts .panel-head > .status-pill { margin: 0; padding: 5px 9px; }
  #forecast-conflicts { display: grid; gap: 10px; padding: 0 20px 20px; }
  .forecast-conflict-card { display: grid; grid-template-columns: 170px minmax(0,1fr); align-items: start; gap: 18px; padding: 16px; border: 1px solid #eee4d0; border-radius: 12px; background: white; }
  .forecast-conflict-meta, .forecast-conflict-event { min-width: 0; overflow-wrap: anywhere; }
  .forecast-conflict-meta h4 { margin: 0; color: #6d4914; font-size: 13px; line-height: 1.5; }
  .forecast-conflict-meta > span { display: block; margin-top: 5px; color: #7c7467; font-size: 12px; line-height: 1.5; }
  .forecast-conflict-pair { display: grid; grid-template-columns: minmax(0,1fr) 66px minmax(0,1fr); gap: 12px; align-items: center; min-width: 0; }
  .forecast-conflict-event strong { display: block; margin-top: 7px; color: #26384a; font-size: 13px; font-weight: 650; line-height: 1.6; }
  .forecast-source { display: inline-block; padding: 3px 7px; border-radius: 6px; color: #166c60; background: #eaf6f1; font-size: 10px; font-weight: 750; }
  .forecast-source.is-visit { color: #665789; background: #f1edf8; }
  .forecast-conflict-between { color: #a07630; font-size: 10px; line-height: 1.5; text-align: center; }
  .forecast-conflict-between > span { font-size: 18px; }
  .notification-panel { overflow: hidden; margin-top: 20px; border-color: #e1e8e5; background: white; }
  .notification-heading { align-items: flex-start; gap: 16px; padding-bottom: 18px; }
  .notification-title { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
  .notification-count { padding: 4px 9px; border-radius: 7px; font-size: 11px; font-weight: 700; color: #956013; background: #fff5dd; white-space: nowrap; }
  .notification-heading > .btn { flex-shrink: 0; }
  .notification-filters { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 20px 17px; border-bottom: 1px solid #edf1ef; }
  .notification-filters button { display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 7px 10px; border: 1px solid #e3e9e6; border-radius: 9px; color: #65716d; background: white; font-size: 12px; white-space: nowrap; }
  .notification-filters button span { min-width: 20px; padding: 1px 5px; border-radius: 5px; background: #f1f4f2; color: #65716d; font-size: 10px; font-weight: 700; text-align: center; }
  .notification-filters button[aria-pressed="true"] { color: #087f72; background: #edf8f4; border-color: #b5dfd2; font-weight: 750; }
  .notification-filters button[aria-pressed="true"] span { color: #087f72; background: #d7efe5; }
  .notification-row { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 17px 20px; border-bottom: 1px solid #edf1ef; }
  .notification-row:last-child { border-bottom: 0; }
  .notification-marker { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #dce7fa; border-radius: 10px; background: #f0f5ff; color: #4264a3; font-weight: 750; font-size: 16px; }
  .notification-follow_up .notification-marker { border-color: #cee9df; background: #edf8f3; color: #087f72; }
  .notification-venue .notification-marker { border-color: #f5dfad; background: #fff7e8; color: #aa6b0b; }
  .notification-copy { min-width: 0; }
  .notification-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 12px; margin-bottom: 5px; }
  .notification-kind { color: #4264a3; font-size: 10px; font-weight: 750; }
  .notification-follow_up .notification-kind { color: #087f72; }
  .notification-venue .notification-kind { color: #aa6b0b; }
  .notification-meta small { color: #7a8782; font-size: 11px; }
  .notification-copy h4 { margin: 0; color: #24392f; font-size: 13px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
  .notification-message { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; margin: 4px 0 0; font-size: 12px; line-height: 1.6; color: #6b7771; }
  .notification-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
  .notification-actions .btn { min-height: 36px; padding: 8px 11px; font-size: 11px; white-space: nowrap; }
  .notification-actions .notification-dismiss { color: #6c7973; background: transparent; border: 1px solid transparent; box-shadow: none; }
  .notification-actions .notification-dismiss:hover { color: #087f72; border-color: #cfe6dd; background: #f4faf7; }
  .notification-pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 13px 20px; border-top: 1px solid #edf1ef; color: #76837d; font-size: 11px; background: #fbfdfc; }
  .notification-pagination .btn { min-height: 34px; padding: 7px 10px; font-size: 11px; }
  .notification-pagination .btn:disabled { opacity: .45; cursor: default; }
  .notification-empty { padding: 28px 20px; color: var(--muted); font-size: 13px; text-align: center; line-height: 1.6; }
  .notification-status { margin: 0; padding: 0 20px 12px; color: var(--muted); font-size: 11px; }
  .notification-status:empty, .notification-count:empty { display: none; }
  .notification-panel button:focus-visible { outline: 3px solid #9bd8c8; outline-offset: 3px; }
  .mobile-only { display: none; }

  @media (max-width: 1100px) {
    .metric-grid.sales-home-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .metric-grid { grid-template-columns: repeat(3, 1fr); }
    .knowledge-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-shortcuts { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .team-forms { grid-template-columns: 1fr; }
    .maintenance-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  }
  @media (max-width: 900px) {
    #view-forecast > .contact-toolbar { grid-template-columns: repeat(2,minmax(0,1fr)); }
    #view-forecast > .contact-toolbar > .btn { grid-column: 1 / -1; justify-self: end; }
    .forecast-conflict-card { grid-template-columns: 1fr; gap: 12px; }
    .forecast-conflict-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
    .forecast-conflict-meta > span { margin-top: 0; }
    .auth-screen { grid-template-columns: minmax(0,440px); padding: 24px; }
    .auth-story { display: none; }
    .auth-mobile-brand { display: grid; margin-bottom: 24px; }
  }
  @media (max-width: 760px) {
    #view-reports > .report-tabs { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .reports-hub-heading h1 { font-size: 24px; }
    #customer-report-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .sales-hero { flex-direction: column; align-items: stretch; padding: 22px; }
    .sales-home-grid { grid-template-columns: 1fr; }
    .metric-grid.sales-home-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .sales-home-toolbar label { width: 100%; }
    .sales-home-toolbar .button-row { width: 100%; }
    .mobile-only { display: grid; }
    .sidebar { transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: translateX(0); }
    body[data-workspace="SALES"] #nav { flex: 0 1 auto; }
    body[data-workspace="SALES"] .sidebar-footer { margin-top: 14px; }
    .nav-backdrop.open { display: block; position: fixed; inset: 0; z-index: 19; width: 100%; height: 100%; border: 0; padding: 0; background: rgba(10,17,31,.45); }
    .workspace { width: 100%; margin-left: 0; }
    .topbar { height: auto; min-height: 72px; padding: 12px 16px; }
    .topbar > div:nth-child(2) { flex: 1; }
    .topbar > div:nth-child(2) { min-width: 0; }
    .topbar h2 { overflow-wrap: anywhere; }
    .top-actions { flex-shrink: 0; }
    .top-actions .search-box { display: none; }
    .content { padding: 20px 14px; }
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid, .settings-grid, .knowledge-grid, .master-data-grid { grid-template-columns: 1fr; }
    .panel.wide { grid-column: auto; }
    .page-heading { align-items: stretch; flex-direction: column; }
    .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .auth-card { padding: 28px; }
    .admin-hero { flex-direction: column; padding: 22px; }
    .admin-hero h1 { font-size: 26px; }
    .admin-metrics, .admin-shortcuts { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .shortcut-card { padding: 16px; }
    .list-row { flex-wrap: wrap; }
    .table-tools { flex-wrap: wrap; }
    .sales-filters { padding: 14px; }
    .sales-filters label { flex-basis: 100%; }
    .visit-list { grid-template-columns: 1fr; }
    .visit-card-head { flex-direction: column; }
    .visit-date { align-items: flex-start; text-align: left; }
    .table-pagination { align-items: stretch; flex-direction: column; }
    .table-pagination .button-row { width: 100%; }
    .table-pagination .button-row .btn { flex: 1; }
    #forecast-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .forecast-conflicts > .panel-head { padding: 16px; flex-wrap: wrap; }
    #forecast-conflicts { padding: 0 16px 16px; }
    .forecast-conflict-card { padding: 14px; }
    .forecast-conflict-meta { display: block; }
    .forecast-conflict-meta > span { margin-top: 4px; }
    .forecast-conflict-pair { grid-template-columns: 1fr; gap: 10px; }
    .forecast-conflict-between { padding: 1px 0; text-align: left; }
    .forecast-conflict-between br, .forecast-conflict-between > span { display: none; }
    .forecast-scroll-help { display: block; }
    .notification-heading { flex-wrap: wrap; padding: 17px 16px 14px; }
    .notification-heading h3 { font-size: 15px; }
    .notification-filters { flex-wrap: nowrap; overflow-x: auto; padding: 0 16px 14px; scrollbar-width: thin; }
    .notification-filters button { flex-shrink: 0; min-height: 40px; }
    .notification-row { grid-template-columns: 28px minmax(0,1fr); gap: 10px; padding: 16px; }
    .notification-marker { width: 28px; height: 28px; border-radius: 8px; align-self: start; }
    .notification-actions { grid-column: 2; justify-content: flex-start; gap: 6px; }
    .notification-actions .btn { min-height: 42px; }
    .notification-actions .notification-dismiss { border-color: #e4ebe7; }
    .notification-pagination { padding: 13px 16px; }
    .notification-pagination .button-row { width: 100%; }
    .notification-pagination .btn { flex: 1; min-height: 40px; }
    .maintenance-metrics { grid-template-columns: 1fr; }
    .maintenance-actions { align-items: stretch; flex-direction: column; }
  }
  @media (max-width: 480px) { #view-forecast > .contact-toolbar { grid-template-columns: 1fr; } #view-forecast > .contact-toolbar > .btn { width: 100%; } }
  @media (max-width: 400px) { .admin-shortcuts { grid-template-columns: 1fr; } .auth-card { padding: 22px; } .auth-screen { padding: 16px; } }
  .trash-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid #e6ebf2; }
  .trash-item > div { min-width: 0; overflow-wrap: anywhere; }
  .trash-item p { margin: 6px 0 0; }
  .trash-item button { flex-shrink: 0; }
  #modal-trash h3 { margin-top: 24px; }
  .lead-delete-section { border-top: 1px solid #e6ebf2; }
  @media (max-width: 560px) { .trash-item { align-items: stretch; flex-direction: column; } .trash-item button { align-self: flex-start; } }
  @media print {
    .service-banner { display: none !important; }
    @page { size: A3 landscape; margin: 10mm; }
    body { background: white; }
    .sidebar, .topbar, .nav-backdrop, .toast, .modal-backdrop, #auth-screen, #loading { display: none !important; }
    .workspace { width: 100%; margin: 0; }
    .content { padding: 0; }
    .view { display: none !important; }
    body:not(.print-management-report) #view-sales { display: block !important; max-width: none; }
    body.print-management-report #view-reports { display: block !important; max-width: none; }
    #view-sales button, #view-reports button { display: none; }
    body.print-management-report .management-report-filters { display: none; }
    body.print-management-report .report-tabs, body.print-management-report .customer-report-filters, body.print-management-report #customer-report-pagination { display: none; }
    body.print-management-report .report-print-header { display: flex; justify-content: space-between; padding: 0 0 10px; margin-bottom: 12px; border-bottom: 1px solid #d7dce5; }
    .table-wrap { overflow: visible; }
    .sales-kpi-table, .management-sales-table, .management-detail-table, .customer-report-table { min-width: 0; }
    .customer-report-table th, .customer-report-table td { font-size: 8px; padding: 5px; white-space: normal; min-width: 0; }
    .sales-kpi-table th, .sales-kpi-table td, .management-sales-table th, .management-sales-table td, .management-detail-table th, .management-detail-table td { padding: 5px; font-size: 8px; white-space: normal; }
    .metric-grid { grid-template-columns: repeat(6, 1fr); }
    #view-reports .metric strong { font-size: 18px; overflow-wrap: normal; white-space: nowrap; }
    tr { break-inside: avoid; }
    body.print-management-report .reports-hub-heading, body.print-management-report .report-tabs, body.print-management-report .operational-report-filters, body.print-management-report #operational-pagination, body.print-management-report .sales-filters { display: none !important; }
    .operational-report-table { min-width: 0; width: 100%; table-layout: fixed; }
    .operational-report-table th, .operational-report-table td { font-size: 8px; padding: 5px; white-space: normal; overflow-wrap: anywhere; min-width: 0; }
    .operational-report-table .report-description { min-width: 0; }
    #view-reports button.report-lead-link { display: inline !important; color: inherit; }
  }
/* Activity workflow and unobtrusive live/session status. */
.live-sync-bar { display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; color:#718096; font-size:11px; padding:0 0 14px; }
.live-sync-bar small { font-size:11px; }
#live-sync-status::before { content:'●'; color:#0d9488; margin-right:6px; }
#live-sync-status[data-kind="warning"]::before { color:#d97706; }
#live-sync-status[data-kind="paused"]::before { color:#94a3b8; }
.idle-warning { display:flex; align-items:center; justify-content:space-between; gap:16px; border:1px solid #f5c77e; border-radius:12px; padding:16px; margin-bottom:16px; background:#fff8e9; }
.idle-warning p { font-size:12px; margin:5px 0 0; }
.activity-target-fields { border:1px solid #e2e8f0; border-radius:12px; padding:16px; margin:20px 0 0; min-width:0; }
.activity-target-fields legend { font-size:13px; font-weight:700; padding:0 6px; }
.activity-target-fields small { color:#718096; font-weight:400; font-size:11px; }
.telemarketing-table { min-width:960px; table-layout:fixed; }
.telemarketing-table th:nth-child(1) { width:140px; }
.telemarketing-table th:nth-child(2) { width:180px; }
.telemarketing-table th:nth-child(3) { width:110px; }
.telemarketing-table th:nth-child(4) { width:90px; }
.telemarketing-table th:nth-child(6) { width:250px; }
.tm-result { white-space:pre-wrap; overflow-wrap:anywhere; font-size:12px; line-height:1.5; margin:8px 0; }
.tm-actions { flex-wrap:wrap; gap:6px; }
.tm-actions .btn { font-size:11px; padding:8px 10px; }
.activity-kpi-table { min-width:650px; }
#view-team .team-forms { grid-template-columns:minmax(0,1fr); }
#report-panel-activity .table-panel + .table-panel { margin-top:18px; }
.visit-achievement-panel { margin-bottom:18px; }
.visit-target-row { display:grid; grid-template-columns:minmax(120px,1fr) 2fr 2fr; gap:12px; padding:12px 20px; border-top:1px solid #edf2f7; font-size:12px; align-items:center; }
.visit-target-row .status-pill { margin-left:6px; }
@media (max-width:700px) { .live-sync-bar { gap:4px; }.idle-warning{align-items:flex-start;flex-direction:column}.visit-target-row{grid-template-columns:1fr;padding:14px 16px;gap:8px} }
@media print { .live-sync-bar,.idle-warning { display:none!important; } }
