#agenda-root {
    width: 100%;
    color: #182230;
}

.agenda-shell {
    display: grid;
    gap: 20px;
    letter-spacing: 0;
}

.agenda-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
    gap: 12px;
}

.agenda-filters label {
    display: grid;
    gap: 4px;
    font-size: .8rem;
    color: #566579;
}

.agenda-filters select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    color: #182230;
    font: inherit;
}

.agenda-unavailable {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    max-width: 680px;
    border-left: 4px solid #0069a8;
    background: #f3f8fc;
    padding: 20px;
}

.agenda-unavailable__code {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 6px;
    background: #003874;
    color: #fff;
    font-size: .76rem;
    font-weight: 800;
}

.agenda-unavailable h2 {
    margin: 0 0 6px;
    color: #111827;
    font-size: 1.15rem;
}

.agenda-unavailable p {
    margin: 0;
    color: #566579;
    font-size: .9rem;
    line-height: 1.5;
}

.agenda-header,
.agenda-toolbar,
.agenda-section-heading,
.agenda-slot-heading,
.agenda-selected-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.agenda-header h2,
.agenda-panel h3 {
    margin: 0;
    color: #111827;
}

.agenda-header h2 {
    font-size: 1.65rem;
    font-weight: 750;
    text-transform: uppercase;
}

.agenda-eyebrow {
    margin-bottom: 4px;
    color: #0069a8;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.agenda-subtitle,
.agenda-help,
.agenda-empty {
    color: #657286;
    font-size: .84rem;
    line-height: 1.45;
}

.agenda-mode {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 999px;
    background: #e8f6ee;
    padding: 7px 10px;
    color: #17623a;
    font-size: .76rem;
    font-weight: 750;
}

.agenda-mode::before {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #1d9b5f;
    content: "";
}

.agenda-session {
    display: flex;
    align-items: center;
    gap: 10px;
}

.agenda-session__logout {
    min-width: 44px;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: #526175;
    font: inherit;
    font-size: .76rem;
    font-weight: 700;
    cursor: pointer;
}

.agenda-login {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    max-width: 520px;
    border: 1px solid #dce3eb;
    border-radius: 8px;
    background: #fff;
    padding: 22px;
}

.agenda-login h2,
.agenda-login p {
    margin: 0 0 8px;
}

.agenda-login__form,
.agenda-login__form label,
.agenda-cancel-form {
    display: grid;
    gap: 8px;
}

.agenda-login__form {
    margin-top: 16px;
}

.agenda-login input,
.agenda-login select,
.agenda-cancel-form input {
    min-height: 44px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0 10px;
    font: inherit;
}

.agenda-toolbar {
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 0;
    padding-bottom: 0;
}

.agenda-week-nav,
.agenda-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.agenda-button {
    min-height: 44px;
    border: 1px solid #dce1df;
    border-radius: 6px;
    background: #fff;
    padding: 0 13px;
    color: #243247;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
}

.agenda-button:hover:not(:disabled) {
    border-color: #0069a8;
    color: #005589;
}

.agenda-button:focus-visible,
.agenda-slot:focus-visible,
.agenda-select:focus-visible {
    outline: 3px solid rgba(0, 105, 168, .2);
    outline-offset: 2px;
}

.agenda-button:disabled {
    cursor: not-allowed;
    opacity: .5;
}

.agenda-button--primary {
    border-color: #17231d;
    background: #17231d;
    color: #fff;
}

.agenda-button--primary:hover:not(:disabled) {
    border-color: #244a37;
    background: #244a37;
    color: #fff;
}

.agenda-button--danger {
    border-color: #e6b8bd;
    color: #a12632;
}

.agenda-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.agenda-calendar {
    min-width: 0;
    overflow-x: auto;
    background: #fff;
}

.agenda-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(7rem, 1fr));
    gap: 10px;
    min-width: 0;
}

.agenda-day {
    min-width: 0;
    min-height: 210px;
    border: 1px solid #dce1df;
    border-radius: 8px;
    padding: 0 9px 10px;
}

.agenda-day:first-child {
    border-left: 1px solid #dce1df;
}

.agenda-day__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
    min-height: 54px;
    border-bottom: 1px solid #e0e4e2;
    background: #fff;
    padding: 10px 0;
    font-size: .8rem;
}

.agenda-day__header time {
    color: #18231d;
    font-size: 1.45rem;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}

.agenda-shift {
    padding: 14px 0 10px;
}

.agenda-shift + .agenda-shift {
    border-top: 1px dashed #e0e4e2;
}

.agenda-shift__label {
    margin-bottom: 8px;
    color: #5f6d80;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.agenda-slot-list {
    display: grid;
    gap: 7px;
}

/* «Bandeja clara» (15/10): lo libre es lo más callado (blanco, borde discontinuo y «+») y lo reservado lleva el color
   de su estado, con su palabra e icono (nunca solo el color). Todo sale de ui/tokens.css. */
.agenda-slot {
    position: relative;
    width: 100%;
    min-height: var(--m-target, 44px);
    border: 1px solid var(--m-line-strong);
    border-radius: var(--m-r-md);
    background: var(--m-surface);
    padding: 8px 8px 8px 10px;
    color: var(--m-text);
    font-size: var(--m-fs-14);
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
}

.agenda-slot:hover:not(:disabled) {
    border-color: var(--m-text);
}

.agenda-slot.is-selected,
.agenda-shell .agenda-slot.is-selected:not(:focus-visible) {
    outline: 3px solid var(--m-text);
    outline-offset: 2px;
}

.agenda-slot.is-free { border: 1px dashed var(--m-control); background: var(--m-surface); color: var(--m-muted); }
.agenda-slot.is-free:hover:not(:disabled) { border-style: solid; border-color: var(--m-text); background: var(--m-hover); color: var(--m-text); }
.agenda-slot:is(.is-reserved, .is-pending, .is-expiring, .is-confirmed, .is-no-answer, .is-done, .is-not-done) { border-left-width: 5px; }
.agenda-slot.is-reserved { border-color: var(--m-line-strong); border-left-color: var(--m-todo-line); background: var(--m-todo-bg); }
.agenda-slot.is-pending { border-color: var(--m-warn-line); background: var(--m-warn-bg); }
.agenda-slot.is-expiring, .agenda-slot.is-not-done { border-color: var(--m-block-line); background: var(--m-block-bg); }
.agenda-slot.is-confirmed, .agenda-slot.is-done { border-color: var(--m-done-line); background: var(--m-done-bg); }
.agenda-slot.is-no-answer { border-style: dashed; border-left-style: solid; border-color: var(--m-control); background: var(--m-subtle); }
.agenda-slot.is-closed { border-color: var(--m-line); background: var(--m-subtle); color: var(--m-muted); }
/* Un turno que ya pasó no es un «Cerrado»: se queda en el lienzo, sin caja de color. */
.agenda-slot.is-past:not(.is-own) { border-color: var(--m-line); background: transparent; color: var(--m-muted); }

.agenda-slot.is-occupied:not(.is-own) {
    cursor: not-allowed;
}

.agenda-slot-heading strong {
    min-width: 0;
    font-size: var(--m-fs-14);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.agenda-slot small {
    display: block;
    margin-top: 4px;
    font-size: var(--m-fs-14);
    line-height: 1.3;
}

.agenda-slot-customer {
    display: block;
    margin-top: 4px;
    font-size: var(--m-fs-15);
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.agenda-availability {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 4px;
    font-size: var(--m-fs-14);
    font-weight: 700;
}

.agenda-slot.is-free .agenda-availability { color: var(--m-text-2); font-weight: 600; }
.agenda-slot.is-reserved .agenda-availability { color: var(--m-todo-ink); }
.agenda-slot.is-pending .agenda-availability { color: var(--m-warn-ink); }
.agenda-slot:is(.is-expiring, .is-not-done) .agenda-availability { color: var(--m-block-ink); }
.agenda-slot:is(.is-confirmed, .is-done) .agenda-availability { color: var(--m-done-ink); }
.agenda-slot:is(.is-no-answer, .is-closed, .is-past) .agenda-availability { color: var(--m-muted); font-weight: 600; }

/* Lo que acompaña al estado: motivo pendiente (aviso) o «Caduca» (rojo), con su icono. */
.agenda-slot-flag { display: flex; align-items: flex-start; gap: 4px; font-weight: 600; overflow-wrap: anywhere; }
.agenda-slot .agenda-slot-flag { display: flex; }
.agenda-slot-flag.is-warn { color: var(--m-warn-ink); }
.agenda-slot-flag.is-block { color: var(--m-block-ink); }
.agenda-slot-flag .m-i, .agenda-availability .m-i { flex: none; margin-top: 1px; }

/* FV: la etiqueta de las tiras de Administración y legalización («FV · día 1 de 2») y una banda ámbar arriba (4,2:1
   sobre blanco), que no compite con el color del estado. */
.agenda-slot.is-fv { padding-top: 11px; box-shadow: inset 0 4px 0 var(--m-p3-solid); }
.agenda-fv-tag { display: inline-flex; align-items: center; gap: 4px; width: fit-content; max-width: 100%; margin-top: 6px; padding: 1px 8px 1px 6px;
    border-radius: var(--m-r-pill); background: var(--m-p3-bg); color: var(--m-p3-ink); box-shadow: inset 0 0 0 1px var(--m-p3-line);
    font-size: var(--m-fs-14); font-weight: 700; line-height: 1.4; white-space: nowrap; }

/* Mañana y tarde de la misma reserva: una píldora doble que ocupa el sitio de las dos. */
.agenda-slot-card.is-double .agenda-slot { min-height: 8.5rem; }

/* C9: el turno lo ocupa el tercer técnico de una FV de otra línea. El rayado va solo en el borde: el texto queda
   siempre sobre el fondo liso de su estado. */
.agenda-slot.is-support { border-style: dashed; padding-left: 20px; }
.agenda-slot.is-support::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 10px; border-radius: var(--m-r-md) 0 0 var(--m-r-md);
    background: repeating-linear-gradient(135deg, var(--m-text-2) 0 2px, transparent 2px 6px); }

.agenda-panel {
    background: #fff;
    padding: 22px;
}

.agenda-panel__body {
    display: grid;
    gap: 14px;
    margin-top: 14px;
}

.agenda-field {
    display: grid;
    gap: 6px;
}

.agenda-field label {
    color: #4f5e71;
    font-size: .75rem;
    font-weight: 700;
}

.agenda-select {
    width: 100%;
    min-height: 44px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    padding: 8px 10px;
    color: #182230;
    font: inherit;
}

.agenda-quote-search {
    width: 100%;
}

.agenda-quote-results {
    display: grid;
    gap: 6px;
}

.agenda-quote-list {
    max-height: 210px;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    list-style: none;
}

.agenda-quote-option {
    padding: 10px 12px;
    min-height: 44px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e1e6ec;
    color: #182230;
    font-size: .78rem;
    cursor: pointer;
    overflow-wrap: anywhere;
}

.agenda-quote-option:last-child {
    border-bottom: 0;
}

.agenda-quote-option:hover,
.agenda-quote-option.is-active {
    background: #e3f4eb;
}

.agenda-quote-option[aria-selected="true"] {
    background: #e3f4eb;
    color: #125c3b;
    font-weight: 700;
    box-shadow: inset 3px 0 0 #17231d;
}

.agenda-quote-empty,
.agenda-quote-more,
.agenda-quote-chosen {
    margin: 0;
    color: #4f5e71;
    font-size: .75rem;
}

.agenda-quote-empty {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    padding: 12px;
}

.agenda-quote-more {
    font-weight: 700;
}

.agenda-quote-chosen strong {
    color: #182230;
    overflow-wrap: anywhere;
}

.agenda-manual {
    display: grid;
    gap: 14px;
}

.agenda-input {
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    padding: 8px 10px;
    color: #182230;
    font: inherit;
}

textarea.agenda-input {
    min-height: 80px;
    resize: vertical;
}

.agenda-input:focus-visible {
    outline: 3px solid #17231d;
    outline-offset: 2px;
}

.agenda-selected-summary {
    align-items: start;
    border-top: 1px solid #e1e6ec;
    border-bottom: 1px solid #e1e6ec;
    padding: 11px 0;
    font-size: .78rem;
}

.agenda-selected-summary strong {
    max-width: 160px;
    text-align: right;
    overflow-wrap: anywhere;
}

.agenda-notice {
    border-left: 3px solid #d69225;
    background: #fff9ed;
    padding: 10px 11px;
    color: #765119;
    font-size: .75rem;
    line-height: 1.4;
}

.agenda-feedback {
    min-height: 38px;
    border-radius: 6px;
    padding: 9px 10px;
    background: #f2f4f6;
    color: #586579;
    font-size: .76rem;
    line-height: 1.4;
}

.agenda-feedback[data-kind="success"] {
    background: #eaf8f0;
    color: #17623a;
}

.agenda-feedback[data-kind="error"] {
    background: #fceef0;
    color: #9b2430;
}

.agenda-cancel-form label {
    color: #4f5e71;
    font-size: .75rem;
    font-weight: 700;
}

.agenda-cancel-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.agenda-loading {
    display: grid;
    min-height: 320px;
    place-items: center;
    color: #64748b;
}

@media (max-width: 1050px) {
    .agenda-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .agenda-header,
    .agenda-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .agenda-days {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        min-width: 0;
    }

    .agenda-day {
        border: 1px solid #dce1df;
    }

    .agenda-day:first-child {
        border-top: 1px solid #dce1df;
    }

    .agenda-shift {
        min-height: 0;
    }

}

@media (max-width: 560px) {
    .agenda-header,
    .agenda-session,
    .agenda-login {
        align-items: stretch;
        flex-direction: column;
    }

    .agenda-login__form .agenda-button,
    .agenda-cancel-actions {
        grid-template-columns: 1fr;
    }
    .agenda-week-nav {
        flex-wrap: nowrap;
    }

    .agenda-button {
        width: auto;
    }
}

.agenda-title, .agenda-week-summary, .agenda-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.agenda-title { justify-content: flex-start; flex-wrap: wrap; }
.agenda-title > span, #agenda-week-label { color: #647068; font-size: .88rem; }
#agenda-week-label { margin: 0; }
.agenda-icon { display: block; flex: 0 0 18px; }
.agenda-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-family: inherit; }
.agenda-icon-button { width: 44px; min-width: 44px; padding: 0; }
.agenda-button--primary .agenda-icon { filter: invert(1); }
.agenda-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.agenda-tabs button {
    min-height: 44px;
    border: 1px solid #e1e6e3;
    border-radius: 6px;
    padding: 0 14px;
    color: #68746d;
    background: #fff;
    font: inherit;
    font-size: .82rem;
    cursor: pointer;
}
.agenda-tabs button[aria-selected="true"] { background: #e3efe8; color: #22553d; border-color: #a9c8b8; font-weight: 650; }
.agenda-tabs button:focus-visible, .agenda-search:focus-within { outline: 3px solid #b1d5c2; outline-offset: 2px; }
.agenda-search { display: flex; align-items: center; gap: 8px; border: 1px solid #dce1df; border-radius: 6px; padding: 0 12px; width: 275px; max-width: 100%; }
.agenda-search input { min-width: 0; width: 100%; min-height: 44px; border: 0; outline: 0; background: transparent; font: inherit; font-size: .8rem; }
.agenda-slot-heading { gap: 5px; flex-wrap: wrap; }
.agenda-slot-time { display: block; margin-bottom: 4px; color: inherit; font-size: var(--m-fs-14); font-weight: 600; font-variant-numeric: tabular-nums; }
.agenda-day.is-today { border-color: #4c9872; }
.agenda-day.is-today .agenda-day__header time { color: #287048; }
.agenda-day-empty { display: grid; justify-items: center; gap: 12px; align-content: start; padding: 24px 0; color: #77827b; }
.agenda-day-empty small { font-size: 0.75rem; }
.agenda-dialog { width: min(480px, calc(100% - 32px)); max-height: calc(100dvh - 40px); margin: auto; padding: 0; overflow-y: auto; border: 1px solid #dce1df; border-radius: 8px; box-shadow: 0 16px 64px #14271c24; }
.agenda-dialog::backdrop { background: #15291f50; }
.agenda-panel-heading h3 { font-size: 1.08rem; }
.agenda-panel-heading { gap: 10px; }
/* Leyenda arriba, compacta: una muestra de cada estado (la misma caja que el turno) con su icono y su palabra. */
.agenda-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; color: var(--m-text-2); font-size: var(--m-fs-14); }
.agenda-legend[hidden] { display: none; }
.agenda-key { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.agenda-key__swatch { display: inline-grid; place-items: center; width: 24px; height: 20px; flex: none; border: 1px solid var(--m-line-strong); border-radius: 4px; background: var(--m-surface); color: var(--m-text-2); }
.agenda-key.is-free .agenda-key__swatch { border-style: dashed; border-color: var(--m-control); }
.agenda-key.is-reserved .agenda-key__swatch { border-left: 4px solid var(--m-todo-line); background: var(--m-todo-bg); color: var(--m-todo-ink); }
.agenda-key.is-pending .agenda-key__swatch { border-color: var(--m-warn-line); border-left-width: 4px; background: var(--m-warn-bg); color: var(--m-warn-ink); }
.agenda-key.is-expiring .agenda-key__swatch { border-color: var(--m-block-line); border-left-width: 4px; background: var(--m-block-bg); color: var(--m-block-ink); }
.agenda-key.is-confirmed .agenda-key__swatch { border-color: var(--m-done-line); border-left-width: 4px; background: var(--m-done-bg); color: var(--m-done-ink); }
.agenda-key.is-no-answer .agenda-key__swatch { border: 1px dashed var(--m-control); border-left: 4px solid var(--m-control); background: var(--m-subtle); color: var(--m-muted); }
.agenda-key.is-closed .agenda-key__swatch { border-color: var(--m-line); background: var(--m-subtle); color: var(--m-muted); }
.agenda-key.is-past .agenda-key__swatch { border-color: var(--m-line); background: transparent; color: var(--m-muted); }
.agenda-key.is-support .agenda-key__swatch { border-style: dashed; background: repeating-linear-gradient(135deg, var(--m-text-2) 0 2px, transparent 2px 6px) left / 7px 100% no-repeat, var(--m-surface); }
.agenda-key.is-fv .agenda-key__swatch { border-color: var(--m-p3-line); background: var(--m-p3-bg); color: var(--m-p3-ink); box-shadow: inset 0 3px 0 var(--m-p3-solid); }
.agenda-followup-form fieldset { display: grid; gap: 12px; min-width: 0; border: 0; padding: 0; margin: 0; }
.agenda-followup-form legend { padding: 0 0 8px; font-size: .85rem; font-weight: 700; }
.agenda-status-options { display: flex; flex-wrap: wrap; gap: 12px; }
.agenda-status-options label { display: flex; align-items: center; gap: 6px; min-height: 44px; font-size: .85rem; cursor: pointer; }
.agenda-status-options input { width: 18px; height: 18px; }
.agenda-reason-label { display: grid; gap: 6px; font-size: .85rem; }
.agenda-reason-label[hidden] { display: none; }
.agenda-reason-label textarea { box-sizing: border-box; width: 100%; min-height: 80px; padding: 8px; border: 1px solid #8c9a93; border-radius: 4px; font: inherit; resize: vertical; }
.agenda-timezone { margin-left: auto; color: var(--m-muted); }
.agenda-header { flex-wrap: wrap; }
.agenda-actions { flex-wrap: wrap; }
#agenda-first { max-width: 100%; white-space: normal; text-align: left; }
.agenda-slot-tooltip { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.agenda-installation-summary { display: grid; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid #dce1df; }
.agenda-summary-field { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; font-size: .88rem; }
.agenda-summary-field > span { color: #647068; }
.agenda-summary-field strong, .agenda-selected-summary strong { overflow-wrap: anywhere; }
.agenda-material { color: #8b4d07; font-size: .85rem; font-weight: 600; }
.agenda-material.is-ready { color: #216442; }
.agenda-material-form { display: grid; gap: 14px; border-top: 1px solid #dce1df; padding-top: 16px; }
.agenda-material-form label { display: grid; gap: 6px; font-size: .88rem; }
.agenda-material-form .agenda-material-toggle { display: flex; align-items: center; min-height: 44px; gap: 10px; }
.agenda-material-form input[type="checkbox"] { width: 20px; height: 20px; flex: 0 0 20px; }
.agenda-material-form textarea { width: 100%; box-sizing: border-box; min-height: 80px; border: 1px solid #bbc6bf; border-radius: 5px; padding: 10px; resize: vertical; font: inherit; }
.agenda-pending { margin-top: 24px; border-top: 1px solid #dce1df; padding-top: 12px; }
.agenda-pending h3 { font-size: 1rem; }
.agenda-pending-row { display: grid; gap: 6px; width: 100%; min-height: 60px; padding: 12px 0; text-align: left; background: transparent; border: 0; border-bottom: 1px solid #dce1df; color: inherit; font: inherit; cursor: pointer; overflow-wrap: anywhere; }
.agenda-pending-row span { color: #647068; font-size: .85rem; }

/* «Bandeja clara» (15/10): la Agenda de la oficina adopta la capa común (.m-ui en .agenda-shell: letra, tokens --m-*,
   botones y un solo foco). Solo dentro de .agenda-shell: la pantalla del técnico y los diálogos de gestión, que usan
   las mismas clases .agenda-*, no cambian. */
.agenda-shell.m-ui { gap: var(--m-sp-4); background: transparent; color: var(--m-text); }
@media (min-width: 901px) { .agenda-shell .agenda-header { align-items: flex-end; } }
.agenda-shell .agenda-filters[hidden] { display: none; }
.agenda-shell .agenda-title { flex-direction: column; align-items: flex-start; gap: 2px; }
.agenda-origin:empty { display: none; }
.agenda-origin__link { gap: 4px; font-size: var(--m-fs-15); font-weight: 500; }
.agenda-shell .agenda-header h2 { color: var(--m-text); font-size: var(--m-fs-28); font-weight: 700; line-height: 1.2; letter-spacing: -.015em; text-transform: none; }
.agenda-shell .agenda-button { min-height: var(--m-target); border: 1px solid var(--m-control); border-radius: var(--m-r-md); background: var(--m-surface); padding: 0 var(--m-sp-4); color: var(--m-text); font-size: var(--m-fs-15); font-weight: 600; text-decoration: none; }
.agenda-shell .agenda-button:hover:not(:disabled) { border-color: var(--m-text); background: var(--m-hover); color: var(--m-text); }
.agenda-shell .agenda-button--primary { border-color: var(--m-action); background: var(--m-action); color: var(--m-on-action); }
.agenda-shell .agenda-button--primary:hover:not(:disabled) { border-color: var(--m-action-hover); background: var(--m-action-hover); color: var(--m-on-action); }
.agenda-shell .agenda-button--danger { border-color: var(--m-block-line); color: var(--m-block-ink); }
.agenda-shell .agenda-button--danger:hover:not(:disabled) { border-color: var(--m-block-line); background: var(--m-block-bg); color: var(--m-block-ink); }
.agenda-shell .agenda-cancel-form .agenda-button--danger[type="submit"] { border-color: var(--m-danger); background: var(--m-danger); color: var(--m-on-action); }
.agenda-shell .agenda-cancel-form .agenda-button--danger[type="submit"]:hover:not(:disabled) { border-color: var(--m-danger-hover); background: var(--m-danger-hover); color: var(--m-on-action); }
.agenda-shell .agenda-button--small { padding: 0 var(--m-sp-3); font-size: var(--m-fs-14); }
.agenda-shell .agenda-button:disabled { opacity: .6; }
.agenda-shell .agenda-icon-button { padding: 0; }
.agenda-shell .agenda-tabs button { border-color: var(--m-control); border-radius: var(--m-r-md); background: var(--m-surface); color: var(--m-text); font-size: var(--m-fs-15); font-weight: 500; }
.agenda-shell .agenda-tabs button:hover { background: var(--m-hover); }
.agenda-shell .agenda-tabs button[aria-selected="true"], .agenda-shell .agenda-tabs button[aria-pressed="true"] { border-color: var(--m-text); background: var(--m-text); color: var(--m-on-action); font-weight: 600; }
.agenda-shell .agenda-search { border-color: var(--m-control); border-radius: var(--m-r-md); background: var(--m-surface); }
.agenda-shell .agenda-search input { color: var(--m-text); font-size: var(--m-fs-16); }
.agenda-shell .agenda-search:focus-within { outline: var(--m-focus-width) solid var(--m-focus); outline-offset: var(--m-focus-offset); }
.agenda-shell .agenda-search input:focus-visible { outline: none; }
.agenda-shell #agenda-week-label { color: var(--m-text-2); font-size: var(--m-fs-16); font-weight: 600; }
.agenda-shell .agenda-mode { background: var(--m-subtle); color: var(--m-text-2); font-size: var(--m-fs-14); font-weight: 600; }
.agenda-shell .agenda-mode::before { background: var(--m-control); }
.agenda-shell .agenda-notice { border-left-color: var(--m-warn-line); background: var(--m-warn-bg); color: var(--m-warn-ink); font-size: var(--m-fs-14); }
.agenda-shell .agenda-filters label { color: var(--m-text-2); font-size: var(--m-fs-14); font-weight: 600; }
.agenda-shell .agenda-filters select, .agenda-shell .agenda-select, .agenda-shell .agenda-input,
.agenda-shell .agenda-cancel-form input, .agenda-shell .agenda-material-form textarea, .agenda-shell .agenda-reason-label textarea {
    border: 1px solid var(--m-control); border-radius: var(--m-r-md); background-color: var(--m-surface); color: var(--m-text); font-size: var(--m-fs-16); }
.agenda-shell .agenda-feedback { background: var(--m-subtle); color: var(--m-text-2); font-size: var(--m-fs-14); }
.agenda-shell .agenda-feedback[data-kind="success"] { background: var(--m-done-bg); color: var(--m-done-ink); }
.agenda-shell .agenda-feedback[data-kind="error"] { background: var(--m-block-bg); color: var(--m-block-ink); }
/* El aviso vacío no ocupa sitio (antes, una barra gris vacía bajo los filtros); sigue en el árbol para anunciar. */
.agenda-shell #agenda-status:empty { min-height: 0; padding: 0; background: none; }
.agenda-shell .agenda-calendar { background: transparent; }
.agenda-shell .agenda-loading { color: var(--m-muted); }
.agenda-shell .agenda-help, .agenda-shell .agenda-empty { color: var(--m-muted); font-size: var(--m-fs-14); }
.agenda-shell .agenda-team-warning, .agenda-shell .agenda-material { color: var(--m-warn-ink); }
.agenda-shell .agenda-material.is-ready { color: var(--m-done-ink); }
.agenda-shell .agenda-pending { border-top-color: var(--m-line); }
.agenda-shell .agenda-pending h3 { margin: 0 0 4px; font-size: var(--m-fs-16); }
.agenda-shell .agenda-pending-row { border-bottom-color: var(--m-line); }
.agenda-shell .agenda-pending-row span { color: var(--m-muted); font-size: var(--m-fs-14); }
/* La reserva y la ficha, en un diálogo de la capa común. */
.agenda-shell .agenda-dialog { border: 0; border-radius: var(--m-r-xl); background: var(--m-surface); box-shadow: var(--m-shadow-pop); color: var(--m-text); }
.agenda-shell .agenda-dialog::backdrop { background: var(--m-scrim); }
.agenda-shell .agenda-panel { background: var(--m-surface); }
.agenda-shell .agenda-panel h3 { color: var(--m-text); font-size: var(--m-fs-20); line-height: 1.3; }
.agenda-shell .agenda-panel h4 { margin: 0 0 4px; font-size: var(--m-fs-16); }
.agenda-shell .agenda-field label, .agenda-shell .agenda-cancel-form label { color: var(--m-text-2); font-size: var(--m-fs-14); font-weight: 600; }
.agenda-shell .agenda-cancel-form p { color: var(--m-text-2); font-size: var(--m-fs-15); }
.agenda-shell .agenda-selected-summary { border-color: var(--m-line); font-size: var(--m-fs-14); }
.agenda-shell .agenda-selected-summary > span, .agenda-shell .agenda-summary-field > span { color: var(--m-muted); }
.agenda-shell .agenda-selected-summary strong { max-width: 60%; }
.agenda-shell .agenda-installation-summary, .agenda-shell .agenda-material-form { border-color: var(--m-line); }
.agenda-shell .agenda-quote-list, .agenda-shell .agenda-quote-empty { border-color: var(--m-control); border-radius: var(--m-r-md); }
.agenda-shell .agenda-quote-option { border-bottom-color: var(--m-line); color: var(--m-text); font-size: var(--m-fs-14); }
.agenda-shell .agenda-quote-option:hover, .agenda-shell .agenda-quote-option.is-active { background: var(--m-hover); }
.agenda-shell .agenda-quote-option[aria-selected="true"] { background: var(--m-selected); color: var(--m-text); box-shadow: inset 4px 0 0 var(--m-text); }
.agenda-shell .agenda-quote-empty, .agenda-shell .agenda-quote-more, .agenda-shell .agenda-quote-chosen { color: var(--m-text-2); font-size: var(--m-fs-14); }
.agenda-shell .agenda-status-options label, .agenda-shell .agenda-reason-label { font-size: var(--m-fs-15); }
.agenda-shell .agenda-followup-form legend { font-size: var(--m-fs-15); }
.agenda-shell .agenda-history h4 { margin: 12px 0 4px; }

/* Scope the full-width workspace to Agenda; the budget editors keep their layout. */
body:not(.mosal-portal):has(#agenda-root:not([hidden])) > main { padding: 30px 24px; background: #fff; }
body:not(.mosal-portal):has(#agenda-root:not([hidden])) > main > div { max-width: none !important; border: 0 !important; border-radius: 0; box-shadow: none !important; overflow: visible; min-height: 0; }
body:not(.mosal-portal):has(#agenda-root:not([hidden])) > main > div > div:first-child { padding: 0; }
body:not(.mosal-portal):has(#agenda-root:not([hidden])) > aside > nav,
body:not(.mosal-portal):has(#agenda-root:not([hidden])) > aside > div:not(:first-child) { display: none; }
body.mosal-portal[data-portal-tool="agenda"] > main { background: var(--m-bg); }
body.mosal-portal[data-portal-tool="agenda"] .workspace-heading { display: none; }
body.mosal-portal[data-portal-tool="agenda"] > main > .portal-card { max-width: none; border: 0; border-radius: 0; }
body.mosal-portal[data-portal-tool="agenda"] > main > .portal-card > div:first-child { padding: 0; }
@media (min-width: 901px) {
    body:not(.mosal-portal):has(#agenda-root:not([hidden])) > aside { width: 218px; background: #171d19; border: 0; box-shadow: none; }
    body:not(.mosal-portal):has(#agenda-root:not([hidden])) > aside > div:first-child { padding: 24px 12px; border: 0; gap: 18px; }
    body:not(.mosal-portal):has(#agenda-root:not([hidden])) > aside img { width: 66px; height: 66px; }
    body:not(.mosal-portal):has(#agenda-root:not([hidden])) > aside h1 { color: #fff; font-family: inherit; font-size: .86rem; letter-spacing: 0; }
    body:not(.mosal-portal):has(#agenda-root:not([hidden])) .tool-switch { background: transparent; box-shadow: none; border: 0; padding: 0; }
    body:not(.mosal-portal):has(#agenda-root:not([hidden])) .tool-switch-option { color: #e2e8e4; border-radius: 6px; }
    body:not(.mosal-portal):has(#agenda-root:not([hidden])) .tool-switch-option small { color: #abbab0; }
    body:not(.mosal-portal):has(#agenda-root:not([hidden])) .tool-switch-option__code { background: #29372f; color: #c7e8d6; border-color: #3a4b40; }
    body:not(.mosal-portal):has(#agenda-root:not([hidden])) .tool-switch-option.active { background: #304c3c; box-shadow: inset 3px 0 #54bf84; }
}
@media (min-width: 901px) and (max-width: 1150px) {
    .agenda-title { width: 100%; }
    .agenda-header { flex-wrap: wrap; }
    .agenda-days { min-width: 56.25rem; }
}
@media (max-width: 900px) {
    body:not(.mosal-portal):has(#agenda-root:not([hidden])) > main { padding: 22px 16px; }
    body:not(.mosal-portal):has(#agenda-root:not([hidden])) > aside { position: static; box-shadow: none; }
    .agenda-actions { flex-wrap: wrap; }
    .agenda-week-summary { align-items: flex-start; flex-wrap: wrap; }
    .agenda-search { width: 100%; }
    .agenda-slot { padding: 10px; }
    .agenda-day__header { font-size: .9rem; }
}
@media (max-width: 560px) {
    .agenda-days { grid-template-columns: minmax(0, 1fr); }
    .agenda-session { flex-direction: row; align-items: center; }
    .agenda-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; width: 100%; }
    .agenda-tabs button { padding: 6px; font-size: 0.75rem; overflow-wrap: anywhere; }
    #agenda-root .agenda-tabs button { font-size: .75rem !important; overflow-wrap: normal; }
    #agenda-root .agenda-actions .agenda-button { font-size: .82rem !important; }
    .agenda-title { gap: 8px; }
    .agenda-header h2 { font-size: 1.4rem; }
    .agenda-actions { gap: 6px; }
    .agenda-panel { padding: 16px; }
    .agenda-day { min-height: 140px; }
    .agenda-timezone { margin-left: 0; }
}

.agenda-management { width: min(940px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 24px; border: 1px solid #d8dfe5; border-radius: 8px; color: #182e40; background: #fff; overflow: auto; box-sizing: border-box; }
.agenda-management { margin: auto; }
.agenda-technical { max-width: 900px; padding: 24px; margin: auto; color: #182e40; }
.agenda-technical header { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.agenda-technical h2 { font-size: 1.4rem; }
.agenda-technical h3 { margin: 20px 0; font-size: 1.1rem; }
.agenda-technical form { display: grid; gap: 16px; margin-top: 20px; }
.agenda-technical textarea { display: block; box-sizing: border-box; width: 100%; min-height: 100px; padding: 12px; border: 1px solid #bac7d1; border-radius: 4px; }
.agenda-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; width: 100%; }
.agenda-month-heading { text-align: center; padding: 8px 0; font-weight: 600; }
/* El mes con las mismas claves que la semana: libre en blanco discontinuo, lleno con color, pasado sin caja. */
.agenda-month-day { min-width: 0; min-height: 72px; border: 1px solid var(--m-line); border-radius: var(--m-r-md); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 4px 2px; background: var(--m-subtle); color: var(--m-text-2); font: inherit; cursor: pointer; }
.agenda-month-day time { font-size: var(--m-fs-16); font-weight: 700; font-variant-numeric: tabular-nums; }
.agenda-month-day span { display: inline-flex; align-items: center; gap: 3px; font-size: var(--m-fs-14); font-weight: 600; line-height: 1.2; text-align: center; }
.agenda-month-day.is-free { border: 1px dashed var(--m-control); background: var(--m-surface); color: var(--m-text-2); }
.agenda-month-day.is-reserved { border-color: var(--m-line-strong); background: var(--m-todo-bg); color: var(--m-todo-ink); }
.agenda-month-day.is-pending { border-color: var(--m-warn-line); background: var(--m-warn-bg); color: var(--m-warn-ink); }
.agenda-month-day.is-past { background: transparent; color: var(--m-muted); }
.agenda-month-day.is-outside time { color: var(--m-muted); font-weight: 500; }
.agenda-month-day:hover { border-color: var(--m-text); }
.agenda-month-day:focus-visible { outline: 3px solid var(--m-focus); outline-offset: 2px; }
.agenda-actions [data-period][aria-pressed=true] { background: #e3f4eb; color: #125c3b; }
@media (max-width: 560px) { .agenda-month-day span { font-size: var(--m-fs-12); } }
.agenda-technical button, .agenda-technical a { min-height: 44px; }
.agenda-management::backdrop { background: rgb(10 28 24 / 45%); }
.agenda-management header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.agenda-management h2 { font-size: 1.3rem; margin: 0; }
.agenda-management h3 { font-size: 1rem; margin: 20px 0 12px; }
.agenda-management-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
.agenda-management section { min-width: 0; }
.agenda-management form { display: grid; gap: 12px; }
.agenda-management label { display: block; font-size: .9rem; overflow-wrap: anywhere; }
.agenda-management input:not([type=checkbox]), .agenda-management select { display: block; width: 100%; min-height: 44px; padding: 8px; margin-top: 5px; box-sizing: border-box; border: 1px solid #b9c6cf; border-radius: 4px; background: white; color: #182e40; }
.agenda-management input[type=checkbox] { width: 20px; height: 20px; margin: 12px 8px 12px 0; vertical-align: middle; }
.agenda-management fieldset { border: 1px solid #d8dfe5; padding: 12px; min-width: 0; }
.agenda-management button { min-height: 44px; white-space: normal; overflow-wrap: anywhere; }
.agenda-management-row { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; width: 100%; text-align: left; padding: 12px 4px; border: 0; border-bottom: 1px solid #e0e5e9; color: inherit; background: transparent; box-sizing: border-box; overflow-wrap: anywhere; }
.agenda-management-row span { font-size: .85rem; }
.agenda-management [role=status] { color: #934020; overflow-wrap: anywhere; }
.agenda-management .agenda-tabs { margin: 16px 0; }
.agenda-management .agenda-tabs [aria-pressed=true] { background: #e3f4eb; color: #125c3b; }
@media (max-width: 640px) {
    .agenda-management { padding: 16px; }
    .agenda-management-columns { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

/* Semana por equipos (28/09/2026): una fila por equipo, una columna por dia. */
.agenda-teamweek { display: grid; gap: 8px; min-width: 0; }
.agenda-teamweek__head,
.agenda-team-row {
    display: grid;
    grid-template-columns: minmax(9rem, 11rem) repeat(var(--agenda-days, 5), minmax(8.5rem, 1fr));
    gap: 8px;
}
.agenda-teamweek__head > span { align-self: end; padding: 8px 4px; color: var(--m-text-2); font-size: var(--m-fs-14); font-weight: 600; }
.agenda-teamweek__day { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px; padding: 8px 6px; border-bottom: 2px solid var(--m-line-strong); color: var(--m-text-2); font-size: var(--m-fs-14); }
.agenda-teamweek__day time { color: var(--m-text); font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.agenda-teamweek__day small { flex-basis: 100%; color: var(--m-warn-ink); font-size: var(--m-fs-14); }
.agenda-teamweek__day.is-today { border-bottom-color: var(--m-text); }
.agenda-teamweek__day.is-past, .agenda-teamweek__day.is-past time { color: var(--m-muted); }
.agenda-today-tag { padding: 1px 6px; border-radius: 4px; background: var(--m-text); color: var(--m-on-action); font-size: var(--m-fs-12); font-weight: 700; }
.agenda-past-tag { color: var(--m-muted); font-size: var(--m-fs-12); font-weight: 600; }
.agenda-team-row { padding-top: 8px; border-top: 1px solid var(--m-line); }
.agenda-team-name { display: grid; align-content: start; gap: 6px; padding: 8px 4px; color: var(--m-text-2); font-size: var(--m-fs-14); overflow-wrap: anywhere; }
.agenda-team-name strong { color: var(--m-text); font-size: var(--m-fs-16); }
.agenda-team-name span { display: flex; align-items: flex-start; gap: 6px; }
.agenda-team-name .agenda-icon { width: 16px; height: 16px; flex-basis: 16px; opacity: .75; }
.agenda-team-warning { color: #8b4d07; font-weight: 650; }
.agenda-team-day { display: grid; align-content: start; gap: 7px; min-width: 0; border: 1px solid var(--m-line); border-radius: var(--m-r-lg); padding: 8px; background: var(--m-surface); }
.agenda-team-day.is-today { border-color: var(--m-text); box-shadow: inset 0 3px 0 var(--m-text); }
/* Los días pasados se quedan en el lienzo: se leen, pero no compiten con lo que viene. */
.agenda-team-day.is-past { background: transparent; }
.agenda-team-day .agenda-day-empty { padding: 10px 0; color: var(--m-muted); }
.agenda-team-day__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.agenda-day-plan { display: grid; gap: 4px; font-size: .75rem; }
.agenda-day-plan.has-content { border-radius: var(--m-r-sm); padding: 6px; background: var(--m-subtle); }
.agenda-day-plan p { margin: 0; overflow-wrap: anywhere; }
.agenda-day-plan__codes { display: flex; align-items: center; gap: 4px; color: var(--m-text); font-weight: 700; }
.agenda-day-plan__codes .agenda-icon, .agenda-day-plan__edit .agenda-icon { width: 14px; height: 14px; flex-basis: 14px; }
.agenda-day-plan__notes { color: var(--m-text-2); white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.agenda-day-plan__edit { display: inline-flex; align-items: center; justify-self: start; gap: 4px; min-height: var(--m-target, 44px); padding: 0 10px; border: 1px dashed var(--m-control); border-radius: var(--m-r-md); background: var(--m-surface); color: var(--m-text); font: inherit; font-size: var(--m-fs-14); font-weight: 600; cursor: pointer; }
.agenda-day-plan__edit:hover { border-style: solid; background: var(--m-hover); }
.agenda-day-plan__edit:focus-visible { outline: 3px solid var(--m-focus); outline-offset: 2px; }
@media (max-width: 900px) {
    .agenda-teamweek__head { display: none; }
    .agenda-team-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .agenda-team-name { padding: 4px 0; }
    .agenda-team-day__label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; color: #4f5e71; font-size: .8rem; font-weight: 700; }
}
.technical-day { margin-top: 16px; }
.technical-day h3 { margin: 18px 0 8px; font-size: 1.05rem; }
.technical-day h4 { margin: 12px 0 6px; font-size: .95rem; }
.technical-day-note { display: grid; gap: 4px; margin: 6px 0; padding: 10px 12px; border-left: 4px solid #4c9872; border-radius: 4px; background: #f1f6f3; font-size: .9rem; }
.technical-day-note p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.technical-day-note span { color: #22553d; font-weight: 700; }
.technical-flag { display: inline-block; justify-self: start; padding: 2px 8px; border-radius: 4px; background: #fde68a; color: #5b3d02; font-size: .8rem; font-weight: 700; }

/* Nueva agenda (SDD 30/09/2026): líneas, estados de la cita y pantallas de Administración. Colores de ui/tokens.css
   («Bandeja clara», 15/10): los estados de la cita son los de toda la oficina. */
.agenda-slot-card { display: grid; gap: 4px; min-width: 0; }
.agenda-slot-site { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; overflow-wrap: anywhere; }
/* Bloques de 30 min (líneas de incidencias): compactos, pero con objetivo de 44 px. */
.agenda-slot-card.is-block .agenda-slot { min-height: var(--m-target, 44px); padding: 4px 6px; }
.agenda-slot-card.is-block .agenda-slot-time { margin-bottom: 2px; }
.agenda-slot-list:has(.agenda-slot-card.is-block) { grid-template-columns: repeat(auto-fill, minmax(3.6rem, 1fr)); gap: 4px; }
.agenda-slot-card.is-block .agenda-slot:not(.is-own) { text-align: center; font-size: var(--m-fs-14); }
.agenda-slot-list:has(.agenda-slot-card.is-block) .agenda-slot-card:has(.is-own) { grid-column: 1 / -1; }
.agenda-slot-crew { display: flex !important; align-items: center; gap: 4px; font-weight: 600; }
.agenda-slot-crew.is-missing { color: var(--m-block-ink); }
.agenda-slot-crew .agenda-icon { width: 14px; height: 14px; }
.agenda-search, .agenda-slot-pair, .agenda-slot-pair select { box-sizing: border-box; }
.agenda-slot-pair { display: grid; gap: 6px; padding: 8px; border: 1px solid var(--m-line); border-radius: var(--m-r-md); background: var(--m-surface); }
.agenda-slot-pair label { display: grid; gap: 2px; color: var(--m-text-2); font-size: var(--m-fs-14); font-weight: 600; }
/* Auditoría 15/10: los desplegables de las tiras, a 1rem y 44 px como el resto de campos (ganan a .portal-unified select). */
#agenda-root .agenda-slot-pair select { width: 100%; min-width: 0; min-height: var(--m-target, 44px); height: auto; padding: 0 8px;
    border: 1px solid var(--m-control); border-radius: var(--m-r-md); background-color: var(--m-surface);
    font-family: inherit; font-size: var(--m-fs-16); font-weight: 500; line-height: 1.3; color: var(--m-text); }
.agenda-button--small { min-height: var(--m-target, 44px); padding: 0 var(--m-sp-3, 12px); font-size: var(--m-fs-14); }
.agenda-line-kind { color: var(--m-muted); font-size: var(--m-fs-14); }
.agenda-confirmation { display: grid; gap: 6px; }
.agenda-office { display: grid; gap: 18px; min-width: 0; }
.agenda-office h3 { margin: 4px 0 6px; font-size: var(--m-fs-16); }
.agenda-office-table { overflow-x: auto; max-width: 100%; }
.agenda-office-table table { width: 100%; border-collapse: collapse; background: var(--m-surface); font-size: var(--m-fs-14); }
.agenda-office-table th, .agenda-office-table td { padding: 8px; border-bottom: 1px solid var(--m-line); text-align: left; vertical-align: top; }
.agenda-office-table th { color: var(--m-text-2); font-size: var(--m-fs-14); font-weight: 600; }
.agenda-office-table td small, .agenda-office-table th small { display: block; color: var(--m-muted); font-size: var(--m-fs-14); font-weight: 400; }
.agenda-office-actions { display: flex; flex-wrap: wrap; gap: 4px; }
/* Estado de la cita en una tabla: píldora con icono y palabra, como .m-status. */
.agenda-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px 2px 8px; border: 1px solid transparent; border-radius: var(--m-r-pill); font-size: var(--m-fs-14); font-weight: 600; white-space: nowrap; }
.agenda-pill:is(.is-todo, .is-reserved) { background: var(--m-todo-bg); color: var(--m-todo-ink); }
.agenda-pill.is-confirmed { background: var(--m-done-bg); color: var(--m-done-ink); }
.agenda-pill.is-pending { border-color: var(--m-warn-line); background: var(--m-warn-bg); color: var(--m-warn-ink); }
.agenda-pill.is-expiring { border-color: var(--m-block-line); background: var(--m-block-bg); color: var(--m-block-ink); }
.agenda-pill:is(.is-no-answer, .is-none) { border: 1px dashed var(--m-control); background: transparent; color: var(--m-later-ink); }
.agenda-office-table .agenda-slot-flag { margin-top: 4px; font-size: var(--m-fs-14); }
.agenda-techweek { min-width: 42rem; }
.agenda-techweek th[scope="row"] { white-space: nowrap; }
.agenda-week-job { display: grid; gap: 2px; width: 100%; min-height: var(--m-target, 44px); margin-bottom: 4px; padding: 5px 6px 5px 8px; border: 1px solid var(--m-line-strong); border-left: 5px solid var(--m-todo-line); border-radius: var(--m-r-sm); background: var(--m-todo-bg); color: var(--m-text); text-align: left; font: inherit; cursor: pointer; }
.agenda-week-job.is-confirmed { border-color: var(--m-done-line); background: var(--m-done-bg); }
.agenda-week-job.is-pending { border-color: var(--m-warn-line); background: var(--m-warn-bg); }
.agenda-week-job small { color: var(--m-text-2) !important; }
.agenda-week-absence { display: block; margin-bottom: 4px; padding: 4px 6px; border-radius: var(--m-r-sm); background: var(--m-subtle); color: var(--m-text-2); font-size: var(--m-fs-14); }
.agenda-warnings { margin: 0 0 8px; padding-left: 18px; color: #8b4d07; }
.technical-new { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: #b91c1c; color: #fff; font-size: .75rem; vertical-align: middle; }
.technical-absence { margin: 4px 0; padding: 6px 10px; border-radius: 4px; background: #e5e7eb; color: #374151; font-size: .85rem; }
.technical-flag.is-ok { background: #dbeafe; color: #1e3a8a; }
/* A15: faltan las fotos de la instalación (aviso en rojo al técnico, encima de la subida de fotos). */
.technical-alert { margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; border: 1px solid #f3b4b4; background: #fde8e8; color: #9b1c1c; }
@media (max-width: 700px) {
    .agenda-office-table table { font-size: var(--m-fs-14); }
}

/* Final confirmation belongs after photos and reports, just above the work notes. */
.technical-completion-section { margin-top: 24px; border-top: 1px solid var(--brand-border, #d6e3db); padding-top: 20px; }
/* 14/10: «¿Cómo ha ido la instalación?»: Instalación finalizada, Pendiente (A12) y Cancelada, cada una con lo que hace. */
.technical-completion-section .technical-outcome { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--brand-border, #d6e3db); }
.technical-completion-section .technical-outcome h3 { margin: 0 0 12px; font-size: 1.05rem; }
.technical-completion-section .technical-outcome-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.technical-completion-section .technical-outcome-choice { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 12px; border: 1px solid var(--brand-border, #d6e3db); border-radius: 10px; background: #fff; }
.technical-completion-section .technical-outcome-choice p { margin: 0; font-size: .86rem; line-height: 1.4; color: var(--brand-muted, #59675f); overflow-wrap: anywhere; }
.technical-completion-section .technical-outcome-choice .agenda-button { width: 100%; min-height: 48px; font-size: .95rem; }
.technical-completion-section .technical-outcome-choice.is-pendiente .agenda-button { border: 2px solid #9a5b00; background: #fff; color: #7a4600; }
.technical-completion-section .technical-outcome-choice.is-cancelada .agenda-button { border: 2px solid #a12632; background: #fff; color: #a12632; }
.technical-completion-section .technical-outcome-choice.is-pendiente .agenda-button[aria-expanded="true"],
.technical-completion-section .technical-outcome-choice.is-pendiente .agenda-button:hover:not(:disabled) { background: #fff4df; color: #7a4600; }
.technical-completion-section .technical-outcome-choice.is-cancelada .agenda-button[aria-expanded="true"],
.technical-completion-section .technical-outcome-choice.is-cancelada .agenda-button:hover:not(:disabled) { background: #fdecee; color: #a12632; }
.technical-completion-section .technical-outcome-choice .agenda-button:disabled { cursor: not-allowed; opacity: .55; }
.technical-completion-section .technical-outcome-later { display: block; margin-top: 4px; font-weight: 700; color: var(--brand-ink, #06150d); }
.technical-completion-section .technical-outcome-form { margin-top: 14px; padding: 16px; border: 1px solid #e2b25a; border-radius: 10px; background: #fffaf0; }
.technical-completion-section .technical-outcome-form.is-cancelada { border-color: #e6b8bd; background: #fff5f6; }
.technical-completion-section .technical-outcome-form[hidden] { display: none; }
.technical-completion-section .technical-outcome-form h4 { margin: 0 0 4px; font-size: 1rem; letter-spacing: 0; text-transform: none; color: #7a4600; }
.technical-completion-section .technical-outcome-form.is-cancelada h4 { color: #a12632; }
.technical-completion-section .technical-outcome-form p { margin: 0 0 12px; font-size: .9rem; color: var(--brand-ink, #06150d); }
.technical-completion-section .technical-outcome-form label { display: block; margin-bottom: 6px; font-weight: 700; }
.technical-completion-section .technical-outcome-form textarea { display: block; box-sizing: border-box; width: 100%; min-height: 96px; padding: 10px 11px; border: 1px solid #bbc8c0; border-radius: 7px; background: #fff; color: inherit; font: inherit; font-size: 16px; }
.technical-completion-section .technical-outcome-form textarea[aria-invalid="true"] { border: 2px solid #a12632; }
.technical-completion-section .technical-outcome-form .technical-outcome-error { margin: 8px 0 0; color: #9b1c1c; font-weight: 700; overflow-wrap: anywhere; }
.technical-completion-section .technical-outcome-form .technical-outcome-error:empty { margin: 0; }
.technical-completion-section .technical-outcome-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.technical-completion-section .technical-outcome-actions .agenda-button { flex: 1 1 180px; min-height: 48px; width: auto; margin: 0; }
.technical-completion-section .technical-outcome-form.is-pendiente button[type="submit"] { border: 1px solid #8a5300; background: #8a5300; color: #fff; }
.technical-completion-section .technical-outcome-form.is-cancelada button[type="submit"] { border: 1px solid #a12632; background: #a12632; color: #fff; }
.technical-completion-section .technical-outcome-form button[type="submit"]:disabled { cursor: wait; opacity: .6; }
.technical-completion { min-width: 0; margin: 0 0 18px; padding: 16px; border: 1px solid var(--brand-border, #d6e3db); border-radius: 12px; }
.technical-completion legend { font-weight: 700; padding: 0 6px; }
.technical-completion label { display: block; min-height: 44px; }
.technical-completion select { display: block; box-sizing: border-box; width: 100%; min-height: 44px; margin: 8px 0 12px; padding: 10px 12px; border: 1px solid var(--brand-border, #d6e3db); border-radius: 8px; background: #fff; color: inherit; font: inherit; }
.technical-completion .technical-check { display: flex; align-items: center; gap: 12px; }
.technical-completion input[type="checkbox"] { width: 22px; height: 22px; flex: 0 0 22px; }
.technical-completion input:disabled { cursor: default; }

/* 26/10: «Corregir» el código postal que trae la obra, como un enlace dentro de la ayuda. */
.agenda-link { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.agenda-link:disabled { cursor: default; opacity: .6; }

/* 28/10: «Falta algo para esta cita» es una casilla (antes dos botones excluyentes) y cerrar el turno va plegado. */
.agenda-check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: var(--m-fs-15, .9rem); cursor: pointer; }
.agenda-check input { width: 18px; height: 18px; }
.agenda-help--warn { color: var(--m-warn-ink, #7a4a00); }
.agenda-slot-admin { border: 1px solid var(--m-line, #d9ddd9); border-radius: 8px; padding: 6px 10px; }
.agenda-slot-admin summary { cursor: pointer; min-height: 36px; display: flex; align-items: center; font-size: var(--m-fs-14, .85rem); color: var(--m-muted, #56615b); }
.agenda-slot-admin[open] { display: grid; gap: 8px; padding-bottom: 10px; }
.agenda-panel .agenda-feedback:empty { display: none; }

/* 28/10 (Fernando): cita provisional (presupuesto sin aceptar), morada con borde discontinuo. */
.agenda-root, .agenda-shell { --agenda-hold-bg: #f1eafa; --agenda-hold-line: #6b3fa0; --agenda-hold-ink: #4b2577; }
@media (prefers-color-scheme: dark) { .agenda-shell { --agenda-hold-bg: #2c2140; --agenda-hold-line: #b08be0; --agenda-hold-ink: #dccbf5; } }
.agenda-slot.is-provisional { border: 2px dashed var(--agenda-hold-line); background: var(--agenda-hold-bg); color: var(--agenda-hold-ink); }
.agenda-slot.is-provisional .agenda-availability { color: var(--agenda-hold-ink); }
.agenda-slot.is-provisional:not(.is-hold) { opacity: .85; }
.agenda-key.is-provisional .agenda-key__swatch { border: 2px dashed var(--agenda-hold-line); background: var(--agenda-hold-bg); color: var(--agenda-hold-ink); }
.agenda-hold-banner { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 2px dashed var(--agenda-hold-line); border-radius: 10px; background: var(--agenda-hold-bg); color: var(--agenda-hold-ink); line-height: 1.45; }
.agenda-hold-chip { align-self: flex-start; padding: 3px 12px; border: 2px dashed var(--agenda-hold-line); border-radius: 999px; background: var(--agenda-hold-bg); color: var(--agenda-hold-ink); font-weight: 600; font-size: 13px; }
.agenda-button--hold { background: var(--agenda-hold-line); border-color: var(--agenda-hold-line); }
.agenda-hold-facts { margin: 0; padding-left: 18px; color: var(--m-ink-soft, #4a554e); font-size: 13px; line-height: 1.5; }
.agenda-holds { display: flex; flex-direction: column; gap: 10px; }
.agenda-holds__scroll { overflow-x: auto; }
.agenda-holds__table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 14px; }
.agenda-holds__table th, .agenda-holds__table td { padding: 10px 12px; border-bottom: 1px solid var(--m-line, #dde2de); text-align: left; vertical-align: middle; }
.agenda-holds__table tr.is-released td { background: var(--m-block-bg, #fdf1ee); }
.agenda-pill.is-hold { background: var(--agenda-hold-bg); color: var(--agenda-hold-ink); }

/* 29/10 (Fernando, AGENDA_RESERVA_NUEVA): reservar en un panel al lado del calendario, sin velo, para poder pulsar
   turnos con él abierto. Obra → Cuándo arriba (se desplaza); los detalles y «Reservar» en el pie, siempre a la vista. */
.agenda-shell .agenda-dialog.agenda-dialog--side, .agenda-dialog.agenda-dialog--side {
    position: fixed; inset: 0 0 0 auto; z-index: 40; width: min(384px, 100vw); height: 100dvh; max-height: none;
    margin: 0; border-radius: 0; border-left: 1px solid var(--m-line, #dce1df); overflow: hidden; }
.agenda-dialog--side[open] { display: flex; flex-direction: column; }
.agenda-dialog--side > .agenda-panel { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; padding: 16px 18px; }
.agenda-dialog--side .agenda-panel__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; align-content: start; margin-top: 10px; }
.agenda-panel__foot { flex: none; display: grid; gap: 10px; padding-top: 12px; margin-top: 8px; border-top: 1px solid var(--m-line, #dce1df); }
.agenda-panel__foot .agenda-followup-form fieldset { margin: 0; padding: 0; border: 0; display: grid; gap: 6px; }
.agenda-panel__foot .agenda-followup-form legend { display: none; }
.agenda-panel__foot .agenda-followup-form > fieldset > p.agenda-help { display: none; }
.agenda-step { display: grid; gap: 8px; }
.agenda-step h4 { margin: 0; font-size: var(--m-fs-14, .9rem); color: var(--m-muted, #56615b); text-transform: none; }
.agenda-step-card { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--m-line, #dce1df); border-radius: 10px; }
.agenda-when { padding: 10px 12px; border-radius: 10px; background: var(--m-surface-2, #f3f5f4); }
.agenda-when.is-chosen { border: 2px solid var(--m-accent, #1f7a4d); background: var(--m-accent-soft, #e8f4ec); }
.agenda-plan-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.agenda-plan-pill { min-height: 44px; padding: 6px 12px; border: 1px solid var(--m-line, #c9d1cc); border-radius: 999px; background: var(--m-surface, #fff); color: inherit; font: inherit; font-size: var(--m-fs-14, .875rem); cursor: pointer; }
.agenda-plan-pill:hover:not(:disabled) { border-color: var(--m-accent, #1f7a4d); }
.agenda-step-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.agenda-step-actions .agenda-link { min-height: 44px; }
.agenda-field--inline { grid-template-columns: auto minmax(0, 9rem); align-items: center; column-gap: 10px; }
.agenda-book-why { margin: 0; font-size: var(--m-fs-14, .875rem); color: var(--m-muted, #56615b); }
.agenda-hold-note { margin: 0; padding: 8px 10px; border: 2px dashed var(--agenda-hold-line); border-radius: 10px; background: var(--agenda-hold-bg); color: var(--agenda-hold-ink); font-size: 13px; line-height: 1.45; }
.agenda-dialog--side #agenda-book { min-height: 48px; width: 100%; }
/* La Agenda va dentro del portal (unos 1070 px a 1366): el calendario se estrecha y se desplaza en horizontal. */
@media (min-width: 701px) { .agenda-layout.has-side { padding-right: 392px; } }
.agenda-step-card strong { min-width: 0; overflow-wrap: anywhere; }
.agenda-dialog--side .agenda-field .agenda-help { font-size: 12.5px; line-height: 1.4; }
@media (max-width: 700px) {
    .agenda-shell .agenda-dialog.agenda-dialog--side, .agenda-dialog.agenda-dialog--side {
        inset: auto 0 0 0; width: 100%; height: 85dvh; border-left: 0; border-top: 1px solid var(--m-line, #dce1df);
        border-radius: 16px 16px 0 0; box-shadow: 0 -8px 32px #14271c30; }
    .agenda-dialog--side.is-short { height: 44dvh; }
    .agenda-layout.has-side.is-short { padding-bottom: 46dvh; }
}
