﻿/* =====================================================
   File: wwwroot/css/schedule.css
   Planner Grid (2 sticky columns: ΣΕΙΡΑ + ΟΝΟΜΑ)
   - No page-level horizontal scroll: scroll stays inside the grid
   - Extra hours shown inline (compact hides text, keeps dot)
   - Bulk modal overlay styles included
   - EmployeeSchedulePage (mobile cards) styles included at the end
   ===================================================== */

/* ---------- Prevent page-level horizontal scroll ---------- */
.planner-shell {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

.planner-grid-host {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

/* ---------- Page header / toolbar ---------- */
.sched-title {
    margin: 0 0 12px 0;
}

.sched-muted {
    opacity: 0.7;
    padding: 8px 0;
}

.planner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

    .planner-header .sched-title {
        margin-bottom: 0;
    }

.planner-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
}

.planner-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    line-height: 1.2;
    text-decoration: none;
}

.planner-primary-btn {
    border-color: #0f172a;
    background: #0f172a;
    color: #fff;
    font-weight: 800;
}

    .planner-primary-btn:disabled {
        border-color: #cbd5e1;
        background: #e2e8f0;
        color: #64748b;
    }

.planner-toolbar-compact {
    flex-wrap: nowrap;
    gap: 8px;
    align-items: end;
    margin-bottom: 8px;
    padding: 8px 10px;
    overflow: visible;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.planner-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

    .planner-field label {
        margin: 0;
        color: #475569;
        font-size: 12px;
        font-weight: 800;
        white-space: nowrap;
    }

    .planner-field .sched-input {
        min-width: 78px;
        height: 34px;
        border-radius: 8px;
    }

.planner-field--wide .sched-input {
    min-width: 160px;
}

.planner-month-nav {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

    .planner-month-nav .sched-btn {
        width: 34px;
        height: 34px;
        padding: 0;
        border-radius: 8px;
        font-size: 20px;
        line-height: 1;
    }

.planner-compact-toggle {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
}

.planner-tools {
    position: relative;
    z-index: 100000;
}

.planner-tools-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 100001;
    display: grid;
    gap: 2px;
    min-width: 245px;
    padding: 6px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, .16);
}

    .planner-tools-menu button {
        width: 100%;
        padding: 9px 10px;
        border: 0;
        border-radius: 6px;
        background: transparent;
        color: #1e293b;
        cursor: pointer;
        font: inherit;
        font-size: 13px;
        font-weight: 750;
        text-align: left;
        white-space: nowrap;
    }

        .planner-tools-menu button:hover {
            background: #f1f5f9;
        }

.planner-publication {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0 10px;
    padding: 10px 12px;
    border: 1px solid #dbe4ef;
    border-left: 6px solid var(--publication-accent);
    border-radius: 8px;
    background: linear-gradient(90deg, var(--publication-soft), #fff 64%);
}

.planner-publication--live {
    --publication-accent: #0284c7;
    --publication-soft: #e0f2fe;
}

.planner-publication--published {
    --publication-accent: #16a34a;
    --publication-soft: #dcfce7;
}

.planner-publication--draft {
    --publication-accent: #f59e0b;
    --publication-soft: #fef3c7;
}

.planner-publication-main {
    min-width: 0;
}

.planner-publication-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #111827;
    font-weight: 950;
}

.planner-publication-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 950;
}

.planner-publication-badge--live {
    background: #bae6fd;
    color: #075985;
}

.planner-publication-badge--published {
    background: #bbf7d0;
    color: #166534;
}

.planner-publication-badge--draft {
    background: #fde68a;
    color: #92400e;
}

.planner-publication-detail,
.planner-publication-message {
    margin-top: 4px;
    color: #475569;
    font-size: 12px;
}

.sched-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.sched-input {
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    min-width: 90px;
}

.sched-btn {
    padding: 7px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
}

    .sched-btn.planner-primary-btn {
        border-color: #0f172a;
        background: #0f172a;
        color: #fff;
        font-weight: 800;
    }

        .sched-btn.planner-primary-btn:disabled {
            border-color: #cbd5e1;
            background: #e2e8f0;
            color: #64748b;
        }

    .sched-btn.secondary {
        opacity: 0.85;
    }

.sched-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ---------- Scroll container + sticky widths ---------- */
.sched-grid-wrap {
    --sticky-col1: 74px; /* ΣΕΙΡΑ */
    --sticky-col2: 240px; /* ΟΝΟΜΑ */

    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: auto;
    overscroll-behavior: contain;
    max-height: calc(100vh - 220px);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    -webkit-overflow-scrolling: touch;
}

    .sched-grid-wrap.compact {
        --sticky-col1: 56px;
        --sticky-col2: 190px;
    }

@media (max-width: 640px) {
    .sched-grid-wrap {
        --sticky-col1: 56px;
        --sticky-col2: 170px;
    }
}

/* ---------- Table ---------- */
.sched-grid {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    min-width: 960px;
}

    .sched-grid th,
    .sched-grid td {
        border-bottom: 1px solid #e2e8f0;
        border-right: 1px solid #e2e8f0;
        padding: 0;
        vertical-align: top;
    }

    /* Sticky header */
    .sched-grid thead th {
        position: sticky;
        top: 0;
        z-index: 10;
        background: #f8fafc;
        padding: 8px;
    }

/* Sticky columns */
.sticky-col {
    position: sticky;
    background: #fff;
    background-clip: padding-box;
}

.sticky-col-1 {
    left: 0;
    z-index: 6;
    min-width: var(--sticky-col1);
    max-width: var(--sticky-col1);
    text-align: center;
    box-shadow: 2px 0 0 rgba(226, 232, 240, 1);
}

.sticky-col-2 {
    left: var(--sticky-col1);
    z-index: 5;
    min-width: var(--sticky-col2);
    max-width: 320px;
    box-shadow: 2px 0 0 rgba(226, 232, 240, 1);
}

/* Top-left header cells */
.sticky-corner {
    z-index: 12 !important;
}

.sticky-corner-2 {
    z-index: 11 !important;
}

.order-col {
    font-weight: 800;
}

.name-col {
    padding: 8px;
    font-weight: 700;
    white-space: nowrap;
}

/* Employee name + avatar (Grid) */
.emp-name {
    display: flex;
    align-items: stretch;
    gap: 8px;
    height: 100%;
}

img.emp-avatar {
    height: 50px !important;
    width: 50px !important;
    aspect-ratio: 1 / 1;
    max-height: none !important;
    max-width: none !important;
    border-radius: 999px !important;
    object-fit: cover !important;
    display: block !important;
    flex: 0 0 auto !important;
    border: 1px solid rgba(226, 232, 240, 1);
}

.emp-text {
    display: flex;
    align-items: center;
}

/* Days */
.day-col {
    min-width: 86px;
    text-align: center;
    position: relative;
}

.day-num {
    font-weight: 800;
}

.day-dow {
    font-size: 12px;
    opacity: 0.7;
}

/* Cells */
.cell {
    min-width: 86px;
    height: 44px;
}

.cell-btn {
    width: 100%;
    height: 44px;
    border: 0;
    cursor: pointer;
    background: transparent;
    padding: 6px;
    text-align: center;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: relative;
}

/* Main text (new + backward compatible) */
.cell-main,
.cell-line-main {
    font-size: 12px;
    line-height: 1.05;
    white-space: nowrap;
}

/* Extra inline text (new + backward compatible) */
.cell-extra-text,
.cell-line-extra {
    font-size: 10px;
    line-height: 1;
    opacity: 0.9;
    white-space: nowrap;
}

/* Hours text variant (if you use it somewhere) */
.cell-line-hours {
    font-size: 10px;
    line-height: 1;
    opacity: 0.9;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Red dot when extra exists */
.cell-extra-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #dc2626;
    display: inline-block;
    flex: 0 0 6px;
}

/* Small badge in cell */
.cell-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 10px;
    line-height: 1;
    padding: 1px 5px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.85);
    color: #fff;
    white-space: nowrap;
}

/* Focus marker used for auto-scroll */
.focus-marker {
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* Compact mode days */
.sched-grid-wrap.compact .day-col,
.sched-grid-wrap.compact .cell {
    min-width: 70px;
}

.sched-grid-wrap.compact .cell-btn {
    height: 38px;
}

.sched-grid-wrap.compact .day-dow {
    display: none;
}

/* Compact mode: hide +xh text, keep dot */
.sched-grid-wrap.compact .cell-extra-text,
.sched-grid-wrap.compact .cell-line-extra,
.sched-grid-wrap.compact .cell-line-hours {
    display: none;
}

.sched-grid-wrap.compact .cell-badge {
    font-size: 9px;
    top: 3px;
    right: 3px;
}

/* Dialog (cell editor) */
.sched-dialog {
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 0;
    width: min(560px, calc(100vw - 24px));
}

.sched-dialog-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
}

.sched-dialog-title {
    font-weight: 800;
}

.sched-x {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
}

.sched-dialog-body {
    display: grid;
    gap: 8px;
    padding: 12px 14px;
}

.sched-dialog-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 12px 14px;
    border-top: 1px solid #e2e8f0;
}

/* Row highlight (desktop) */
@media (hover: hover) and (pointer: fine) {
    .sched-grid tbody tr:hover td.sticky-col {
        background-image: linear-gradient(rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05));
    }

    .sched-grid tbody tr:hover .cell-btn {
        filter: saturate(1.05) brightness(0.99);
    }
}

.sched-grid tbody tr:focus-within td.sticky-col {
    background-image: linear-gradient(rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.06));
}

.sched-grid tbody tr:focus-within .cell-btn {
    filter: saturate(1.03) brightness(0.99);
}

/* Mobile tweaks (desktop grid only) */
@media (max-width: 640px) {
    .sched-grid {
        min-width: 820px;
    }

        /* IMPORTANT: scope to desktop grid to not affect mobile header */
        .sched-grid .day-dow {
            display: none;
        }
}

/* =====================================================
   Bulk modal overlay (always on top)
   ===================================================== */
.bulk-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}

.bulk-modal {
    width: min(780px, calc(100vw - 24px));
    max-height: min(86vh, 860px);
    overflow: auto;
    background: #fff;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.bulk-modal-head {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
}

.bulk-modal-title {
    font-weight: 900;
}

.bulk-modal-x {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
}

.bulk-modal-body {
    display: grid;
    gap: 10px;
    padding: 12px 14px;
}

.bulk-modal-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    z-index: 2;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 12px 14px;
    border-top: 1px solid #e2e8f0;
}

/* Bulk helpers */
.bulk-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.bulk-field {
    display: grid;
    gap: 6px;
}

.bulk-range {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.bulk-cal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
}

.bulk-picked {
    margin-left: auto;
    opacity: 0.85;
    font-weight: 800;
}

/* Legend */
.bulk-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 4px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    opacity: 0.85;
}

.legend-box {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    display: inline-block;
    border: 2px solid transparent;
}

    .legend-box.exist {
        border-color: #2563eb;
        background: rgba(37, 99, 235, 0.12);
    }

    .legend-box.hol {
        border-color: #f97316;
        background: rgba(249, 115, 22, 0.12);
    }

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
    background: rgba(15, 23, 42, 0.45);
}

/* Bulk calendar */
.bulk-cal {
    margin-top: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px;
}

.bulk-cal-head {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 6px;
}

.bulk-cal-h {
    text-align: center;
    font-weight: 900;
    opacity: 0.75;
    font-size: 12px;
}

.bulk-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.bulk-cal-empty {
    height: 34px;
}

.bulk-cal-day {
    height: 34px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-weight: 900;
}

    .bulk-cal-day.has {
        position: relative;
    }

        .bulk-cal-day.has::after {
            content: "";
            position: absolute;
            left: 50%;
            bottom: 6px;
            width: 6px;
            height: 6px;
            transform: translateX(-50%);
            border-radius: 999px;
            background: rgba(15, 23, 42, 0.45);
        }

    /* already same assignment */
    .bulk-cal-day.exist {
        box-shadow: inset 0 0 0 3px rgba(37, 99, 235, 0.85);
        background: rgba(37, 99, 235, 0.08);
    }

    /* official holiday */
    .bulk-cal-day.hol {
        box-shadow: inset 0 0 0 3px rgba(249, 115, 22, 0.85);
        background: rgba(249, 115, 22, 0.10);
    }

    /* sunday marker */
    .bulk-cal-day.sun {
        box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.6);
    }

    /* today marker */
    .bulk-cal-day.today {
        box-shadow: inset 0 0 0 3px rgba(22, 163, 74, 0.8);
    }

    /* selected strongest */
    .bulk-cal-day.sel {
        background: #111827;
        color: #fff;
        border-color: #111827;
        box-shadow: none;
    }

.bulk-error {
    margin-top: 8px;
    color: #dc2626;
    font-weight: 900;
}

/* =====================================================
   Centered modal ABOVE EVERYTHING (optional overlay editor)
   ===================================================== */
.cell-editor-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}

.cell-editor {
    width: min(560px, calc(100vw - 24px));
    max-height: 86vh;
    overflow: auto;
    background: #fff;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

/* =====================================================
   EmployeeSchedulePage.razor (mobile-first cards)
   Scoped under .emp-page to avoid conflicts with grid .emp-name
   ===================================================== */
.emp-page {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    padding: 14px 12px 22px;
}

    .emp-page .emp-topbar {
        position: sticky;
        top: 0;
        z-index: 30;
        background: #fff;
        padding: 10px 0 12px;
        border-bottom: 1px solid #e2e8f0;
    }

    .emp-page .emp-profile {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 10px;
    }

    .emp-page .emp-avatar-lg {
        width: 42px;
        height: 42px;
        border-radius: 999px;
        object-fit: cover;
        border: 1px solid #e2e8f0;
    }

    .emp-page .emp-profile-text {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
    }

    .emp-page .emp-name {
        font-weight: 800;
        font-size: 16px;
        line-height: 1.1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .emp-page .emp-sub {
        opacity: 0.75;
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .emp-page .emp-monthbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .emp-page .emp-month {
        font-weight: 800;
        font-size: 15px;
        text-transform: capitalize;
    }

    .emp-page .emp-btn {
        border: 1px solid #cbd5e1;
        background: #fff;
        border-radius: 14px;
        padding: 8px 12px;
        cursor: pointer;
        min-width: 44px;
        font-size: 18px;
        line-height: 1;
    }

    .emp-page .emp-btn:active {
        transform: translateY(1px);
    }

    .emp-page .emp-pwa-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        margin: 10px 0;
        padding: 10px;
        border: 1px solid #d1e7dd;
        border-radius: 8px;
        background: #f6fffb;
    }

    .emp-page .emp-pwa-title {
        font-weight: 900;
        color: #0f5132;
        white-space: nowrap;
    }

    .emp-page .emp-pwa-actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .emp-page .emp-action-btn {
        font-size: 14px;
        min-height: 38px;
        border-radius: 8px;
    }

    .emp-page .emp-pwa-message {
        flex-basis: 100%;
        color: #0f5132;
        font-size: 13px;
        line-height: 1.35;
    }

    .emp-page .emp-cards {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        padding-top: 12px;
    }

@media (min-width: 720px) {
    .emp-page .emp-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .emp-page .emp-pwa-message {
        flex-basis: auto;
        max-width: 360px;
        text-align: right;
    }
}

@media (min-width: 1024px) {
    .emp-page .emp-cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.emp-page .emp-card {
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    position: relative;
}

    .emp-page .emp-card::before {
        content: "";
        position: absolute;
        inset: 0 auto 0 0;
        width: 6px;
        background: var(--accent, #e2e8f0);
    }

    .emp-page .emp-card.today {
        outline: 2px solid rgba(59, 130, 246, 0.25);
        outline-offset: 2px;
    }

.emp-page .emp-card-head {
    padding: 12px 12px 10px 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.emp-page .emp-date-num {
    font-weight: 900;
    font-size: 16px;
}

.emp-page .emp-date-dow {
    opacity: 0.75;
    font-size: 13px;
    text-transform: capitalize;
}

.emp-page .emp-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.emp-page .emp-badge {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 12px;
    white-space: nowrap;
}

    .emp-page .emp-badge.soft {
        opacity: 0.8;
    }

.emp-page .emp-card-body {
    padding: 0 12px 12px 16px;
}

.emp-page .emp-shift {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
}

.emp-page .emp-shift-title {
    font-weight: 900;
    font-size: 16px;
}

.emp-page .emp-extra {
    font-size: 13px;
    opacity: 0.8;
}

.emp-page .emp-muted {
    opacity: 0.75;
    padding: 10px 0;
}

.emp-page .emp-muted-sm {
    opacity: 0.7;
    font-size: 12px;
}

.emp-page .emp-error {
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: #9f1239;
    padding: 12px;
    border-radius: 14px;
}

@media (prefers-reduced-motion: reduce) {
    .emp-page .emp-btn:active {
        transform: none;
    }
}

@media (max-width: 360px) {
    .emp-page {
        padding: 12px 10px 18px;
    }

        .emp-page .emp-btn {
            padding: 8px 10px;
        }

        .emp-page .emp-card-head {
            padding: 12px 10px 10px 14px;
        }

        .emp-page .emp-card-body {
            padding: 0 10px 12px 14px;
        }
}

.emp-posta {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.15;
    margin-top: 6px;
    opacity: 1;
}

/* αν κάποιο global style το “πατάει”, βάλε πιο συγκεκριμένο selector */
.emp-card .emp-card-body .emp-posta {
    font-size: 20px;
    font-weight: 800;
    opacity: 1;
}

.rest-mini-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(239, 68, 68, .12);
    border: 1px solid rgba(239, 68, 68, .30);
    color: #7f1d1d;
    font-size: 12px;
    font-weight: 900;
}

.cell-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    width: 100%;
    padding: 4px 6px;
    gap: 1px;
}

.cell-main {
    display: block;
    font-size: 12px;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cell-posta {
    display: block;
    font-size: 11px;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.95;
}

.cell-posta-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    display: inline-block;
    align-self: flex-end;
    background: currentColor;
    opacity: 0.9;
}

.bulk-cal-day.posta::before {
    content: "";
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    left: 6px;
    bottom: 6px;
    background: rgba(15, 23, 42, .85);
}

/* legend dot */
.legend-dot.posta {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .85);
}

.sched-mobile-shell {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    padding: 10px 10px 16px;
    display: grid;
    gap: 10px;
}

.sched-mobile-weekbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

    .sched-mobile-weekbar .sched-btn {
        flex: 0 0 auto;
    }

.sched-mobile-weektitle {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.sched-mobile-weekbar,
.sched-mobile-days {
    touch-action: pan-y;
}

/* ===== Mobile days: always fit 7 columns ===== */
.sched-mobile-shell,
.sched-mobile-shell * {
    box-sizing: border-box;
}

.sched-mobile-days,
.sched-mobile-weekgrid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.sched-mobile-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: clamp(2px, 1.2vw, 6px);
}

.sched-mobile-day {
    min-width: 0;
    overflow: hidden;
    border-radius: clamp(8px, 2vw, 12px);
    padding: clamp(3px, 1vw, 6px) 0;
    text-align: center;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

    .sched-mobile-day .day-num {
        font-size: clamp(12px, 3.2vw, 14px);
        font-weight: 800;
    }

    .sched-mobile-day .day-dow {
        font-size: clamp(9px, 2.4vw, 10px);
        opacity: 0.7;
    }

/* 1-letter weekday on narrow phones / large font scaling */
@media (max-width: 430px) {
    .sched-mobile-day .day-dow {
        display: block;
        max-width: none;
        overflow: visible;
        white-space: nowrap;
        margin: .12rem 0 0;
    }
}

.sched-mobile-cards {
    display: grid;
    gap: 10px;
}

.sched-mobile-card {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
}

.sched-mobile-emp {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-bottom: 1px solid #e2e8f0;
}

.sched-mobile-emptext {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.sched-mobile-empname {
    font-weight: 900;
    font-size: 14px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sched-mobile-empmeta {
    font-weight: 800;
    opacity: 0.75;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sched-mobile-weekgrid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0;
}

.sched-mobile-cell {
    min-width: 0;
    overflow: hidden;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.sched-mobile-weekgrid .sched-mobile-cell:nth-child(7n) {
    border-right: 0;
}

.sched-mobile-cell--off {
    background: #f8fafc;
    min-height: 44px;
}

/* Make ScheduleCell more “tap friendly” inside mobile cells */
.sched-mobile-cell .cell-btn {
    height: 44px;
    padding: 4px 4px;
}

.sched-mobile-cell .cell-main,
.sched-mobile-cell .cell-line-main {
    font-size: clamp(10px, 2.8vw, 11px);
}

.sched-mobile-cell .cell-extra-text,
.sched-mobile-cell .cell-line-extra,
.sched-mobile-cell .cell-line-hours {
    display: none;
}

.tap-tip-host {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    touch-action: manipulation;
}

.tap-tip-bubble {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(17, 24, 39, 0.92);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    z-index: 9999;
    pointer-events: none;
}

    .tap-tip-bubble::after {
        content: "";
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        border: 6px solid transparent;
        border-top-color: rgba(17, 24, 39, 0.92);
    }
.sched-desktop {
    display: block;
}

.sched-mobile {
    display: none;
}

/* mobile breakpoint */
@media (max-width: 640px) {
    .sched-desktop {
        display: none;
    }

    .sched-mobile {
        display: block;
    }
}

/* ---------- Mobile planner polish ---------- */
@media (max-width: 640px) {
    .planner-shell {
        padding: .35rem;
        background: #f8fafc;
        overflow-x: clip;
        overflow-y: visible;
    }

    .planner-grid-host {
        overflow-x: clip;
        overflow-y: visible;
    }

    .sched-title {
        margin: 0 0 .5rem;
        padding-inline: .25rem;
        font-size: 1.05rem;
        font-weight: 900;
    }

    .planner-header {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: .5rem;
        margin-bottom: .45rem;
        padding-inline: .25rem;
    }

    .planner-header-actions {
        justify-content: flex-start;
        width: 100%;
        max-width: 100%;
        gap: .45rem;
    }

        .planner-header-actions .sched-btn {
            min-height: 2.35rem;
            border-radius: 999px;
            padding: .5rem .7rem;
            font-size: .82rem;
            font-weight: 850;
            white-space: nowrap;
        }

    .planner-tools-menu {
        position: fixed;
        top: 4.6rem;
        right: .7rem;
        left: .7rem;
        min-width: 0;
        max-width: calc(100vw - 1.4rem);
    }

    .planner-publication {
        align-items: flex-start;
        flex-wrap: wrap;
        margin: .35rem .25rem .55rem;
        padding: .65rem .7rem;
    }

        .planner-publication .sched-btn {
            width: 100%;
            justify-content: center;
        }

    .planner-publication-title {
        flex-wrap: wrap;
    }

    .sched-toolbar {
        flex-wrap: nowrap;
        align-items: center;
        gap: .45rem;
        margin: 0 -.25rem .6rem;
        padding: .2rem .25rem .55rem;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

        .sched-toolbar::-webkit-scrollbar {
            display: none;
        }

        .sched-toolbar label {
            flex: 0 0 auto;
            color: #475569;
            font-size: .78rem;
            font-weight: 850;
            white-space: nowrap;
        }

        .sched-toolbar .sched-input {
            flex: 0 0 auto;
            min-width: 76px;
            min-height: 2.5rem;
            border-radius: .9rem;
            background: #fff;
            font-size: .9rem;
        }

        .sched-toolbar .sched-btn {
            flex: 0 0 auto;
            min-height: 2.5rem;
            border-radius: 999px;
            padding: .55rem .75rem;
            background: #fff;
            font-size: .82rem;
            font-weight: 850;
            white-space: nowrap;
        }

        .sched-toolbar .sched-toggle {
            flex: 0 0 auto;
            min-height: 2.5rem;
            padding: 0 .75rem;
            border: 1px solid #cbd5e1;
            border-radius: 999px;
            background: #fff;
            color: #334155;
            font-size: .82rem;
            font-weight: 850;
            white-space: nowrap;
        }

    .sched-mobile-shell {
        max-width: 100%;
        padding: .35rem .35rem 1.25rem;
        gap: .75rem;
    }

    .sched-mobile-weekbar {
        position: sticky !important;
        top: max(0px, env(safe-area-inset-top)) !important;
        z-index: 80;
        gap: .45rem;
        padding: .5rem;
        border-color: #dbe4f0;
        border-radius: 1rem;
        background: rgba(255, 255, 255, .96);
        box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
        backdrop-filter: blur(10px);
    }

        .sched-mobile-weekbar .sched-btn {
            display: grid;
            place-items: center;
            min-width: 2.55rem;
            min-height: 2.55rem;
            padding: 0 .7rem;
            border-radius: .85rem;
            background: #fff;
            color: #0f172a;
            font-size: 1.25rem;
            font-weight: 900;
            line-height: 1;
        }

            .sched-mobile-weekbar .sched-btn[title="PDF"] {
                min-width: 2.45rem;
                font-size: .95rem;
            }

    .sched-mobile-weektitle {
        color: #0f172a;
        font-size: .98rem;
        font-weight: 900;
        line-height: 1.15;
        white-space: normal;
    }

    .sched-mobile-days {
        position: sticky !important;
        top: calc(3.65rem + env(safe-area-inset-top)) !important;
        z-index: 70;
        grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
        gap: .18rem;
        padding: .25rem 0 .35rem;
        background: rgba(248, 250, 252, .97);
        box-shadow: 0 8px 18px rgba(15, 23, 42, .06);
        backdrop-filter: blur(8px);
    }

    .sched-mobile-day {
        min-height: 3rem;
        padding: .38rem .05rem;
        border-color: #dbe4f0;
        border-radius: .85rem;
        background: #fff;
        box-shadow: 0 8px 18px rgba(15, 23, 42, .05);
    }

        .sched-mobile-day .day-num {
            font-size: .95rem;
            font-weight: 900;
            line-height: 1.05;
        }

        .sched-mobile-day .day-dow {
            display: block;
            max-width: none;
            overflow: visible;
            white-space: nowrap;
            margin-top: .12rem;
            color: #475569;
            font-size: .62rem;
            font-weight: 900;
            line-height: 1;
            opacity: 1;
        }

    .sched-mobile-cards {
        gap: .75rem;
    }

    .sched-mobile-card {
        border-color: #dbe4f0;
        border-radius: 1rem;
        background: #fff;
        overflow: visible;
        box-shadow: 0 12px 24px rgba(15, 23, 42, .07);
    }

    .sched-mobile-empbar {
        gap: .55rem;
        padding: .65rem .7rem .45rem;
        border-bottom: 1px solid #edf2f7;
        border-radius: 1rem 1rem 0 0;
        background: #fff;
    }

    .sched-mobile-emp {
        flex: 1 1 auto;
        min-width: 0;
        gap: .65rem;
        padding: 0;
        border-bottom: 0;
    }

        .sched-mobile-emp .emp-avatar {
            width: 3rem;
            height: 3rem;
            flex: 0 0 3rem;
            border: 1px solid #e2e8f0;
            border-radius: 999px;
            background: #fff;
            object-fit: cover;
        }

    .sched-mobile-emptext {
        min-width: 0;
        gap: .16rem;
    }

    .sched-mobile-empname {
        color: #0f172a;
        font-size: .9rem;
        font-weight: 950;
        line-height: 1.16;
        white-space: normal;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .sched-mobile-empmeta {
        color: #64748b;
        font-size: .76rem;
        font-weight: 900;
        opacity: 1;
    }

    .sched-mobile-empbar .sched-btn--ghost {
        min-height: 2.1rem;
        padding: .35rem .6rem;
        border-radius: 999px;
        background: #f8fafc;
        color: #334155;
        font-size: .75rem;
        font-weight: 900;
    }

    .sched-mobile-weekgrid {
        grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
        gap: .18rem;
        padding: .5rem;
        border-radius: 0 0 1rem 1rem;
        background: #fff;
    }

    .sched-mobile-cell {
        min-height: 3.2rem;
        border: 0;
        overflow: visible;
    }

    .sched-mobile-cell--off {
        min-height: 3.2rem;
        border-radius: .8rem;
        background: #eef2f7;
    }

    .sched-mobile-cell .cell-btn {
        width: 100%;
        height: 3.05rem !important;
        min-height: 3.05rem !important;
        padding: .22rem .08rem !important;
        border: 1px solid rgba(15, 23, 42, .08) !important;
        border-radius: .8rem !important;
        box-shadow: 0 5px 12px rgba(15, 23, 42, .08);
        font-weight: 900;
    }

    .sched-mobile-cell .cell-main,
    .sched-mobile-cell .cell-line-main {
        max-width: 100%;
        overflow: hidden;
        color: inherit;
        font-size: .62rem;
        font-weight: 900;
        line-height: 1.05;
        text-overflow: ellipsis;
        overflow-wrap: anywhere;
    }

    .tap-tip-host {
        right: -.1rem;
        bottom: -.1rem;
    }
}

@media (max-width: 380px) {
    .sched-mobile-shell {
        padding-inline: .2rem;
    }

    .sched-mobile-weekbar {
        gap: .3rem;
        padding: .42rem;
    }

        .sched-mobile-weekbar .sched-btn {
            min-width: 2.35rem;
            min-height: 2.35rem;
            padding-inline: .55rem;
        }

    .sched-mobile-days,
    .sched-mobile-weekgrid {
        gap: .22rem;
    }

    .sched-mobile-weekgrid {
        padding: .38rem;
    }

    .sched-mobile-cell .cell-main,
    .sched-mobile-cell .cell-line-main {
        font-size: .62rem;
    }
}
