:root {
    --bg: #f5f2ec;
    --panel: #fffdfa;
    --panel-strong: #ffffff;
    --text: #1f252b;
    --muted: #56616d;
    --muted-soft: #717b86;
    --line: #d8cec0;
    --line-strong: #c8bbab;
    --dark: #17222b;
    --accent: #246b68;
    --danger: #b42318;
    --success: #1f7a4d;
    --shadow: 0 18px 45px rgba(37, 31, 24, 0.12);
    --radius: 8px;
    --scrollbar-track: rgba(216, 206, 192, .34);
    --scrollbar-thumb: rgba(36, 107, 104, .46);
    --scrollbar-thumb-hover: rgba(36, 107, 104, .7);
}

* { box-sizing: border-box; }

* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    min-height: 42px;
    border: 3px solid transparent;
    border-radius: 999px;
    background-color: var(--scrollbar-thumb);
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: var(--scrollbar-thumb-hover);
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

.kanban-board,
.modal-body,
.suggest-box {
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.kanban-board::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.suggest-box::-webkit-scrollbar-track {
    border-radius: 999px;
    background: var(--scrollbar-track);
}

[hidden] { display: none !important; }

html {
    min-height: 100%;
    scroll-behavior: smooth;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100dvh;
    min-width: 320px;
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,0) 320px),
        linear-gradient(90deg, rgba(36,107,104,.055) 0 1px, transparent 1px 100%),
        var(--bg);
    background-size: auto, 28px 28px, auto;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at 18% 0%, rgba(36,107,104,.09), transparent 34%),
        radial-gradient(circle at 90% 12%, rgba(217,119,6,.08), transparent 26%),
        var(--bg);
}

button, input, textarea, select {
    font: inherit;
    font-size: 16px;
}

button { cursor: pointer; }

a { color: inherit; text-decoration: none; }

.app-shell {
    width: min(100%, 1600px);
    margin: 0 auto;
    min-height: 100dvh;
    padding: 18px 18px 40px;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #1f5f5b, #17222b);
    box-shadow: 0 10px 24px rgba(23, 34, 43, .18);
    font-weight: 800;
}

.brand h1 {
    margin: 0;
    font-size: clamp(24px, 3vw, 38px);
    line-height: 1;
    letter-spacing: 0;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 800;
}

.searchbar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.searchbar {
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255,255,255,.9);
}

.searchbar svg { width: 20px; color: var(--muted); }

.searchbar input,
.deal-form input, .deal-form textarea, .deal-form select,
.comment textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    padding: 11px 12px;
    outline: none;
}

textarea { resize: vertical; }

input:focus, textarea:focus, select:focus {
    border-color: rgba(36, 107, 104, .6);
    box-shadow: 0 0 0 4px rgba(36, 107, 104, .12);
}

.searchbar input { border: 0; background: transparent; padding: 0; box-shadow: none; }

.top-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.segmented, .button, .icon-button {
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255,255,255,.94);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    transition: border-color .18s ease, background .18s ease, color .18s ease;
}

.segmented:hover, .button:hover, .icon-button:hover { border-color: rgba(36, 107, 104, .45); }
.segmented.is-active { background: var(--dark); border-color: var(--dark); color: #fff; }
.icon-button.is-active { background: #fff; border-color: var(--dark); color: var(--dark); }
.icon-button { width: 44px; padding: 0; flex: 0 0 44px; }
.icon-button.small { min-height: 36px; width: 36px; flex-basis: 36px; }
.icon-button.primary, .button.dark { background: var(--dark); border-color: var(--dark); color: #fff; }
.icon-button.recording {
    position: relative;
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}
.icon-button.recording::after {
    content: "";
    position: absolute;
    inset: -6px;
    border: 2px solid rgba(180, 35, 24, .28);
    border-radius: var(--radius);
    animation: voice-ring 1.2s ease-out infinite;
}
.button.ghost { background: transparent; }
.button.ghost:hover { background: rgba(255,255,255,.8); }
.button.full { width: 100%; }
.button.compact { min-height: 36px; padding: 0 10px; font-size: 14px; }
.button.danger, .icon-button.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.button.text-danger { color: var(--danger); border: 0; min-height: 32px; padding: 0; background: transparent; }

svg { width: 18px; height: 18px; stroke-width: 2; }

.command-panel {
    position: relative;
    width: min(100%, 640px);
    min-width: 0;
}

.unified-search {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 4px 5px 4px 12px;
    border: 1px solid var(--line-strong);
    background: rgba(255,255,255,.94);
    box-shadow: none;
}

#voice-button {
    background: var(--dark);
    border-color: var(--dark);
    color: #fff;
}

.voice-listener {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 70;
    width: min(100%, 300px);
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-height: 42px;
    padding: 6px 8px;
    border: 1px solid rgba(36,107,104,.2);
    border-radius: var(--radius);
    background: rgba(255,255,255,.96);
    box-shadow: 0 10px 24px rgba(37,31,24,.12);
}

.voice-pulse {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--accent);
    box-shadow: 0 0 0 0 rgba(36,107,104,.28);
    animation: voice-pulse 1.25s ease-in-out infinite;
}

.voice-copy {
    display: grid;
    gap: 2px;
}

.voice-copy strong { font-size: 15px; }
.voice-copy span { display: none; }

.voice-bars {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 30px;
}

.voice-bars span {
    width: 4px;
    min-height: 8px;
    border-radius: 99px;
    background: var(--accent);
    animation: voice-bar .72s ease-in-out infinite alternate;
}

.voice-bars span:nth-child(2) { animation-delay: .12s; }
.voice-bars span:nth-child(3) { animation-delay: .24s; }
.voice-bars span:nth-child(4) { animation-delay: .36s; }
.voice-listener.is-processing .voice-pulse { animation: processing-spin 1s linear infinite; }
.voice-listener.is-processing .voice-bars span { animation-duration: .38s; }

.ai-result-panel {
    position: fixed;
    top: 84px;
    right: 18px;
    z-index: 80;
    width: min(390px, calc(100vw - 24px));
    pointer-events: none;
}

.ai-result {
    pointer-events: auto;
}

.ai-message {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid rgba(36,107,104,.24);
    border-radius: var(--radius);
    background: rgba(255,255,255,.96);
    box-shadow: 0 14px 34px rgba(37,31,24,.16);
    backdrop-filter: blur(12px);
}

.ai-message header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.ai-message header > span {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text);
    font-size: 14px;
    font-weight: 820;
}

.ai-message header i {
    width: 17px;
    height: 17px;
    color: var(--accent);
}

.ai-message p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
    line-height: 1.35;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(5, minmax(250px, 1fr));
    gap: 12px;
    align-items: start;
    overflow-x: auto;
    scrollbar-gutter: stable;
    min-height: calc(100dvh - 170px);
    padding-bottom: 32px;
}

.kanban-board.with-archive {
    grid-template-columns: repeat(7, minmax(250px, 1fr));
}

.kanban-column {
    min-height: 62vh;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: rgba(255,255,255,.68);
    overflow: hidden;
}

.column-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    min-height: 68px;
    padding: 12px;
    border-bottom: 1px solid var(--line-strong);
    background: rgba(255,255,255,.9);
}

.column-head p { margin: 0; font-weight: 750; }
.column-head span { color: var(--muted); font-size: 13px; font-weight: 650; }

.tone-sky .column-head { box-shadow: inset 4px 0 0 #3b82f6; }
.tone-amber .column-head { box-shadow: inset 4px 0 0 #d97706; }
.tone-violet .column-head { box-shadow: inset 4px 0 0 #7c3aed; }
.tone-rose .column-head { box-shadow: inset 4px 0 0 #e11d48; }
.tone-green .column-head { box-shadow: inset 4px 0 0 #16a34a; }
.tone-archive-success .column-head { box-shadow: inset 4px 0 0 #0f766e; }
.tone-archive-failed .column-head { box-shadow: inset 4px 0 0 #991b1b; }

.archive-column {
    background: rgba(248,250,249,.86);
}

.archive-column-head {
    background: rgba(255,255,255,.96);
}

.archived-deal-card {
    box-shadow: none;
    cursor: pointer;
}

.deal-list {
    display: grid;
    gap: 10px;
    min-height: 120px;
    padding: 10px;
}

.deal-card {
    position: relative;
    display: block;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--panel-strong);
    box-shadow: 0 10px 22px rgba(31,37,43,.1);
    cursor: grab;
    touch-action: pan-y;
}

.deal-card.sortable-ghost { opacity: .45; }
.deal-card.sortable-chosen { transform: rotate(.3deg); cursor: grabbing; }
.is-dragging-card .deal-card-main { pointer-events: none; }

.deal-card-main {
    display: grid;
    gap: 7px;
    width: 100%;
    min-width: 0;
    padding: 12px;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.deal-card strong {
    overflow-wrap: anywhere;
    font-size: 16px;
}

.deal-title-link {
    color: var(--text);
    font-size: 16px;
    font-weight: 760;
    overflow-wrap: anywhere;
}

.deal-title-link:hover { color: var(--accent); }

.deal-card span, .deal-card small { color: var(--muted); overflow-wrap: anywhere; }
.deal-card small { line-height: 1.35; }
.deal-card footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.deal-card em {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #3f4a55;
    background: #f6f8f8;
    border: 1px solid #dbe3e2;
    border-radius: 6px;
    padding: 3px 6px;
    font-style: normal;
    font-size: 13px;
}

.phone-action {
    color: inherit;
    font-weight: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.phone-action:hover {
    color: var(--accent);
}

.column-empty, .empty-state {
    min-height: 90px;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 650;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: rgba(255,255,255,.75);
}

.deal-form {
    display: grid;
    gap: 12px;
}

.deal-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(160px, .45fr);
    gap: 10px;
    align-items: end;
}

.deal-form-grid.three {
    grid-template-columns: minmax(110px, .42fr) minmax(0, 1fr) minmax(0, 1fr);
}

.phone-stack {
    display: grid;
    gap: 10px;
}

.contact-card {
    display: grid;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: rgba(255,255,255,.86);
}

.contact-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.contact-card header.contact-actions {
    justify-content: flex-end;
    min-height: 28px;
}

.contact-card header span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.contact-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(190px, .55fr);
    gap: 10px;
}

.deal-form label {
    position: relative;
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 720;
}

.deal-form label input, .deal-form label textarea, .deal-form label select {
    color: var(--text);
}

.file-list, .comment-list, .event-list { display: grid; gap: 10px; }

.file-row, .event-list p {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.file-row a, .comment-file {
    display: inline-flex;
    gap: 7px;
    align-items: center;
    color: var(--accent);
    overflow-wrap: anywhere;
}

.comment {
    display: grid;
    gap: 8px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #fff;
    padding: 10px;
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
    margin-top: 8px;
    font-weight: 650;
}

.modal {
    width: min(620px, calc(100% - 20px));
    max-height: calc(100dvh - 24px);
    border: 0;
    border-radius: var(--radius);
    padding: 0;
    background: var(--panel);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.modal::backdrop { background: rgba(23,34,43,.36); }
.modal-body {
    max-height: calc(100dvh - 24px);
    padding: 18px;
    overflow: auto;
}
.modal-body header, .modal-body footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}
.modal-body h2 { margin: 0; }

.create-deal-form {
    gap: 14px;
}

.create-modal-head {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.form-section {
    display: grid;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: rgba(255,255,255,.84);
}

.file-picker {
    position: relative;
    min-height: 44px;
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    cursor: pointer;
    overflow: hidden;
}

.file-picker input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.file-picker span {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    display: grid;
    place-items: center;
    color: var(--accent);
}

.file-picker strong {
    min-width: 0;
    font-size: 15px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-picker small {
    display: none;
}

.file-picker:hover {
    border-color: rgba(36,107,104,.5);
    background: rgba(36,107,104,.04);
}

.file-picker.has-files {
    border-color: rgba(36,107,104,.6);
    background: rgba(36,107,104,.06);
}

.deal-page {
    width: min(calc(100% - 28px), 1480px);
    min-height: 100dvh;
    margin: 0 auto;
    padding: 14px 0 44px;
}

.deal-hero {
    position: static;
    top: 0;
    z-index: 10;
    display: grid;
    gap: 14px;
    padding: 10px 0 16px;
    background: transparent;
    backdrop-filter: none;
}

.deal-back {
    width: max-content;
}

.deal-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: end;
}

.deal-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.stage-chip {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: rgba(255,255,255,.9);
    color: var(--text);
    font-size: 13px;
    font-weight: 820;
    line-height: 1;
}

.stage-chip::before {
    content: "";
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: currentColor;
}

.stage-chip.tone-sky { color: #1d4ed8; background: rgba(59,130,246,.11); border-color: rgba(59,130,246,.28); }
.stage-chip.tone-amber { color: #92400e; background: rgba(217,119,6,.13); border-color: rgba(217,119,6,.3); }
.stage-chip.tone-violet { color: #6d28d9; background: rgba(124,58,237,.11); border-color: rgba(124,58,237,.28); }
.stage-chip.tone-rose { color: #be123c; background: rgba(225,29,72,.1); border-color: rgba(225,29,72,.26); }
.stage-chip.tone-green { color: #15803d; background: rgba(22,163,74,.11); border-color: rgba(22,163,74,.28); }
.stage-chip.final-success { color: #0f766e; background: rgba(15,118,110,.1); border-color: rgba(15,118,110,.28); }
.stage-chip.final-failed { color: #991b1b; background: rgba(153,27,27,.1); border-color: rgba(153,27,27,.28); }

.deal-actions {
    display: flex;
    justify-content: flex-end;
}

.inline-close-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inline-close-form select {
    min-height: 44px;
    max-width: 190px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 0 10px;
}

.deal-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.deal-fact {
    min-width: 0;
    display: inline-flex;
    gap: 8px;
    align-items: center;
    min-height: 40px;
    max-width: 100%;
    padding: 0 11px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: rgba(255,255,255,.92);
    color: var(--text);
    font-weight: 750;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.deal-fact.compact {
    min-width: 54px;
    justify-content: center;
}

.deal-fact i {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    color: var(--accent);
}

.deal-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: 16px;
    align-items: start;
}

.deal-main-flow,
.deal-side-flow {
    display: grid;
    gap: 16px;
}

.deal-panel {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: rgba(255,255,255,.9);
}

.section-title {
    display: flex;
    gap: 10px;
    align-items: start;
}

.section-title > i {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    padding: 9px;
    border-radius: var(--radius);
    color: #fff;
    background: var(--dark);
}

.section-title h2,
.contacts-editor h3 {
    margin: 0;
    font-size: 20px;
    line-height: 1.15;
}

.section-title h2 {
    color: var(--text);
    font-weight: 820;
}

.section-title p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.detail-form {
    gap: 14px;
}

.detail-form-section {
    display: grid;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: rgba(255,255,255,.78);
}

.contacts-editor {
    display: grid;
    gap: 10px;
    padding-top: 4px;
}

.readonly-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.readonly-grid > div,
.readonly-contact .contact-grid > div {
    min-width: 0;
    display: grid;
    gap: 5px;
    padding: 11px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #fff;
}

.readonly-grid .wide {
    grid-column: 1 / -1;
}

.readonly-grid span,
.readonly-contact span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.readonly-grid strong,
.readonly-contact strong,
.readonly-grid p {
    min-width: 0;
    margin: 0;
    color: var(--text);
    overflow-wrap: anywhere;
}

.mini-head,
.form-actions,
.composer-actions {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
}

.comment-composer {
    display: grid;
    gap: 10px;
}

.comment-composer textarea,
.activity-comment textarea {
    width: 100%;
    min-height: 96px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    padding: 12px;
    outline: none;
}

.compact-picker {
    width: min(100%, 240px);
}

.detail-comments {
    gap: 12px;
}

.activity-comment {
    padding: 12px;
    background: #fff;
    border-color: var(--line-strong);
}

.comment-readonly {
    margin: 0;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.file-grid {
    display: grid;
    gap: 10px;
}

.file-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 36px;
    gap: 8px;
    align-items: center;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #fff;
}

.file-card a {
    min-width: 0;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 8px;
    align-items: center;
}

.file-card a i {
    grid-row: 1 / 3;
    color: var(--accent);
}

.file-card span {
    color: var(--text);
    font-weight: 650;
}

.file-card span,
.file-card small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    line-height: 1.25;
}

.file-card small {
    white-space: nowrap;
}

.file-card small {
    color: var(--muted);
    font-size: 12px;
}

.event-timeline {
    display: grid;
    gap: 12px;
}

.event-timeline article {
    position: relative;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
}

.event-timeline article > span {
    width: 14px;
    height: 14px;
    margin-top: 3px;
    border-radius: 50%;
    border: 2px solid rgba(36,107,104,.35);
    background: #fff;
}

.compact-events {
    gap: 10px;
}

.compact-events.is-collapsed article.is-extra {
    display: none;
}

.compact-events article {
    grid-template-columns: 12px minmax(0, 1fr);
    gap: 8px;
}

.compact-events article > span {
    width: 7px;
    height: 7px;
    margin-top: 7px;
    border: 0;
    background: rgba(36,107,104,.32);
}

.compact-events strong {
    font-size: 14px;
    line-height: 1.2;
}

.compact-events p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--muted-soft);
    font-size: 13px;
    line-height: 1.25;
}

.event-toggle {
    width: 100%;
}

.event-timeline p {
    margin: 0;
}

.event-timeline strong {
    display: block;
}

.event-timeline small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.empty-note {
    margin: 0;
    padding: 12px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: rgba(255,255,255,.8);
    color: var(--muted);
    font-weight: 650;
}

.danger-zone {
    background: rgba(180,35,24,.045);
}

@keyframes voice-ring {
    0% { opacity: 1; transform: scale(.92); }
    100% { opacity: 0; transform: scale(1.22); }
}

@keyframes voice-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(36,107,104,.28); transform: scale(1); }
    50% { box-shadow: 0 0 0 10px rgba(36,107,104,0); transform: scale(1.04); }
}

@keyframes voice-bar {
    from { height: 8px; opacity: .55; }
    to { height: 28px; opacity: 1; }
}

@keyframes processing-spin {
    from { transform: rotate(0); }
    to { transform: rotate(360deg); }
}

.toast-stack {
    position: fixed;
    z-index: 50;
    top: 14px;
    right: 14px;
    display: grid;
    gap: 8px;
}
.toast {
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--dark);
    color: #fff;
    box-shadow: var(--shadow);
}

.suggest-box {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 60;
    display: grid;
    max-height: 260px;
    overflow: auto;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}
.suggest-box button {
    min-height: 42px;
    border: 0;
    background: #fff;
    text-align: left;
    padding: 9px 12px;
}
.suggest-box button:hover { background: #f4f6f6; }

.muted { color: var(--muted); }

.login-shell {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 18px;
}

.login-panel {
    width: min(100%, 430px);
    display: grid;
    gap: 20px;
    padding: 22px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: rgba(255,255,255,.92);
    box-shadow: var(--shadow);
}

.login-brand h1 { font-size: 32px; }
.login-error {
    margin: 0;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--danger);
    background: rgba(180, 35, 24, .08);
}

@media (max-width: 1080px) {
    .topbar { grid-template-columns: 1fr; }
    .top-actions { justify-content: flex-end; }
    .command-panel { grid-template-columns: 140px minmax(0, 1fr); width: 100%; }
    .deal-hero { position: static; }
    .deal-workspace { grid-template-columns: 1fr; }
    .deal-side-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
    .danger-zone { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
    .app-shell { padding: 12px; }
    .deal-page { width: min(calc(100% - 20px), 1480px); padding: 12px 0 34px; }
    .brand h1 { font-size: 28px; }
    .topbar {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
        align-items: start;
    }
    .top-actions {
        justify-content: flex-end;
        gap: 6px;
    }
    .top-actions .button {
        width: 44px;
        padding: 0;
    }
    .top-actions .button span {
        display: none;
    }
    .command-panel {
        width: 100%;
    }
    .searchbar { flex-direction: row; }
    .voice-listener { grid-template-columns: 34px minmax(0, 1fr) auto; }
    .voice-bars { grid-column: auto; justify-content: center; }
    .ai-result-panel {
        top: auto;
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
    }
    .kanban-board {
        display: flex;
        gap: 12px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        min-height: calc(100dvh - 160px);
        padding-bottom: 28px;
    }
    .kanban-column {
        flex: 0 0 min(88vw, 380px);
        min-height: 58vh;
        scroll-snap-align: start;
    }
    .file-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }
    .file-row a {
        min-width: 0;
        overflow-wrap: anywhere;
    }
    .comment-meta { align-items: stretch; flex-direction: column; }
    .deal-form-grid { grid-template-columns: 1fr; }
    .contact-grid { grid-template-columns: 1fr; }
    .deal-hero-grid { grid-template-columns: 1fr; }
    .deal-actions { display: grid; justify-content: stretch; }
    .deal-actions > form,
    .deal-actions .button,
    .inline-close-form { width: 100%; }
    .inline-close-form select { max-width: none; flex: 1; }
    .deal-side-flow { grid-template-columns: 1fr; }
    .mini-head,
    .composer-actions,
    .form-actions { align-items: stretch; flex-direction: column; }
    .compact-picker { width: 100%; }
    .readonly-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
    .brand-mark { width: 40px; height: 40px; }
    .button span { overflow-wrap: anywhere; }
    .inline-close-form { flex-direction: column; }
    .deal-fact { flex: 1 1 100%; }
    .deal-fact.compact { flex-basis: calc(50% - 4px); }
    .deal-panel { padding: 12px; }
    .section-title h2 { font-size: 18px; }
    .command-panel { width: 100%; }
}
