.list-template-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(15, 23, 42, 0.38);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.list-template-panel {
    width: min(860px, 100%);
    max-height: min(760px, calc(100vh - 40px));
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.list-template-header,
.list-template-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid #e2e8f0;
}

.list-template-footer {
    border-top: 1px solid #e2e8f0;
    border-bottom: 0;
    justify-content: flex-end;
}

.list-template-title {
    font-size: 16px;
    font-weight: 650;
    color: #0f172a;
}

.list-template-close {
    color: #64748b;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.list-template-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.list-template-body {
    padding: 16px 18px;
    overflow-y: auto;
}

.list-template-field {
    display: grid;
    gap: 5px;
}

.list-template-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}

.list-template-name-input,
.list-template-small-input {
    width: 100%;
}

.list-template-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 16px 0 12px;
    padding: 3px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.list-template-tab {
    min-height: 30px;
    padding: 0 12px;
    border-radius: 6px;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
}

.list-template-tab:hover {
    color: #0f172a;
}

.list-template-tab-active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.list-template-options {
    display: grid;
    gap: 8px;
}

.list-template-presets {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    align-items: start;
    gap: 12px;
}

.list-template-option {
    width: 100%;
    min-height: 58px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
}

.list-template-option:hover,
.list-template-option-selected {
    border-color: #3b82f6;
    background: #eff6ff;
}

.list-template-radio {
    width: 14px;
    height: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #fff;
}

.list-template-option-selected .list-template-radio {
    border: 4px solid #3b82f6;
}

.list-template-option-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.list-template-option-name {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.list-template-option-meta {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-template-system-label {
    font-size: 10px;
    font-weight: 700;
    color: #475569;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 3px 8px;
    white-space: nowrap;
}

.list-template-option-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 4px;
}

.list-template-action-button {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    border-radius: 6px;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
}

.list-template-action-button:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.list-template-action-delete:hover {
    background: #fef2f2;
    color: #dc2626;
}

.list-template-loading {
    min-height: 52px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #64748b;
    font-size: 13px;
}

.list-template-spinner {
    width: 18px;
    height: 18px;
}

.list-template-preview {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    padding: 12px;
}

.list-template-preview-heading {
    display: grid;
    gap: 2px;
    margin-bottom: 10px;
}

.list-template-preview-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0;
}

.list-template-preview-title {
    min-width: 0;
    color: #0f172a;
    font-size: 14px;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.list-template-preview-meta {
    min-width: 0;
    color: #64748b;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.list-template-preview-options {
    display: grid;
    gap: 6px;
}

.list-template-preview-row {
    min-height: 30px;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
}

.list-template-preview-color {
    width: 18px;
    height: 18px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 5px;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.72);
}

.list-template-preview-name {
    min-width: 0;
    color: #0f172a;
    font-size: 13px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.list-template-preview-empty {
    min-height: 48px;
    display: flex;
    align-items: center;
    color: #64748b;
    font-size: 13px;
}

.list-template-create {
    display: grid;
}

.list-template-create-fields {
    display: grid;
    gap: 10px;
}

.list-template-column-builder {
    display: grid;
    gap: 8px;
}

.list-template-column-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

.list-template-column-color {
    width: 34px;
    height: 34px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: inset 0 0 0 2px #fff;
    cursor: pointer;
}

.list-template-column-color:hover {
    border-color: #64748b;
}

.list-template-column-color-popover {
    position: fixed;
    z-index: 10070;
    width: max-content;
    max-width: 100%;
    padding: 6px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.list-template-column-color-grid {
    padding-bottom: 0;
}

.list-template-column-color-grid .col-color-swatch {
    width: 26px;
    height: 26px;
    min-height: unset;
    padding: 0;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    outline: none;
}

.list-template-column-color-grid .col-color-swatch:hover {
    transform: scale(1.12);
}

.list-template-column-color-grid .col-color-swatch-active {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #334155;
}

.list-template-column-name {
    min-width: 0;
}

.list-template-column-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.list-template-column-action {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.list-template-column-action:hover:not(:disabled) {
    background: #f1f5f9;
    color: #0f172a;
}

.list-template-column-action:disabled {
    color: #cbd5e1;
    cursor: default;
}

.list-template-column-delete:hover:not(:disabled) {
    color: #dc2626;
    background: #fef2f2;
}

.list-template-add-column {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #2563eb;
    font-size: 13px;
    font-weight: 600;
}

.list-template-add-column:hover {
    color: #1d4ed8;
}

.list-template-save-template {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 760px) {
    .list-template-panel {
        width: min(540px, 100%);
    }

    .list-template-presets {
        grid-template-columns: 1fr;
    }
}
