:root {
    --bg: #ececec;
    --toolbar: #ffffff;
    --text: #2b2b2b;
    --muted: #6b6b6b;
    --create: #e05c6c;
    --create-hover: #c94c5b;
    --shift: #4a4a4a;
    --empty: #e8d7ea;
    --border: #d8d8d8;
    --error: #c62828;
    --success: #2e7d32;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
}

h1, h2, h3 { font-weight: 650; margin: 0 0 0.6rem; }

a { color: #2b6cb0; }

.app-shell { min-height: 100vh; }

.toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 1rem;
    background: var(--toolbar);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.toolbar-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1;
    align-items: center;
}

.toolbar-filters select,
.week-picker {
    background: #f3f3f3;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.45rem 0.7rem;
    font: inherit;
}

.week-picker {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 16rem;
    justify-content: space-between;
}

.toolbar-actions {
    display: flex;
    gap: 0.15rem;
}

.btn-create {
    background: var(--create);
    color: white;
    border: 0;
    border-radius: 4px;
    padding: 0.7rem 1.1rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
}

.btn-create:hover { background: var(--create-hover); }

.btn-primary, .btn-secondary, .link-btn, .add-period, .icon-btn, .candidate {
    font: inherit;
    cursor: pointer;
}

.btn-primary {
    background: var(--create);
    color: white;
    border: 0;
    border-radius: 4px;
    padding: 0.55rem 1rem;
}

.btn-secondary {
    background: #f3f3f3;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 0.9rem;
}

.icon-btn {
    background: transparent;
    border: 0;
    color: #555;
    padding: 0.4rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover { background: #f0f0f0; }

.schedule-body { padding: 0.4rem 0 2rem; }

.day-section { background: white; margin: 0.35rem 0.6rem; border-radius: 2px; }

.day-header {
    width: 100%;
    text-align: left;
    background: white;
    border: 0;
    border-bottom: 1px solid #efefef;
    padding: 0.55rem 0.8rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.chevron { display: inline-block; transition: transform 0.15s; }
.chevron.collapsed { transform: rotate(-90deg); }

.shift-block { padding: 0 0.5rem 0.4rem; }

.shift-header {
    background: var(--shift);
    color: white;
    padding: 0.35rem 0.7rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.35rem;
}

.shift-header-actions button {
    background: transparent;
    color: #ddd;
    border: 0;
    cursor: pointer;
    margin-left: 0.6rem;
}

.staff-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.7rem;
    margin-top: 2px;
}

.staff-row span, .staff-hours {
    color: #333;
}

.staff-row > div:first-child {
    display: flex;
    gap: 0.8rem;
    align-items: baseline;
}

.staff-hours { display: flex; gap: 0.8rem; align-items: center; }

.empty-slot {
    background: var(--empty);
    padding: 0.25rem 0.5rem;
    margin-top: 2px;
    min-height: 1.8rem;
}

.add-period {
    background: white;
    border: 1px solid #c8b4cc;
    border-radius: 3px;
    padding: 0.15rem 0.5rem;
    font-size: 12px;
}

.page-pad { padding: 1.2rem 1.4rem 2.5rem; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1rem; }
.back-link { display: inline-block; margin-bottom: 0.3rem; }
.muted { color: var(--muted); }
.empty-hint { color: var(--muted); padding: 1rem; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table th, .data-table td {
    text-align: left;
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid #eee;
}

.role-pill {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    margin: 0 0.2rem 0.2rem 0;
}

.timeline { padding: 0.4rem 0.8rem 0.6rem; }

.timeline-hours {
    position: relative;
    height: 1.3rem;
    margin: 0 7.5rem 0 11.5rem;
    color: var(--muted);
    font-size: 11px;
}

.timeline-hour {
    position: absolute;
    transform: translateX(-50%);
    white-space: nowrap;
}

.timeline-row {
    display: grid;
    grid-template-columns: 11rem 1fr auto;
    gap: 0.5rem;
    align-items: center;
    margin: 0.25rem 0;
}

.timeline-name {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.timeline-track {
    position: relative;
    height: 1.7rem;
    background: #f4f4f4;
    border-radius: 3px;
    overflow: hidden;
}

.timeline-bar {
    position: absolute;
    top: 2px;
    bottom: 2px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #222;
    min-width: 4rem;
    padding: 0 0.35rem;
    overflow: hidden;
}

.candidate-selected { outline: 2px solid var(--create); background: #fff5f6; }

.role-checks {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 0.7rem;
}

.role-checks legend { font-weight: 600; padding: 0 0.25rem; }

.settings-form { max-width: 40rem; }
.settings-card {
    background: white;
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
    border-radius: 6px;
}

.auth-card {
    max-width: 28rem;
    margin: 4rem auto;
    background: white;
    padding: 1.6rem;
    border-radius: 8px;
}

.form-grid {
    display: grid;
    gap: 0.7rem;
    margin: 0.8rem 0;
}

.form-grid label, .avail-day label { display: grid; gap: 0.25rem; }

input[type="text"], input[type="password"], input[type="email"], select, .form-grid input {
    font: inherit;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.check-row {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 0.45rem;
}

.form-error { color: var(--error); }
.demo-box {
    margin-top: 1.2rem;
    background: #f7f7f7;
    padding: 0.8rem;
    border-radius: 6px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 1rem;
    z-index: 50;
}

.modal {
    background: white;
    width: min(640px, 100%);
    border-radius: 8px;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
}

.modal-header, .modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #eee;
}

.modal-footer {
    border-bottom: 0;
    border-top: 1px solid #eee;
    gap: 0.5rem;
    justify-content: flex-end;
}

.modal-body { padding: 1rem; overflow: auto; }

.candidate-list, .invite-list, .invite-results { list-style: none; padding: 0; margin: 0.6rem 0; }
.candidate {
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0.55rem 0.6rem;
    border: 1px solid #eee;
    background: #fafafa;
    margin-bottom: 0.35rem;
}

.match { font-size: 12px; font-weight: 600; }
.match-Available { color: #2e7d32; }
.match-Partial { color: #ed6c02; }
.match-Unavailable { color: var(--error); }
.match-Unknown { color: var(--muted); }

.avail-days { display: grid; gap: 0.7rem; margin: 1rem 0; }
.avail-day { background: white; padding: 0.8rem; border-radius: 6px; }
.time-row { display: flex; gap: 0.8rem; }

.toast-host {
    position: fixed;
    top: 0.8rem;
    right: 0.8rem;
    z-index: 80;
    display: grid;
    gap: 0.4rem;
}

.toast {
    padding: 0.7rem 1rem;
    border-radius: 4px;
    color: white;
    min-width: 16rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.toast-error { background: var(--error); }
.toast-success { background: var(--success); }
.toast-info { background: #455a64; }

.db-settings {
    margin: 2rem auto;
    max-width: 48rem;
    background: white;
    padding: 1.5rem;
    border: 2px solid var(--error);
}

.db-settings-grid { display: grid; grid-template-columns: 12rem 1fr; gap: 0.4rem 1rem; }
.db-settings-grid dt { font-weight: 600; }
.db-error { color: var(--error); }
.db-hint { margin-top: 1rem; color: var(--muted); }

.week-nav { display: flex; gap: 0.5rem; margin: 0.6rem 0 1rem; }

#blazor-error-ui {
    background: #b32121;
    color: white;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

@media print {
    .no-print, .toolbar-actions, .toolbar .btn-create { display: none !important; }
    .toolbar { position: static; }
    .day-section { break-inside: avoid; }
}

h1:focus { outline: none; }
.validation-message { color: var(--error); }
