:root {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: #1b2430;
    background: #f3f5f7;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}


/* Login */

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(
            145deg,
            #eef3f2 0%,
            #f8f8f7 58%,
            #e7eceb 100%
        );
}

.login-card {
    width: min(100%, 420px);
    background: white;
    border: 1px solid #dce2e5;
    border-radius: 18px;
    padding: 38px;
    box-shadow:
        0 18px 50px rgba(35, 51, 60, 0.10);
}

.brand-mark {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #243d3a;
    color: white;
    font-weight: 700;
    margin-bottom: 20px;
}

.login-card h1 {
    margin: 0;
    font-size: 2rem;
}

.login-subtitle {
    margin: 7px 0 30px;
    color: #697780;
}

.login-card label,
.event-form label {
    display: block;
    margin: 16px 0 7px;
    font-weight: 600;
}

.login-card input,
.event-form input,
.event-form select,
.event-form textarea {
    width: 100%;
    border: 1px solid #bcc7cc;
    border-radius: 8px;
    padding: 11px 12px;
    outline: none;
    background: white;
}

.login-card input:focus,
.event-form input:focus,
.event-form select:focus,
.event-form textarea:focus {
    border-color: #496d68;
    box-shadow:
        0 0 0 3px rgba(73, 109, 104, 0.13);
}

.event-form textarea {
    resize: vertical;
}


/* Buttons */

.primary-button,
.secondary-button,
.icon-button,
.danger-button {
    border-radius: 8px;
    border: 1px solid transparent;
}

.primary-button {
    width: 100%;
    margin-top: 24px;
    padding: 12px 16px;
    border-color: #243d3a;
    background: #243d3a;
    color: white;
    font-weight: 650;
}

.primary-button:hover {
    background: #1b302e;
}

.primary-button:disabled,
.danger-button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.primary-button.toolbar-primary,
.primary-button.inline-primary {
    width: auto;
    margin-top: 0;
}

.primary-button.toolbar-primary {
    padding: 9px 14px;
}

.primary-button.inline-primary {
    padding: 10px 18px;
}

.secondary-button {
    padding: 9px 14px;
    background: white;
    border-color: #c8d0d4;
    color: #26343d;
}

.secondary-button:hover {
    background: #f4f6f7;
}

.secondary-button.compact {
    padding: 8px 12px;
}

.icon-button {
    width: 38px;
    height: 38px;
    background: white;
    border-color: #c8d0d4;
    color: #26343d;
    font-size: 1.6rem;
    line-height: 1;
}

.danger-button {
    padding: 10px 15px;
    background: #fff;
    border-color: #c95757;
    color: #a52f2f;
}

.danger-button:hover {
    background: #fff2f2;
}

.message {
    min-height: 22px;
    margin-top: 12px;
    font-size: 0.92rem;
    color: #a02f2f;
}


/* App */

.topbar {
    min-height: 70px;
    padding: 12px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    background: #243d3a;
    color: white;
}

.topbar-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.topbar-subtitle {
    color: #c9d7d5;
    font-size: 0.86rem;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar .secondary-button {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.45);
    color: white;
}

.content {
    width: min(1500px, calc(100% - 40px));
    margin: 26px auto 40px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 22px;
    align-items: start;
}

.calendar-card,
.legend-card {
    background: white;
    border: 1px solid #dce2e5;
    border-radius: 14px;
    box-shadow:
        0 6px 24px rgba(30, 45, 53, 0.055);
}

.calendar-card {
    overflow: hidden;
}

.calendar-toolbar {
    padding: 22px 24px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.calendar-toolbar h1 {
    margin: 0;
    font-size: 1.55rem;
}

.toolbar-help {
    margin: 5px 0 0;
    color: #71808a;
    font-size: 0.92rem;
}

.toolbar-actions,
.month-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.month-title-row {
    min-height: 58px;
    padding: 0 24px 16px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

.month-title-row h2 {
    margin: 0;
    text-transform: capitalize;
    font-size: 1.3rem;
}

.calendar-status {
    color: #728089;
    font-size: 0.88rem;
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
    background: #f5f7f8;
    border-top: 1px solid #dfe5e7;
    border-bottom: 1px solid #dfe5e7;
}

.calendar-weekdays div {
    padding: 10px 8px;
    text-align: center;
    color: #687780;
    font-size: 0.82rem;
    font-weight: 650;
}

.calendar-grid {
    background: #dfe5e7;
    gap: 1px;
}

.calendar-day {
    min-height: 128px;
    padding: 8px;
    background: white;
    overflow: hidden;
}

.calendar-day.manage-enabled {
    cursor: default;
}

.calendar-day.outside-month {
    background: #f8f9f9;
    color: #a6afb4;
}

.calendar-day.today {
    box-shadow:
        inset 0 0 0 2px #6b8f89;
}

.day-number-row {
    display: flex;
    justify-content: flex-end;
    min-height: 25px;
}

.day-number {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 0.84rem;
    font-weight: 650;
}

.calendar-day.today .day-number {
    background: #243d3a;
    color: white;
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.calendar-event {
    width: 100%;
    border: 0;
    border-left: 4px solid #73848c;
    border-radius: 5px;
    padding: 6px 7px;
    text-align: left;
    background: #eef1f2;
    color: #26343d;
}

.calendar-event:hover {
    filter: brightness(0.97);
}

.event-time {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
}

.event-title {
    display: block;
    margin-top: 1px;
    font-size: 0.79rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-event.type-service,
.legend-dot.type-service {
    border-color: #4e766f;
    background: #e4efed;
}

.calendar-event.type-funeral,
.legend-dot.type-funeral {
    border-color: #646b78;
    background: #ebedf0;
}

.calendar-event.type-wedding,
.legend-dot.type-wedding {
    border-color: #9a6d7b;
    background: #f3e8ec;
}

.calendar-event.type-other,
.legend-dot.type-other {
    border-color: #887346;
    background: #f1eddf;
}


/* Sidepanel */

.legend-card {
    padding: 20px;
}

.legend-card h2 {
    margin: 0 0 16px;
    font-size: 1.05rem;
}

.legend-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.91rem;
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-left-width: 5px;
    border-left-style: solid;
    border-radius: 3px;
}

.info-box {
    margin-top: 22px;
    padding: 13px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-radius: 8px;
    background: #f4f6f6;
    color: #627078;
    font-size: 0.84rem;
    line-height: 1.4;
}


/* Dialog */

.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(21, 29, 34, 0.48);
}

.dialog-card {
    width: min(100%, 620px);
    max-height: calc(100vh - 40px);
    overflow: auto;
    background: white;
    border-radius: 14px;
    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.24);
}

.dialog-header {
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e5e7;
}

.dialog-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.dialog-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: #f1f3f4;
    font-size: 1.5rem;
}

.event-form {
    padding: 20px;
}

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

.dialog-actions {
    margin-top: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dialog-actions-right {
    display: flex;
    gap: 9px;
    margin-left: auto;
}


/* Mobil */

@media (max-width: 980px) {
    .content {
        grid-template-columns: 1fr;
    }

    .legend-card {
        order: -1;
    }

    .legend-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (max-width: 720px) {
    .topbar {
        padding: 11px 15px;
    }

    #signedInUser {
        display: none;
    }

    .content {
        width: 100%;
        margin: 0;
        display: block;
    }

    .calendar-card,
    .legend-card {
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .legend-card {
        display: none;
    }

    .calendar-toolbar {
        padding: 16px 12px 10px;
        align-items: stretch;
        flex-direction: column;
    }

    .toolbar-help {
        display: none;
    }

    .toolbar-actions {
        justify-content: space-between;
    }

    .month-title-row {
        padding: 0 12px 12px;
    }

    .calendar-weekdays div {
        padding: 8px 2px;
        font-size: 0.7rem;
    }

    .calendar-day {
        min-height: 92px;
        padding: 4px;
    }

    .calendar-event {
        padding: 4px;
        border-left-width: 3px;
    }

    .event-title {
        font-size: 0.7rem;
    }

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

    .dialog-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .dialog-actions-right {
        width: 100%;
        margin-left: 0;
    }

    .dialog-actions-right button,
    .danger-button {
        flex: 1;
    }
}


/* ---------------------------------------------------------
   Step 6F - Faste ringninger
   --------------------------------------------------------- */

.dialog-subtitle {
    margin-top: 3px;
    color: #71808a;
    font-size: 0.85rem;
}

.recurring-dialog {
    width: min(100%, 760px);
}

.recurring-form {
    padding: 20px;
}

.recurring-schedules {
    display: grid;
    gap: 16px;
}

.recurring-schedule-card {
    padding: 17px;
    border: 1px solid #dce2e5;
    border-radius: 10px;
    background: #fafbfb;
}

.recurring-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.recurring-heading-row h3 {
    margin: 0;
    font-size: 1.05rem;
}

.recurring-profile {
    margin-top: 4px;
    color: #728089;
    font-size: 0.84rem;
}

.switch-label {
    display: flex !important;
    align-items: center;
    gap: 7px;
    margin: 0 !important;
    font-weight: 600;
}

.switch-label input {
    width: auto !important;
    margin: 0;
}

.recurring-schedule-card > label {
    display: block;
    margin: 15px 0 7px;
    font-weight: 600;
}

.recurring-time {
    width: 170px !important;
}

.weekday-title {
    margin-top: 16px;
    margin-bottom: 7px;
    font-weight: 600;
}

.weekday-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(52px, 1fr));
    gap: 7px;
}

.weekday-option {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 0 !important;
    padding: 8px 5px;
    border: 1px solid #cdd5d8;
    border-radius: 7px;
    background: white;
    font-size: 0.82rem;
    font-weight: 600;
}

.weekday-option input {
    width: auto !important;
    margin: 0;
}

.summary-line {
    display: block;
}

.summary-line + .summary-line {
    margin-top: 3px;
}

@media (max-width: 720px) {
    .toolbar-actions {
        flex-wrap: wrap;
    }

    #recurringBellButton {
        flex: 1 1 auto;
    }

    .recurring-heading-row {
        align-items: center;
    }

    .recurring-time {
        width: 100% !important;
    }

    .weekday-grid {
        grid-template-columns:
            repeat(4, minmax(58px, 1fr));
    }
}


/* ---------------------------------------------------------
   Trin 9H.5 - Driftsoverblik og navigation
   --------------------------------------------------------- */
.site-navigation {
    display: flex;
    gap: 8px;
    padding: 12px max(20px, calc((100% - 1500px) / 2));
    background: #e8eeec;
    border-bottom: 1px solid #d7e1dc;
}
.site-nav-button {
    border: 1px solid transparent;
    background: transparent;
    color: #304b47;
    padding: 10px 20px;
    font-weight: 650;
    border-radius: 8px;
}
.site-nav-button.active {
    color: white;
    background: #243d3a;
}
.site-nav-button:not(.active):hover { background: #d9e4df; }
.dashboard-shell {
    width: min(1500px, calc(100% - 40px));
    margin: 28px auto 40px;
    display: grid;
    gap: 20px;
}
.dashboard-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.dashboard-heading h1 { margin: 3px 0 7px; font-size: 1.8rem; }
.eyebrow { margin: 0; color: #647f74; font-size: .82rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.dashboard-overview { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.dashboard-metric, .dashboard-section, .dashboard-device {
    background: white;
    border: 1px solid #dce2e5;
    border-radius: 13px;
    box-shadow: 0 6px 24px rgba(30,45,53,.045);
}
.dashboard-metric { display:flex; flex-direction:column; gap:10px; padding:22px; }
.dashboard-metric > span { font-size:.86rem; color:#63717b; }
.dashboard-metric strong { font-size:1.25rem; }
.dashboard-section { padding:22px; }
.dashboard-section-heading { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:16px; }
.dashboard-section-heading h2 { margin:0; font-size:1.17rem; }
.dashboard-message { color:#6c7b83; font-size:.88rem; margin-bottom:10px; min-height:20px; }
.dashboard-device-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(270px,1fr)); gap:14px; }
.dashboard-device { box-shadow:none; padding:18px; }
.dashboard-device-header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:12px; }
.dashboard-device h3 { margin:0; font-size:1rem; }
.dashboard-device-subtitle { display:block; color:#63717b; font-size:.83rem; margin-top:4px; }
.status-pill { border-radius:40px; padding:5px 10px; font-size:.8rem; font-weight:650; white-space:nowrap; }
.status-pill.online { background:#e8f4ea; color:#236839; }
.status-pill.delayed { background:#fff3d8; color:#815600; }
.status-pill.offline { background:#fde9e9; color:#a02c35; }
.status-pill.unknown { background:#edf0f2; color:#596875; }
.dashboard-device dl { display:grid; grid-template-columns:auto minmax(0,1fr); gap:10px 12px; font-size:.89rem; margin:0; }
.dashboard-device dt { color:#65737b; }
.dashboard-device dd { margin:0; text-align:right; overflow-wrap:anywhere; }
.dashboard-hint { color:#69777f; font-size:.84rem; line-height:1.5; margin:15px 0 0; }
.dashboard-table-wrap { overflow-x:auto; }
.dashboard-log-table { border-collapse:collapse; width:100%; min-width:650px; font-size:.89rem; }
.dashboard-log-table th,.dashboard-log-table td { padding:12px 10px; border-bottom:1px solid #e7ebee; text-align:left; vertical-align:top; }
.dashboard-log-table th { color:#53626b; font-size:.8rem; background:#f7f9f9; }
.dashboard-log-table td:first-child { white-space:nowrap; }
.dashboard-log-table tr:last-child td { border-bottom:0; }
.dashboard-severity { font-size:.75rem; border-radius:5px; padding:2px 6px; margin-right:6px; background:#edf0f2; }
.dashboard-severity.error { color:#a02c35; background:#fde9e9; }
.dashboard-severity.warning { color:#815600; background:#fff3d8; }
@media(max-width:720px) {
    .site-navigation { padding:10px 12px; }
    .dashboard-shell { width:calc(100% - 24px); margin:18px auto; }
    .dashboard-heading { align-items:flex-start; flex-direction:column; }
    .dashboard-heading h1 { font-size:1.45rem; }
    .dashboard-overview { grid-template-columns:1fr; gap:8px; }
    .dashboard-metric { padding:15px; gap:5px; }
    .dashboard-section { padding:14px; }
    .dashboard-section-heading { align-items:flex-start; }
    .dashboard-device-grid { grid-template-columns:1fr; }
}
