/* User self-service + roster view switch */
.self-service-page { max-width: 1180px; }
.self-service-header { margin-bottom: 22px; }
.profile-card,
.my-unavailability-add-panel,
.my-unavailability-list-panel { padding: 24px 26px; }
.profile-identity { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.profile-avatar { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; background: #315f55; color: #fff; font-size: 20px; font-weight: 900; }
.profile-identity h2 { margin: 2px 0 4px; font-size: 27px; }
.profile-form { display: grid; gap: 22px; }
.profile-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.profile-form-grid label,
.my-unavailability-add-form label,
.my-unavailability-edit-grid label { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 800; }
.profile-form-grid input,
.my-unavailability-add-form input,
.my-unavailability-edit-grid input { width: 100%; min-height: 44px; }
.profile-readonly-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.profile-readonly-grid > div { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.profile-readonly-grid span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.profile-readonly-grid strong { color: var(--ink); font-size: 13px; }
.profile-actions { display: flex; justify-content: flex-end; }
.self-service-note { margin: 0; color: var(--muted); font-size: 11.5px; }
.self-service-empty { padding: 36px; text-align: center; }
.self-service-empty h2 { margin: 6px 0 8px; }
.self-service-panel-head { margin-bottom: 18px; }
.my-unavailability-add-form { display: grid; grid-template-columns: 180px 180px minmax(280px, 1fr) auto; gap: 12px; align-items: end; }
.my-unavailability-add-form .button { min-height: 44px; white-space: nowrap; }
.my-unavailability-list-panel { margin-top: 18px; }
.my-unavailability-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.my-unavailability-actions form { margin: 0; }
.self-service-empty-inline { padding: 28px 10px; color: var(--muted); text-align: center; }
.my-unavailability-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.my-unavailability-edit-grid .full { grid-column: 1 / -1; }

.roster-view-switch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 4px 14px rgba(31,48,42,.04);
}
.roster-view-switch button {
    min-width: 104px;
    padding: 8px 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    text-align: center;
    font: inherit;
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
    cursor: pointer;
}
.roster-view-switch button:hover { color: var(--ink); background: var(--soft); }
.roster-view-switch button.active { background: #315f55; color: #fff; }
.roster-view-switch-wrap { display: flex; justify-content: flex-end; margin: 0 0 14px; }

.roster-compact-view {
    display: grid;
    gap: 16px;
    margin-top: 14px;
}
.roster-compact-view[hidden] { display: none !important; }
.roster-compact-totals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    max-width: 520px;
}
.roster-compact-totals > div {
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
}
.roster-compact-totals strong {
    display: block;
    color: var(--ink);
    font-size: 22px;
    line-height: 1;
}
.roster-compact-totals span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.roster-compact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 14px;
}
.roster-compact-date {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface);
}
.roster-compact-date-head {
    padding: 12px 15px;
    background: #365f55;
    color: #fff;
}
.roster-compact-date:nth-child(even) .roster-compact-date-head { background: #4e8176; }
.roster-compact-date-head h2 {
    margin: 0;
    color: inherit;
    font-size: 17px;
    line-height: 1.2;
}
.roster-compact-services { display: grid; }
.roster-compact-service + .roster-compact-service { border-top: 1px solid var(--line); }
.roster-compact-service h3 {
    margin: 0;
    padding: 9px 14px;
    background: var(--soft);
    color: #315f55;
    font-size: 12px;
    font-weight: 900;
}
.roster-compact-assignments { display: grid; }
.roster-compact-assignment {
    display: grid;
    grid-template-columns: minmax(100px, .9fr) minmax(0, 1.4fr);
    gap: 14px;
    align-items: center;
    min-height: 36px;
    padding: 8px 14px;
    border-top: 1px solid var(--line);
}
.roster-compact-assignment:first-child { border-top: 0; }
.roster-compact-role {
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 800;
}
.roster-compact-assignment strong {
    color: var(--ink);
    font-size: 12px;
    font-weight: 850;
}
.roster-compact-empty {
    min-height: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 36px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    text-align: center;
}
.roster-compact-empty strong { color: var(--ink); font-size: 20px; }
.roster-compact-empty span { color: var(--muted); font-size: 13px; }

html[data-theme="dark"] .profile-avatar { background: #4e8176; }
html[data-theme="dark"] .profile-readonly-grid > div { background: #1d2b25; border-color: #35463e; }
html[data-theme="dark"] .roster-view-switch { background: #17231e; border-color: #35463e; }
html[data-theme="dark"] .roster-view-switch button:hover { background: #24332c; }
html[data-theme="dark"] .roster-view-switch button.active { background: #4e8176; color: #f3f6f4; }
html[data-theme="dark"] .roster-compact-totals > div,
html[data-theme="dark"] .roster-compact-date,
html[data-theme="dark"] .roster-compact-empty { background: #17231e; border-color: #35463e; }
html[data-theme="dark"] .roster-compact-service + .roster-compact-service,
html[data-theme="dark"] .roster-compact-assignment { border-color: #2b3c34; }
html[data-theme="dark"] .roster-compact-service h3 { background: #1d2b25; color: #aebdb6; }
html[data-theme="dark"] .roster-compact-assignment strong { color: #d5ddd8; }
html[data-theme="dark"] .roster-compact-role { color: #9aa8a1; }

@media (max-width: 860px) {
    .profile-form-grid { grid-template-columns: 1fr; }
    .profile-readonly-grid { grid-template-columns: 1fr; }
    .my-unavailability-add-form { grid-template-columns: 1fr 1fr; }
    .my-unavailability-reason { grid-column: 1 / -1; }
    .my-unavailability-add-form .button { grid-column: 1 / -1; width: 100%; }
    .roster-compact-grid { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
}
@media (max-width: 600px) {
    .self-service-page { width: calc(100% - 20px); }
    .profile-card,
    .my-unavailability-add-panel,
    .my-unavailability-list-panel { padding: 18px 16px; }
    .profile-identity { align-items: flex-start; }
    .my-unavailability-add-form,
    .my-unavailability-edit-grid { grid-template-columns: 1fr; }
    .my-unavailability-reason,
    .my-unavailability-edit-grid .full { grid-column: auto; }
    .roster-view-switch-wrap { justify-content: stretch; }
    .roster-view-switch { width: 100%; }
    .roster-view-switch button { flex: 1; min-width: 0; }
    .roster-compact-totals { grid-template-columns: repeat(3, 1fr); max-width: none; }
    .roster-compact-grid { grid-template-columns: 1fr; }
}

/* Person-centric Compact View */
.roster-compact-people {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 14px;
}

.roster-compact-person {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface);
}

.roster-compact-person-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    padding: 11px 14px;
    background: #365f55;
    color: #fff;
}

.roster-compact-person:nth-child(even) .roster-compact-person-head {
    background: #4e8176;
}

.roster-compact-person-head h2 {
    margin: 0;
    color: inherit;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.15;
}

.roster-compact-person-head > span {
    flex: 0 0 auto;
    color: rgba(255, 255, 255, .78);
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.roster-compact-person-schedule {
    display: grid;
}

.roster-compact-person-row {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-height: 48px;
    padding: 8px 12px;
    border-top: 1px solid var(--line);
}

.roster-compact-person-row:first-child {
    border-top: 0;
}

.roster-compact-when {
    display: grid;
    gap: 2px;
}

.roster-compact-when strong {
    color: var(--ink);
    font-size: 11.5px;
    font-weight: 900;
}

.roster-compact-when span {
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 800;
}

.roster-compact-person-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-start;
}

.roster-compact-role-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border: 1px solid #d8e2dd;
    border-radius: 999px;
    background: #f2f6f4;
    color: #315f55;
    font-size: 10.5px;
    font-weight: 850;
    line-height: 1;
}

html[data-theme="dark"] .roster-compact-person {
    background: #17231e;
    border-color: #35463e;
}

html[data-theme="dark"] .roster-compact-person-row {
    border-color: #2b3c34;
}

html[data-theme="dark"] .roster-compact-when strong {
    color: #d5ddd8;
}

html[data-theme="dark"] .roster-compact-when span {
    color: #92a099;
}

html[data-theme="dark"] .roster-compact-role-pill {
    border-color: #3a4d44;
    background: #213029;
    color: #aebdb6;
}

@media (max-width: 860px) {
    .roster-compact-people {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 600px) {
    .roster-compact-people {
        grid-template-columns: 1fr;
    }
    .roster-compact-person-row {
        grid-template-columns: 92px minmax(0, 1fr);
    }
}
