/**
 * Three-month dashboard calendar — full width.
 * Side months: compact “mini” grid (legacy .month-card.small / .calendar-day-small).
 * Center month: legacy HTML/CSS (.cal-month / .day four rows) inside .dc-main-cal.
 */

.dc-root {
    width: 100%;
    max-width: none;
}

.dc-dashboard {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 200px;
}

/* Midtkolonne: navigasjon over kortet (ikke inne i hvit .dc-panel--main) */
.dc-main-column {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: stretch;
    min-width: 0;
}

/* Over kortet: gjennomsiktig, ingen kant som på kortet */
.dc-main-headbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px 12px;
    width: 100%;
    padding: 0 4px 12px;
    margin: 0;
    border: none;
    background: transparent;
}

.dc-main-headbar__nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 12px;
    min-width: 0;
    grid-column: 2;
}

.dc-main-headbar__spacer {
    grid-column: 3;
    min-width: 0;
    pointer-events: none;
}

.dc-main-headbar__today {
    justify-self: start;
    appearance: none;
    margin: 0;
    background: transparent;
    border: 1px solid var(--border, #d1d5db);
    border-radius: 9999px;
    padding: 6px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    color: #2563eb;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}

.dc-main-headbar__today:hover {
    background: rgba(37, 99, 235, 0.06);
    border-color: #93c5fd;
}

.dc-main-headbar__today:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.dc-main-headbar__chev {
    appearance: none;
    margin: 0;
    padding: 4px 10px;
    border: none;
    border-radius: var(--radius-md, 10px);
    background: transparent;
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1;
    font-family: inherit;
    color: var(--text, #334155);
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}

.dc-main-headbar__chev:hover {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text, #0f172a);
}

.dc-main-headbar__chev:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.dc-main-headbar__chev--icon .bi {
    font-size: 1.125rem;
    line-height: 1;
    display: block;
}

.dc-main-headbar__date {
    margin: 0;
    padding: 0;
    font-size: clamp(1.05rem, 1.25vw, 1.3rem);
    font-weight: 650;
    color: var(--heading, #475569);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

/* Tre kolonner uten mellomrom mellom sidemåneder og midt */
.dc-panels {
    display: grid;
    grid-template-columns:
        minmax(0, min(24%, 216px))
        minmax(min(100%, 440px), 1fr)
        minmax(0, min(24%, 216px));
    gap: 0;
    align-items: start;
    width: 100%;
}

/* Month panels: same chrome as layout .card (app.php) — flat surface, soft border, radius-lg, no extra shadow */
.dc-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background: var(--surface, #fff);
    border: 1px solid var(--border-soft, #f1f5f9);
    border-radius: var(--radius-lg, 12px);
    box-shadow: none;
}

/* Stor kalender: samme ramme/hjørner som .card, uten innvendig luft (rutenett kant-i-kant) */
.dc-panel--main {
    background: var(--surface, #fff);
    border: 1px solid var(--border-soft, #f1f5f9);
    border-radius: var(--radius-lg, 12px);
    box-shadow: none;
    padding: 0;
    overflow: hidden;
}

.dc-panel--side {
    border-radius: var(--radius-lg, 12px);
    box-shadow: none;
    background: transparent;
    border-color: transparent;
}

/* Små måneder: luft over */
#dc-panel-left.dc-panel--side,
#dc-panel-right.dc-panel--side {
    margin-top: 40px;
}

.dc-panel--interactive {
    cursor: pointer;
    transition:
        border-color var(--transition-fast, 160ms ease),
        background-color var(--transition-fast, 160ms ease);
}

.dc-panel--interactive:hover {
    border-color: var(--border, #e5e7eb);
    background: var(--surface-muted, #f8fafc);
}

.dc-panel--side.dc-panel--interactive:hover {
    border-color: var(--border-soft, #f1f5f9);
    background: rgba(148, 163, 184, 0.1);
}

.dc-panel--interactive:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.dc-month-header {
    text-align: center;
    font-weight: 700;
    color: var(--heading, #475569);
    letter-spacing: -0.02em;
    background: var(--surface, #fff);
}

.dc-panel--side .dc-month-header {
    border-bottom: none;
    padding: 10px 8px 6px;
    background: transparent;
}

.dc-month-header__title {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    line-height: 1.2;
}

.dc-month-header--side .dc-month-header__title {
    font-size: 0.8rem;
    font-weight: 650;
}

.dc-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    text-align: center;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    margin: 0;
    padding: 0;
}

.dc-weekdays--side {
    font-size: 0.58rem;
    padding: 2px 8px 4px;
    letter-spacing: 0.03em;
    margin-bottom: 2px;
}

.dc-weekdays--side .dc-weekdays__cell:nth-child(6) {
    color: #64748b;
}

.dc-weekdays--side .dc-weekdays__cell:nth-child(7) {
    color: #94a3b8;
}

.dc-weekdays__cell {
    display: block;
    padding: 0.2rem 0;
}

.dc-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin: 0;
}

/* Mini month: flat number grid — no large “tiles” (legacy .calendar-days-small) */
.dc-grid--side {
    padding: 2px 8px 10px;
    row-gap: 7px;
    column-gap: 2px;
    background: transparent;
    border: none;
}

.dc-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    font-weight: 500;
    color: var(--text, #0f172a);
    background: var(--surface, #fff);
    border: none;
    cursor: default;
    transition: background-color 0.12s ease;
}

.dc-grid--side .dc-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box;
    aspect-ratio: auto;
    min-width: 0;
    /* Lik bunnflate for alle celler → tall på samme linje; prikk under i reservert sone */
    padding: 2px 0 8px;
    min-height: calc(1.25em + 8px);
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.15;
    background: transparent;
    border-radius: 0;
}

.dc-grid--side .dc-cell--outside {
    background: transparent;
}

.dc-grid--side .dc-cell:hover:not(.dc-cell--outside) {
    background: rgba(148, 163, 184, 0.15);
    border-radius: 3px;
}

.dc-cell--outside {
    color: #94a3b8;
    font-weight: 400;
}

.dc-grid--side .dc-cell--outside {
    color: #adb5bd;
    font-size: 0.62rem;
}

/* Weekday date numbers: same as default (black). Red only for today or public holiday. */
.dc-cell--sat:not(.dc-cell--outside),
.dc-cell--sun:not(.dc-cell--outside) {
    color: var(--text, #0f172a);
}

.dc-cell--outside-weekend {
    color: #cbd5e1;
}

.dc-cell--today {
    position: relative;
    font-weight: 700;
    color: #dc2626;
    box-shadow: inset 0 0 0 2px #dc2626;
    border-radius: 6px;
}

.dc-grid--side .dc-cell--today {
    border-radius: 999px;
    box-shadow: 0 0 0 1.5px #dc2626;
    font-weight: 700;
    color: #dc2626;
}

.dc-grid--side .dc-cell.dc-cell--holiday:not(.dc-cell--outside) {
    color: #dc2626;
    font-weight: 600;
}

.dc-cell__daynum {
    line-height: 1.2;
}

.dc-grid--side .dc-cell__daynum {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 1.25em;
    line-height: 1.25;
}

/* Side mini-month: helligdags-prikk i reservert sone under tallet (ingen ekstra padding på .dc-cell--holiday) */
.dc-grid--side .dc-cell.dc-cell--holiday::after {
    content: "";
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: linear-gradient(90deg, #ff8a8a, #d63031);
    pointer-events: none;
}

/* Ytre luft håndteres av .dc-panel--main (som .card-padding) */
.dc-panel--main .full-calendar {
    padding: 0;
}

.dc-panel--main .full-calendar.full-calendar--dash-month {
    padding: 0;
}

.dc-panel--main .full-calendar--dash-month .full-calendar__inner--legacy-cal {
    background: transparent;
    border: none;
    padding: 0;
    border-radius: 0;
}

/**
 * Center month: same structure as legacy .cal-month / .day — scoped under .dc-main-cal.
 * Tokens adapted for dashboard light theme (from public/old/static/assets/css/app.css).
 */
.dc-main-cal {
    --cal-gap: 0;
    --ov-day-h: 156px;
    --ov-radius-md: 12px;
    --ov-elevated: #ffffff;
    --ov-separator: #e2e8f0;
    --ov-label: #334155;
    --ov-secondary: #64748b;
    --ov-gantt-weekend-sat: #64748b;
    --ov-red: #dc2626;
    --ov-blue: #2563eb;
    --ov-holiday-bg: linear-gradient(180deg, #fdf5f5, #f5eaea);
}

.dc-main-cal .cal-month,
.dc-main-cal .ov-dash-single-month {
    width: 100%;
}

/* Kun linjer mellom celler — ingen ytre ramme på månedsrutenettet */
.dc-main-cal .ov-dash-single-month {
    border: none;
    border-radius: 0;
    overflow: visible;
    background: var(--ov-elevated);
}

.dc-main-cal .cal-week-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-rows: var(--ov-day-h);
    gap: 0;
    align-items: stretch;
}

.dc-main-cal .cal-week-grid.cal-week-head {
    grid-auto-rows: min-content;
}

.dc-main-cal .cal-week-head .cal-dow-cell {
    box-sizing: border-box;
    padding: 6px 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--ov-secondary);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--ov-elevated);
    border-right: 1px solid var(--ov-separator);
    border-bottom: 1px solid var(--ov-separator);
}

.dc-main-cal .cal-week-head .cal-dow-cell:nth-child(7n) {
    border-right: none;
}

.dc-main-cal .cal-week-head .cal-dow-cell--sat {
    color: var(--ov-gantt-weekend-sat);
}

.dc-main-cal .cal-week-head .cal-dow-cell--sun {
    color: var(--ov-red);
}

.dc-main-cal .day {
    --day-pad-x: 5px;
    box-sizing: border-box;
    height: var(--ov-day-h);
    min-height: var(--ov-day-h);
    max-height: var(--ov-day-h);
    background: var(--ov-elevated);
    border: none;
    border-right: 1px solid var(--ov-separator);
    border-bottom: 1px solid var(--ov-separator);
    border-radius: 0;
    padding: 6px var(--day-pad-x) 5px;
    display: grid;
    grid-template-rows: auto minmax(28px, 1fr) minmax(28px, 1fr) auto;
    gap: 4px;
    align-content: stretch;
    overflow: hidden;
    box-shadow: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.dc-main-cal .cal-week-grid > :nth-child(7n) {
    border-right: none;
}

.dc-main-cal .cal-week:not(.cal-week--head-row):last-of-type .cal-week-grid > * {
    border-bottom: none;
}

.dc-main-cal .day:active {
    filter: brightness(0.98);
}

.dc-main-cal .day-r1 {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ov-label);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Lørdag/søndag: samme som vanlige dager (sort/mørk). Rødt kun for helligdag eller i dag. */
.dc-main-cal .day--sat .day-r1,
.dc-main-cal .day--sun .day-r1 {
    color: var(--ov-label);
}

.dc-main-cal .day.day-holiday .day-r1,
.dc-main-cal .day.day--today .day-r1 {
    color: var(--ov-red);
}

.dc-main-cal .day-r2,
.dc-main-cal .day-r3 {
    min-height: 0;
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

.dc-main-cal .day-duty-placeholder {
    width: 100%;
    min-height: 0;
    flex: 1;
    border-radius: 0;
    background: transparent;
    border: none;
    pointer-events: none;
}

.dc-main-cal .day-r4 {
    font-size: 10px;
    font-weight: 700;
    color: var(--ov-red);
    line-height: 1.15;
    text-align: center;
    padding: 3px 2px;
    border-radius: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-height: 1.15em;
}

.dc-main-cal .day-r4-empty {
    color: transparent;
    border: 1px dashed transparent;
}

.dc-main-cal .day.day--today {
    outline: 2px solid var(--ov-red);
    outline-offset: -2px;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ov-red) 35%, transparent);
    position: relative;
    z-index: 1;
}

/* Helligdag (ikke i dag): kun bakgrunnsfyll — samme rutenettlinjer som vanlige dager. */
.dc-main-cal .day-holiday {
    background: var(--ov-holiday-bg);
}

.dc-main-cal .day-holiday .day-r4 {
    color: var(--ov-red);
    background: color-mix(in srgb, var(--ov-red) 8%, transparent);
    border: none;
}

/* I dag + helligdag: behold tydelig kant på helligdagslinjen under tall. */
.dc-main-cal .day-holiday.day--today .day-r4 {
    border: 0.5px solid color-mix(in srgb, var(--ov-red) 30%, transparent);
}

.dc-main-cal .cal-week {
    margin-bottom: 0;
    overflow: visible;
}

/* Ukenummer-kolonne til venstre (ISO 8601, mandag første dag i rad) */
.dc-main-cal .cal-week--with-weekcol {
    display: grid;
    grid-template-columns: minmax(2rem, 2.75rem) minmax(0, 1fr);
    gap: 0;
    align-items: stretch;
}

.dc-main-cal .cal-week--head-row {
    margin-bottom: 0;
}

.dc-main-cal .cal-week-head-wk {
    box-sizing: border-box;
    padding: 6px 4px;
    font-size: 10px;
    font-weight: 700;
    color: var(--ov-secondary);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.2;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ov-elevated);
    border-right: 1px solid var(--ov-separator);
    border-bottom: 1px solid var(--ov-separator);
}

.dc-main-cal .cal-week--head-row .cal-week-head {
    margin-bottom: 0;
}

.dc-main-cal .cal-week-num {
    box-sizing: border-box;
    min-height: var(--ov-day-h);
    padding: 10px 4px 0;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--ov-secondary);
    text-align: center;
    line-height: 1.2;
    background: var(--ov-elevated);
    border-right: 1px solid var(--ov-separator);
    border-bottom: 1px solid var(--ov-separator);
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.dc-main-cal .cal-week:not(.cal-week--head-row):last-of-type .cal-week-num {
    border-bottom: none;
}

.dc-main-cal .cal-week-stack {
    position: relative;
    overflow: visible;
}

.dc-main-cal .cal-week-ribbons {
    position: absolute;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0;
    pointer-events: none;
    z-index: 5;
    min-height: 30px;
}

.dc-main-cal .cal-week-ribbons--period {
    top: 31px;
}

.dc-main-cal .cal-day-placeholder {
    box-sizing: border-box;
    height: var(--ov-day-h);
    min-height: var(--ov-day-h);
    background: var(--ov-elevated);
    border-right: 1px solid var(--ov-separator);
    border-bottom: 1px solid var(--ov-separator);
}

@media (max-width: 640px) {
    .dc-main-cal {
        --ov-day-h: 128px;
    }

    .dc-main-cal .cal-week--with-weekcol {
        grid-template-columns: minmax(1.75rem, 2.25rem) minmax(0, 1fr);
    }

    .dc-main-cal .cal-week-num {
        font-size: 11px;
        padding: 8px 4px 0;
    }

    .dc-main-cal .day-r1 {
        font-size: 15px;
    }

    .dc-main-cal .day {
        grid-template-rows: auto minmax(22px, 1fr) minmax(22px, 1fr) auto;
        gap: 3px;
        padding: 4px 4px 4px;
    }

    .dc-main-cal .day-r4 {
        font-size: 9px;
    }
}

.dashboard-calendar-card__title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: var(--heading, #475569);
}

.dashboard-calendar-card__lead {
    margin: 0 0 1.25rem;
    font-size: 0.9375rem;
}

@media (max-width: 900px) {
    .dc-panels {
        grid-template-columns: 1fr;
    }

    .dc-main-column {
        order: -1;
    }

    .dc-panel--side {
        max-width: none;
        width: 100%;
    }

    .dc-grid--side {
        row-gap: 8px;
    }

    /* When stacked, side months get slightly larger tap targets but stay “secondary” */
    .dc-grid--side .dc-cell {
        font-size: 0.72rem;
        padding: 3px 0 9px;
        min-height: calc(1.25em + 9px);
    }

    .dc-grid--side .dc-cell.dc-cell--holiday::after {
        bottom: 4px;
    }

    .dc-month-header--side .dc-month-header__title {
        font-size: 0.88rem;
    }
}

