:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --brand: #0f766e;
    --brand-dark: #0b5f59;
    --danger: #dc2626;
    --warn: #d97706;
    --ok: #16a34a;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    --radius: 14px;
    font-family: "Segoe UI", "Noto Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
}

a { color: inherit; text-decoration: none; }

.app-shell {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #0f172a;
    color: #e2e8f0;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-user {
    margin-top: auto;
    padding: 0.75rem 0.5rem 0.25rem;
    border-top: 1px solid rgba(148,163,184,0.2);
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at top left, rgba(20,184,166,0.18), transparent 40%),
        linear-gradient(160deg, #0f172a, #1e293b 45%, #0f766e);
    padding: 1.5rem;
}

.login-wrap { width: min(420px, 100%); }
.login-card h1 { margin: 0 0 0.35rem; font-size: 1.5rem; }
.login-card .muted { margin-top: 0; margin-bottom: 1rem; }

.brand {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.5rem;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(145deg, #14b8a6, #0f766e);
    display: grid;
    place-items: center;
    font-weight: 700;
    color: white;
}

.brand strong { display: block; font-size: 1.05rem; }
.brand small { color: #94a3b8; }

.nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nav a {
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    color: #cbd5e1;
}

.nav a:hover { background: rgba(148, 163, 184, 0.12); color: white; }
.nav a.active { background: rgba(20, 184, 166, 0.18); color: #5eead4; font-weight: 600; }

.content {
    padding: 1.5rem 1.75rem 2.5rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.7rem;
}

.page-header p {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem;
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat strong {
    display: block;
    font-size: 1.8rem;
    margin-top: 0.35rem;
}

.stat span { color: var(--muted); font-size: 0.9rem; }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
    color: var(--muted);
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    font: inherit;
    color: var(--text);
    background: white;
}

textarea { min-height: 80px; resize: vertical; }

.btn {
    border: none;
    border-radius: 10px;
    padding: 0.65rem 1rem;
    font: inherit;
    cursor: pointer;
    background: var(--brand);
    color: white;
    font-weight: 600;
}

.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: #e2e8f0; color: #0f172a; }
.btn.secondary:hover { background: #cbd5e1; }
.btn.danger { background: var(--danger); }
.btn.small { padding: 0.4rem 0.7rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.table-wrap { overflow: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 0.75rem 0.6rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th { color: var(--muted); font-size: 0.85rem; font-weight: 600; }

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    background: #eef2ff;
    color: #3730a3;
}

.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #ffedd5; color: #9a3412; }
.badge.muted { background: #f1f5f9; color: #475569; }

.shift-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
}

.muted { color: var(--muted); }
.error { color: var(--danger); margin: 0.5rem 0; }
.ok-msg { color: var(--ok); margin: 0.5rem 0; }

.days {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.day-check {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    flex-direction: row;
}

.roster-editor-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.roster-editor-head h2 { margin: 0 0 0.25rem; }

.roster-scroll { overflow: auto; }

.roster-grid {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}

.roster-grid th,
.roster-grid td {
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    padding: 0.55rem;
    vertical-align: middle;
}

.roster-grid th:last-child,
.roster-grid td:last-child { border-right: none; }

.roster-grid tbody tr:last-child th,
.roster-grid tbody tr:last-child td { border-bottom: none; }

.roster-grid thead th {
    background: #0f172a;
    color: #e2e8f0;
    text-align: center;
    font-size: 0.85rem;
}

.roster-grid tbody th {
    background: #f8fafc;
    width: 88px;
    font-size: 0.9rem;
}

.roster-select {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.45rem 0.5rem;
    font: inherit;
    background: white;
}

.roster-select:disabled {
    background: #f1f5f9;
    color: #64748b;
}

.pattern-cell {
    line-height: 1.7;
}

.mini-shift {
    display: inline-block;
    border-left: 3px solid #64748b;
    background: #f8fafc;
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    margin: 0.1rem 0.15rem 0.1rem 0;
    font-size: 0.8rem;
    white-space: nowrap;
}

.mini-shift b { font-weight: 700; }

.totals-card {
    margin-top: 1.25rem;
}

.totals-head h2 {
    margin: 0 0 0.25rem;
    font-size: 1.2rem;
}

.totals-head p { margin: 0 0 1rem; }

.totals-table td,
.totals-table th {
    white-space: nowrap;
}

.totals-table tr.row-over td {
    background: #fff7ed;
}

.totals-table tr.row-under td {
    background: #f8fafc;
}

.entry-hours {
    font-variant-numeric: tabular-nums;
}

.calendar-wrap {
    padding: 0.85rem;
    overflow: auto;
}

.calendar-head,
.calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    min-width: 720px;
}

.calendar-head {
    margin-bottom: 0;
    border-bottom: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.calendar-head div {
    background: #0f172a;
    color: #e2e8f0;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.55rem 0.35rem;
    letter-spacing: 0.02em;
}

.calendar {
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.day-cell {
    min-height: 118px;
    background: #fff;
    padding: 0.45rem 0.4rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.day-cell.empty {
    background: #f1f5f9;
    min-height: 118px;
}

.day-cell.weekend {
    background: #f8fafc;
}

.day-cell .day-num {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-weight: 700;
    font-size: 0.92rem;
}

.day-cell .week-tag {
    font-size: 0.72rem;
    font-weight: 500;
}

.day-entries {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
}

.entry {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.05rem;
    width: 100%;
    text-align: left;
    border: none;
    border-left: 3px solid #3b82f6;
    background: #f8fafc;
    border-radius: 6px;
    padding: 0.3rem 0.4rem;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.entry:hover { background: #ecfeff; outline: 1px solid #99f6e4; }
.entry.replacement { background: #fff7ed; }
.entry.needs-cover {
    background: #fef2f2;
    outline: 1px dashed #f87171;
}
.entry.with-absence:not(.needs-cover) {
    background: #fffbeb;
}
.entry-shift { font-size: 0.78rem; font-weight: 700; line-height: 1.2; }
.entry-name { font-size: 0.78rem; line-height: 1.2; }
.entry-note { font-size: 0.7rem; color: var(--muted); line-height: 1.2; }

.absence-chip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.4rem;
    color: white;
    border-radius: 6px;
    padding: 0.28rem 0.4rem;
    font-size: 0.75rem;
    line-height: 1.2;
}

.absence-chip strong { font-weight: 700; }
.absence-flag {
    margin-left: auto;
    background: rgba(0,0,0,0.2);
    border-radius: 999px;
    padding: 0.05rem 0.35rem;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.day-cell.has-absence {
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.15);
}

.absence-alert {
    margin: 0.75rem 0;
    padding: 0.65rem 0.75rem;
    background: #fff7ed;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: grid;
    place-items: center;
    padding: 1rem;
    z-index: 40;
}

.modal {
    width: min(520px, 100%);
    background: white;
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25);
}

.modal h2 { margin-top: 0; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1rem;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.legal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin: 1rem 0 0;
    font-size: 0.8rem;
    opacity: 0.9;
}

.legal-links a,
.sidebar-legal a,
.legal-nav a,
.legal-footer a,
.legal-doc a {
    color: var(--brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.sidebar-legal {
    margin-top: 0.75rem;
    display: grid;
    gap: 0.25rem;
    font-size: 0.75rem;
}

.sidebar-legal .linkish {
    background: none;
    border: 0;
    padding: 0;
    color: #94a3b8;
    text-align: left;
    cursor: pointer;
    text-decoration: underline;
    font: inherit;
}

.legal-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(20,184,166,0.12), transparent 35%),
        linear-gradient(180deg, #f8fafc, #eef2f7);
    padding: 1.25rem;
}

.legal-top {
    max-width: 880px;
    margin: 0 auto 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.legal-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    font-size: 0.9rem;
}

.legal-main {
    max-width: 880px;
    margin: 0 auto;
    padding: 1.5rem 1.75rem 2rem;
}

.legal-footer {
    max-width: 880px;
    margin: 1rem auto 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
}

.legal-doc h1 { margin-top: 0; font-size: 1.75rem; }
.legal-doc h2 { margin-top: 1.75rem; font-size: 1.2rem; }
.legal-doc h3 { margin-top: 1.1rem; font-size: 1.05rem; }
.legal-doc p, .legal-doc li { line-height: 1.55; }
.legal-doc ul { padding-left: 1.2rem; }

.legal-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0 1rem;
    font-size: 0.92rem;
}

.legal-table th,
.legal-table td {
    border: 1px solid var(--line);
    padding: 0.55rem 0.65rem;
    text-align: left;
    vertical-align: top;
}

.legal-table th { background: #f8fafc; }

.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.92);
    color: #e2e8f0;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.25);
}

.cookie-banner a { color: #5eead4; }

.cookie-banner-inner {
    max-width: 980px;
    margin: 0 auto;
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
}

.cookie-banner h2 {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
}

.cookie-banner p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.45;
    max-width: 62ch;
    color: #cbd5e1;
}

.cookie-banner-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cookie-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.45);
    z-index: 1300;
}

.cookie-modal {
    position: fixed;
    z-index: 1301;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(480px, calc(100vw - 2rem));
    padding: 1.25rem;
}

.cookie-option {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin: 0.85rem 0;
}

.cookie-option small {
    display: block;
    color: var(--muted);
    margin-top: 0.2rem;
}

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: sticky; top: 0; z-index: 5; }
    .cookie-banner-inner { align-items: stretch; }
}
