:root {
    color-scheme: light;
    --page: #eef2f4;
    --panel: #ffffff;
    --line: #dfe5ea;
    --text: #333333;
    --muted: #6f7c87;
    --blue: #2fc6f6;
    --blue-dark: #12a9d6;
    --green: #9dcf00;
    --shadow: 0 1px 2px rgba(0, 0, 0, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--page);
    color: var(--text);
    font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

button,
input {
    font: inherit;
}

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

.topbar h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 500;
}

.topbar p {
    margin: 3px 0 0;
    color: var(--muted);
}

.topbar-actions,
.settings-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn {
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 3px;
    padding: 0 15px;
    cursor: pointer;
    font-weight: 500;
}

.btn-primary {
    background: var(--green);
    color: #ffffff;
}

.btn-secondary {
    background: #ffffff;
    border-color: #c9d1d8;
    color: #525c66;
}

.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 {
    grid-column: 1 / -1;
    margin: 0;
}

.error-box {
    color: #b42318;
}

.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 {
    height: 100%;
    min-width: 2%;
    border-radius: 5px;
    background: var(--blue);
    transition: width .18s ease;
}

.progress-track.is-indeterminate .progress-bar {
    width: 38%;
    min-width: 38%;
    animation: progress-slide 1.15s ease-in-out infinite;
}

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

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

.loader-meta {
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}

.tabs {
    display: flex;
    gap: 2px;
    padding: 0 22px;
}

.tab,
.mini-tab {
    border: 0;
    border-radius: 4px 4px 0 0;
    padding: 10px 18px;
    background: transparent;
    color: #525c66;
    cursor: pointer;
}

.tab.is-active,
.mini-tab.is-active {
    background: #ffffff;
    color: #111827;
    box-shadow: 0 -1px 0 var(--line), 1px 0 0 var(--line), -1px 0 0 var(--line);
}

.kanban {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(286px, 1fr);
    gap: 12px;
    align-items: start;
    overflow-x: auto;
    min-height: calc(100vh - 130px);
    padding: 14px 22px 24px;
}

.column {
    min-width: 286px;
    background: #e5e9ed;
    border-radius: 4px;
    border: 1px solid #d7dee4;
}

.column.is-over {
    outline: 2px solid var(--blue);
    outline-offset: -2px;
}

.column-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    padding: 0 12px;
    background: var(--stage-bg);
    color: var(--stage-text);
    border-radius: 4px 4px 0 0;
    font-weight: 600;
}

.column-head.muted {
    background: #f7f9fa;
    color: #6b7280;
}

.column-head b {
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .55);
    font-size: 12px;
}

.dropzone {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 140px;
    padding: 8px;
}

.crm-card {
    background: var(--panel);
    border-radius: 4px;
    border: 1px solid #d8dee4;
    box-shadow: var(--shadow);
    padding: 10px;
    cursor: grab;
}

.crm-card.is-dragging {
    opacity: .55;
}

.card-title {
    display: block;
    width: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    color: #2067b0;
    cursor: pointer;
    text-align: left;
    font-weight: 600;
    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;
}

.stage-badge.muted {
    background: #eef2f4;
    color: #6b7280;
}

.card-fields {
    display: grid;
    gap: 6px;
    margin-top: 9px;
}

.card-field span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.card-field strong {
    display: block;
    color: #343a40;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.field-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
}

.field-links a {
    color: #2067b0;
    font-weight: 500;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.field-links a:hover {
    text-decoration: underline;
}

.settings-dialog {
    width: min(920px, calc(100vw - 32px));
    border: 0;
    border-radius: 6px;
    padding: 0;
    box-shadow: 0 18px 60px rgba(0, 0, 0, .25);
}

.settings-dialog::backdrop {
    background: rgba(29, 39, 49, .45);
}

.settings-panel {
    padding: 0;
    margin: 0;
    background: #ffffff;
}

.settings-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

.settings-head h2,
.settings-section h3 {
    margin: 0;
    font-weight: 500;
}

.settings-tabs {
    padding: 12px 20px 0;
    border-bottom: 1px solid var(--line);
}

.settings-section {
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

.stage-row {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) 48px 48px 36px;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    margin-top: 10px;
    color: #414b56;
}

.stage-row input[type="text"] {
    min-height: 34px;
    border: 1px solid #cfd7df;
    border-radius: 3px;
    padding: 0 9px;
}

.stage-row input[type="color"] {
    width: 48px;
    height: 34px;
    padding: 2px;
    border: 1px solid #cfd7df;
    border-radius: 3px;
    background: #ffffff;
}

.icon-btn {
    width: 34px;
    height: 34px;
    border: 1px solid #cfd7df;
    border-radius: 3px;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px 14px;
    max-height: 260px;
    overflow: auto;
    margin-top: 12px;
}

.field-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    color: #414b56;
}

.settings-actions {
    justify-content: flex-end;
    padding: 14px 20px;
}

.install-screen {
    display: grid;
    place-items: center;
    padding: 24px;
}

.install-box {
    width: min(520px, 100%);
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.install-box h1 {
    margin: 0 0 8px;
}

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

    .kanban {
        grid-auto-columns: minmax(270px, 86vw);
        min-height: calc(100vh - 180px);
    }

    .stage-row {
        grid-template-columns: minmax(0, 1fr) 44px 44px 34px;
    }
}
