/* Modal dialog */
.modal {
    border: none;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    padding: 0;
    margin: auto;
    width: min(500px, 90vw);
    max-height: 85vh;
    overflow: hidden;
}

.modal::backdrop {
    background: rgba(0, 0, 0, 0.4);
}

.modal-large {
    width: min(800px, 90vw);
}

.modal-content {
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
    flex: 1;
    min-width: 0;
    font-size: 16px;
    font-weight: 600;
}

.modal-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}

.btn-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0 4px;
    line-height: 1;
}

.btn-close:hover {
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
}

/* Form inside dialog */
.modal form {
    padding: 20px;
    overflow-y: auto;
}

/* Search dialog — spotlight / command-palette style */
.search-dialog {
    border: none;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-light);
    padding: 0;
    margin: 15vh auto auto;
    width: min(620px, 90vw);
    max-height: 70vh;
    overflow: hidden;
}

.search-dialog::backdrop {
    background: rgba(0, 0, 0, 0.35);
}

.search-container {
    display: flex;
    flex-direction: column;
    max-height: 70vh;
}

/* Input row */
.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
}

.search-icon {
    flex-shrink: 0;
    color: var(--text-muted);
}

.search-input-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    line-height: 1.4;
}

.search-input-wrap input::placeholder {
    color: var(--text-muted);
}

.search-esc {
    flex-shrink: 0;
    font-size: 11px;
    font-family: inherit;
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-muted);
    background: var(--bg-primary);
    cursor: pointer;
    line-height: 1.3;
}

.search-esc:hover {
    color: var(--text-secondary);
}

/* Column filters */
.search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
}

.search-filter-btn {
    padding: 3px 10px;
    font-size: 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 500;
}

.search-filter-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.search-filter-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.search-options {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.search-options label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
}

.search-options input[type="checkbox"] {
    accent-color: var(--accent);
}

/* Results */
.search-results {
    overflow-y: auto;
    padding: 6px 8px 8px;
    max-height: calc(70vh - 110px);
}

.search-count {
    font-size: 11px;
    color: var(--text-muted);
    padding: 2px 10px 6px;
    font-weight: 500;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.1s;
}

.search-result-item:hover,
.search-result-item.active {
    background: var(--bg-hover);
}

.search-result-main {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-title mark,
.search-result-desc mark {
    background: rgba(0, 113, 227, 0.15);
    color: var(--accent);
    border-radius: 2px;
    padding: 0 1px;
}

[data-theme="dark"] .search-result-title mark,
[data-theme="dark"] .search-result-desc mark {
    background: rgba(10, 132, 255, 0.2);
    color: var(--accent);
}

.search-result-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 1px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-column {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--text-muted);
    padding-top: 2px;
    white-space: nowrap;
}

.search-divider {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 10px 4px;
    border-top: 1px solid var(--border-light);
    margin-top: 4px;
}

.search-empty {
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Dependency picker */
.dep-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.dep-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px 3px 10px;
    border-radius: 999px;
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    font-size: 12px;
    line-height: 1.4;
    max-width: 280px;
}

.dep-chip-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.dep-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1;
    padding: 0 2px;
    flex-shrink: 0;
}

.dep-chip-remove:hover {
    color: var(--danger, #e53e3e);
}

.dep-picker-wrap {
    position: relative;
}

.dep-picker-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
}

.dep-picker-input::placeholder {
    color: var(--text-muted);
}

.dep-picker-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    max-height: 180px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    margin-top: 2px;
}

.dep-picker-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 10px;
    cursor: pointer;
    transition: background 0.1s;
}

.dep-picker-option:hover {
    background: var(--bg-hover);
}

.dep-picker-option-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--text-primary);
}

.dep-picker-empty {
    padding: 12px 10px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* Status badge used in dep picker and chips */
.dep-status-badge {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 500;
    padding: 1px 7px;
    border-radius: 999px;
    white-space: nowrap;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.dep-status-badge.dep-status-todo {
    background: var(--bg-primary);
    color: var(--text-secondary);
}

.dep-status-badge.dep-status-doing,
.dep-status-badge.dep-status-running {
    background: rgba(0, 113, 227, 0.1);
    color: var(--accent);
    border-color: rgba(0, 113, 227, 0.2);
}

.dep-status-badge.dep-status-review {
    background: rgba(255, 159, 10, 0.1);
    color: #d97706;
    border-color: rgba(255, 159, 10, 0.2);
}

.dep-status-badge.dep-status-done {
    background: rgba(52, 199, 89, 0.1);
    color: #16a34a;
    border-color: rgba(52, 199, 89, 0.2);
}

.dep-status-badge.dep-status-paused {
    background: rgba(142, 142, 147, 0.1);
    color: var(--text-muted);
    border-color: rgba(142, 142, 147, 0.2);
}

/* Detail column badge */
.detail-column-badge {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Auto-approve toggle in the detail dialog header */
.detail-auto-approve-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
}

.detail-auto-approve-wrap select {
    font-size: 12px;
    padding: 2px 6px;
    cursor: pointer;
}
