/* ── Lane select form ── */

form.lane-select-form .lane-select-row.lane-select-two-cols {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    column-gap: 8px;
    row-gap: 10px;
    align-items: end;
}

form.lane-select-form .left label,
form.lane-select-form .right label {
    display: block;
    margin: 0 0 6px 0;
    font-weight: 700;
}

form.lane-select-form .inline-form {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    min-width: 0;
}

form.lane-select-form select,
form.lane-select-form input[type="date"],
form.lane-select-form .today-btn {
    flex: 1 1 0;
    min-width: 0;
    height: 38px;
    padding: 0 .6rem;
    font-size: 14px;
    line-height: 1.2;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
}

form.lane-select-form .today-btn {
    flex: 0 0 auto;
    background: var(--bg);
    cursor: pointer;
    transition: background .2s;
}

form.lane-select-form .today-btn:hover {
    background: #eaeaea;
}

form.lane-select-form .center {
    display: none !important;
}

@media (max-width:360px) {
    form.lane-select-form .inline-form { gap: 4px; }
    form.lane-select-form select,
    form.lane-select-form input[type="date"],
    form.lane-select-form .today-btn { font-size: 13px; height: 34px; }
}

/* ── Reservation item ── */

.res-item {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.res-item .edit {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    text-decoration: none;
    opacity: .85;
}

.res-item .edit:hover { opacity: 1; }

.res-item .label {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.res-item .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    opacity: .7;
}

/* ── Badges ── */

td.freeski {
    background: rgba(0, 160, 0, .08);
    color: #0a7a0a;
    font-weight: 600;
    text-align: center;
}

.lane-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    line-height: 1;
    padding: 3px 8px;
    border-radius: 999px;
    margin-left: 0;
    margin-right: 6px;
    white-space: nowrap;
}

.lane-badge i,
td.freeski i {
    margin-right: .35rem;
    font-size: 0.95em;
    vertical-align: -1px;
}

.freeski-badge { background: rgba(0, 160, 0, .12); color: #0a7a0a; }
.closed-badge  { background: rgba(160, 0, 0, .12); color: #7a0a0a; }
.custom-badge  { background: var(--badge-bg, rgba(0,0,0,.08)); color: var(--badge-fg, var(--text)); }

/* ── Lane header ── */

.lane-th { vertical-align: bottom; }
.lane-head { display: block; font-weight: 700; }
.lane-subbadges { margin-top: 4px; }

/* ── Info button ── */

.lane-day-table .btn-info-res {
    margin-left: auto;
    border: 0;
    background: #2d7dd2;
    font-size: 12px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
}

.lane-day-table .btn-info-res:hover { background: #e3e7ee; }

.lane-day-table td.cell-has-info { position: relative; }

.lane-day-table td.cell-has-info .btn-info-res {
    position: absolute;
    top: 4px;
    right: 4px;
    border: 0;
    padding: 3px 5px;
    font-size: 11px;
    line-height: 1;
    border-radius: 6px;
    background: #2d7dd2;
    cursor: pointer;
}

.lane-day-table td.cell-has-info .btn-info-res:hover { background: #dce9ff; }

.lane-day-table .res-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    min-width: 0;
}

.lane-day-table .res-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    min-width: 0;
}

.lane-day-table .res-item .label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ── Dark mode discipline colors ── */

body.dark td.reserved.disc-sl,
[data-theme="dark"] td.reserved.disc-sl { background: rgba(200, 80, 90, 0.25); }
body.dark td.reserved.disc-gs,
[data-theme="dark"] td.reserved.disc-gs { background: rgba(90, 130, 230, 0.22); }
body.dark td.reserved.disc-sg,
[data-theme="dark"] td.reserved.disc-sg { background: rgba(70, 180, 110, 0.22); }
body.dark td.reserved.disc-dh,
[data-theme="dark"] td.reserved.disc-dh { background: rgba(220, 180, 60, 0.26); }
body.dark td.reserved.disc-mixed,
[data-theme="dark"] td.reserved.disc-mixed { background: rgba(160, 160, 160, 0.20); }

.note-legend { font-style: italic; }
body.dark .note-legend { color: #bbb; }

/* ── Sticky header ── */

.myres-sticky-top { position: sticky; top: 0; z-index: 100; }

/* body scroll lock when modal open */
body.modal-open { overflow: hidden; position: fixed; width: 100%; }


/* ═══════════════════════════════════════════════
   UNIFIED MODAL DESIGN SYSTEM
   Applies to: bookingModal, cancelModal, editModal,
               manageModal, res-contacts-modal
   ═══════════════════════════════════════════════ */

/* ── Overlay shell ── */

.modal[hidden] { display: none; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px 12px max(12px, env(safe-area-inset-bottom)) 12px;
    background: rgba(0, 0, 0, 0.42);
    overflow-y: auto;
}

.modal.modal-open { display: flex; }

/* ── Modal card ── */

.modal .modal-content {
    position: relative;
    max-width: 560px;
    width: 100%;
    background: var(--surface);
    color: var(--text);
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    padding: 30px 26px;
    max-height: 92vh;
    overflow-y: auto;
    animation: modalUp 0.22s ease-out;
}

.modal .modal-content--narrow { max-width: 420px; }

@keyframes modalUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Close button ── */

.modal .modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 20px;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
}

.modal .modal-close:hover {
    background: color-mix(in oklab, var(--border) 60%, transparent);
    color: var(--text);
}

/* ── Header ── */

.modal .modal-content h2 {
    margin: 0 0 3px;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--text);
}

.modal-subtitle {
    margin: 0 0 20px;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.4;
}

/* ── Alert / info text ── */

.modal-alert {
    font-size: 0.88rem;
    color: var(--text);
    background: color-mix(in oklab, var(--border) 30%, transparent);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 10px 14px;
    margin-bottom: 14px;
}

.modal-alert:empty { display: none; }

/* ── Info summary grid ── */

.modal-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
    background: color-mix(in oklab, var(--surface) 40%, var(--border) 20%);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 18px;
}

.modal-info-row {
    padding: 6px 0;
    border-bottom: 1px solid color-mix(in oklab, var(--border) 60%, transparent);
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.modal-info-row:nth-last-child(-n+2) { border-bottom: none; }

.modal-info-label {
    font-size: 0.68rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--muted);
}

.modal-info-value {
    font-size: 0.88rem;
    color: var(--text);
}

/* ── Phone share row ── */

.modal-phone-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: color-mix(in oklab, var(--surface) 40%, var(--border) 20%);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 11px 14px;
    margin-bottom: 18px;
}

.modal-phone-row input[type="checkbox"] {
    margin-top: 2px;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.modal-phone-row label {
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.5;
    cursor: pointer;
}

.modal-phone-row label small {
    display: block;
    margin-top: 3px;
    opacity: 0.8;
    font-size: 0.78rem;
}

/* ── Field label ── */

.modal-field-label {
    display: block;
    font-size: 0.68rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 5px;
}

.modal-field { margin-bottom: 13px; }

.modal-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.78rem;
    color: var(--muted);
    opacity: 0.8;
}

/* ── Two-column layout ── */

.modal-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 13px;
}

/* ── Inputs, selects, textarea (all modals) ── */

.modal input:not([type="checkbox"]):not([type="hidden"]):not([type="radio"]),
.modal select,
.modal textarea {
    width: 100%;
    padding: 0.58rem 0.78rem;
    font-size: 0.88rem;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text);
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.modal select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpolyline fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' points='1,1 5,5 9,1'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
    cursor: pointer;
}

.modal textarea { resize: vertical; line-height: 1.5; }

.modal input:not([type="checkbox"]):not([type="hidden"]):hover,
.modal select:hover,
.modal textarea:hover {
    border-color: color-mix(in oklab, var(--accent) 45%, var(--border));
}

.modal input:not([type="checkbox"]):not([type="hidden"]):focus,
.modal select:focus,
.modal textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 14%, transparent);
}

/* ── Action bar ── */

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

/* Spread variant: left group + right group */
.modal-actions--spread {
    justify-content: space-between;
    flex-wrap: wrap;
}

.modal-actions-left,
.modal-actions-right {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Button variants ── */

.btn-cancel,
.btn-submit,
.btn-secondary,
.btn-danger {
    padding: 0.52rem 1.1rem;
    border-radius: 7px;
    font-size: 0.88rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

/* Ghost / dismiss */
.btn-cancel {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-cancel:hover {
    background: color-mix(in oklab, var(--border) 50%, transparent);
}

/* Primary action */
.btn-submit {
    background: var(--accent);
    border: none;
    color: #fff;
    padding: 0.52rem 1.35rem;
}

.btn-submit:hover:not(:disabled) { opacity: 0.88; }
.btn-submit:disabled { opacity: 0.45; cursor: not-allowed; }

/* Secondary / outline */
.btn-secondary {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
}

.btn-secondary:hover {
    background: color-mix(in oklab, var(--accent) 8%, transparent);
}

/* Destructive */
.btn-danger {
    background: transparent;
    border: 1px solid color-mix(in oklab, #e24b4a 70%, var(--border));
    color: #c0392b;
}

.btn-danger:hover {
    background: color-mix(in oklab, #e24b4a 8%, transparent);
    border-color: #e24b4a;
}

/* ── Contacts list (res-contacts-modal) ── */

.contacts-list { margin-top: 4px; }

.contacts-loading {
    font-size: 0.88rem;
    color: var(--muted);
    font-style: italic;
    margin: 0;
}

.contact-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid color-mix(in oklab, var(--border) 60%, transparent);
}

.contact-row:last-child { border-bottom: none; }

.contact-row .name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.contact-row .meta {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 1px;
}

.contact-row .contact-detail {
    font-size: 0.82rem;
    color: var(--muted);
    text-align: right;
}

/* ── Manage requests list ── */

.manage-requests { margin-bottom: 4px; }

.manage-requests .request-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 7px;
    margin-bottom: 6px;
    border: 1px solid var(--border);
    background: color-mix(in oklab, var(--surface) 40%, var(--border) 10%);
}

.manage-requests .request-row input[type="checkbox"],
.manage-requests .request-row input[type="radio"] {
    margin-top: 2px;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.manage-requests .request-meta {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.5;
}

.manage-requests .request-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

/* ── Responsive ── */

@media (max-width: 600px) {
    .modal .modal-content {
        padding: 22px 16px;
        border-radius: 12px;
    }

    .modal-info-grid { grid-template-columns: 1fr; }

    .modal-info-row:nth-last-child(-n+2) {
        border-bottom: 1px solid color-mix(in oklab, var(--border) 60%, transparent);
    }

    .modal-info-row:last-child { border-bottom: none; }

    .modal-form-row { grid-template-columns: 1fr; gap: 0; }

    .modal-actions,
    .modal-actions--spread { flex-direction: column; gap: 8px; }

    .modal-actions-left,
    .modal-actions-right { width: 100%; }

    .btn-cancel,
    .btn-submit,
    .btn-secondary,
    .btn-danger { width: 100%; text-align: center; justify-content: center; }
}

@media (max-width: 400px) {
    .modal { padding: 6px; }
    .modal .modal-content { padding: 18px 12px; }
}

/* ── bookingModal open-state (JS adds class) ── */
#bookingModal.modal-open { display: flex; }

/* ── fissi-modal (contacts) — JS controls via hidden attribute ── */

.fissi-modal[hidden] { display: none; }

.fissi-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.fissi-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
    z-index: 0;
}

.fissi-modal-card {
    position: relative;
    z-index: 1;
    max-width: 420px;
    width: 100%;
    background: var(--surface);
    color: var(--text);
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    padding: 30px 26px;
    max-height: 92vh;
    overflow-y: auto;
    animation: modalUp 0.22s ease-out;
}

.fissi-modal-card h2 {
    margin: 0 0 3px;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--text);
}

.fissi-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 20px;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
}

.fissi-modal-close:hover {
    background: color-mix(in oklab, var(--border) 60%, transparent);
    color: var(--text);
}

@media (max-width: 600px) {
    .fissi-modal-card { padding: 22px 16px; border-radius: 12px; }
}

@media (max-width: 400px) {
    .fissi-modal { padding: 6px; }
    .fissi-modal-card { padding: 18px 12px; }
}