/* Constructor-specific styles.
   Relies on shared.css for palette, sidebar, topbar, cards, form-rows, buttons. */

/* -------- Import: input + button in one row -------- */

.input-group {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    max-width: 640px;
}

.import-input {
    flex: 1 1 auto;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 0.45rem 0.7rem;
    font-family: "SF Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    min-width: 0;
}

.import-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* -------- Prototype workspace -------- */

.content {
    max-width: 1540px;
}

.constructor-start .form-section {
    padding-bottom: 1.35rem;
}

.constructor-workspace {
    display: block;
}

.constructor-workspace__main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 370px;
    gap: 1rem;
    align-items: start;
}

.constructor-workspace > input[type="hidden"] {
    display: none;
}

.constructor-configuration,
.constructor-result {
    min-width: 0;
    margin-bottom: 0;
}

.constructor-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
}

.constructor-field-grid > .form-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
}

.constructor-field-grid > .form-row .form-row__label {
    text-align: left;
}

.constructor-field-grid > .form-row input,
.constructor-field-grid > .form-row select,
.constructor-field-grid > .form-row textarea {
    width: 100%;
    max-width: none;
}

.constructor-field-grid > .programme-count-overrides,
.constructor-field-grid > .programme-image-source {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
    margin-left: 0;
}

.constructor-field-grid .programme-count-overrides__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.constructor-field-grid .programme-image-source {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.constructor-field-grid .programme-image-source__header,
.constructor-field-grid .programme-image-source__status {
    grid-column: 1 / -1;
}

.constructor-field-grid .programme-image-source__separator {
    display: none;
}

.constructor-field-grid .programme-image-option {
    display: flex;
    margin-top: 0;
    flex-direction: column;
}

.constructor-field-grid .programme-image-option > p {
    flex: 1;
}

.programme-image-option__select {
    width: 100%;
    margin-top: 0.85rem;
    justify-content: center;
    font-weight: 700;
}

.programme-image-option__select.btn--secondary:not(.btn--selected) {
    border-color: var(--brand);
    background: var(--panel);
    color: var(--brand);
}

.programme-image-option__select.btn--secondary:not(.btn--selected):hover {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand);
}

.programme-image-option__select.btn--selected {
    border-color: var(--brand);
    background: var(--brand);
    color: #ffffff;
}

.programme-image-option__select.btn--selected:hover {
    border-color: var(--brand-hover);
    background: var(--brand-hover);
    color: #ffffff;
}

.constructor-field-grid .programme-image-option .form-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
}

.constructor-field-grid .programme-image-option .form-row__label {
    text-align: left;
}

.constructor-field-grid .programme-image-option input,
.constructor-field-grid .programme-image-option select {
    width: 100%;
    max-width: none;
}

.anchor-time-control {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
}

.anchor-time-control input {
    flex: 1 1 auto;
    min-width: 0;
}

.anchor-time-control .btn {
    flex: 0 0 auto;
    justify-content: center;
}

.programme-duration-control {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 0.5rem;
}

.programme-duration-control label,
.programme-duration-control label > span {
    display: block;
}

.programme-duration-control label > span,
.programme-duration-control__label {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
    font-size: 0.7rem;
}

.timezone-offset-control {
    display: flex;
    flex-direction: column;
}

.constructor-result {
    position: sticky;
    top: calc(var(--topbar-height) + 1rem);
    max-height: calc(100vh - var(--topbar-height) - var(--page-footer-height) - 2rem);
    overflow: auto;
}

.constructor-result .form-section {
    padding: 1.25rem;
}

.configuration-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.configuration-summary__item {
    padding: 0.65rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel-alt);
    text-align: center;
}

.configuration-summary__item strong,
.configuration-summary__item span {
    display: block;
}

.configuration-summary__item strong {
    color: var(--text);
    font-size: 0.95rem;
}

.configuration-summary__item span {
    margin-top: 0.15rem;
    color: var(--text-muted);
    font-size: 0.65rem;
}

.configuration-facts {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.configuration-facts div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.configuration-facts dt,
.configuration-facts dd {
    margin: 0;
    font-size: 0.72rem;
}

.configuration-facts dt {
    color: var(--text-muted);
}

.configuration-facts dd {
    color: var(--text);
    font-weight: 600;
    text-align: right;
}

.constructor-result .form-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
}

.constructor-result .form-row__label {
    text-align: left;
}

.constructor-result .form-row__control textarea,
.constructor-result .form-row__control input {
    width: 100%;
    max-width: none;
}

.constructor-result .result-block {
    padding-top: 1.1rem;
}

.constructor-result .result-block__actions .btn,
.constructor-result .short-url-actions .btn {
    flex: 1 1 130px;
    justify-content: center;
}

.constructor-preview {
    margin-top: 1rem;
}

/* -------- Programme count hierarchy -------- */

.programme-count-overrides {
    max-width: 480px;
    margin-left: 196px;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--panel-alt);
}

.programme-count-overrides__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.programme-count-overrides__header strong,
.programme-count-overrides__header span {
    display: block;
}

.programme-count-overrides__header strong {
    color: var(--text);
    font-size: 0.82rem;
}

.programme-count-overrides__header div > span {
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.programme-count-overrides__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.programme-count-side {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
}

.programme-count-side .form-row__label {
    text-align: left;
    font-size: 0.78rem;
    font-weight: 600;
}

.programme-count-side .form-row__control input {
    width: 100%;
}

.programme-count-summary {
    margin: 0.8rem 0 0;
    padding-top: 0.7rem;
    border-top: 1px solid var(--border);
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 600;
}

/* -------- Programme image source -------- */

.programme-image-source {
    max-width: 640px;
    margin-left: 196px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--panel-alt);
}

.programme-image-source__header strong,
.programme-image-source__header span {
    display: block;
}

.programme-image-source__header strong {
    color: var(--text);
    font-size: 0.88rem;
}

.programme-image-source__header span,
.programme-image-option > p {
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.5;
}

.programme-image-option {
    margin-top: 0.85rem;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    transition: border-color 0.15s ease, opacity 0.15s ease;
}

.programme-image-option--active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.programme-image-option--inactive {
    opacity: 0.72;
}

.programme-image-option--inactive .btn {
    opacity: 1;
}

.programme-image-option__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--text);
    font-size: 0.82rem;
}

.programme-image-option > p {
    margin-bottom: 0.75rem;
}

.programme-image-option .form-row {
    grid-template-columns: 155px 1fr;
}

.programme-image-option > .btn + .form-row {
    margin-top: 0.75rem;
}

.programme-image-source__separator {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0.85rem 0 0;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
}

.programme-image-source__separator::before,
.programme-image-source__separator::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--border);
}

.programme-image-source__status {
    margin: 0.85rem 0 0;
    color: var(--brand);
    font-size: 0.75rem;
    font-weight: 600;
}

/* -------- Optional constructor sections -------- */

.optional-section {
    margin: 0;
    padding: 1.5rem 1.75rem;
    border: 0;
    border-top: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
}

.optional-section + .optional-section {
    margin-top: 0;
}

.optional-section summary.form-section__title {
    margin: 0;
}

.optional-section[open] summary.form-section__title {
    margin-bottom: 1rem;
}

.optional-section summary.form-section__title .badge {
    margin-left: auto;
}

.optional-section__body {
    padding: 0;
}

.optional-section__body > .card__desc:first-child {
    margin-top: 0;
}

/* -------- Result action row -------- */

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.result-block {
    padding: 1rem 0 1.1rem;
}

.result-block + .result-block {
    border-top: 1px solid var(--border);
}

.result-block__title {
    margin: 0 0 0.85rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.result-block__actions,
.short-url-actions {
    margin-top: 0.75rem;
}

.short-url-actions {
    align-items: center;
}

.short-url-row input {
    font-family: "SF Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.short-url-preset-context {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.short-url-preset-context[hidden] {
    display: none;
}

.short-url-preset-context strong {
    color: var(--text);
    font-size: 0.86rem;
}

.result-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}

.deterministic-heading {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.info-tooltip {
    display: inline-flex;
}

.info-tooltip__trigger {
    display: inline-grid;
    width: 1.15rem;
    height: 1.15rem;
    padding: 0;
    place-items: center;
    border: 1px solid var(--text-subtle);
    border-radius: 50%;
    background: var(--panel);
    color: var(--text-muted);
    cursor: help;
    font: 700 0.7rem/1 sans-serif;
}

.info-tooltip__trigger:hover,
.info-tooltip__trigger:focus-visible {
    border-color: var(--brand);
    color: var(--brand);
    outline: none;
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.info-tooltip__content {
    position: absolute;
    top: calc(100% + 0.55rem);
    left: 0;
    z-index: 20;
    display: flex;
    width: min(460px, calc(100vw - 4rem));
    padding: 0.8rem;
    flex-direction: column;
    gap: 0.65rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--text-muted);
    box-shadow: 0 12px 30px rgba(32, 28, 55, 0.18);
    font-size: 0.76rem;
    font-weight: 400;
    line-height: 1.45;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-0.25rem);
    transition: opacity 0.15s ease, transform 0.15s ease;
    visibility: hidden;
}

.info-tooltip__content strong {
    display: block;
    margin-bottom: 0.12rem;
    color: var(--text);
    font-size: 0.76rem;
}

.info-tooltip:hover .info-tooltip__content,
.info-tooltip:focus-within .info-tooltip__content {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.form-row--disabled {
    opacity: 0.58;
}

.form-row--disabled input {
    cursor: not-allowed;
    background: var(--panel-alt);
}

/* -------- Manual blackout timeline -------- */

.blackout-manual {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.blackout-timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.blackout-timeline-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.blackout-timeline {
    display: flex;
    align-items: stretch;
    gap: 3px;
    margin-top: 0.65rem;
    padding: 0.65rem;
    overflow-x: auto;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.blackout-slot {
    min-width: 42px;
    height: 50px;
    padding: 0.25rem;
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    background: var(--panel);
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.7rem;
    font-weight: 600;
}

.blackout-slot--future {
    background: var(--brand-soft);
}

.blackout-slot--current {
    border-color: var(--warning);
    background: var(--warning-soft);
    color: var(--warning);
}

.blackout-slot:hover,
.blackout-slot:focus-visible {
    border-color: var(--warning);
    background: var(--table-row-hover);
    outline: none;
}

.blackout-slot.is-blackout {
    border-color: var(--danger);
    background: var(--danger-soft);
    color: var(--danger);
}

.blackout-slot.is-pending {
    border-color: var(--brand);
    box-shadow: inset 0 0 0 2px var(--brand);
}

.blackout-slot:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.blackout-timeline-limit {
    width: 100%;
    padding: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.78rem;
}

.blackout-selection-hint {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.blackout-range-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.65rem;
}

.blackout-range-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 0.72rem;
    font-weight: 600;
}

.blackout-range-item button {
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

/* -------- Toast -------- */

.toast {
    margin-top: 0.75rem;
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 500;
}

.toast--info {
    background: var(--brand-soft);
    border: 1px solid var(--brand);
    color: var(--brand);
}

.toast--success {
    background: var(--success-soft);
    border: 1px solid var(--success);
    color: #14532d;
}

.toast--warning {
    background: var(--warning-soft);
    border: 1px solid var(--warning);
    color: #92400e;
}

.toast--error {
    background: var(--danger-soft);
    border: 1px solid var(--danger);
    color: #991b1b;
}

/* -------- Generated EPG preview -------- */

.preview-panel {
    scroll-margin-top: calc(var(--topbar-height) + 1rem);
}

.preview-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.preview-toolbar__field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
}

.preview-toolbar__field select,
.preview-toolbar__field input {
    min-width: 180px;
    padding: 0.45rem 0.7rem;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font: inherit;
    font-size: 0.82rem;
}

.preview-toolbar__field--search {
    flex: 1 1 260px;
}

.preview-toolbar__field--search input {
    width: 100%;
}

.preview-toolbar__views {
    display: flex;
    gap: 0.35rem;
    margin-left: auto;
}

.preview-toolbar__views .is-active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.preview-edit-requirement {
    margin-top: 0.75rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    background: var(--warning-soft);
    color: #92400e;
    font-size: 0.76rem;
    line-height: 1.4;
}

.preview-table-wrap {
    max-height: 580px;
    overflow: auto;
}

.preview-table {
    min-width: 1600px;
}

.preview-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.preview-table td {
    white-space: nowrap;
}

.preview-table td:nth-child(7),
.preview-table td:nth-child(8) {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-table th:first-child,
.preview-table td:first-child {
    position: sticky;
    left: 0;
    background: var(--panel);
    box-shadow: 1px 0 0 var(--border);
}

.preview-table th:first-child {
    z-index: 4;
}

.preview-table td:first-child {
    z-index: 1;
}

.preview-table tbody tr:hover td:first-child {
    background: var(--warning-soft);
}

.preview-table tbody tr.preview-row--edited {
    background: var(--brand-soft);
}

.preview-table tbody tr.preview-row--edited td:first-child {
    background: var(--brand-soft);
    box-shadow:
        inset 3px 0 0 var(--brand),
        1px 0 0 var(--border);
}

.preview-table tbody tr.preview-row--edited:hover td:first-child {
    background: var(--brand-soft);
}

.preview-action-cell {
    min-width: 92px;
}

.preview-edit {
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
}

.preview-edited-badge {
    display: block;
    margin-top: 0.3rem;
    color: var(--brand);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
}

.preview-empty {
    padding: 2rem !important;
    color: var(--text-muted);
    text-align: center !important;
}

.preview-state {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    background: var(--panel-alt);
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}

.preview-state--current {
    background: var(--warning-soft);
    color: var(--warning);
}

.preview-flag {
    color: var(--text-subtle);
}

.preview-flag.is-enabled {
    color: var(--danger);
    font-weight: 700;
}

.preview-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.78rem;
}

.preview-pagination__actions {
    display: flex;
    gap: 0.4rem;
}

.preview-raw {
    margin: 0;
    padding: 0.85rem 1.1rem;
    background: var(--code-bg);
    color: var(--code-text);
    border-top: 1px solid var(--border);
    max-height: 580px;
    overflow: auto;
    font-family: "SF Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.78rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-all;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.url-length.is-warning,
#short-url-status.is-warning {
    color: var(--danger);
    font-weight: 600;
}

/* -------- Per-programme editor -------- */

.programme-editor {
    width: min(860px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    padding: 0;
    overflow: visible;
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
}

.programme-editor::backdrop {
    background: rgba(17, 24, 39, 0.72);
}

.programme-editor form {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 2rem);
}

.programme-editor__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--panel-alt);
}

.programme-editor__header h2 {
    margin: 0;
    font-size: 1.05rem;
}

.programme-editor__header p {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-family: "SF Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.72rem;
}

.programme-editor__close {
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
}

.programme-editor__body {
    padding: 0 1.25rem;
    overflow-y: auto;
}

.programme-editor__section {
    padding: 1.25rem 0;
}

.programme-editor__section + .programme-editor__section {
    border-top: 1px solid var(--border);
}

.programme-editor__section h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1rem;
    color: var(--text-muted);
    font-size: 0.76rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.programme-editor__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 1rem;
}

.programme-editor__grid label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.programme-editor__grid input,
.programme-editor__grid select,
.programme-editor__grid textarea {
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--text);
    font: inherit;
    font-size: 0.84rem;
}

.programme-editor__grid input[readonly] {
    background: var(--panel-alt);
    color: var(--text-muted);
}

.programme-editor__wide {
    grid-column: 1 / -1;
}

.programme-editor__flags {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
}

.programme-editor__flags label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text);
    font-size: 0.82rem;
}

.programme-editor__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--panel-alt);
}

.programme-editor__note {
    margin-right: auto;
    color: var(--text-muted);
    font-size: 0.72rem;
}

/* -------- Preset picker -------- */

.preset-picker {
    width: min(760px, calc(100vw - 2rem));
}

.preset-picker__search {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.preset-picker__search input {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--text);
    font: inherit;
}

.preset-picker__search input:focus {
    border-color: var(--brand);
    outline: none;
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.preset-picker__status {
    min-height: 1.1rem;
    margin: 0.75rem 0;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.preset-picker__status.is-error {
    color: var(--danger);
}

.preset-picker__list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.preset-picker__item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel-alt);
}

.preset-picker__details {
    min-width: 0;
    margin-right: auto;
}

.preset-picker__details strong {
    display: block;
    overflow: hidden;
    color: var(--text);
    font-size: 0.9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preset-picker__details span {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.preset-picker__item-actions {
    display: flex;
    flex-shrink: 0;
    gap: 0.45rem;
}

.preset-picker__pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.85rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* -------- Import warnings -------- */

.warnings {
    margin-top: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.warning {
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.4;
    border: 1px solid transparent;
}

.warning--warning {
    background: var(--warning-soft);
    border-color: #f59e0b;
    color: #854d0e;
}

.warning--info {
    background: var(--brand-soft);
    border-color: var(--brand);
    color: var(--brand);
}

.warning--error {
    background: var(--danger-soft);
    border-color: var(--danger);
    color: #991b1b;
}

.warning__badge {
    text-transform: uppercase;
    font-size: 0.66rem;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    font-weight: 700;
}

/* -------- Responsive tweaks -------- */

@media (max-width: 1240px) {
    .constructor-workspace__main {
        grid-template-columns: minmax(0, 1fr);
    }

    .constructor-result {
        position: static;
        max-height: none;
        grid-row: auto;
    }
}

@media (max-width: 760px) {
    .programme-count-overrides,
    .programme-image-source { margin-left: 0; }

    .constructor-field-grid,
    .constructor-field-grid .programme-image-source {
        grid-template-columns: minmax(0, 1fr);
    }

    .constructor-field-grid .programme-image-option,
    .constructor-field-grid .programme-image-source__header,
    .constructor-field-grid .programme-image-source__status {
        grid-column: 1;
    }
}

@media (max-width: 640px) {
    .input-group { flex-direction: column; }
    .anchor-time-control { flex-direction: column; }
    .programme-duration-control {
        grid-template-columns: minmax(0, 1fr);
    }
    .programme-count-overrides__grid { grid-template-columns: 1fr; }
    .programme-image-option .form-row {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }
    .form-actions .btn { flex: 1 1 auto; justify-content: center; }
    .preview-toolbar__views { margin-left: 0; width: 100%; }
    .preview-pagination { align-items: flex-start; flex-direction: column; }
    .programme-editor__grid { grid-template-columns: 1fr; }
    .programme-editor__wide { grid-column: auto; }
    .programme-editor__actions { align-items: stretch; flex-direction: column; }
    .programme-editor__note { margin-right: 0; }
    .preset-picker__item { align-items: stretch; flex-direction: column; }
    .preset-picker__details { width: 100%; }
    .preset-picker__item-actions { flex-wrap: wrap; }
    .preset-picker__item-actions .btn { flex: 1 1 auto; }
}
