:root {
    color-scheme: light;
    --bg: #f6f3fb;
    --surface: rgba(255, 255, 255, 0.96);
    --surface-strong: #ffffff;
    --surface-muted: #f3eff8;
    --text: #171221;
    --muted: #6d6676;
    --border: rgba(74, 52, 94, 0.14);
    --primary: #7c3aed;
    --primary-strong: #6d28d9;
    --danger: #c43232;
    --danger-soft: #fde8e8;
    --success: #168554;
    --success-soft: #def7ec;
    --warning: #b56a08;
    --needed: #f7d9dc;
    --needed-border: #d9545f;
    --no-cover: #e5e2e8;
    --no-cover-text: #6f6875;
    --shadow: 0 18px 50px rgba(46, 16, 101, 0.11);
    --small-shadow: 0 8px 24px rgba(46, 16, 101, 0.09);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f0b16;
    --surface: rgba(29, 23, 40, 0.96);
    --surface-strong: #211a2d;
    --surface-muted: #181220;
    --text: #f8f4ff;
    --muted: #b7afc1;
    --border: rgba(232, 222, 244, 0.13);
    --danger-soft: #4a2026;
    --success-soft: #153c2d;
    --needed: #57272d;
    --needed-border: #ef7f89;
    --no-cover: #302a35;
    --no-cover-text: #b4acba;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
    --small-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(196, 181, 253, 0.5), transparent 34rem),
        var(--bg);
}

html[data-theme="dark"] {
    background:
        radial-gradient(circle at top left, rgba(77, 44, 125, 0.5), transparent 34rem),
        var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
}

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

button,
summary,
select {
    touch-action: manipulation;
}

button:disabled {
    cursor: wait;
    opacity: 0.68;
}

.app-shell {
    width: min(100% - 24px, 1180px);
    margin: 0 auto;
    padding: max(20px, env(safe-area-inset-top)) 0
        calc(98px + env(safe-area-inset-bottom));
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(1.5rem, 5vw, 2.15rem);
    letter-spacing: -0.04em;
}

h2 {
    margin-bottom: 0;
    letter-spacing: -0.035em;
}

.eyebrow {
    margin: 0 0 3px;
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.muted {
    color: var(--muted);
    line-height: 1.55;
}

/* Login */
.auth-card {
    width: min(100%, 440px);
    margin: clamp(24px, 8vh, 80px) auto;
    padding: clamp(24px, 5vw, 40px);
    border: 1px solid var(--border);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.brand-mark {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: white;
    font-size: 1.45rem;
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(124, 58, 237, 0.25);
}

.auth-card .eyebrow {
    margin-top: 18px;
}

.stack {
    display: grid;
    gap: 12px;
    margin-top: 24px;
}

.stack.compact {
    margin-top: 16px;
}

label {
    font-size: 0.9rem;
    font-weight: 750;
}

input,
select,
textarea {
    width: 100%;
    min-height: 50px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    outline: none;
    background: var(--surface-strong);
    color: var(--text);
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.13);
}

#pin,
#new-pin {
    font-size: 1.5rem;
    letter-spacing: 0.45em;
    text-align: center;
}

.button {
    min-height: 46px;
    padding: 0 17px;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 800;
    transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

.button:not(:disabled):active,
.icon-button:not(:disabled):active {
    transform: scale(0.975);
}

.button-primary {
    margin-top: 8px;
    background: var(--primary);
    color: white;
}

.button-primary:hover {
    background: var(--primary-strong);
}

.button-secondary {
    background: #ede9fe;
    color: #5b21b6;
}

html[data-theme="dark"] .button-secondary {
    background: #33224e;
    color: #e3d8ff;
}

.button-quiet {
    min-height: 42px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.button-success {
    background: var(--success);
    color: white;
}

.button-danger {
    background: var(--danger);
    color: white;
}

.button-danger-soft {
    background: var(--danger-soft);
    color: var(--danger);
}

.button-neutral {
    background: var(--no-cover);
    color: var(--text);
}

.button-warning {
    background: #fff2d8;
    color: #8b4b00;
}

html[data-theme="dark"] .button-warning {
    background: #47351e;
    color: #ffd58a;
}

.alert {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 14px;
    line-height: 1.4;
}

.alert-error {
    background: #fef3f2;
    color: #b42318;
}

.alert-success {
    background: #ecfdf3;
    color: #067647;
}

.create-person {
    margin-top: 24px;
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

.create-person summary {
    cursor: pointer;
    color: var(--primary);
    font-weight: 800;
}

/* Main app */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.identity,
.topbar-actions,
.month-navigation,
.selection-summary,
.selection-actions {
    display: flex;
    align-items: center;
}

.identity {
    gap: 12px;
}

.person-avatar {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    place-items: center;
    border: 3px solid color-mix(in srgb, var(--person-colour), white 75%);
    border-radius: 17px;
    background: var(--person-colour);
    color: white;
    font-size: 1.1rem;
    font-weight: 900;
    box-shadow: var(--small-shadow);
}

.topbar-actions {
    gap: 8px;
}

.icon-button {
    display: grid;
    width: 44px;
    height: 44px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 1.65rem;
    line-height: 1;
    box-shadow: 0 4px 14px rgba(42, 22, 66, 0.05);
}

.admin-notice {
    margin-bottom: 14px;
    padding: 13px 16px;
    border: 1px solid rgba(124, 58, 237, 0.24);
    border-radius: 16px;
    background: rgba(124, 58, 237, 0.08);
    color: var(--text);
    line-height: 1.45;
}

.calendar-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 26px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

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

.month-navigation {
    gap: 12px;
}

.month-title-wrap {
    min-width: 180px;
    text-align: center;
}

.month-title-wrap h2 {
    font-size: clamp(1.25rem, 4vw, 1.7rem);
}

.text-button {
    padding: 3px 4px;
    border: 0;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    font-weight: 800;
}

.filter-control {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
}

.filter-control select {
    width: auto;
    min-width: 150px;
    min-height: 42px;
}

.calendar-help {
    margin: 0 22px 14px;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

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

.weekday-row {
    padding: 0 14px;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
}

.weekday-row span {
    padding: 9px 2px;
}

.calendar-grid {
    gap: 7px;
    min-height: 420px;
    padding: 0 14px 14px;
}

.day-cell {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 78px;
    padding: 9px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 15px;
    background: var(--surface-muted);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease,
        border-color 120ms ease;
}

button.day-cell:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: var(--small-shadow);
}

.day-number {
    display: grid;
    min-width: 26px;
    height: 26px;
    padding: 0 5px;
    place-items: center;
    border-radius: 9px;
    font-size: 0.88rem;
    font-weight: 900;
}

.day-status {
    display: block;
    width: 100%;
    overflow: hidden;
    font-size: clamp(0.68rem, 1.5vw, 0.84rem);
    font-weight: 800;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.day-needs-cover {
    border-color: color-mix(in srgb, var(--needed-border), transparent 55%);
    background: var(--needed);
    color: color-mix(in srgb, var(--needed-border), #3b0a0f 38%);
}

html[data-theme="dark"] .day-needs-cover {
    color: #ffdce0;
}

.day-no-cover-needed {
    background: var(--no-cover);
    color: var(--no-cover-text);
}

.day-claimed {
    border-color: color-mix(in srgb, var(--owner-colour), black 8%);
    background: var(--owner-colour);
    color: var(--owner-text);
}

.day-blank {
    cursor: default;
    opacity: 0.35;
    background: transparent;
}

.day-today .day-number {
    background: var(--text);
    color: var(--surface-strong);
}

.day-cell.is-filtered {
    opacity: 0.2;
    filter: saturate(0.35);
}

.day-cell.selected-claim,
.day-cell.selected-release,
.day-cell.selected-request,
.day-cell.selected-admin {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary), transparent 68%);
    transform: translateY(-2px);
}

.day-cell.selected-claim::after,
.day-cell.selected-release::after,
.day-cell.selected-request::after,
.day-cell.selected-admin::after {
    content: "✓";
    position: absolute;
    top: 7px;
    right: 7px;
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 0.78rem;
    font-weight: 900;
}

.calendar-loading,
.calendar-error {
    grid-column: 1 / -1;
    display: grid;
    min-height: 320px;
    place-items: center;
    align-content: center;
    gap: 10px;
    color: var(--muted);
    text-align: center;
}

.calendar-error strong {
    color: var(--text);
}

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 14px 22px 18px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.8rem;
}

.calendar-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.legend-dot {
    width: 11px;
    height: 11px;
    border-radius: 4px;
}

.legend-needed {
    background: var(--needed-border);
}

.legend-covered {
    background: var(--success);
}

.legend-none {
    background: var(--no-cover-text);
}

.selection-bar {
    position: fixed;
    z-index: 30;
    right: max(12px, calc((100vw - 1180px) / 2));
    bottom: max(12px, env(safe-area-inset-bottom));
    left: max(12px, calc((100vw - 1180px) / 2));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px 12px 18px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: color-mix(in srgb, var(--surface-strong), transparent 4%);
    box-shadow: 0 18px 55px rgba(29, 12, 51, 0.25);
    backdrop-filter: blur(18px);
}

.selection-summary {
    gap: 12px;
}

.selection-actions {
    gap: 8px;
}


.admin-selection-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-person-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    white-space: nowrap;
}

.admin-person-control span {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--muted);
}

.admin-person-control select {
    width: auto;
    min-width: 150px;
    min-height: 46px;
    padding-right: 34px;
}

.toast {
    position: fixed;
    z-index: 50;
    top: max(16px, env(safe-area-inset-top));
    left: 50%;
    width: min(calc(100% - 28px), 480px);
    padding: 13px 16px;
    transform: translateX(-50%);
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--surface-strong);
    color: var(--text);
    box-shadow: var(--shadow);
    font-weight: 750;
    text-align: center;
}

.toast[data-type="success"] {
    border-color: color-mix(in srgb, var(--success), transparent 55%);
    background: var(--success-soft);
}

.toast[data-type="error"] {
    border-color: color-mix(in srgb, var(--danger), transparent 55%);
    background: var(--danger-soft);
}

[hidden] {
    display: none !important;
}

@media (max-width: 720px) {
    .app-shell {
        width: min(100% - 14px, 1180px);
        padding-top: max(12px, env(safe-area-inset-top));
    }

    .calendar-topbar {
        align-items: flex-start;
    }

    .person-avatar {
        width: 43px;
        height: 43px;
        border-radius: 14px;
    }


    .admin-selection-actions {
        width: 100%;
        align-items: stretch;
    }

    .admin-person-control {
        width: 100%;
        justify-content: space-between;
    }

    .admin-person-control select {
        flex: 1;
        min-width: 0;
    }

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

    .month-navigation {
        justify-content: space-between;
    }

    .month-title-wrap {
        min-width: 0;
        flex: 1;
    }

    .filter-control {
        justify-content: space-between;
    }

    .filter-control select {
        flex: 1;
        min-width: 0;
        max-width: 220px;
    }

    .calendar-help {
        margin: 0 13px 11px;
        font-size: 0.82rem;
    }

    .weekday-row,
    .calendar-grid {
        padding-right: 7px;
        padding-left: 7px;
    }

    .weekday-row {
        font-size: 0.63rem;
    }

    .calendar-grid {
        gap: 4px;
        min-height: 390px;
        padding-bottom: 8px;
    }

    .day-cell {
        min-height: 67px;
        padding: 6px 5px;
        border-radius: 11px;
    }

    .day-number {
        min-width: 22px;
        height: 22px;
        padding: 0 3px;
        border-radius: 7px;
        font-size: 0.76rem;
    }

    .day-status {
        font-size: 0.63rem;
    }

    .day-cell.selected-claim::after,
    .day-cell.selected-release::after,
    .day-cell.selected-request::after,
    .day-cell.selected-admin::after {
        top: 4px;
        right: 4px;
        width: 18px;
        height: 18px;
        font-size: 0.66rem;
    }

    .calendar-legend {
        gap: 11px;
        padding: 12px 13px 15px;
        font-size: 0.72rem;
    }

    .selection-bar {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
        padding: 11px;
        border-radius: 18px;
    }

    .selection-summary {
        justify-content: space-between;
        padding: 0 4px;
    }

    .selection-actions {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    }

    .selection-actions .button {
        min-height: 45px;
        padding: 0 10px;
        font-size: 0.84rem;
    }
}

@media (max-width: 430px) {
    .topbar-actions .button-quiet {
        width: 82px;
        padding: 0 8px;
        font-size: 0.75rem;
    }

    .identity h1 {
        max-width: 130px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .day-status {
        letter-spacing: -0.015em;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* Stage 3: requests and notifications */
textarea {
    min-height: 112px;
    padding: 12px 14px;
    resize: vertical;
    line-height: 1.45;
}

.notification-button {
    position: relative;
    font-size: 1.15rem;
}

.notification-button.has-notifications {
    border-color: color-mix(in srgb, var(--primary), transparent 45%);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary), transparent 82%);
}

.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    display: grid;
    min-width: 21px;
    height: 21px;
    padding: 0 5px;
    place-items: center;
    border: 2px solid var(--surface-strong);
    border-radius: 999px;
    background: var(--danger);
    color: white;
    font-size: 0.66rem;
    font-weight: 900;
    line-height: 1;
}

.request-action-button,
.dialog-actions .button-primary {
    margin-top: 0;
}

.day-request-pending {
    background-image: linear-gradient(
        135deg,
        transparent 0 70%,
        color-mix(in srgb, white, transparent 82%) 70% 78%,
        transparent 78% 100%
    );
}

.day-request-label {
    position: absolute;
    right: 5px;
    bottom: 5px;
    max-width: calc(100% - 10px);
    padding: 3px 5px;
    overflow: hidden;
    border-radius: 6px;
    background: color-mix(in srgb, #111827, transparent 15%);
    color: white;
    font-size: 0.56rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.day-request-count {
    position: absolute;
    right: 6px;
    bottom: 6px;
    display: grid;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    place-items: center;
    border: 2px solid color-mix(in srgb, var(--owner-colour, var(--surface-strong)), white 70%);
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--primary);
    font-size: 0.68rem;
    font-weight: 950;
    box-shadow: var(--small-shadow);
}

.legend-requested {
    background: var(--primary);
}

.app-dialog {
    width: min(calc(100% - 24px), 680px);
    max-height: min(88vh, 820px);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface-strong);
    color: var(--text);
    box-shadow: 0 28px 90px rgba(20, 8, 38, 0.38);
}

.app-dialog::backdrop {
    background: rgba(17, 12, 25, 0.55);
    backdrop-filter: blur(4px);
}

.compact-dialog {
    width: min(calc(100% - 24px), 520px);
}

.dialog-panel {
    display: flex;
    max-height: min(88vh, 820px);
    padding: 22px;
    flex-direction: column;
}

.dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.dialog-header .eyebrow {
    margin-bottom: 4px;
}

.dialog-close {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    font-size: 1.55rem;
}

.dialog-summary {
    margin-bottom: 18px;
    color: var(--muted);
    line-height: 1.5;
}

.optional-label {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
}

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

.request-filter {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-bottom: 14px;
    padding: 4px;
    border-radius: 14px;
    background: var(--surface-muted);
}

.request-filter-button {
    min-height: 40px;
    padding: 0 10px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 800;
}

.request-filter-button.is-active {
    background: var(--surface-strong);
    color: var(--text);
    box-shadow: 0 3px 10px rgba(35, 19, 54, 0.08);
}

.requests-list {
    display: grid;
    gap: 10px;
    min-height: 180px;
    padding: 2px 3px 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.requests-loading,
.requests-empty {
    display: grid;
    min-height: 190px;
    place-items: center;
    align-content: center;
    gap: 7px;
    color: var(--muted);
    text-align: center;
}

.requests-empty strong {
    color: var(--text);
}

.request-card {
    position: relative;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: var(--surface);
}

.request-card.is-unread::before {
    content: "";
    position: absolute;
    top: 17px;
    left: -4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
}

.request-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.request-date {
    display: block;
    margin-bottom: 4px;
    font-size: 1rem;
    font-weight: 900;
}

.request-card p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.4;
}

.request-status {
    flex: 0 0 auto;
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 900;
    white-space: nowrap;
}

.request-status-pending .request-status {
    background: #fff2d8;
    color: #8b4b00;
}

html[data-theme="dark"] .request-status-pending .request-status {
    background: #47351e;
    color: #ffd58a;
}

.request-status-accepted .request-status {
    background: var(--success-soft);
    color: var(--success);
}

.request-status-declined .request-status,
.request-status-invalidated .request-status {
    background: var(--danger-soft);
    color: var(--danger);
}

.request-card blockquote {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-left: 3px solid var(--primary);
    border-radius: 0 10px 10px 0;
    background: var(--surface-muted);
    color: var(--text);
    font-size: 0.86rem;
    line-height: 1.45;
}

.request-meta {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.72rem;
}

.request-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.request-card-actions .button {
    min-height: 40px;
    padding-inline: 14px;
    font-size: 0.8rem;
}

@media (max-width: 720px) {
    .app-dialog {
        width: calc(100% - 14px);
        max-height: calc(100dvh - 18px);
        border-radius: 20px;
    }

    .dialog-panel {
        max-height: calc(100dvh - 18px);
        padding: 17px 14px;
    }

    .request-card-top {
        gap: 7px;
    }

    .request-status {
        max-width: 125px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .day-request-label {
        right: 3px;
        bottom: 3px;
        padding: 2px 3px;
        font-size: 0.48rem;
    }

    .day-request-count {
        right: 3px;
        bottom: 3px;
        min-width: 18px;
        height: 18px;
        border-width: 1px;
        font-size: 0.58rem;
    }
}

@media (max-width: 430px) {
    .topbar-actions {
        gap: 5px;
    }

    .topbar-actions .icon-button {
        width: 39px;
        height: 39px;
        border-radius: 12px;
    }

    .notification-badge {
        top: -7px;
        right: -7px;
    }

    .dialog-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

.admin-mode-toggle {
    min-height: 44px;
    padding-inline: 14px;
    background: #ede9fe;
    color: #5b21b6;
    border: 1px solid rgba(124, 58, 237, 0.25);
}

.admin-mode-toggle.is-active {
    background: #111827;
    color: #ffffff;
    border-color: #111827;
}

.request-decline-reason {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(180, 35, 24, 0.08);
    color: var(--text);
}

.request-decline-reason strong {
    display: block;
    margin-bottom: 3px;
    color: #b42318;
}

@media (max-width: 680px) {
    .admin-mode-toggle {
        min-height: 40px;
        padding-inline: 10px;
        font-size: 0.82rem;
    }
}

/* Stage 6: per-phone Web Push */
.push-settings-button.push-enabled {
    border-color: color-mix(in srgb, var(--success), transparent 45%);
    background: var(--success-soft);
}

.push-permission-card {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    padding: 14px 16px;
    border: 1px solid color-mix(in srgb, var(--primary), transparent 62%);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface-strong), var(--primary) 5%);
    box-shadow: var(--small-shadow);
}

.push-permission-icon {
    display: grid;
    width: 45px;
    height: 45px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 14px;
    background: color-mix(in srgb, var(--primary), transparent 84%);
    font-size: 1.4rem;
}

.push-permission-copy {
    display: grid;
    flex: 1;
    gap: 3px;
    min-width: 0;
}

.push-permission-copy span,
.push-device-note,
.push-ios-help span {
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.45;
}

.push-permission-actions {
    display: flex;
    gap: 8px;
}

.push-permission-actions .button-primary {
    margin-top: 0;
}

.push-settings-status {
    margin: 8px 0 14px;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-muted);
    font-weight: 750;
    line-height: 1.45;
}

.push-ios-help {
    display: grid;
    gap: 4px;
    margin-bottom: 14px;
    padding: 13px 14px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--warning), transparent 88%);
}

.push-dialog-actions {
    flex-wrap: wrap;
}

.push-device-note {
    margin: 14px 0 0;
}

@media (max-width: 720px) {
    .push-permission-card {
        align-items: flex-start;
        flex-wrap: wrap;
        padding: 13px;
    }

    .push-permission-copy {
        width: calc(100% - 62px);
        flex: 1 1 calc(100% - 62px);
    }

    .push-permission-actions {
        width: 100%;
    }

    .push-permission-actions .button {
        flex: 1;
    }

    .push-settings-button {
        display: grid;
    }
}

/* Keep the expanded Stage 6 controls usable on narrow phones. */
@media (max-width: 720px) {
    .calendar-topbar {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .topbar-actions {
        flex: 1 1 100%;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

@media (max-width: 430px) {
    .admin-mode-toggle {
        min-height: 39px;
        padding-inline: 8px;
        font-size: 0.72rem;
    }
}
