/* === Dark green theme v0.11 === */
:root {
    --bg:          #0d0f1a;
    --surface:     #131621;
    --surface-2:   #191e2e;
    --surface-3:   #232840;
    --border:      #2a3350;
    --border-light:#1c2238;
    --text:        #e4eaf4;
    --text-2:      #8a9bb8;
    --text-3:      #424e6a;
    --accent:      #34d399;
    --accent-h:    #10b981;
    --accent-dim:  rgba(52,211,153,0.12);
    --green:       #34d399;
    --red:         #f43f5e;
    --amber:       #fbbf24;
    --purple:      #a78bfa;
}

* { box-sizing: border-box; }

[x-cloak] { display: none !important; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

h1, h2 {
    color: var(--text);
    font-weight: 800;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* === Top nav === */

.topnav {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}

.topnav .brand {
    font-weight: 800;
    font-size: 18px;
    color: var(--accent);
    letter-spacing: -0.02em;
}

.topnav a:not(.brand) {
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--text-2);
    font-weight: 500;
    font-size: 14px;
    transition: background .15s, color .15s;
}

.topnav a:not(.brand):hover {
    background: var(--surface-2);
    color: var(--text);
}

.topnav a.active {
    background: var(--surface-2);
    color: var(--text);
    font-weight: 600;
}

/* === Page === */

.page {
    max-width: 720px;
    margin: 28px auto;
    padding: 0 16px;
    width: 100%;
    animation: fadeInUp .35s ease;
}

.page-card      { max-width: 640px; }
.page-card-wide { max-width: 1100px; }

.card-detail-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 860px) {
    .card-detail-grid { grid-template-columns: 1fr; }
}

.card-detail-info .panel,
.card-detail-main .panel { margin-bottom: 20px; }

/* === Notes / Events === */

.note-list, .event-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}

.note {
    padding: 10px 14px;
    margin-bottom: 8px;
    background: var(--surface-2);
    border-radius: 10px;
    animation: fadeInUp .3s ease backwards;
}

.note-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-2);
    font-weight: 700;
    margin-bottom: 4px;
}

.note-text { font-size: 14px; }

.event {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    animation: fadeInUp .3s ease backwards;
}

.event:last-child { border-bottom: none; }

.event-date {
    flex: 0 0 auto;
    color: var(--text-2);
    font-size: 12px;
}

.tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.tab-bar button {
    background: transparent;
    color: var(--text-2);
    box-shadow: none;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .15s, border-color .15s;
}

.tab-bar button:hover {
    background: transparent;
    color: var(--text);
    transform: none;
    border-color: var(--border);
}

.tab-bar button.active {
    background: transparent;
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* === Stats === */

.stats-grid  { display: grid; grid-template-columns: 1fr; gap: 20px; }

.stats-numbers {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.stats-number {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: var(--surface-2);
    border-radius: 12px;
    padding: 14px 20px;
    min-width: 100px;
}

.stats-value { font-size: 26px; font-weight: 800; color: var(--accent); }
.stats-label { font-size: 12px; color: var(--text-2); font-weight: 600; }

.stats-list { list-style: none; padding: 0; margin: 0; }

.stats-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}
.stats-list li:last-child { border-bottom: none; }
.stats-list-name  { font-weight: 600; }
.stats-list-value { font-weight: 800; color: var(--accent); }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 8px;
    text-decoration: none;
    transition: color .15s, border-color .15s;
    margin-bottom: 12px;
}
.back-link:hover {
    color: var(--text);
    border-color: var(--accent);
}

/* === Forms === */

.inline-form {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.inline-form input { flex: 1; }

input, select {
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface-2);
    color: var(--text);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
}

input::placeholder { color: var(--text-3); }

button {
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: #0a1610;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    box-shadow: none;
    transition: background .15s, transform .1s, opacity .15s;
}

button:hover {
    background: var(--accent-h);
    transform: translateY(-1px);
}

button:active { transform: translateY(0); }

/* === Pipeline list === */

.pipeline-list { list-style: none; padding: 0; }

.pipeline-list li {
    position: relative;
    padding: 0;
    margin-bottom: 8px;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: border-color .2s;
    animation: fadeInUp .35s ease backwards;
}

.pipeline-list li:hover { border-color: var(--accent); }

.pipeline-list a { font-weight: 600; color: var(--text); }

.pipeline-link {
    display: block;
    padding: 12px 16px;
    padding-right: 44px;
}

.pipeline-delete {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.page-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* === Buttons === */

.btn-danger, .btn-danger-outline {
    box-shadow: none;
}

.btn-danger {
    background: transparent;
    color: var(--text-3);
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1;
}

.btn-danger:hover {
    background: rgba(244, 63, 94, 0.15);
    color: var(--red);
    transform: none;
}

.btn-danger-outline {
    background: transparent;
    color: var(--red);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-danger-outline:hover {
    background: rgba(244, 63, 94, 0.1);
    transform: none;
}

.btn-archive {
    background: transparent;
    color: var(--text-3);
    border: 1px solid var(--border);
    font-size: 13px;
    padding: 6px 12px;
    box-shadow: none;
}
.btn-archive:hover {
    color: var(--red);
    border-color: rgba(244, 63, 94, 0.4);
    background: rgba(244, 63, 94, 0.07);
    transform: none;
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text-2);
    box-shadow: none;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-3);
    color: var(--text);
    transform: none;
    box-shadow: none;
}

.btn-sm {
    font-size: 12px;
    padding: 5px 10px;
}

/* === Board === */

.board-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Board header — compact, filters on the right */

.board-header-area {
    display: flex;
    gap: 20px;
    padding: 14px 24px 10px;
    flex: 0 0 auto;
    align-items: flex-start;
}

.board-header-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.board-header-left h1 {
    margin: 0;
    font-size: 18px;
    color: var(--text);
}

.board-header-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Gear menu */
.board-gear-menu { position: relative; }

.board-gear-btn {
    background: none;
    border: 1px solid var(--border);
    box-shadow: none;
    padding: 6px 8px;
    cursor: pointer;
    color: var(--text-2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    transition: border-color .15s, color .15s, background .15s;
}

.board-gear-btn:hover {
    border-color: var(--accent);
    color: var(--text);
    background: var(--surface-2);
    transform: none;
    box-shadow: none;
}

.board-gear-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    min-width: 180px;
    padding: 4px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* === View toggle (Воронка / Список) === */
.view-toggle {
    display: flex;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
    flex-shrink: 0;
}

.view-toggle-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.view-toggle-btn:hover {
    color: var(--text);
    background: var(--surface-3);
}

.view-toggle-btn.vtb-active {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

/* === Board list view === */
.board-list-view {
    padding: 16px 24px 40px;
    max-width: 860px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.board-list-group {}

.board-list-stage-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 0 0 6px;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--border);
}

.board-list-count {
    background: var(--surface-2);
    color: var(--text-3);
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 20px;
}

.board-list-empty {
    padding: 48px 0;
    text-align: center;
    color: var(--text-3);
    font-size: 14px;
}

.board-action-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    background: transparent;
    border: none;
    box-shadow: none;
    cursor: pointer;
    font-family: inherit;
    transition: background .12s;
}

.board-action-item:hover {
    background: var(--surface-2);
    transform: none;
    box-shadow: none;
}

.board-action-danger { color: var(--red); }
.board-action-danger:hover { background: rgba(244, 63, 94, 0.1); }

/* Filter form — inside board-header-right */
.board-filter-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.board-search-input {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 13px;
    font-family: inherit;
    background: var(--surface-2);
    color: var(--text);
    width: 220px;
    max-width: 100%;
    transition: border-color .15s, box-shadow .15s, width .2s;
}

.board-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
    outline: none;
    width: 280px;
}

.board-filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
}

.board-filter-controls .custom-select { min-width: 110px; }

.board-filter-controls .custom-select-toggle {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 8px;
}

.filter-save-link {
    background: var(--surface-2);
    border: 1px solid var(--border);
    box-shadow: none;
    color: var(--text-2);
    font-size: 13px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    font-family: inherit;
    transition: color .15s, background .15s;
}

.filter-save-link:hover {
    color: var(--text);
    background: var(--surface-3);
    transform: none;
    box-shadow: none;
}

/* Rename */
.rename-wrap h1, .rename-wrap h2 { cursor: pointer; }
.rename-wrap form { display: block; }

.rename-input {
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 4px 8px;
    font-family: inherit;
    font-weight: 700;
    background: var(--surface-2);
    color: var(--text);
    width: 100%;
}

.rename-input-lg {
    font-size: 18px;
    padding: 5px 10px;
    min-width: 180px;
}

.header-rename-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.header-rename-actions {
    display: flex;
    gap: 8px;
}

/* Pipeline tabs */
.pipeline-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pipeline-tabs a {
    padding: 5px 12px;
    border-radius: 7px;
    background: var(--surface-2);
    color: var(--text-2);
    font-weight: 500;
    font-size: 13px;
    border: 1px solid var(--border);
    transition: border-color .15s, color .15s;
}

.pipeline-tabs a:hover { color: var(--text); border-color: var(--accent); }

.pipeline-tabs a.active {
    background: var(--accent);
    color: #0a1610;
    border-color: var(--accent);
}

/* Board columns */
.board {
    flex: 1;
    display: flex;
    gap: 12px;
    padding: 0 24px 24px;
    overflow-x: auto;
    align-items: stretch;
    min-height: 0;
}

.board-column {
    background: var(--surface);
    border-radius: 14px;
    padding: 12px;
    min-width: 272px;
    flex: 0 0 272px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 0;
    animation: fadeInUp .35s ease backwards;
}

.board-column h2 {
    font-size: 13px;
    margin: 0;
    font-weight: 700;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.board-column-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    flex: 0 0 auto;
}

.board-column-header { cursor: grab; user-select: none; }

.board-column-new {
    background: transparent;
    border: 1px dashed var(--border);
    justify-content: center;
    align-items: stretch;
    min-height: 60px;
}

/* Cards */
.card-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 12px;
    overflow-y: auto;
    padding-right: 2px;
}

.card {
    position: relative;
    background: var(--surface-2);
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    color: inherit;
    cursor: grab;
    transition: border-color .15s, transform .15s;
    animation: fadeInUp .3s ease backwards;
}

.card:hover {
    border-color: var(--border);
    transform: translateY(-1px);
}

.card.sortable-ghost { opacity: 0.35; }
.card.sortable-chosen { cursor: grabbing; }

.card-link { display: block; color: inherit; padding-right: 18px; }

.card-delete {
    position: absolute;
    top: 5px;
    right: 5px;
    opacity: 0;
    transition: opacity .15s;
}

.card:hover .card-delete { opacity: 1; }

.card-delete .btn-danger { width: 20px; height: 20px; font-size: 12px; }

.card-name { font-weight: 700; font-size: 13px; color: var(--text); }

.card-company { font-size: 11px; color: var(--text-2); margin-top: 2px; }

.card-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.card-tags-lg { margin: 10px 0 16px; gap: 6px; }

.card-tags-lg .tag {
    font-size: 13px;
    padding: 5px 12px;
    border-radius: 8px;
}

.card-tags-lg .tag-custom .tag-delete button {
    width: 16px;
    height: 16px;
    font-size: 13px;
}

.tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
}

.tag-tier    { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.tag-source  { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.tag-custom  {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Tag color palette — deterministic by tag ID % 10 */
.tag-c0 { background: rgba(239,68,68,0.18);   color: #fca5a5; }
.tag-c1 { background: rgba(249,115,22,0.18);  color: #fdba74; }
.tag-c2 { background: rgba(234,179,8,0.18);   color: #fde047; }
.tag-c3 { background: rgba(34,197,94,0.18);   color: #86efac; }
.tag-c4 { background: rgba(20,184,166,0.18);  color: #5eead4; }
.tag-c5 { background: rgba(59,130,246,0.18);  color: #93c5fd; }
.tag-c6 { background: rgba(99,102,241,0.18);  color: #a5b4fc; }
.tag-c7 { background: rgba(168,85,247,0.18);  color: #d8b4fe; }
.tag-c8 { background: rgba(236,72,153,0.18);  color: #f9a8d4; }
.tag-c9 { background: rgba(245,158,11,0.18);  color: #fcd34d; }

.tag-custom .tag-delete { margin: 0; display: inline-flex; }

.tag-custom .tag-delete button {
    background: transparent;
    box-shadow: none;
    color: inherit;
    padding: 0;
    width: 13px;
    height: 13px;
    font-size: 11px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
}

.tag-custom .tag-delete button:hover {
    transform: none;
    box-shadow: none;
    color: var(--red);
    background: rgba(244, 63, 94, 0.15);
}

.tag-empty { color: var(--text-3); font-style: italic; font-size: 13px; }

/* Card footer */
.card-footer {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
}

/* Card status labels (no borders, just text) */
.card-status-label {
    font-size: 10px;
    font-weight: 700;
}

.card-status-overdue  { color: var(--red); }
.card-status-no-tasks { color: var(--amber); }

/* Assignee avatars on card */
.card-assignees { display: flex; align-items: center; }

.card-assignee-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 1.5px solid rgba(255,255,255,0.15);
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: -4px;
    flex-shrink: 0;
}

.card-assignee-avatar:first-child { margin-left: 0; }

.card-assignee-more {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-3);
    margin-left: 4px;
}

/* Add row */
.add-row { flex: 0 0 auto; margin-top: 8px; margin-bottom: 8px; }

.add-toggle {
    width: 100%;
    background: transparent;
    box-shadow: none;
    color: var(--text-2);
    border: 1px solid rgba(52,211,153,0.25);
    font-weight: 600;
    text-align: center;
    font-size: 13px;
    border-radius: 8px;
    transition: border-color .15s, color .15s, background .15s;
}

.add-toggle:hover {
    background: rgba(52,211,153,0.07);
    color: var(--accent);
    border-color: rgba(52,211,153,0.55);
    transform: none;
    box-shadow: none;
}

.add-toggle-column { margin: auto 0; }

.board-column-new .inline-form {
    margin-top: 0;
    align-self: center;
    width: 100%;
}

/* === Card detail panels === */

.panel {
    background: var(--surface);
    border-radius: 14px;
    padding: 18px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
    animation: fadeInUp .35s ease backwards;
}

.panel-title { margin: 0 0 16px; font-size: 14px; font-weight: 700; color: var(--text-2); letter-spacing: 0.04em; text-transform: uppercase; }

.card-form { display: flex; flex-direction: column; }

.card-form label {
    display: grid;
    grid-template-columns: 100px 1fr;
    align-items: center;
    gap: 0 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-light);
}

.card-form label:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.card-form label > span {
    font-size: 11px;
    color: var(--text-2);
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1.3;
}

.card-form input[type="text"],
.card-form .autocomplete-input {
    padding: 6px 10px;
    font-size: 13px;
}

.card-form .custom-select-toggle { width: 100%; font-size: 13px; }
.card-form .autocomplete-input { font-size: 13px; }

/* === Tasks panel (card detail) === */

.task-list { list-style: none; padding: 0; margin: 0 0 16px; }

.task {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: var(--surface-2);
    border-radius: 10px;
    border: 1px solid var(--border-light);
    transition: opacity .15s;
    animation: fadeInUp .3s ease backwards;
}

.task-top {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.task-toggle { flex: 0 0 auto; display: flex; align-items: center; }

.task-checkbox {
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 6px;
    background: var(--surface-3);
    border: 1.5px solid var(--border);
    color: #fff;
    box-shadow: none;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.task-checkbox:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--accent);
}

.task-done .task-checkbox {
    background: var(--green);
    border-color: var(--green);
}

.task-text { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.task-avatar {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--text-2);
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--border);
    cursor: pointer;
}

.task-meta {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.task-assignee-slot {
    position: relative;
    display: flex;
    align-items: center;
}

.task-deadline-slot {
    flex: 0 0 84px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.task-deadline { font-size: 11px; color: var(--text-3); }

.task-done { opacity: 0.45; }
.task-done .task-text { text-decoration: line-through; }

.task-empty { color: var(--text-3); font-style: italic; padding: 8px 0; font-size: 13px; }

.task-edit-btn {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 6px;
    background: var(--surface-3);
    color: var(--text-2);
    box-shadow: none;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}

.task-edit-btn:hover {
    transform: none;
    color: var(--text);
    border-color: var(--accent);
}

.task-edit-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
}

.task-edit-form .custom-select { min-width: 160px; }

.task-overdue { border-left: 2px solid var(--red); }
.task-overdue .task-deadline { color: var(--red); font-weight: 700; }


.task-card-ref {
    display: block;
    margin-bottom: 5px;
    font-size: 11px;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.task-card-ref:hover { text-decoration: underline; }

.page-tasks { max-width: 800px; }

/* === Global tasks page (board layout) === */

.tasks-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
}

.tasks-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 14px 24px 10px;
    flex: 0 0 auto;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 0;
}

.tasks-header-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.tasks-header-left h1 {
    margin: 0;
    font-size: 18px;
}

.tasks-header-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 4px;
}

.tasks-filter-form {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.tasks-filter-form .custom-select { min-width: 130px; }
.tasks-filter-form .custom-select-toggle { font-size: 13px; padding: 6px 10px; }

.tasks-board {
    flex: 1;
    display: flex;
    gap: 1px;
    overflow-x: auto;
    background: var(--border-light);
    min-height: 0;
}

.tasks-column {
    flex: 1;
    min-width: 280px;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    padding: 16px;
    min-height: 0;
}

.tasks-column-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
    flex: 0 0 auto;
}

.tasks-column-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-2);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.tasks-column-count {
    font-size: 12px;
    color: var(--text-3);
}

.tasks-column-divider {
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
    margin-bottom: 14px;
    flex: 0 0 auto;
    opacity: 0.5;
}

.tasks-column-divider-overdue {
    background: var(--red);
    opacity: 0.7;
}

.tasks-column-overdue .tasks-column-title {
    color: #fca5a5;
}

.tasks-column-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 0 8px;
    list-style: none;
    margin: 0;
}

/* task items inside tasks-column-body inherit task-list styling */
.tasks-column-body .task {
    border-bottom: 1px solid var(--border);
}
.tasks-column-body .task:last-child {
    border-bottom: none;
}

.tasks-column-empty {
    color: var(--text-3);
    font-size: 13px;
    font-style: italic;
    padding: 8px 0;
    list-style: none;
}

/* Task cards in tasks page — same structure as board .card */
.card-task { cursor: default; }
.card-task .card-link { cursor: default; }
.card-task .card-link[href] { cursor: pointer; }
.card-task-done { opacity: 0.45; }
.card-task-done .card-name { text-decoration: line-through; color: var(--text-3); }

/* Checkbox toggle button (top-right on task card) */
/* Task board card bottom section */
.task-card-bottom {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-card-assignee {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 1.5px solid var(--border);
    color: var(--text-2);
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Full-width done button on task card */
.task-done-btn {
    width: 100%;
    background: transparent;
    box-shadow: none;
    border: 1px solid var(--border);
    color: var(--text-3);
    font-size: 12px;
    font-weight: 600;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}

.task-done-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
    transform: none;
    box-shadow: none;
}

.task-done-btn-active {
    background: var(--accent-dim);
    border-color: rgba(52,211,153,0.4);
    color: var(--accent);
}

.task-done-btn-active:hover {
    background: transparent;
    border-color: var(--border);
    color: var(--text-3);
    transform: none;
    box-shadow: none;
}

/* Deadline badge inside task card footer */
.task-dl-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 20px;
    border: 1px solid var(--border);
    color: var(--text-3);
    white-space: nowrap;
}
.task-dl-overdue {
    color: #fca5a5 !important;
    border-color: rgba(239,68,68,0.45) !important;
    background: rgba(239,68,68,0.08);
}
.task-dl-today {
    color: #fcd34d !important;
    border-color: rgba(251,191,36,0.55) !important;
    background: rgba(251,191,36,0.07);
}

/* Add task row (in tasks board columns) */
.tasks-add-row { flex: 0 0 auto; margin-top: 8px; margin-bottom: 10px; }

.tasks-add-btn {
    width: 100%;
    background: transparent;
    box-shadow: none;
    color: var(--text-2);
    border: 1px solid rgba(52,211,153,0.25);
    font-weight: 600;
    text-align: center;
    font-size: 13px;
    border-radius: 8px;
    transition: border-color .15s, color .15s, background .15s;
}

.tasks-add-btn:hover {
    background: rgba(52,211,153,0.07);
    color: var(--accent);
    border-color: rgba(52,211,153,0.55);
    transform: none;
    box-shadow: none;
}

.tasks-add-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background: var(--surface-2);
    border-radius: 10px;
    border: 1px solid var(--border);
}

/* task-add-main-row overrides width:100% for the text input */

.tasks-add-form-row {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.tasks-add-form-row .custom-select { min-width: 150px; flex: 1; }

/* Task form meta row (assignee + deadline in add form) */
.task-form-meta-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.task-form-meta-row .custom-select { flex: 1; min-width: 130px; }

.task-form-deadline {
    flex: 1;
    min-width: 130px;
    font-size: 13px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text);
}

/* Entity tasks page */
.page-tasks-entity { max-width: 900px; }

.task-empty-state {
    color: var(--text-3);
    font-style: italic;
    padding: 20px 0;
    font-size: 14px;
}

.task-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

/* === Filter bar (tasks page top) === */

.filter-bar {
    padding: 0 24px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    flex: 0 0 auto;
}

.filter-bar-tasks { padding: 0 0 12px; }

.filter-bar-form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.filter-bar .custom-select { min-width: 110px; }

.filter-bar .custom-select-toggle {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 8px;
}

.filter-bar .custom-select-toggle::after {
    width: 6px;
    height: 6px;
    margin-left: 6px;
}

.filter-bar .custom-select-menu li { font-size: 13px; }

.filter-search-sm {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-family: inherit;
    background: var(--surface-2);
    color: var(--text);
    width: 150px;
    transition: border-color .15s, width .2s;
}

.filter-search-sm:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
    outline: none;
    width: 200px;
}

.filter-reset-btn {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    background: none;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 5px 9px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s;
    display: inline-flex;
    align-items: center;
}

.filter-reset-btn:hover {
    background: rgba(244, 63, 94, 0.1);
    color: var(--red);
    border-color: var(--red);
}

.saved-filter-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.saved-filter-chip {
    display: inline-flex;
    align-items: stretch;
    background: var(--surface-2);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: border-color .15s;
}

.saved-filter-chip .chip-label {
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-3);
    white-space: nowrap;
    transition: color .15s, background .15s;
}

.saved-filter-chip .chip-label:hover {
    background: var(--surface-3);
    color: var(--text);
}

/* Active state */
.saved-filter-chip.chip-active {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.saved-filter-chip.chip-active .chip-label {
    color: var(--accent);
}

.saved-filter-chip.chip-active .chip-delete {
    border-left-color: rgba(52,211,153,0.25);
}

.chip-delete-form { margin: 0; }

.chip-delete {
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--text-3);
    padding: 0 8px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-left: 1px solid var(--border);
    transition: background .15s, color .15s;
}

.chip-delete:hover {
    background: rgba(244, 63, 94, 0.12);
    color: var(--red);
    transform: none;
    box-shadow: none;
}

.save-filter-details { display: inline-block; }

.filter-save-toggle {
    cursor: pointer;
    list-style: none;
    user-select: none;
    font-size: 12px;
    color: var(--text-3);
    padding: 4px 0;
}

.filter-save-toggle::-webkit-details-marker { display: none; }
.filter-save-toggle:hover { color: var(--text-2); }

.save-filter-form {
    margin-top: 6px;
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-name-input {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
    background: var(--surface-2);
    color: var(--text);
    min-width: 160px;
    transition: border-color .15s;
}

.filter-name-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18);
    outline: none;
}

/* === Nav search === */

.nav-search { margin-left: auto; }
.nav-search input { width: 200px; }

/* === Search page === */

.page-search { max-width: 800px; }

.search-list { list-style: none; padding: 0; margin: 0; }

.search-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}

.search-list li:last-child { border-bottom: none; }

.search-list a { font-weight: 700; color: var(--text); }

/* === Auth === */

.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 28px;
    width: 100%;
    max-width: 360px;
    border: 1px solid var(--border);
    animation: fadeInUp .35s ease;
}

.brand-title {
    margin: 0 0 4px;
    font-size: 22px;
    color: var(--accent);
}

.auth-form { display: grid; gap: 12px; margin-top: 8px; }

.auth-form label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12px;
    color: var(--text-2);
    font-weight: 500;
}

.auth-error {
    background: rgba(244, 63, 94, 0.12);
    color: var(--red);
    border: 1px solid rgba(244, 63, 94, 0.25);
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 13px;
}

.auth-switch {
    margin: 14px 0 0;
    font-size: 13px;
    text-align: center;
    color: var(--text-2);
}

/* === Nav user === */

.nav-user { display: flex; align-items: center; gap: 8px; font-size: 13px; position: relative; }

.nav-username { color: var(--text-2); }

.nav-avatar-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    transition: border-color .15s, transform .15s;
    box-shadow: none;
    padding: 0;
    flex-shrink: 0;
}
.nav-avatar-btn:hover { border-color: rgba(255,255,255,0.5); transform: scale(1.1); box-shadow: none; }

.nav-logout-btn {
    background: transparent; box-shadow: none;
    color: var(--text-3); border: 1px solid var(--border);
    padding: 4px 10px; font-size: 12px;
}
.nav-logout-btn:hover { background: var(--surface-2); color: var(--text); transform: none; box-shadow: none; }

.nav-avatar-dropdown {
    position: absolute;
    right: 0; top: calc(100% + 8px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,.5);
    padding: 12px;
    z-index: 100;
    width: 220px;
    display: flex; flex-direction: column; gap: 10px;
}

.nav-avatar-preview {
    width: 52px; height: 52px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px;
    margin: 0 auto 4px;
    transition: background .2s;
}

.nav-avatar-section-label {
    font-size: 11px; color: var(--text-3); font-weight: 600;
    text-transform: uppercase; letter-spacing: .05em;
}

.nav-avatar-emoji-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
}
.nav-avatar-emoji-btn {
    font-size: 20px; padding: 4px; border-radius: 6px;
    background: transparent; border: 2px solid transparent;
    cursor: pointer; box-shadow: none;
    transition: background .1s, border-color .1s;
    line-height: 1;
}
.nav-avatar-emoji-btn:hover { background: var(--surface-2); transform: none; box-shadow: none; }
.nav-avatar-emoji-active { border-color: var(--accent) !important; background: var(--surface-3) !important; }

.nav-avatar-color-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
}
.nav-avatar-color-btn {
    width: 28px; height: 28px; border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer; box-shadow: none; padding: 0;
    transition: transform .1s, border-color .1s;
}
.nav-avatar-color-btn:hover { transform: scale(1.15); box-shadow: none; }
.nav-avatar-color-active { border-color: #fff !important; }

.nav-avatar-save {
    width: 100%; padding: 6px; font-size: 13px;
    background: var(--accent); color: #fff; border: none;
    border-radius: 8px; cursor: pointer;
    transition: opacity .15s;
    box-shadow: none;
}
.nav-avatar-save:hover { opacity: .85; transform: none; box-shadow: none; }

/* === Staggered animations === */

.board-column:nth-child(2) { animation-delay: .04s; }
.board-column:nth-child(3) { animation-delay: .08s; }
.board-column:nth-child(4) { animation-delay: .12s; }
.board-column:nth-child(5) { animation-delay: .16s; }
.board-column:nth-child(n+6) { animation-delay: .2s; }

.card:nth-child(2) { animation-delay: .03s; }
.card:nth-child(3) { animation-delay: .06s; }
.card:nth-child(4) { animation-delay: .09s; }
.card:nth-child(n+5) { animation-delay: .12s; }

/* === Task create form === */

.task-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.task-form input[name="text"] { flex: 1; }

.task-form-simple {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* === Members === */

.member-list { list-style: none; padding: 0; }

.member-list li {
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    animation: fadeInUp .35s ease backwards;
}

/* === Modal === */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeInUp .2s ease;
}

.modal {
    background: var(--surface);
    border-radius: 16px;
    padding: 24px 28px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-title { margin: 0 0 18px; font-size: 17px; }

.modal-label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12px;
    color: var(--text-2);
    font-weight: 500;
    margin-bottom: 14px;
}

.modal-select { width: 100%; }

.modal-actions { display: flex; gap: 8px; margin-top: 6px; }

.title-actions { display: flex; gap: 10px; align-items: center; justify-content: space-between; }

/* === Custom select === */

.custom-select { position: relative; }

.custom-select-toggle {
    width: 100%;
    text-align: left;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 13px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color .15s;
}

.custom-select-toggle:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--accent);
}

.custom-select-toggle::after {
    content: "";
    width: 7px;
    height: 7px;
    margin-left: 8px;
    border-right: 1.5px solid var(--text-3);
    border-bottom: 1.5px solid var(--text-3);
    transform: rotate(45deg);
    transition: transform .15s;
    flex-shrink: 0;
}

.custom-select-toggle.open::after { transform: rotate(-135deg); }

.custom-select-toggle.open,
.custom-select-toggle:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18);
    outline: none;
}

.custom-select-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 5px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    max-height: 220px;
    overflow-y: auto;
}

.custom-select-menu li {
    padding: 7px 10px;
    border-radius: 7px;
    font-size: 13px;
    cursor: pointer;
    transition: background .1s;
    color: var(--text);
}

.custom-select-menu li:hover { background: var(--surface-2); }

.custom-select-menu li.selected {
    background: var(--accent);
    color: #0d0f1a;
}

/* === Flatpickr dark theme === */

.flatpickr-calendar {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
    border-radius: 12px !important;
    color: var(--text) !important;
    width: 224px !important;
}

.flatpickr-months .flatpickr-month,
.flatpickr-weekdays { background: var(--surface) !important; }

.flatpickr-day {
    color: var(--text) !important;
    height: 32px !important;
    line-height: 32px !important;
    max-width: 32px !important;
    border-radius: 6px !important;
}

.dayContainer {
    width: 224px !important;
    min-width: 224px !important;
    max-width: 224px !important;
}

.flatpickr-days {
    width: 224px !important;
}

.flatpickr-day:hover {
    background: var(--surface-2) !important;
    border-color: transparent !important;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
}

.flatpickr-day.today { border-color: var(--accent) !important; }

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
    color: var(--text-3) !important;
}

.flatpickr-time input,
.flatpickr-time .flatpickr-am-pm {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border: none !important;
}

.flatpickr-time input:hover,
.flatpickr-time .flatpickr-am-pm:hover,
.flatpickr-time input:focus,
.flatpickr-time .flatpickr-am-pm:focus {
    background: var(--surface-3) !important;
}

.flatpickr-prev-month, .flatpickr-next-month { color: var(--text-2) !important; fill: var(--text-2) !important; }
.flatpickr-prev-month:hover, .flatpickr-next-month:hover { color: var(--text) !important; fill: var(--text) !important; }

span.flatpickr-weekday { color: var(--text-3) !important; background: var(--surface) !important; }

.flatpickr-current-month .flatpickr-monthDropdown-months { background: var(--surface) !important; color: var(--text) !important; }
.flatpickr-current-month input.cur-year { color: var(--text) !important; }

/* Compact flatpickr */
.flatpickr-calendar.open { font-size: 13px !important; }

/* === Autocomplete === */

.autocomplete { position: relative; }

.autocomplete-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 13px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface-2);
    color: var(--text);
    transition: border-color .15s;
}

.autocomplete-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18);
    outline: none;
}

.autocomplete-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 5px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    max-height: 200px;
    overflow-y: auto;
}

.autocomplete-item {
    padding: 7px 10px;
    border-radius: 7px;
    font-size: 14px;
    cursor: pointer;
    transition: background .1s;
}

.autocomplete-item:hover { background: var(--surface-2); }

/* === Entity list (companies/contacts) === */

.entity-list { list-style: none; padding: 0; margin: 0; }

.deals-pipeline-hdr {
    font-size: 18px;
    font-weight: 800;
    color: var(--accent);
    padding: 28px 0 10px;
    border-bottom: 2px solid var(--accent);
    margin-bottom: 6px;
    opacity: .85;
}
.deals-pipeline-hdr:first-child {
    padding-top: 4px;
}

.entity-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 6px;
    background: var(--surface);
    border-radius: 10px;
    border: 1px solid var(--border);
    animation: fadeInUp .3s ease backwards;
    transition: border-color .15s;
}

.entity-row:hover { border-color: var(--accent); }

.entity-name {
    font-weight: 700;
    color: var(--text);
    flex: 1;
    cursor: pointer;
    font-size: 14px;
}

.entity-name:hover { color: var(--accent); }

.entity-rename { flex: 1; }
.entity-rename form { display: block; width: 100%; }
.entity-rename .rename-input { width: 100%; }

.entity-count {
    font-size: 12px;
    color: var(--text-2);
    background: var(--surface-2);
    padding: 2px 9px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    white-space: nowrap;
}

.entity-count:hover { color: var(--accent); border-color: var(--accent); }

.entity-stats { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.entity-tg {
    font-size: 12px;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    padding: 2px 9px;
    border-radius: 6px;
}

.entity-company {
    font-size: 12px;
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.12);
    padding: 2px 9px;
    border-radius: 6px;
}

/* === Contact list === */

.contact-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.contact-item {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 12px 16px;
    animation: fadeInUp .3s ease backwards;
    transition: border-color .15s;
}

.contact-item:hover { border-color: var(--accent); }

.contact-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.contact-name {
    font-weight: 700;
    color: var(--text);
    font-size: 14px;
}

.contact-name:hover { color: var(--accent); }

.contact-cards {
    margin-top: 7px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.contact-card-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    text-decoration: none;
    transition: border-color .15s, color .15s;
}

.contact-card-chip:hover { border-color: var(--accent); color: var(--text); }

.contact-card-stage {
    font-weight: 400;
    color: var(--text-3);
    font-size: 11px;
}

.contact-card-stage::before { content: "→ "; }

/* === Tasks panel (card detail) header === */

.tasks-panel-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}


/* === Pipeline switch dropdown === */

.pipeline-switch { position: relative; }

.pipeline-switch-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 7px 14px;
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    box-shadow: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: border-color .15s, background .15s;
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pipeline-switch-btn:hover {
    border-color: var(--accent);
    background: var(--surface-3);
    transform: none;
    box-shadow: none;
}

.pipeline-switch-dropdown {
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    min-width: 180px;
    padding: 4px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ps-active { color: var(--accent) !important; font-weight: 700; }

.pipeline-switch-divider { height: 1px; background: var(--border-light); margin: 4px 0; }

.ps-new-btn { color: var(--text-2); font-style: normal; }
.ps-new-btn:hover { color: var(--accent); }

.ps-new-form {
    display: flex;
    gap: 6px;
    padding: 4px 6px;
    align-items: center;
}
.ps-new-input {
    flex: 1;
    padding: 5px 9px;
    font-size: 13px;
    border-radius: 7px;
    min-width: 0;
}

/* === Filter dropdown panel === */

.filter-dropdown-wrap { position: relative; }

.filter-toggle-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 12px;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
    box-shadow: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: border-color .15s, color .15s;
}

.filter-toggle-btn:hover {
    border-color: var(--accent);
    color: var(--text);
    transform: none;
    box-shadow: none;
}

.filter-toggle-active {
    border-color: var(--accent);
    color: var(--accent);
}

.filter-dropdown-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 10px 32px rgba(0,0,0,0.45);
    min-width: 380px;
    padding: 20px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-dp-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.filter-dp-row:last-of-type {
    border-bottom: none;
}

.filter-dp-row .custom-select { flex: 1; }

.filter-dp-search {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 13px;
    font-family: inherit;
    background: var(--surface-2);
    color: var(--text);
    transition: border-color .15s;
    width: 100%;
}

.filter-dp-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52,211,153,0.18);
    outline: none;
}

.filter-dp-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 14px;
    margin-top: 6px;
    border-top: 1px solid var(--border);
}

.filter-save-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.filter-save-inline .filter-name-input {
    flex: 1;
    min-width: 0;
}

/* === Stats dashboard KPI cards === */

.stats-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 8px;
}

.stats-kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: fadeInUp .35s ease backwards;
}

.stats-kpi-value {
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
}

.stats-kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stats-kpi-danger { border-top: 3px solid var(--red); }
.stats-kpi-danger .stats-kpi-value { color: var(--red); }

.stats-kpi-amber { border-top: 3px solid var(--amber); }
.stats-kpi-amber .stats-kpi-value { color: var(--amber); }

.stats-kpi-green { border-top: 3px solid var(--accent); }
.stats-kpi-green .stats-kpi-value { color: var(--accent); }

.stats-kpi-accent { border-top: 3px solid var(--purple); }
.stats-kpi-accent .stats-kpi-value { color: var(--purple); }

/* Stats table */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.stats-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 6px 10px 10px;
    border-bottom: 1px solid var(--border);
}

.stats-table td {
    padding: 10px 10px;
    border-bottom: 1px solid var(--border-light);
}

.stats-table tr:last-child td { border-bottom: none; }

.stats-table tr:hover td { background: var(--surface-2); }

.stats-td-name { font-weight: 600; }
.stats-td-num { text-align: center; font-weight: 700; color: var(--text-2); }
.stats-th-danger { color: var(--red) !important; }
.stats-td-danger { color: var(--red) !important; }

/* === Task inline edit styles === */

.task-text-click {
    cursor: pointer;
    border-radius: 4px;
    padding: 1px 2px;
    transition: background .12s;
}

.task-text-click:hover { background: var(--surface-3); }

.task-meta-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.task-deadline-overdue { color: var(--red) !important; font-weight: 700; }
.task-deadline-today   { color: var(--amber) !important; font-weight: 700; }

.task-edit-text {
    width: 100%;
    margin-bottom: 4px;
}

.task-edit-date { min-width: 160px; }

.task-edit-row {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 6px;
}

.task-edit-row .custom-select { min-width: 160px; flex: 1; }

/* === Confirm dialog === */

.confirm-modal { max-width: 360px; }
.confirm-modal .modal-title { font-size: 16px; margin-bottom: 20px; }

/* === API docs === */

.page-api h1 { margin-bottom: 6px; }

.api-intro { color: var(--text-2); font-size: 14px; margin: 0 0 12px; }

.api-base-url {
    background: var(--surface-2);
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 13px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.api-section { margin-bottom: 28px; }

.api-section h2 {
    font-size: 15px;
    margin: 0 0 10px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--border);
}

.api-endpoint {
    background: var(--surface);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 5px 10px;
    align-items: start;
}

.api-method {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    text-align: center;
    margin-top: 2px;
}

.api-method.get    { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.api-method.post   { background: rgba(52, 211, 153, 0.12); color: #34d399; }
.api-method.patch  { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.api-method.delete { background: rgba(244, 63, 94, 0.15);  color: #fb7185; }

.api-path { font-size: 13px; font-weight: 600; color: var(--text); align-self: center; }
.api-desc { grid-column: 2; font-size: 13px; color: var(--text-2); margin: 0; }

.api-example {
    grid-column: 2;
    background: var(--surface-2);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 12px;
    overflow-x: auto;
    margin: 4px 0 0;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-2);
    border: 1px solid var(--border-light);
}

/* === v0.11 additions === */

/* Task board card content */
.card-task .card-name { font-size: 14px; font-weight: 700; line-height: 1.35; }
.card-task .card-company { font-size: 12px; margin-top: 4px; }
/* task-dl-badge defined above */

/* Task meta hover edit (card detail panel) */
.task-hover-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.task-popup-deadline { left: auto; right: 0; }

.task-editable {
    cursor: pointer;
    border-radius: 4px;
    transition: background .12s;
}
.task-editable:hover { background: var(--surface-3); }

.task-inline-popup {
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    min-width: 200px;
    z-index: 40;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.task-inline-popup .custom-select { min-width: 180px; }
.task-inline-popup .flatpickr-input { width: 100%; }

/* Fixed-position task popups — bypass overflow:hidden of scroll containers */
.task-popup-fixed {
    position: fixed;
    z-index: 500;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.task-popup-fixed .custom-select { min-width: 180px; }
.task-popup-fixed .flatpickr-input { width: 160px; }

/* Bigger task input when creating task */
.task-add-text-input {
    font-size: 15px !important;
    padding: 10px 14px !important;
    font-weight: 500 !important;
}

.task-search-form {
    display: flex;
    align-items: center;
}

/* Compact single-line task creation form */
.task-add-main-row {
    display: flex;
    align-items: center;
    gap: 7px;
}

.task-add-text-compact {
    flex: 1;
    min-width: 0;
    font-size: 13px !important;
    padding: 6px 10px !important;
    font-weight: 400 !important;
    width: auto !important;
}

.task-add-dl-pill {
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
}

.task-add-assignee-wrap {
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
}

.task-add-avatar {
    width: 28px;
    height: 28px;
    font-size: 10px;
    color: var(--accent);
    border-color: rgba(52,211,153,0.4);
}

.task-avatar-initials {
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}

.task-assignee-menu-item {
    padding: 6px 10px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    border-radius: 6px;
    white-space: nowrap;
}

.task-assignee-menu-item:hover {
    background: var(--surface-3);
}

/* Card search autocomplete for task creation */
.card-search-wrap {
    position: relative;
}

.card-search-results {
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
    min-width: 260px;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    max-height: 200px;
    overflow-y: auto;
}

.card-search-item {
    padding: 8px 12px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    transition: background .12s;
}
.card-search-item:hover { background: var(--surface-2); }
.card-search-item-stage { font-size: 11px; color: var(--text-3); margin-left: 6px; }

/* Ensure pipeline-switch shows dropdown z-index above board header */
.pipeline-switch-dropdown { z-index: 40; }

/* Pipeline add form (create pipeline button visible) */
.pipeline-create-btn {
    border: 2px solid rgba(52,211,153,0.4);
    color: var(--accent);
    background: rgba(52,211,153,0.07);
    font-weight: 700;
    border-radius: 10px;
    padding: 9px 18px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    box-shadow: none;
}
.pipeline-create-btn:hover {
    border-color: var(--accent);
    background: rgba(52,211,153,0.13);
    transform: none;
    box-shadow: none;
}

/* === Assignee name tooltip on board cards === */
.card-assignee-named {
    position: relative;
}
.card-assignee-named::after {
    content: attr(data-name);
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-3);
    color: var(--text);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    z-index: 20;
}
.card-assignee-named:hover::after {
    opacity: 1;
}

/* === Task add form actions === */
.task-add-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

/* === Priority badges === */
.card-name-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}
.card-name-row .card-name {
    flex: 1;
    min-width: 0;
}
.card-name-row-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.priority-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 5px;
    flex-shrink: 0;
    white-space: nowrap;
    letter-spacing: -0.02em;
}
.priority-highest { background: rgba(244,63,94,0.18); color: #f43f5e; }
.priority-high     { background: rgba(251,191,36,0.18); color: #fbbf24; }
.priority-low      { background: rgba(99,102,241,0.15); color: #818cf8; }
.priority-lowest   { background: rgba(100,116,139,0.18); color: #94a3b8; }

/* === Filter field labels === */
.filter-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex: 1;
    min-width: 0;
}
.filter-field-lbl {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* === Quick filter button (Мои задачи) === */
.quick-filter-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: border-color .15s, color .15s, background .15s;
    white-space: nowrap;
}
.quick-filter-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}
.quick-filter-active {
    border-color: var(--accent);
    background: var(--accent-dim);
    color: var(--accent);
}

/* Modal label as standalone line */
.modal-label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 4px; margin-top: 12px; }
.modal-label:first-child { margin-top: 0; }

/* === Board search in header === */
.board-header-search {
    flex: 0 0 auto;
}

/* === Add-card 3-field form === */
.add-card-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.add-card-form input[type="text"] {
    width: 100%;
    font-size: 13px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text);
    transition: border-color .15s;
}

.add-card-form input[type="text"]:focus {
    border-color: var(--accent);
    outline: none;
}

.add-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 2px;
}

/* === Company detail page === */

.company-stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
}

.company-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 24px;
    min-width: 90px;
}

.company-stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}

.company-stat-label {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 4px;
}

.company-section {
    margin-bottom: 28px;
}

.company-section-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-2);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.entity-link {
    color: var(--text) !important;
    text-decoration: none;
}

.entity-link:hover {
    color: var(--accent) !important;
    text-decoration: underline;
}

.entity-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-3);
}

.entity-stage {
    color: var(--text-2);
}

.entity-pipeline {
    color: var(--text-3);
    font-size: 11px;
}

.entity-telegram {
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
}

.entity-telegram:hover { text-decoration: underline; }

.entity-edit-btn {
    background: none;
    border: none;
    box-shadow: none;
    color: var(--text-3);
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
    line-height: 1;
    opacity: 0;
    transition: opacity .15s;
}

.entity-row:hover .entity-edit-btn {
    opacity: 1;
}

.entity-edit-btn:hover {
    color: var(--accent);
    transform: none;
    box-shadow: none;
}

.filter-search-form {
    display: flex;
    align-items: center;
}

/* === Tasks flat list === */
.tasks-flat-list {
    max-width: 860px;
    margin: 16px auto 0;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tasks-empty {
    list-style: none;
    padding: 24px;
    color: var(--text-3);
    font-style: italic;
    text-align: center;
}

/* tasks-add-row on the flat tasks page */
.tasks-flat-list ~ .tasks-add-row,
.tasks-shell > .tasks-add-row {
    max-width: 860px;
    margin: 0 auto;
    padding: 12px 24px 0;
    width: 100%;
}

.tasks-shell > .tasks-add-row {
    max-width: 860px;
    width: 100%;
    padding: 12px 24px 0;
    margin: 0 auto;
    box-sizing: border-box;
}

/* ── Admin ─────────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; padding: 10px 16px; font-size: 12px; font-weight: 600; color: var(--text-3); border-bottom: 1px solid var(--border); }
.admin-table td { padding: 10px 16px; border-bottom: 1px solid var(--border-light); font-size: 13px; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.role-select { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; color: var(--text-1); font-size: 12px; padding: 4px 8px; cursor: pointer; outline: none; }
.role-select:hover { border-color: var(--accent); }
.role-select:disabled { opacity: 0.45; cursor: default; }


/* ── Delete buttons for tasks and notes ── */
.task-delete-form { display: flex; align-items: center; }
.task-delete-btn {
    display: flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; padding: 0;
    background: none; border: none; border-radius: 4px;
    color: var(--text-3); font-size: 18px; line-height: 1;
    cursor: pointer; opacity: 0; transition: opacity .15s, color .15s;
}
.task:hover .task-delete-btn,
.note:hover .task-delete-btn { opacity: 1; }
.task-delete-btn:hover { color: var(--red); }

/* === Merge companies modal === */
.merge-select-wrap {
    position: relative;
}

.merge-select-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    transition: border-color .15s;
    user-select: none;
}
.merge-select-toggle:hover,
.merge-select-toggle.open { border-color: var(--accent); }
.merge-select-toggle svg { flex-shrink: 0; color: var(--text-3); transition: transform .15s; }
.merge-select-toggle.open svg { transform: rotate(180deg); }

.merge-select-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    z-index: 200;
    overflow: hidden;
}
.merge-select-search {
    padding: 8px;
    border-bottom: 1px solid var(--border);
}
.merge-select-search input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--text);
    outline: none;
    box-sizing: border-box;
}
.merge-select-search input:focus { border-color: var(--accent); }
.merge-select-menu ul {
    list-style: none;
    margin: 0;
    padding: 4px;
    max-height: 220px;
    overflow-y: auto;
}
.merge-select-menu ul li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
}
.merge-select-menu ul li:hover { background: var(--surface-2); }
.merge-select-menu ul li.selected { background: var(--accent); color: #fff; }
.merge-select-menu ul li.selected .merge-select-meta { color: rgba(255,255,255,.7); }
.merge-select-meta { font-size: 11px; color: var(--text-3); flex-shrink: 0; margin-left: 8px; }
.merge-select-empty { color: var(--text-3) !important; cursor: default !important; justify-content: center !important; }
.merge-select-empty:hover { background: none !important; }

.merge-confirm-block {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.merge-confirm-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
}
.merge-confirm-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}
.merge-confirm-row.danger .merge-confirm-icon { background: rgba(229,62,62,.15); color: #e53e3e; }
.merge-confirm-row.success .merge-confirm-icon { background: rgba(72,187,120,.15); color: #38a169; }
.merge-confirm-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.merge-confirm-name { font-size: 15px; font-weight: 600; color: var(--text); }
.merge-confirm-meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.merge-confirm-arrow { text-align: center; font-size: 18px; color: var(--text-3); padding: 2px 0; }

/* === Duplicates panel === */
.dup-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    margin-left: 5px;
    line-height: 1;
}
.dup-btn-active {
    border-color: var(--accent) !important;
    color: var(--accent) !important;
}
.dup-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}
.dup-panel-header {
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 14px;
}
.dup-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dup-pair {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.dup-company {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-decoration: none;
    color: var(--text);
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: border-color .15s;
}
.dup-company:hover { border-color: var(--accent); }
.dup-company-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dup-company-meta {
    font-size: 11px;
    color: var(--text-3);
}
.dup-arrow {
    font-size: 18px;
    color: var(--text-3);
    flex-shrink: 0;
}
.dup-merge-btn {
    flex-shrink: 0;
    white-space: nowrap;
}
.dup-ignore-btn {
    flex-shrink: 0;
    white-space: nowrap;
    opacity: 0.65;
}
.dup-ignore-btn:hover {
    opacity: 1;
}

