/* A transformed page makes the fixed modal backdrop jump when its entrance animation ends. */
.service-module.active { animation: none; }
html:has(> body[data-screen="service"]) { scrollbar-gutter: stable; }
body[data-screen="service"]:has([data-modal="service-task"].open) { overflow: hidden; }

.service-module .service-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(310px, .85fr);
    gap: 14px;
    margin-bottom: 14px;
}

.service-module .panel-head > a,
.service-list > article > a,
.service-history .panel-head > a {
    color: var(--navy);
    text-decoration: none;
    font-size: calc(11px * var(--panel-font-scale, 1));
    font-weight: 800;
}

.service-list article {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.service-list article:last-child { border: 0; }
.service-priority {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    color: #7d8795;
    background: #edf0f4;
    border-radius: 7px;
    font-size: calc(13px * var(--panel-font-scale, 1));
    font-weight: 900;
}
.service-priority.danger { color: #a7333e; background: #fbe3e5; }
.service-priority.warning { color: #9a5a0c; background: #fff0d4; }
.service-priority.soon { color: #174b7d; background: #e1edf9; }
.service-list strong { color: var(--navy); font-size: calc(13px * var(--panel-font-scale, 1)); }
.service-list p { margin: 1px 0; color: var(--muted); font-size: calc(11px * var(--panel-font-scale, 1)); }
.service-list small { color: #9a5a0c; font-size: calc(11px * var(--panel-font-scale, 1)); }
.service-list > article > a {
    padding: 6px 9px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
}
.service-list > article > a:hover { border-color: #9eb0c4; background: #f7f9fc; }
.service-empty { padding: 42px 18px; color: var(--muted); text-align: center; font-size: calc(12px * var(--panel-font-scale, 1)); }

.service-calendar {
    transition: opacity .18s ease, transform .18s ease;
}
.service-calendar.is-loading {
    opacity: .55;
    transform: translateY(2px);
    pointer-events: none;
}
.service-calendar.is-entering {
    animation: service-calendar-enter .22s ease both;
}
@keyframes service-calendar-enter {
    from { opacity: .25; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.service-calendar .panel-head > div:last-child { display: flex; gap: 4px; }
.service-calendar .panel-head > div:last-child a {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    color: var(--navy);
    border: 1px solid var(--line);
    border-radius: 4px;
    text-decoration: none;
}
.service-module .mini-month {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    padding: 14px 18px 8px;
}
.service-module .mini-month > span { color: var(--muted); text-align: center; font-size: calc(10px * var(--panel-font-scale, 1)); text-transform: uppercase; }
.service-module .mini-month > a,
.service-module .mini-month > i {
    display: grid;
    height: 25px;
    place-items: center;
    color: #4c5b70;
    border-radius: 4px;
    text-decoration: none;
    font-size: calc(11px * var(--panel-font-scale, 1));
    font-style: normal;
}
.service-module .mini-month > a.current { color: #fff; background: var(--navy); }
.service-module .mini-month > a.event { color: #9c420f; background: #ffeadc; }
.service-module .mini-month > a.urgent-event { color: #a7333e; background: #fbe3e5; box-shadow: inset 0 -2px #c74954; }
.service-module .month-legend { display: flex; gap: 13px; padding: 10px 18px 14px; color: var(--muted); font-size: calc(11px * var(--panel-font-scale, 1)); }
.service-module .month-legend span { display: flex; align-items: center; gap: 5px; }
.service-module .month-legend i { width: 7px; height: 7px; border-radius: 2px; }
.service-module .orange-legend { background: var(--orange); }
.service-module .red-legend { background: var(--red); }

@media (prefers-reduced-motion: reduce) {
    .service-calendar { transition: none; }
    .service-calendar.is-entering { animation: none; }
}

.service-history { overflow: hidden; }
.service-history .table-wrap { overflow-x: auto; }
.service-history td:nth-child(1), .service-history td:nth-child(4), .service-history td:nth-child(6) { white-space: nowrap; }
.service-history { scroll-margin-top: calc(var(--topbar) + 16px); }
.service-history tbody tr.service-task-saved { background: #fff3e9; box-shadow: inset 3px 0 var(--orange); }
.service-history tbody tr[data-service-row-url]:not([data-service-row-url=""]) { cursor: pointer; }
.service-history tbody tr[data-service-row-url]:not([data-service-row-url=""]):hover { background: #f8fafc; }
.service-list-tabs { display: flex; gap: 8px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.service-list-tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 5px; color: var(--navy); text-decoration: none; font-size: calc(12px * var(--panel-font-scale, 1)); font-weight: 800; }
.service-list-tabs a[aria-current="page"] { color: #a34300; background: #fff0e6; }
.service-list-tabs span { min-width: 22px; padding: 2px 5px; border-radius: 10px; background: #edf1f6; text-align: center; font-size: calc(10px * var(--panel-font-scale, 1)); }
.service-history th.service-actions-heading { text-align: right; }
.service-row-actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.service-row-actions form { margin: 0; }
.service-row-action { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--navy); font: inherit; font-size: calc(11px * var(--panel-font-scale, 1)); font-weight: 800; text-decoration: none; white-space: nowrap; cursor: pointer; }
.service-row-action:hover { background: #f1f5fa; border-color: #9eb0c4; }
.service-row-action-danger { color: #b42332; border-color: #f1cbd0; }
.service-row-action-danger:hover { background: #fff0f1; border-color: #d99ba3; }
.service-row-action:focus-visible, .service-list-tabs a:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.service-history-empty { padding: 42px 18px !important; color: var(--muted); text-align: center; }
.service-history .list-footer a,
.service-mini-pager a {
    display: grid;
    min-width: 27px;
    height: 27px;
    place-items: center;
    color: var(--navy);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    text-decoration: none;
    font-size: calc(11px * var(--panel-font-scale, 1));
    font-weight: 800;
}
.service-history .list-footer a.active,
.service-mini-pager a.active { color: #fff; background: var(--navy); border-color: var(--navy); }
.service-mini-pager { display: flex; justify-content: flex-end; gap: 4px; padding: 10px 18px; border-top: 1px solid var(--line); }

.service-fleet-empty {
    display: flex;
    min-height: 105px;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    padding: 18px;
}
.service-fleet-empty > span { display: grid; width: 40px; height: 40px; place-items: center; color: var(--navy); background: #edf3f9; border-radius: 7px; font-size: calc(21px * var(--panel-font-scale, 1)); }
.service-fleet-empty p { flex: 1; margin: 0; color: var(--muted); font-size: calc(12px * var(--panel-font-scale, 1)); }

.service-modal { width: min(760px, calc(100vw - 28px)); }
.service-modal form { padding: 0; }
.service-form-body { display: grid; gap: 14px; max-height: min(68vh, 670px); overflow-y: auto; padding: 18px 22px; }
.service-form-body [hidden] { display: none !important; }
.service-form-body label { color: #34465e; font-size: calc(11px * var(--panel-font-scale, 1)); font-weight: 800; }
.service-form-body input,
.service-form-body select,
.service-form-body textarea { margin-top: 5px; }
.service-modal .modal-actions { margin: 0; padding: 15px 22px; border-top: 1px solid var(--line); }
.service-modal .modal-actions .button-danger { margin-right: auto; }
.service-recurrence { display: grid; gap: 12px; margin: 0; padding: 14px; background: #f8fafc; border: 1px solid var(--line); border-radius: 7px; }
.service-recurrence legend { padding: 0 6px; color: var(--navy); font-size: calc(11px * var(--panel-font-scale, 1)); font-weight: 900; }
.service-recurrence .check-row { display: flex; min-height: 36px; align-items: center; gap: 9px; cursor: pointer; }
.service-recurrence .check-row input { width: 18px; height: 18px; flex: 0 0 auto; margin: 0; accent-color: var(--orange); cursor: pointer; }
.service-document-link { display: inline-flex; width: fit-content; align-items: center; padding: 8px 10px; color: var(--navy); background: #f8fafc; border: 1px solid var(--line); border-radius: 5px; text-decoration: none; font-size: calc(11px * var(--panel-font-scale, 1)); font-weight: 800; }

@media (max-width: 840px) {
    .service-module .service-grid { grid-template-columns: 1fr; }
    .service-history .table-wrap { overflow-x: auto; }
    .service-history table { min-width: 760px; }
}

@media (max-width: 560px) {
    .service-list article { grid-template-columns: 40px minmax(0, 1fr); padding: 13px 14px; }
    .service-list > article > a { grid-column: 2; width: fit-content; }
    .service-module .mini-month { padding-inline: 12px; }
    .service-modal { max-height: calc(100vh - 16px); }
    .service-form-body { max-height: calc(100vh - 190px); padding: 14px; }
    .service-modal .modal-actions { flex-wrap: wrap; padding: 12px 14px; }
    .service-modal .modal-actions .button-danger { width: 100%; margin-right: 0; }
    .service-fleet-empty { align-items: flex-start; flex-wrap: wrap; }
    .service-fleet-empty p { min-width: calc(100% - 60px); }
}
