/* Shared schedule grid styles (admin + user views) */

.schedule-page {
    padding-bottom: 2rem;
}

.schedule-picker-card {
    background: var(--vma-bg-card);
    border: 1px solid var(--vma-border-light);
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    margin-bottom: 0;
}

.schedule-picker-card__form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1.25rem;
}

@media (max-width: 575px) {
    .schedule-picker-card__form {
        flex-direction: column;
        align-items: stretch;
    }
}

.schedule-picker-card__field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
    flex: 1 1 10rem;
}

.schedule-picker-card__field--select {
    flex: 1 1 12rem;
}

.schedule-picker-card__field--action {
    flex: 0 0 auto;
    min-width: 7rem;
}

.schedule-picker-card__field--action .schedule-picker-card__btn {
    width: 100%;
}

.schedule-picker-card__label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--vma-text-muted);
}

.schedule-picker-card__select {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    color: var(--vma-text-primary);
    background: var(--vma-bg-input);
    border: 1px solid var(--vma-border-input);
    border-radius: 10px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
}

.schedule-picker-card__select:focus {
    outline: none;
    border-color: var(--vma-accent);
    box-shadow: 0 0 0 3px var(--vma-accent-soft);
}

.schedule-picker-card__actions {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-left: auto;
}

.schedule-picker-card__btn {
    min-height: 2.75rem;
}

.schedule-content-card {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem 1.25rem;
}

.schedule-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--vma-text-muted);
}

.schedule-empty-state__icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.6;
}

.schedule-empty-state__title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--vma-text-secondary);
    margin-bottom: 0.25rem;
}

.schedule-empty-state__text {
    font-size: 0.875rem;
}

.sched-user-summary-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.75rem;
    background: var(--vma-bg-subtle, #f8fafc);
    border: 1px solid var(--vma-border-light, #e2e8f0);
    border-radius: 10px;
}

.sched-user-summary-bar__title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--vma-text-heading);
    margin-right: auto;
}

.sched-row__stats {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.sched-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--vma-bg-card, #fff);
    border: 1px solid var(--vma-border-light, #e2e8f0);
    border-radius: 8px;
    padding: 0.2rem 0.55rem;
    min-width: 3.5rem;
}

.sched-stat__label {
    font-size: 0.58rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--vma-text-muted);
    line-height: 1;
}

.sched-stat__value {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--vma-text-heading);
    line-height: 1.3;
}

.sched-stat--over .sched-stat__value {
    color: #dc2626;
}

.sched-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    align-items: center;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.72rem;
}

.sched-legend__sep {
    color: var(--vma-text-muted);
    margin-left: 0.25rem;
}

.sched-legend__item {
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.sched-legend__item--holiday { background: #fef9c3; color: #92400e; }
.sched-legend__item--weekend { background: #f1f5f9; color: #64748b; }

.sched-legend__marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0.1rem 0.45rem;
    white-space: nowrap;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: help;
}

.sched-legend__marker::after {
    content: attr(data-tooltip);
    position: absolute;
    z-index: 20;
    bottom: calc(100% + 0.4rem);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 16rem;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    background: #1e293b;
    color: #f8fafc;
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.35;
    white-space: normal;
    text-align: center;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.sched-legend__marker::before {
    content: "";
    position: absolute;
    z-index: 20;
    bottom: calc(100% + 0.15rem);
    left: 50%;
    transform: translateX(-50%);
    border: 0.3rem solid transparent;
    border-top-color: #1e293b;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.sched-legend__marker:hover::after,
.sched-legend__marker:hover::before,
.sched-legend__marker:focus-visible::after,
.sched-legend__marker:focus-visible::before {
    opacity: 1;
    visibility: visible;
}

.sched-calendars-wrapper {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

@media (max-width: 991px) {
    .sched-calendars-wrapper {
        flex-direction: column;
    }

    .sched-calendar {
        max-width: 100% !important;
    }
}

.sched-calendar {
    flex: 1;
    min-width: 320px;
    max-width: 50%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.sched-calendar--plan .sched-calendar__header {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border-bottom-color: #93c5fd;
}

.sched-calendar--actual .sched-calendar__header {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-bottom-color: #6ee7b7;
}

.sched-calendar__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-bottom: 2px solid #cbd5e1;
}

.sched-calendar__icon { font-size: 1.25rem; }

.sched-calendar__title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1e293b;
}

.sched-calendar__subtitle {
    font-size: 0.75rem;
    color: #64748b;
    margin-left: auto;
    font-weight: 500;
}

.sched-calendar__body {
    padding: 0.75rem;
}

.sched-week-group {
    margin-bottom: 1rem;
    border-radius: 8px;
    padding: 0.5rem 0.5rem 0.65rem;
}

.sched-week-group:last-child { margin-bottom: 0; }

.sched-week-group__label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--vma-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
    padding-left: 0.2rem;
}

.sched-week--c1 { background: #f0f9ff; border-left: 3px solid #0ea5e9; }
.sched-week--c2 { background: #f0fdf4; border-left: 3px solid #22c55e; }
.sched-week--c3 { background: #fefce8; border-left: 3px solid #eab308; }
.sched-week--c4 { background: #faf5ff; border-left: 3px solid #a855f7; }

.sched-day-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.sched-tile {
    display: flex;
    flex-direction: column;
    width: 4.85rem;
    min-height: 5.6rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.sched-tile:hover {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.sched-tile--readonly {
    background: #fff;
    cursor: default;
}

.sched-tile--readonly:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.sched-tile--holiday { background: #fffbeb; border-color: #fcd34d; }
.sched-tile--weekend { background: #f8fafc; border-color: #e2e8f0; }
.sched-tile--marked { border-color: #cbd5e1; }
.sched-tile--has-actual {
    background: #ffffff;
    border-color: #bbf7d0;
    box-shadow: inset 3px 0 0 #22c55e, 0 1px 2px rgba(15, 23, 42, 0.04);
}
.sched-tile--has-plan {
    box-shadow: inset 3px 0 0 #3b82f6, 0 1px 2px rgba(15, 23, 42, 0.04);
}
.sched-tile--wr-target {
    background: #fffbeb !important;
    border: 1px dashed #f59e0b !important;
    position: relative;
    box-shadow: none !important;
}

.sched-tile--wr-target::after {
    content: attr(data-pip-label);
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.55rem;
    font-weight: 700;
    color: #92400e;
    background: #fde68a;
    padding: 1px 3px;
    border-radius: 3px;
    max-width: 3.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 1;
}

.sched-tile--compensation-blocked {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    cursor: not-allowed;
}

.sched-tile--compensation-blocked .sched-tile__h-input,
.sched-tile--compensation-blocked .sched-tile__marker-select,
.sched-tile--compensation-blocked .sched-tile__kod-input {
    display: none;
}

.sched-tile__compensation-label {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.2rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #334155;
    letter-spacing: 0.02em;
}

.sched-tile__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
    background: #0f172a;
    padding: 0.28rem 0.35rem;
}

.sched-tile--holiday .sched-tile__header { background: #b45309; }
.sched-tile--weekend .sched-tile__header { background: #475569; }
.sched-tile--vacation .sched-tile__header { background: #047857; }
.sched-tile--has-actual .sched-tile__header { background: #14532d; }

.sched-tile__day {
    font-size: 0.8rem;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.sched-tile__dow {
    font-size: 0.58rem;
    font-weight: 600;
    color: rgba(248, 250, 252, 0.72);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sched-tile__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    padding: 0.45rem 0.35rem 0.35rem;
    min-height: 2.4rem;
    gap: 0.2rem;
}

.sched-tile__footer {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.28rem 0.35rem 0.35rem;
    border-top: 1px solid #f1f5f9;
    background: #fafafa;
    min-height: 1.35rem;
}

.sched-tile__footer--readonly {
    justify-content: center;
    align-items: center;
    gap: 0.2rem;
}

.sched-tile__marker-display {
    font-weight: 700;
    font-size: 0.62rem;
    color: #334155;
    letter-spacing: 0.02em;
}

.sched-tile__kod-display {
    color: #64748b;
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sched-tile__shift-badge {
    align-self: center;
    font-size: 0.58rem;
    font-weight: 600;
    color: #64748b;
    background: transparent;
    border-radius: 0;
    padding: 0;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}

.sched-tile__body .sched-tile__shift-badge {
    color: #475569;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 0.1rem 0.35rem;
}

.sched-actual-hours {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.18rem;
    width: 100%;
    line-height: 1;
    min-width: 0;
}

.sched-actual-hours__main {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.12rem;
    min-width: 0;
}

.sched-actual-hours__value {
    font-size: 0.95rem;
    font-weight: 750;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.sched-actual-hours__unit {
    font-size: 0.62rem;
    font-weight: 600;
    color: #94a3b8;
}

.sched-actual-hours__over {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    font-size: 0.58rem;
    font-weight: 700;
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 0.08rem 0.3rem;
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.sched-actual-hours--empty {
    color: #cbd5e1;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
}

.sched-plan-hours__value {
    font-size: 0.95rem;
    font-weight: 750;
    color: #1e3a8a;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

html.dark .sched-calendar {
    background: var(--vma-bg-card, #1e293b);
    border-color: var(--vma-border-light, rgba(255, 255, 255, .08));
}

html.dark .sched-tile {
    background: var(--vma-bg-input, #334155);
    border-color: var(--vma-border-light, rgba(255, 255, 255, .08));
    box-shadow: none;
}

html.dark .sched-tile--holiday { background: rgba(217, 119, 6, 0.25); border-color: rgba(217, 119, 6, 0.45); }
html.dark .sched-tile--weekend { background: rgba(100, 116, 139, 0.25); border-color: rgba(100, 116, 139, 0.35); }
html.dark .sched-tile--has-actual {
    background: rgba(5, 150, 105, 0.12);
    border-color: rgba(5, 150, 105, 0.35);
    box-shadow: inset 3px 0 0 #34d399;
}
html.dark .sched-tile__footer { background: rgba(15, 23, 42, 0.35); border-top-color: rgba(255,255,255,0.06); }
html.dark .sched-actual-hours__value { color: #f8fafc; }
html.dark .sched-actual-hours__over { background: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.35); color: #fca5a5; }
html.dark .sched-tile__shift-badge { background: transparent; color: #94a3b8; }
html.dark .sched-tile__body .sched-tile__shift-badge { background: rgba(255,255,255,0.08); color: #cbd5e1; }
html.dark .sched-legend__item--holiday { background: rgba(217, 119, 6, 0.25); color: #fcd34d; }
html.dark .sched-legend__item--weekend { background: rgba(100, 116, 139, 0.25); color: #94a3b8; }
html.dark .sched-legend__marker { background: rgba(99, 102, 241, 0.25); color: #a5b4fc; }
html.dark .sched-legend__marker::after { background: #334155; color: #f1f5f9; }
html.dark .sched-legend__marker::before { border-top-color: #334155; }
html.dark .sched-user-summary-bar { background: rgba(15, 23, 42, 0.5); }
