/* Phase container — fills the sheet up to its max-height; inner
   regions (.dp-plan) own the scroll. (Was height:100% for the old
   full-height drawer; min-height:0 lets the flex child shrink so the
   inner overflow:auto actually engages inside a max-height sheet.) */
.dp-phase {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    max-height: min(80vh, 760px);
}

/* Header */
.dp-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.dp-header-icon {
    width: 24px;
    height: 24px;
    color: var(--accent-blue);
    flex-shrink: 0;
}

.dp-header-icon svg {
    width: 100%;
    height: 100%;
}

.dp-header-icon-success {
    color: var(--color-green-text);
}

.dp-header-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.dp-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-normal) var(--ease-in-out);
    padding: 0;
}

.dp-close-btn svg {
    width: 18px;
    height: 18px;
}

.dp-close-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Loading phase */
.dp-loading-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    gap: 16px;
}

.dp-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent-blue);
    border-radius: var(--radius-circle);
    animation: dp-spin 0.8s linear infinite;
}

@keyframes dp-spin {
    to { transform: rotate(360deg); }
}

.dp-loading-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0;
}

/* Error phase */
.dp-error-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    gap: 16px;
}

.dp-error-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    text-align: center;
    margin: 0;
}

/* Summary bar */
.dp-summary-bar {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* P2b-4: inline Tune disclosure (live — used by Plan My Day) */
.dp-tune { padding: 4px 16px 10px; flex-shrink: 0; }

.dp-tune-toggle {
    background: none;
    border: none;
    padding: 4px 0;
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    cursor: pointer;
}
.dp-tune-toggle:hover { color: var(--text-secondary); }
.dp-tune-toggle:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
}

.dp-tune-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

/* The author display:flex above otherwise overrides the [hidden]
   attribute (author rule beats the UA sheet), so the Tune fields
   never collapsed. This restores collapse. */
.dp-tune-panel[hidden] { display: none; }

/* Pre-plan Area chooser */
.dp-areas-body { padding: 12px 16px; overflow-y: auto; flex: 1; }
.dp-areas-prompt {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0 0 12px;
}
.dp-areas-list {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
}
.dp-area-all,
.dp-area-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 4px 2px;
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}
.dp-area-all { font-weight: 600; }
.dp-area-all input,
.dp-area-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-blue);
    cursor: pointer;
    flex-shrink: 0;
}
.dp-area-dot {
    width: 9px;
    height: 9px;
    border-radius: var(--radius-circle);
    flex-shrink: 0;
}
.dp-area-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dp-tune-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dp-tune-label {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dp-tune-input {
    width: 64px;
    min-height: 28px;
    padding: 2px 6px;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}
.dp-tune-input:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
}
