:root { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #15231d; background: #f2f6f3; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top left, #dff5e7 0, transparent 34rem), #f3f6f4; }
.shell { width: min(920px, calc(100% - 32px)); margin: 0 auto; padding: 64px 0; }
header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 28px; }
.eyebrow { color: #16834b; font-weight: 800; letter-spacing: .14em; font-size: 12px; margin: 0 0 8px; }
h1 { font-size: clamp(32px, 5vw, 54px); letter-spacing: -.04em; margin: 0; }
.sub { color: #5a6a62; max-width: 590px; font-size: 17px; line-height: 1.6; }
.connection { white-space: nowrap; display: flex; align-items: center; gap: 9px; background: #fff; border: 1px solid #dce6df; border-radius: 999px; padding: 10px 14px; box-shadow: 0 8px 30px #173c2612; }
.connection span { width: 10px; height: 10px; border-radius: 50%; background: #e1a72f; }
.connection.online span { background: #21aa62; box-shadow: 0 0 0 5px #21aa6218; }
.connection.offline span { background: #c94d4d; }
.card { background: #fff; border: 1px solid #dce6df; border-radius: 22px; padding: clamp(22px, 5vw, 38px); box-shadow: 0 22px 70px #173c2612; }
.card + .card { margin-top: 24px; }
.access-card { max-width: 520px; }
h2 { margin-top: 0; }
label { display: grid; gap: 9px; font-weight: 700; margin-bottom: 22px; }
input, textarea, select { width: 100%; border: 1px solid #cbd8d0; border-radius: 12px; padding: 14px 15px; font: inherit; color: inherit; background: #fbfdfb; transition: .2s; }
input:focus, textarea:focus, select:focus { outline: none; border-color: #16834b; box-shadow: 0 0 0 4px #16834b18; background: #fff; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 54px; }
.password-toggle { position: absolute; top: 50%; right: 7px; transform: translateY(-50%); width: 42px; height: 42px; padding: 0; background: transparent; color: #526159; font-size: 20px; line-height: 1; }
.password-toggle:hover, .password-toggle:focus-visible { background: #e9f3ec; color: #155c39; }
textarea { resize: vertical; min-height: 150px; }
button { border: 0; border-radius: 12px; padding: 13px 20px; font: inherit; font-weight: 800; background: #166c42; color: #fff; cursor: pointer; }
button:hover { background: #0f5734; }
button:disabled { opacity: .55; cursor: wait; }
.secondary { background: #eef7f1; color: #155c39; }
.secondary:hover { background: #dceee2; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.section-heading h2 { margin-bottom: 0; }
.heading-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.group-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }
.group-grid form + form { border-left: 1px solid #e1e9e4; padding-left: 36px; }
.contacts-layout { display: grid; grid-template-columns: minmax(230px, .75fr) minmax(0, 1.6fr); gap: 30px; min-height: 420px; }
.contacts-sidebar { border-right: 1px solid #e1e9e4; padding-right: 24px; }
.contact-list { margin-top: 14px; display: grid; grid-auto-rows: max-content; align-content: start; gap: 8px; max-height: 610px; overflow: auto; }
.contact-item { position: relative; width: 100%; text-align: left; padding: 13px; background: #f5f8f6; color: #20352b; border: 1px solid transparent; transition: background .15s, border-color .15s, box-shadow .15s, transform .15s; }
.contact-item:hover { background: #e7f3eb; border-color: #b7d7c3; }
.contact-item.active, .contact-item[aria-current="true"] { background: linear-gradient(90deg, #ccebd7, #e7f6ec); color: #0b5030; border-color: #58a879; box-shadow: inset 5px 0 #08783f, 0 3px 12px #08783f24; transform: translateX(2px); }
.contact-item.active::after, .contact-item[aria-current="true"]::after { content: ""; position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: #0d9955; box-shadow: 0 0 0 4px #0d995522; }
.contact-item.active strong, .contact-item[aria-current="true"] strong { color: #073f26; }
.contact-item strong, .contact-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-item small, .muted, .contact-form-heading span, label small { color: #718078; font-weight: 500; }
.contact-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.contact-form-heading { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.contact-actions { display: flex; justify-content: space-between; gap: 16px; }
.contact-empty { display: grid; place-items: center; text-align: center; color: #718078; }
h3 { margin: 0 0 22px; font-size: 19px; }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.form-footer small { color: #75837b; }
.result { margin-top: 24px; border-radius: 14px; padding: 16px; background: #eef7f1; color: #155c39; line-height: 1.5; }
.result.error { background: #fff0f0; color: #9a3131; }
.hidden { display: none; }
body.auth-locked { overflow: hidden; }
body.auth-locked .shell { min-height: 100vh; height: 100vh; display: grid; place-items: center; padding: 24px; }
body.auth-locked .shell > header { display: none; }
body.auth-locked .access-card { width: min(420px, 100%); max-width: 420px; margin: 0; }
body.auth-locked .access-card h2 { text-align: center; }
body.auth-locked .access-card > p { text-align: center; }
@media (max-width: 680px) { .shell { padding: 36px 0; } header { display: grid; } .connection { justify-self: start; } .form-footer, .section-heading { align-items: stretch; flex-direction: column; } .group-grid, .contacts-layout, .contact-fields { grid-template-columns: 1fr; } .group-grid form + form { border-left: 0; border-top: 1px solid #e1e9e4; padding-left: 0; padding-top: 30px; } .contacts-sidebar { border-right: 0; border-bottom: 1px solid #e1e9e4; padding: 0 0 22px; } }

/* Atendimento em três painéis */
.shell { width: min(1580px, calc(100% - 24px)); padding: 24px 0; }
.service-workspace { display: grid; grid-template-columns: 320px minmax(430px, 1fr) 390px; height: calc(100vh - 155px); min-height: 650px; background: #fff; border: 1px solid #dce6df; border-radius: 20px; overflow: hidden; box-shadow: 0 22px 70px #173c2612; }
.contact-rail, .detail-rail { min-width: 0; background: #fbfdfc; transition: width .2s, transform .2s; }
.contact-rail { border-right: 1px solid #dce6df; padding: 20px 16px; overflow: hidden; }
.detail-rail { border-left: 1px solid #dce6df; display: flex; flex-direction: column; overflow: hidden; }
.rail-heading, .detail-heading, .conversation-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rail-heading h2, .conversation-header h2 { margin: 0; font-size: 20px; }
.rail-actions, .contact-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.rail-actions button { padding: 10px 8px; }
.contact-filters select { padding: 10px 8px; font-size: 13px; }
.contact-filters #contactStageFilter { grid-column: 1 / -1; }
#contactsMode .contact-list { height: calc(100vh - 323px); }
.contact-list { max-height: calc(100vh - 385px); }
.contact-item { border-radius: 11px; }
.contact-item .contact-summary { color: #718078; margin-top: 4px; }
.contact-item .contact-extra-preview { color: #526159; margin-top: 5px; font-size: 11px; }
.conversation-pane { min-width: 0; display: grid; grid-template-rows: auto 1fr auto auto; background: #eef3f0; }
.conversation-pane.board-mode { display: block; position: relative; overflow: hidden; }
.conversation-pane.board-mode > .conversation-header,
.conversation-pane.board-mode > .message-thread,
.conversation-pane.board-mode > .message-composer,
.conversation-pane.board-mode > .result { display: none; }
.conversation-pane.board-mode > .kanban-workspace,
.conversation-pane.board-mode > .lawyer-workspace { width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 0; }
.conversation-header { min-height: 74px; padding: 14px 20px; background: #fff; border-bottom: 1px solid #dce6df; }
.conversation-header span { color: #718078; font-size: 13px; }
.message-thread { overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 10px; background-image: linear-gradient(#dbe7df55 1px, transparent 1px), linear-gradient(90deg, #dbe7df55 1px, transparent 1px); background-size: 24px 24px; }
.empty-conversation { margin: auto; color: #718078; text-align: center; }
.message-bubble { max-width: 78%; padding: 11px 14px; border-radius: 13px; background: #fff; box-shadow: 0 2px 8px #173c2612; line-height: 1.45; white-space: pre-wrap; }
.message-bubble.mine { align-self: flex-end; color: #fff; background: #16835f; }
.message-bubble time { display: block; margin-top: 5px; font-size: 10px; text-align: right; opacity: .7; }
.message-media { display: block; width: min(100%, 420px); max-height: 380px; margin-top: 7px; border-radius: 9px; object-fit: contain; background: #0d1713; }
.message-media.sticker { width: min(180px, 100%); background: transparent; }
audio.message-media { height: 40px; background: transparent; }
.message-document { display: block; margin-top: 7px; padding: 10px; border-radius: 8px; background: #edf4ef; color: #155c39; text-decoration: none; font-weight: 700; overflow-wrap: anywhere; }
.message-bubble.mine .message-document { background: #ffffff26; color: #fff; }
.media-unavailable { display: block; margin-top: 6px; opacity: .75; }
.message-composer { padding: 12px 16px; background: #fff; border-top: 1px solid #dce6df; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.message-composer textarea { min-height: 52px; max-height: 130px; resize: vertical; }
.composer-actions { display: grid; gap: 6px; justify-items: end; }
.composer-actions small { color: #718078; font-size: 10px; }
.icon-button { width: 36px; height: 36px; padding: 0; border-radius: 999px; background: #edf5f0; color: #155c39; font-size: 22px; }
.show-left, .show-right { display: none; }
.detail-heading { min-height: 58px; padding: 12px 15px; background: #fff; border-bottom: 1px solid #dce6df; }
.detail-tabs { display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-bottom: 1px solid #dce6df; }
.detail-tabs button { padding: 11px 4px; border-radius: 0; background: transparent; color: #607067; font-size: 12px; border-bottom: 3px solid transparent; }
.detail-tabs button.active { color: #166c42; border-bottom-color: #16834b; }
.detail-content { flex: 1; overflow-y: auto; padding: 18px; }
.detail-content label { margin-bottom: 14px; font-size: 13px; }
.detail-content input, .detail-content textarea, .detail-content select { padding: 10px 11px; }
.detail-content textarea { min-height: 90px; }
.detail-panel h3 { margin-bottom: 14px; }
.extra-fields { display: grid; gap: 10px; margin-bottom: 15px; }
.extra-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 7px; align-items: center; }
.extra-row strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.extra-row button { padding: 8px; background: #f7e7e7; color: #9a3131; }
.inline-field { display: grid; grid-template-columns: 1fr 1fr auto; gap: 7px; }
.timeline { display: grid; gap: 10px; }
.timeline-item { border-left: 3px solid #b8d8c4; padding: 8px 10px; background: #f3f7f4; border-radius: 0 9px 9px 0; }
.contact-rail.collapsed { display: none; }
.detail-rail.collapsed { display: none; }
.service-workspace.left-collapsed { grid-template-columns: minmax(430px,1fr) 390px; }
.service-workspace.right-collapsed { grid-template-columns: 320px minmax(430px,1fr); }
.service-workspace.left-collapsed.right-collapsed { grid-template-columns: 1fr; }
.service-workspace.left-collapsed .show-left, .service-workspace.right-collapsed .show-right { display: inline-grid; place-items: center; }
@media (max-width: 1050px) { .service-workspace { grid-template-columns: 280px minmax(380px,1fr); } .detail-rail { position: fixed; z-index: 20; top: 12px; right: 12px; bottom: 12px; width: min(390px, calc(100vw - 24px)); box-shadow: 0 10px 50px #15231d33; } .show-right { display: inline-grid; place-items: center; } }
@media (max-width: 720px) { .shell { width: 100%; padding: 0; } body > .shell > header { padding: 14px; margin: 0; } .service-workspace { height: calc(100vh - 105px); min-height: 0; border-radius: 0; grid-template-columns: 1fr; } .contact-rail { position: fixed; z-index: 21; top: 12px; left: 12px; bottom: 12px; width: min(330px, calc(100vw - 24px)); box-shadow: 0 10px 50px #15231d33; } .show-left { display: inline-grid; place-items: center; } .groups-card { margin: 16px; } }

/* Versão compacta e abas Contatos/Grupos */
body { font-size: 13px; }
.shell > header { margin-bottom: 14px; }
.shell > header h1 { font-size: clamp(24px, 3vw, 36px); }
.shell > header .sub { margin: 6px 0 0; font-size: 13px; }
.service-workspace { grid-template-columns: 280px minmax(420px,1fr) 350px; height: calc(100vh - 118px); min-height: 590px; border-radius: 15px; }
.contact-rail { padding: 14px 12px; }
.rail-heading h2, .conversation-header h2 { font-size: 16px; }
.rail-heading .eyebrow { font-size: 10px; margin-bottom: 3px; }
.crm-mode-tabs { display: grid; grid-template-columns: 1fr 1fr; margin: 12px 0; padding: 3px; border-radius: 10px; background: #edf3ef; }
.crm-mode-tabs button { padding: 8px 6px; border-radius: 8px; background: transparent; color: #607067; font-size: 12px; }
.crm-mode-tabs button.active { background: #fff; color: #166c42; box-shadow: 0 2px 8px #173c2615; }
.rail-actions { margin: 9px 0; }
.rail-actions button { padding: 8px 6px; font-size: 12px; }
.contact-rail input, .contact-rail select { padding: 9px 10px; font-size: 12px; border-radius: 9px; }
.contact-list { margin-top: 9px; max-height: calc(100vh - 335px); gap: 5px; }
.contact-item { padding: 9px 10px; font-size: 12px; }
.contact-item small { font-size: 10px; }
.conversation-header { min-height: 56px; padding: 9px 14px; }
.message-thread { padding: 15px; gap: 7px; }
.message-bubble { padding: 8px 11px; border-radius: 10px; font-size: 12px; }
.message-composer { padding: 8px 10px; }
.message-composer textarea { min-height: 43px; padding: 9px 10px; font-size: 12px; }
.message-composer button { padding: 10px 14px; font-size: 12px; }
.detail-heading { min-height: 48px; padding: 8px 12px; }
.detail-tabs button { padding: 9px 2px; font-size: 10px; }
.detail-content { padding: 12px; }
.detail-content h3 { font-size: 15px; }
.detail-content label { margin-bottom: 9px; font-size: 11px; gap: 5px; }
.detail-content input, .detail-content textarea, .detail-content select { padding: 8px 9px; font-size: 12px; border-radius: 9px; }
.detail-content textarea { min-height: 70px; }
.timeline-item { padding: 7px 9px; font-size: 11px; }
.service-workspace.left-collapsed { grid-template-columns: minmax(420px,1fr) 350px; }
.service-workspace.right-collapsed { grid-template-columns: 280px minmax(420px,1fr); }
@media (max-width: 1050px) { .service-workspace { grid-template-columns: 260px minmax(380px,1fr); } }

/* Encaixe integral na janela */
html, body { height: 100%; }
body { overflow: hidden; }
.shell { width: 100%; max-width: none; height: 100vh; padding: 8px 10px; display: flex; flex-direction: column; }
.shell > header { flex: 0 0 auto; min-height: 66px; margin-bottom: 9px; display: grid; grid-template-columns: minmax(240px, 1fr) auto minmax(420px, 1fr); align-items: center; gap: 14px; }
.shell > header h1 { font-size: 25px; line-height: 1.05; }
.shell > header .sub { margin: 4px 0 0; font-size: 12px; line-height: 1.3; }
.service-workspace { flex: 1 1 auto; height: auto; min-height: 0; }
.contact-list { max-height: none; height: calc(100vh - 278px); }
.conversation-pane, .contact-rail, .detail-rail { min-height: 0; }
.message-thread, .detail-content { min-height: 0; }
.groups-card { flex: 0 0 auto; max-height: calc(100vh - 20px); overflow: auto; }
@media (max-width: 720px) { body { overflow: hidden; } .shell { height: 100vh; padding: 0; } .service-workspace { height: auto; flex: 1 1 auto; } }

/* Painéis laterais redimensionáveis */
.service-workspace { --left-rail-width: 280px; --right-rail-width: 350px; grid-template-columns: var(--left-rail-width) 6px minmax(360px, 1fr) 6px var(--right-rail-width); }
.service-workspace.hidden { display: none; }
.panel-resizer { position: relative; z-index: 8; width: 6px; cursor: col-resize; touch-action: none; background: #edf3ef; border-left: 1px solid #dce6df; border-right: 1px solid #dce6df; }
.panel-resizer::after { content: ""; position: absolute; inset: 0 -4px; }
.panel-resizer:hover, .panel-resizer.dragging { background: #39a66b; }
body.resizing-panels { cursor: col-resize; user-select: none; }
.contact-list { overflow-x: hidden; }
.contact-item strong { display: block; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.3; padding-right: 15px; }
.contact-item.active, .contact-item[aria-current="true"] { transform: none; }
.service-workspace.left-collapsed { grid-template-columns: minmax(360px, 1fr) 6px var(--right-rail-width); }
.service-workspace.left-collapsed .panel-resizer-left { display: none; }
.service-workspace.right-collapsed { grid-template-columns: var(--left-rail-width) 6px minmax(360px, 1fr); }
.service-workspace.right-collapsed .panel-resizer-right { display: none; }
.service-workspace.left-collapsed.right-collapsed { grid-template-columns: 1fr; }
.service-workspace.left-collapsed.right-collapsed .panel-resizer { display: none; }
@media (max-width: 1050px) { .service-workspace { grid-template-columns: min(300px, 38vw) minmax(380px, 1fr); } .panel-resizer { display: none; } }
@media (max-width: 720px) { .service-workspace { grid-template-columns: 1fr; } }

/* Links, anexos e novas mensagens */
.message-text a { color: #0866c4; text-decoration: underline; overflow-wrap: anywhere; }
.message-bubble.mine .message-text a { color: #d9f2ff; }
.message-media { cursor: zoom-in; }
.media-open { display: inline-block; margin-top: 5px; color: #155c39; font-size: 10px; font-weight: 700; }
.message-bubble.mine .media-open { color: #fff; }
.contact-item.incoming:not(.active) { background: linear-gradient(90deg, #fff0a8, #fff9d7); border-color: #dda900; box-shadow: inset 5px 0 #e0a400, 0 3px 14px #a8790033; animation: incoming-pulse 1.4s ease-in-out infinite alternate; }
.contact-item.incoming:not(.active)::after { content: "NOVA"; position: absolute; top: 7px; right: 7px; padding: 2px 5px; border-radius: 999px; background: #d89400; color: #fff; font-size: 8px; font-weight: 900; letter-spacing: .05em; }
@keyframes incoming-pulse { from { box-shadow: inset 5px 0 #e0a400, 0 2px 8px #a8790022; } to { box-shadow: inset 5px 0 #e0a400, 0 4px 18px #a8790060; } }

/* Quadro de etapas */
.header-actions { min-width: 0; display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: flex-end; gap: 10px; }
.account-switch { display: flex; flex-direction: row; gap: 10px; align-items: center; }
.account-switch label { display: flex; align-items: center; gap: 8px; margin: 0; }
.account-switch label > span { padding-left: 2px; color: #5f7067; font-size: 12px; font-weight: 400; line-height: 1.1; text-transform: none; letter-spacing: normal; }
.account-switch label > span strong { font-weight: 600; }
.account-switch select { width: auto; min-width: 180px; padding: 8px 30px 8px 10px; background: #fff; }
.account-switch button { padding: 8px 12px; }
.directory-reset { width: 100%; padding: 7px 8px; margin: -3px 0 8px; font-size: 11px; }
.account-dialog { border: 0; padding: 0; border-radius: 18px; width: min(650px, calc(100vw - 28px)); box-shadow: 0 24px 80px #15332655; }
.account-dialog::backdrop { background: #10291f88; backdrop-filter: blur(3px); }
.dialog-card { padding: 24px; display: grid; gap: 18px; }
.dialog-heading, .account-row, .new-account { display: flex; align-items: center; gap: 12px; }
.dialog-heading { justify-content: space-between; }
.dialog-heading h2 { margin: 2px 0 0; }
.account-list { display: grid; gap: 8px; }
.account-row { padding: 12px; border: 1px solid #dbe7df; border-radius: 12px; }
.account-row > div { display: grid; flex: 1; gap: 3px; }
.account-row small { color: #718078; }
.account-state { font-size: 12px; padding: 5px 8px; border-radius: 20px; background: #eef2ef; }
.account-state.online { background: #dcf6e8; color: #08763e; }
.new-account input { flex: 1; }
.qr-panel { text-align: center; padding: 16px; border-radius: 14px; background: #f0f8f3; }
.qr-panel h3, .qr-panel p { margin: 0 0 8px; }
.qr-panel img { display: block; width: min(320px, 100%); margin: 10px auto; border-radius: 8px; }
.selectable-card { position: relative; display: grid; grid-template-columns: 20px minmax(0,1fr); gap: 5px; align-items: start; }
.selectable-card > input { margin: 13px 0 0 2px; accent-color: #147748; cursor: pointer; }
.selectable-card > .contact-item { width: 100%; }
.lawyer-tag { align-self: flex-start; display: inline-flex; width: max-content; max-width: 100%; padding: 3px 8px; border-radius: 999px; color: var(--lawyer-color); background: color-mix(in srgb, var(--lawyer-color) 16%, white); border: 1px solid color-mix(in srgb, var(--lawyer-color) 45%, white); font-size: 10px; font-weight: 800; }
.lawyer-workspace { flex: 1 1 auto; min-height: 0; border: 1px solid #d9e5dd; border-radius: 18px; background: #edf6f1; overflow: hidden; display: flex; flex-direction: column; }
.lawyer-workspace.hidden { display: none; }
.lawyer-columns { flex: 1 1 auto; min-height: 0; overflow-x: auto; overflow-y: hidden; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); align-items: stretch; gap: 10px; padding: 12px; }
.lawyer-column { height: 100%; min-height: 0; align-self: stretch; display: flex; flex-direction: column; overflow: hidden; border-top: 5px solid var(--lawyer-color); border-radius: 13px; background: #f7faf8; padding: 10px; }
.lawyer-column-heading { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.lawyer-column-heading span { padding: 3px 7px; border-radius: 20px; background: #e5eee8; font-size: 11px; }
.lawyer-card-list { flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; display: flex; flex-direction: column; gap: 8px; padding-right: 3px; }
.lawyer-card { display: grid; grid-template-columns: 20px 1fr; gap: 7px; align-items: start; padding: 11px; border-radius: 10px; border: 1px solid #dce6df; border-left: 4px solid var(--lawyer-color); background: #fff; box-shadow: 0 4px 10px #1d3c2d0d; cursor: grab; }
.lawyer-card > div { display: grid; gap: 4px; min-width: 0; }
.lawyer-card small { color: #68776f; }
.card-archive-check { position: absolute; top: 9px; right: 9px; accent-color: #147748; z-index: 2; }
.kanban-card { position: relative; }
.view-switch { justify-self: center; display: grid; grid-template-columns: repeat(3, auto); grid-auto-flow: column; width: max-content; min-width: max-content; padding: 3px; border-radius: 11px; background: #e5eee8; white-space: nowrap; }
.view-switch button { min-width: 82px; padding: 8px 13px; border-radius: 8px; background: transparent; color: #53675c; font-size: 11px; white-space: nowrap; }
.view-switch button.active { background: #fff; color: #086b3a; box-shadow: 0 2px 8px #173c2618; }
.kanban-workspace { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #dce6df; border-radius: 15px; background: linear-gradient(135deg, #e1f0e7, #d9e8e8); box-shadow: 0 22px 70px #173c2612; }
.kanban-workspace.hidden { display: none; }
.kanban-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 16px; background: #fff; border-bottom: 1px solid #dce6df; }
.kanban-toolbar h2 { margin: 0; font-size: 18px; }
.kanban-toolbar-actions { display: flex; align-items: center; gap: 10px; }
.kanban-toolbar-actions button { padding: 8px 11px; font-size: 10px; }
.kanban-filters { flex: 0 0 auto; width: calc(100% - 24px); display: grid; grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(160px, 1fr)); align-items: center; gap: 8px; margin: 9px 12px 0; padding: 0; background: transparent; }
.kanban-filters input { grid-column: auto; }
.kanban-filters input, .kanban-filters select { padding: 9px 10px; border: 1px solid #cbd8d0; border-radius: 9px; font-size: 12px; background: #fbfdfb; }
.priority-legend { display: flex; gap: 6px; flex-wrap: wrap; }
.priority-legend span, .kanban-priority { padding: 3px 7px; border-radius: 999px; font-size: 9px; font-weight: 800; }
.priority-urgent { background: #ffe0df; color: #a9211c; }
.priority-high { background: #ffead4; color: #9a4b00; }
.priority-normal { background: #dff0ff; color: #155e94; }
.priority-low { background: #e7eee9; color: #596a60; }
.kanban-columns { flex: 1; min-height: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 10px; padding: 12px; overflow-x: auto; overflow-y: hidden; align-items: stretch; }
.kanban-column { height: 100%; min-height: 0; display: flex; flex-direction: column; padding: 8px; border-radius: 12px; background: #f3f6f4cc; border: 2px solid transparent; border-top: 5px solid var(--stage-color, #3f9cd0); transition: .15s; overflow: hidden; }
.kanban-column.drag-over { border-color: #16834b; background: #e3f3e9; }
.kanban-column-heading { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; padding: 4px 5px 10px; background: #f3f6f4; position: sticky; top: 0; z-index: 2; }
.kanban-column-heading span { min-width: 23px; padding: 3px 6px; border-radius: 999px; text-align: center; background: #dfe8e2; font-size: 10px; }
.kanban-card-list { flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; display: flex; flex-direction: column; gap: 7px; padding-right: 3px; }
.kanban-card { position: relative; display: grid; gap: 5px; padding: 10px; border-radius: 10px; background: #fff; border: 1px solid #d7e1da; border-top: 5px solid var(--stage-color, #3f9cd0); box-shadow: 0 2px 7px #173c2614; cursor: grab; }
.kanban-card:hover { box-shadow: 0 5px 15px #173c2625; transform: translateY(-1px); }
.kanban-card.dragging { opacity: .45; }
.kanban-card.priority-urgent .kanban-priority { background: #ffe0df; color: #a9211c; }
.kanban-card.priority-high .kanban-priority { background: #ffead4; color: #9a4b00; }
.kanban-card.priority-normal .kanban-priority { background: #dff0ff; color: #155e94; }
.kanban-card.priority-low .kanban-priority { background: #e7eee9; color: #596a60; }
.kanban-card.incoming { outline: 3px solid #e1aa00; animation: incoming-pulse 1.4s ease-in-out infinite alternate; }
.kanban-card strong { overflow-wrap: anywhere; line-height: 1.3; }
.kanban-card small, .kanban-meta { color: #687a70; font-size: 10px; }
.kanban-priority { justify-self: start; }
.contact-workflow { margin-top: 5px; padding-left: 7px; border-left: 3px solid #3f9cd0; }
.contact-workflow.priority-urgent { border-left-color: #d93630; color: #a9211c; }
.contact-workflow.priority-high { border-left-color: #e47b21; color: #9a4b00; }
.contact-workflow.priority-low { border-left-color: #91a39a; }
.contact-item { border-left: 5px solid var(--stage-color, transparent); }
.contact-item:hover { border-left-color: var(--stage-color, #b7d7c3); }
.contact-item.active, .contact-item[aria-current="true"] { border-left-color: var(--stage-color, #08783f); box-shadow: inset 3px 0 var(--stage-color, #08783f), 0 3px 12px #08783f24; }
@media (max-width: 1100px) { .shell > header { grid-template-columns: minmax(210px,1fr) auto; } .header-actions { grid-column: 1 / -1; justify-content: flex-end; } }
@media (max-width: 900px) { .kanban-filters { grid-template-columns: repeat(3,minmax(0,1fr)); } .kanban-filters input { grid-column: 1 / -1; } }
@media (max-width: 720px) { .shell > header { grid-template-columns: 1fr; } .view-switch { justify-self: stretch; width: 100%; } .header-actions { width: 100%; align-items: stretch; flex-direction: column; } .account-switch { width: 100%; } .account-switch label { flex: 1; } .account-switch select { width: 100%; } .view-switch button { padding: 7px 6px; } .kanban-workspace { border-radius: 0; } .kanban-columns { grid-auto-columns: minmax(250px, 82vw); } .kanban-filters { grid-template-columns: 1fr; } .kanban-filters input { grid-column: 1; } }

.stage-modal { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 18px; background: #10251a88; backdrop-filter: blur(3px); }
.stage-modal.hidden { display: none; }
.stage-modal-card { width: min(520px, 100%); max-height: min(720px, 90vh); overflow: auto; padding: 18px; border-radius: 16px; background: #fff; box-shadow: 0 24px 80px #10251a55; }
.stage-modal-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stage-modal-heading h2 { margin: 0; font-size: 19px; }
.stage-editor-list { display: grid; gap: 6px; margin-bottom: 18px; }
.stage-editor-item { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 9px; padding: 9px 11px; text-align: left; background: #f2f6f3; color: #20352b; }
.stage-editor-item span { width: 18px; height: 18px; border-radius: 5px; }
.stage-editor-item small { color: #64756b; }
.stage-modal-card label { margin-bottom: 12px; }
.stage-modal-card input { padding: 10px; }
.stage-modal-card input[type="color"] { height: 44px; padding: 4px; }
.stage-form-actions { display: flex; justify-content: flex-end; gap: 8px; }


