:root {
    --bg: #f2f8f7;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #475569;
    --brand: #0d9488;
    --danger: #dc2626;
    --warning: #d97706;
    --success: #15803d;
    --line: #d1e5e3;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Avenir Next", "Segoe UI", sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top right, #c8f7f2 0%, var(--bg) 55%);
}

.app-shell {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px;
}

.topbar {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

h1, h2, h3 { margin: 0; }
h1 { font-size: 1.5rem; }

.brand {
    display: block;
    position: relative;
    text-decoration: none;
    line-height: 0;
    width: 100%;
}

.brand::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 48%;
    border-radius: 0 0 10px 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
    pointer-events: none;
    z-index: 1;
}

.brand-logo {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
    position: relative;
    z-index: 0;
}

.brand-title {
    position: absolute;
    left: 14px;
    bottom: 12px;
    color: #ffffff;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: 0.01em;
    font-size: clamp(10px, 2.5vw, 24px);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    z-index: 2;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
}

.control-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
}

input, select, button { font: inherit; }

input, select {
    border: 1px solid #bfd7d4;
    border-radius: 10px;
    padding: 9px 11px;
}

button {
    border: 0;
    border-radius: 10px;
    background: var(--brand);
    color: white;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
}

button.secondary {
    background: #e2e8f0;
    color: #0f172a;
}

button i.fa {
    margin-right: 6px;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#clearButton {
		margin-right: auto;
}

.muted, .help-text { color: var(--muted); }
.hidden { display: none !important; }

#loginForm {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.user-form {
    display: grid;
    gap: 10px;
    margin: 12px 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.user-form > .muted {
    grid-column: 1 / -1;
    margin: 0;
}

.inline-toggle {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.user-form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.users-table-wrap {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
}

.users-table th,
.users-table td {
    border-bottom: 1px solid var(--line);
    padding: 8px 6px;
    text-align: left;
    vertical-align: middle;
}

.users-table td.actions {
    white-space: nowrap;
}

.users-table td.actions button {
    margin-right: 6px;
}

.status-chip {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}

.status-chip.active {
    background: #dcfce7;
    color: #166534;
}

.status-chip.inactive {
    background: #fee2e2;
    color: #991b1b;
}

.weeks-grid {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.week-row {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    display: grid;
    grid-template-columns: 90px 1fr auto;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    background: #fbfffe;
}

.week-refresh-button {
    min-width: 44px;
    padding: 9px 10px;
}

.week-refresh-button i.fa {
    margin-right: 0;
}

.week-status { font-weight: 700; }
.status-ledig { color: var(--success); }
.status-delvis { color: var(--warning); }
.status-reserveret { color: var(--danger); }
.status-vinterlukket { color: #475569; }

dialog {
    width: min(520px, calc(100vw - 24px));
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0;
}

.dialog-form {
    padding: 14px;
    display: grid;
    gap: 12px;
}

.days-grid {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    display: grid;
    gap: 8px;
}

.day-selection-row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) 96px 96px;
    align-items: center;
    gap: 8px;
    min-height: 32px;
}

.day-selection-row > label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

.days-grid.hide-winter-controls .day-selection-row {
    grid-template-columns: minmax(150px, 1fr) 96px;
}

.days-grid.hide-winter-controls .day-selection-row > :nth-child(3) {
    display: none;
}

.days-grid.hide-winter-controls .day-winter-closed input[data-kind="reservation"] {
    cursor: not-allowed;
    opacity: 0.45;
}

.day-selection-header {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-align: center;
    border-bottom: 1px solid var(--line);
    padding-bottom: 6px;
}

.day-selection-header span:first-child {
    text-align: left;
}

.select-all-row {
    border-bottom: 1px solid var(--line);
    padding-bottom: 6px;
}

.day-selection-row.day-locked {
    color: #b91c1c;
}

.day-selection-row.day-locked .day-name {
    text-decoration: line-through;
}

.day-selection-row.day-winter-closed {
    color: #475569;
    background: #f1f5f9;
    border-radius: 6px;
    padding: 0 4px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 18px;
}

@media (max-width: 640px) {
    .week-row { grid-template-columns: 70px 1fr auto; }
    .controls { flex-direction: column; align-items: stretch; }
    .control-buttons { width: 100%; }
    .dialog-actions { gap: 28px; }
    .user-form { grid-template-columns: 1fr; }
    .topbar #logoutButton {
        width: max-content;
    }
    .brand-title {
        left: 10px;
        bottom: 9px;
    }
    .day-selection-row {
        grid-template-columns: minmax(120px, 1fr) 82px 82px;
        gap: 4px;
    }
    .days-grid.hide-winter-controls .day-selection-row {
        grid-template-columns: minmax(120px, 1fr) 82px;
    }
    .day-selection-header {
        font-size: 0.72rem;
    }
}

.no-line-height {
    line-height: 0;
}
