:root {
    color-scheme: light;
    --page: #ffffff;
    --panel: #ffffff;
    --line: #dfe5ea;
    --text: #333333;
    --muted: #6f7c87;
    --blue: #2fc6f6;
    --control-bg: #e1e6e7;
    --control-bg-active: #ced3d4;
    --control-border: #bec3c4;
    --control-text: #656767;
    --control-text-active: #2c2d2e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .08);
}

html,
body {
    height: 100%;
    overflow: hidden;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--text);
    font: 14px/1.45 "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
}

button {
    font: inherit;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 22px 0;
    flex: 0 0 auto;
}

.nav-row,
.topbar-actions,
.tabs {
    display: flex;
    align-items: center;
}

.tabs,
.topbar-actions {
    gap: 8px;
}

.tab,
.btn {
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0 15px;
    cursor: pointer;
    font-weight: 400;
}

.tab {
    background: var(--control-bg);
    color: var(--control-text);
    font-size: 14px;
    line-height: 34px;
}

.tab.is-active,
.tab:hover {
    border-color: var(--control-border);
    background: var(--control-bg-active);
    color: var(--control-text-active);
}

.btn-secondary {
    background: var(--control-bg);
    color: var(--control-text);
}

.btn-secondary:hover,
.btn-secondary:focus {
    border-color: var(--control-border);
    background: var(--control-bg-active);
    color: var(--control-text-active);
}

.notice,
.error-box,
.loader {
    margin: 12px 22px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.kanban > .loader,
.kanban > .error-box,
.kanban > .empty-state {
    grid-column: 1 / -1;
    margin: 0 0 0 12px;
}

.error-box {
    color: #b42318;
}

.empty-state {
    padding: 20px 16px;
    color: var(--muted);
}

.progress-loader {
    width: min(560px, 100%);
}

.loader-title {
    font-weight: 600;
    color: #303942;
}

.progress-track {
    height: 10px;
    overflow: hidden;
    margin-top: 12px;
    border-radius: 5px;
    background: #dfe7ed;
}

.progress-bar {
    width: 38%;
    min-width: 38%;
    height: 100%;
    border-radius: 5px;
    background: var(--blue);
    animation: progress-slide 1.15s ease-in-out infinite;
}

@keyframes progress-slide {
    0% {
        transform: translateX(-110%);
    }

    100% {
        transform: translateX(270%);
    }
}

.kanban {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 300px;
    gap: 0;
    align-items: stretch;
    flex: 1 1 auto;
    overflow-x: auto;
    overflow-y: hidden;
    height: 100%;
    min-height: 0;
    padding: 14px 10px 24px;
}

.column {
    display: flex;
    flex-direction: column;
    width: 300px;
    min-width: 300px;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0 12px;
}

.column-head {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 32px;
    min-height: 32px;
    padding: 0 22px 0 14px;
    background: var(--stage-bg);
    color: var(--stage-text);
    border-radius: 8px 0 0 8px;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.2;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .04);
}

.column-head::after {
    content: "";
    position: absolute;
    right: -12.5px;
    top: 3.5px;
    z-index: 1;
    width: 25px;
    height: 25px;
    border-radius: 4px;
    background: var(--stage-bg);
    transform: rotate(45deg);
}

.column-head span {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.column-head b {
    flex: 0 0 auto;
    margin-left: .6em;
    font-size: 12px;
    font-weight: 400;
}

.dropzone {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 8px;
    max-width: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px 0 18px;
    scrollbar-gutter: stable;
}

.crm-card {
    max-width: 100%;
    min-width: 0;
    background: var(--panel);
    border: 1px solid var(--card-accent, #ff5b61);
    border-left: 4px solid var(--card-accent, #ff5b61);
    border-radius: 0 12px 12px 0;
    box-shadow: none;
    padding: 14px 16px;
}

.card-title {
    display: block;
    width: 100%;
    color: #333333;
    text-align: left;
    font-size: 14px;
    font-weight: 400;
    overflow-wrap: anywhere;
}

.stage-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 600;
}

.card-fields {
    display: grid;
    gap: 7px;
    margin-top: 10px;
}

.card-field span {
    display: block;
    color: #8a949e;
    font-size: 12px;
    line-height: 1.2;
}

.card-field strong {
    display: block;
    margin-top: 2px;
    color: #333333;
    font-size: 13px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

@media (max-width: 720px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        padding-inline: 14px;
    }

    .kanban {
        grid-auto-columns: minmax(280px, calc(100vw - 36px));
        padding-inline: 6px;
    }

    .column {
        width: min(300px, calc(100vw - 36px));
        min-width: min(300px, calc(100vw - 36px));
    }
}
