html, body {
    margin: 0;
    padding: 0;
    background: #f7f6f3;
}

* { box-sizing: border-box; }

a { color: #1d3557; }
a:hover { color: #14243c; }

button, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

.app {
    font-family: "Source Sans 3", Helvetica, sans-serif;
    color: #1c1c1a;
    background: #f7f6f3;
    height: 100vh;
    min-height: 520px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-header {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 20px;
    align-items: center;
    padding: 10px 24px;
    background: #fffefb;
    border-bottom: 1px solid #ddd8d0;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand h1 {
    margin: 0;
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.brand p {
    margin: 0;
    font-size: 12.5px;
    color: #6f6a63;
}

.tabs {
    display: flex;
    gap: 18px;
    align-self: stretch;
    align-items: center;
}

.tab {
    padding: 4px 2px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    font-size: 14.5px;
    font-weight: 600;
    color: #6f6a63;
    text-decoration: none;
}

.tab.is-active {
    color: #1d3557;
    border-bottom-color: #1d3557;
}

.tab.is-disabled {
    cursor: default;
}

.header-spacer { flex: 1 1 20px; }

.status {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 12px;
    border: 1px solid #ddd8d0;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
}

.status strong {
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.status span {
    font-size: 12.5px;
    color: #6f6a63;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    align-items: center;
    padding: 8px 24px;
    border-bottom: 1px solid #ddd8d0;
}

.toolbar-nav,
.toolbar-tools {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-group,
.view-group {
    display: flex;
}

.btn {
    height: 32px;
    padding: 0 12px;
    border: 1px solid #ddd8d0;
    background: #fffefb;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    color: #1c1c1a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover { background: #f0ede7; }

.btn-icon {
    width: 32px;
    padding: 0;
    font-size: 15px;
    font-weight: 400;
}

.btn-mid {
    border-left: none;
    border-right: none;
}

.btn-view.is-active {
    border-color: #1d3557;
    background: #1d3557;
    color: #fffefb;
}

.btn-view + .btn-view { border-left: none; }

.btn-accent {
    height: 32px;
    padding: 0 14px;
    border: 1px solid #1d3557;
    background: #1d3557;
    color: #fffefb;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}

.range-label {
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 15.5px;
    min-width: 190px;
}

.toolbar-spacer { flex: 1 1 40px; }

.filter-select {
    height: 32px;
    padding: 0 8px;
    border: 1px solid #ddd8d0;
    background: #fffefb;
    font-size: 13.5px;
}

.people-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 14px;
    padding: 6px 24px;
    border-bottom: 1px solid #ddd8d0;
    background: #fffefb;
}

.chip {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px;
    border: 1px solid #e6e2da;
    background: transparent;
    font-size: 13px;
    color: #1c1c1a;
    text-decoration: none;
}

.chip-swatch {
    width: 10px;
    height: 10px;
    flex: none;
}

.chip-role {
    color: #8b857d;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.board {
    flex: 1;
    overflow: auto;
    padding: 0 24px 20px;
    isolation: isolate;
    z-index: 0;
}

.grid-head,
.grid-body {
    display: flex;
}

.grid-head {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f7f6f3;
    border-bottom: 1px solid #ddd8d0;
}

.time-gutter {
    width: 62px;
    flex: none;
    position: relative;
}

.hour-label {
    display: flex;
    justify-content: flex-end;
    padding-right: 10px;
    padding-top: 2px;
}

.hour-label span {
    font-size: 12px;
    color: #8b857d;
    font-variant-numeric: tabular-nums;
}

.col-head,
.col-body {
    flex: 1 1 0;
    min-width: 150px;
}

.is-day .col-head,
.is-day .col-body {
    min-width: 0;
}

.col-head {
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    border-left: 1px solid #ddd8d0;
}

.col-head.is-today,
.col-body.is-today {
    background: #fffefb;
}

.col-head .dow {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #6f6a63;
}

.col-head strong {
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 14.5px;
    font-weight: 700;
}

.col-body {
    position: relative;
    border-left: 1px solid #ddd8d0;
    border-top: 1px solid #ddd8d0;
    background: #fdfcf9;
}

.slot {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    border-bottom: 1px dotted #e6e2da;
    background: transparent;
    cursor: pointer;
}

.slot:hover { background: #efece5; }

.slot.is-hour {
    border-bottom: 1px solid #ddd8d0;
}

.event {
    position: absolute;
    left: 3px;
    right: 3px;
    padding: 4px 7px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid;
    border-left-width: 3px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    appearance: none;
    -webkit-appearance: none;
}

.event { z-index: 1; }

.event:hover { filter: brightness(0.97); }

.event:focus-visible {
    outline: 2px solid #1d3557;
    outline-offset: 1px;
    z-index: 2;
}

.event.is-dim { opacity: 0.24; }

.event-title {
    flex: none;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.event-title.clamp-1 { -webkit-line-clamp: 1; }
.event-title.clamp-2 { -webkit-line-clamp: 2; }

.event-time,
.event-meta {
    flex: none;
    font-size: 11.5px;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.now-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #b9523f;
    pointer-events: none;
    z-index: 2;
}

.month-head,
.month-week {
    display: grid;
    grid-template-columns: repeat(5, minmax(140px, 1fr));
}

.month-head.is-weekend,
.month-week.is-weekend {
    grid-template-columns: repeat(7, minmax(120px, 1fr));
}

.month-head {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f7f6f3;
}

.month-dow {
    padding: 6px 10px;
    border-left: 1px solid #ddd8d0;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #6f6a63;
}

.month-cell {
    min-height: 128px;
    padding: 8px 8px 10px;
    border-left: 1px solid #ddd8d0;
    border-top: 1px solid #ddd8d0;
    background: #fdfcf9;
    cursor: pointer;
}

.month-cell:hover { background: #efece5; }

.month-cell.is-today { background: #fffefb; }
.month-cell.is-outside { opacity: 0.42; }

.month-num {
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 14.5px;
    font-weight: 700;
    display: block;
    margin-bottom: 6px;
}

.month-event {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    margin-bottom: 4px;
    padding: 3px 6px;
    border: 1px solid;
    border-left-width: 3px;
    background: var(--event-bg);
    border-color: var(--event-border);
    color: var(--event-color);
    font-size: 12px;
    line-height: 1.3;
    overflow: hidden;
    white-space: nowrap;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.month-event.is-dim { opacity: 0.24; }

.month-event-dot {
    display: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex: none;
}

.month-event-time {
    flex: none;
    font-variant-numeric: tabular-nums;
}

.month-event-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.month-more {
    display: none;
    margin-top: 2px;
    padding: 0 2px;
    font-size: 11px;
    color: #6f6a63;
}

.agenda {
    max-width: 920px;
}

.agenda-day + .agenda-day {
    margin-top: 2px;
}

.agenda-head,
.agenda-event,
.agenda-empty {
    display: flex;
    align-items: center;
    width: 100%;
    border: none;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
}

.agenda-head {
    gap: 8px;
    padding: 8px 14px;
    background: #efece5;
    color: #1c1c1a;
    font-size: 13.5px;
}

.agenda-head:hover,
.agenda-empty:hover,
.agenda-event:hover {
    filter: brightness(0.98);
}

.agenda-weekday {
    text-transform: lowercase;
}

.agenda-num {
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 15px;
    font-weight: 700;
    min-width: 1.4em;
}

.agenda-day.is-today .agenda-num {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 50%;
    background: #1d3557;
    color: #fffefb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.agenda-month {
    color: #6f6a63;
}

.agenda-empty {
    padding: 12px 14px 12px 25px;
    background: #fffefb;
    color: #8b857d;
    font-size: 13.5px;
}

.agenda-event {
    gap: 10px;
    padding: 11px 14px;
    background: #fffefb;
    border-bottom: 1px solid #eeeae3;
    color: #1c1c1a;
}

.agenda-event.is-dim { opacity: 0.24; }

.agenda-bar {
    width: 3px;
    align-self: stretch;
    min-height: 18px;
    flex: none;
}

.agenda-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agenda-time {
    flex: none;
    font-size: 13px;
    color: #6f6a63;
    font-variant-numeric: tabular-nums;
}

.agenda-week {
    display: none;
}

.page-message {
    padding: 48px 24px;
    max-width: 640px;
}

.page-message h1 {
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 22px;
}

.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;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    isolation: isolate;
}

.modal.is-open { display: flex; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(28, 28, 26, 0.46);
}

.modal-card {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(620px, 100%);
    max-height: min(calc(100vh - 48px), calc(100dvh - 48px));
    min-height: 0;
    overflow: hidden;
    background: #fffefb;
    border: 1px solid #ddd8d0;
    box-shadow: 0 16px 40px rgba(28, 28, 26, 0.18);
    animation: dcFade 0.16s ease-out;
}

.modal-card > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

@keyframes dcFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: none;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 16px 22px;
    background: #fffefb;
    border-bottom: 1px solid #e6e2da;
}

.modal-head h2 {
    margin: 0;
    min-width: 0;
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 17px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.modal-close {
    flex: none;
    width: 40px;
    height: 40px;
    margin: -8px -10px -8px 0;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 22px;
    color: #8b857d;
    line-height: 1;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
    padding: 20px 22px 8px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 600;
    color: #6f6a63;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.field-wide { grid-column: 1 / -1; }

.field[hidden] { display: none; }

.field input,
.field select,
.field textarea {
    height: 38px;
    padding: 0 10px;
    border: 1px solid #ddd8d0;
    background: #fff;
    font-size: 14px;
    font-weight: 400;
    color: #1c1c1a;
    text-transform: none;
    letter-spacing: 0;
    font-family: inherit;
}

.field textarea {
    height: auto;
    padding: 8px 10px;
    resize: vertical;
}

.toggle-row {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}

.toggle {
    padding: 8px 14px;
    border: 1px solid #ddd8d0;
    background: #fff;
    color: #1c1c1a;
    font-size: 13.5px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}

.toggle.is-on {
    border-color: #1d3557;
    background: #1d3557;
    color: #fffefb;
}

.conflict {
    margin: 0 22px 8px;
    padding: 10px 12px;
    background: #fbf0ed;
    color: #8a3a2b;
    font-size: 13.5px;
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    flex: none;
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding: 14px 22px 20px;
    background: #fffefb;
    border-top: 1px solid #e6e2da;
}

.modal-actions-right {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

.btn-save {
    height: 38px;
    padding: 0 18px;
}

.btn-danger {
    height: 38px;
    padding: 0 14px;
    border: 1px solid #ddd8d0;
    background: #fffefb;
    color: #8a3a2b;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}

.btn-danger:hover { background: #fbf0ed; }

.modal-confirm { z-index: 50; }

.modal-card-sm { width: min(440px, 100%); }

.modal-card-read {
    width: min(420px, 100%);
    isolation: isolate;
}

.modal-card-read:focus {
    outline: none;
}

.read-accent {
    height: 4px;
    background: #1d3557;
}

.read-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 16px 22px 8px;
    -webkit-overflow-scrolling: touch;
}

.read-when {
    margin: 0 0 4px;
    font-size: 13.5px;
    color: #6f6a63;
}

.read-time {
    margin: 0 0 16px;
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
}

.read-facts {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.read-fact {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 10px;
    align-items: baseline;
}

.read-fact[hidden] {
    display: none;
}

.read-fact dt {
    font-size: 11.5px;
    font-weight: 600;
    color: #6f6a63;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.read-fact dd {
    margin: 0;
    font-size: 14.5px;
    color: #1c1c1a;
}

.read-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}

.read-chips[hidden] {
    display: none;
}

.read-chip {
    padding: 4px 9px;
    border: 1px solid #ddd8d0;
    font-size: 12.5px;
    color: #1c1c1a;
}

.read-notes {
    margin: 14px 0 0;
    padding: 10px 12px;
    background: #f7f6f3;
    font-size: 13.5px;
    line-height: 1.45;
    color: #1c1c1a;
    white-space: pre-wrap;
}

.read-notes[hidden] {
    display: none;
}

.confirm-text {
    margin: 0;
    padding: 20px 22px 8px;
    font-size: 14.5px;
    line-height: 1.5;
    color: #1c1c1a;
}

.confirm-text strong {
    font-family: "Libre Baskerville", Georgia, serif;
    font-weight: 700;
}

.confirm-hint {
    margin: 0;
    padding: 0 22px 4px;
    font-size: 13.5px;
    line-height: 1.45;
    color: #6f6a63;
}

.confirm-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 22px 4px;
    font-size: 13.5px;
    color: #1c1c1a;
    cursor: pointer;
}

.confirm-option[hidden] {
    display: none;
}

#person-modal .swatches {
    min-height: 38px;
    align-items: center;
}

.btn-danger-solid {
    height: 38px;
    padding: 0 16px;
    border-color: #8a3a2b;
    background: #8a3a2b;
    color: #fffefb;
}

.btn-danger-solid:hover { background: #732f23; }

.flash {
    margin: 0;
    padding: 10px 24px;
    font-size: 13.5px;
}

.flash-ok {
    background: #eef4ee;
    color: #2d5a32;
    border-bottom: 1px solid #d5e3d6;
}

.flash-error {
    background: #fbf0ed;
    color: #8a3a2b;
    border-bottom: 1px solid #edd8d2;
}

.app-admin {
    height: auto;
    min-height: 100vh;
    overflow: auto;
}

.admin {
    width: 100%;
    padding: 22px 24px 48px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.admin-section {
    background: #fffefb;
    border: 1px solid #ddd8d0;
    padding: 22px 24px 20px;
}

.admin-section-head {
    margin: 0 0 16px;
}

.admin-section-head-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
}

.admin-fold-toggle {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    flex: 1 1 240px;
    padding: 0;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    color: inherit;
}

.admin-fold-toggle:hover .admin-fold-title {
    color: #1d3557;
}

.admin-fold-chevron {
    width: 18px;
    height: 18px;
    margin-top: 3px;
    flex: none;
    border: 1px solid #ddd8d0;
    background: #fffefb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-fold-chevron::before {
    content: "";
    width: 5px;
    height: 5px;
    border-right: 1.5px solid #1c1c1a;
    border-bottom: 1.5px solid #1c1c1a;
    transform: translateY(-1px) rotate(45deg);
}

.is-collapsible.is-open .admin-fold-chevron::before {
    transform: translateY(1px) rotate(-135deg);
}

.admin-fold-title {
    display: block;
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 17px;
    font-weight: 700;
}

.admin-fold-sub {
    display: block;
    margin-top: 4px;
    font-size: 13.5px;
    color: #6f6a63;
    font-weight: 400;
}

.admin-fold-body[hidden] {
    display: none;
}

.is-collapsible:not(.is-open) .admin-section-head {
    margin-bottom: 0;
}

.admin-section-head h2 {
    margin: 18px 0 4px;
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 17px;
    font-weight: 700;
}

.admin-section-head:first-child h2,
.admin-section-head-row h2 {
    margin-top: 0;
}

.admin-section-head p {
    margin: 0;
    font-size: 13.5px;
    color: #6f6a63;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 16px;
    margin-bottom: 8px;
}

.admin .field input,
.admin .field select {
    width: 100%;
}

.rules {
    display: flex;
    flex-direction: column;
    border-top: 1px solid #e6e2da;
}

.rule {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid #e6e2da;
}

.rule strong {
    display: block;
    font-size: 14.5px;
}

.rule p {
    margin: 3px 0 0;
    font-size: 13px;
    color: #6f6a63;
    font-weight: 400;
}

.rule .toggle {
    min-width: 84px;
    flex: none;
    text-align: center;
}

.ics-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 4px 0 10px;
}

.ics-row input {
    flex: 1 1 280px;
    min-width: 0;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #ddd8d0;
    background: #fff;
    font-size: 13.5px;
    font-family: inherit;
}

.ics-help {
    margin: 0 0 8px;
    padding-left: 18px;
    font-size: 13.5px;
    color: #6f6a63;
}

.ics-help li + li {
    margin-top: 6px;
}

.ics-help strong {
    color: #1f1c17;
    font-weight: 600;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.person-row {
    display: grid;
    grid-template-columns: 8px minmax(140px, 1.2fr) 150px minmax(180px, 1.4fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e6e2da;
}

.person-row input,
.person-row select {
    height: 38px;
    padding: 0 10px;
    border: 1px solid #ddd8d0;
    background: #fff;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
}

.person-bar {
    display: block;
    width: 8px;
    height: 38px;
}

.swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.swatch {
    position: relative;
    width: 18px;
    height: 18px;
}

.swatch input {
    position: absolute;
    inset: 0;
    opacity: 0;
    margin: 0;
    cursor: pointer;
}

.swatch span {
    display: block;
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
}

.swatch input:checked + span {
    box-shadow: 0 0 0 2px #1d3557;
}

.swatch input:focus-visible + span {
    outline: 2px solid #1d3557;
    outline-offset: 2px;
}

.swatch-custom-face {
    background: conic-gradient(from 180deg, #c45c4a, #d4a017, #4f8a5b, #3d6d9a, #7a4e8e, #c45c4a);
}

.swatch-custom.is-picked .swatch-custom-face {
    background-image: none;
    background-color: var(--swatch, #38538a);
}

.swatch-custom-picker,
.person-row input[type="color"],
.admin .field input[type="color"] {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    cursor: pointer;
}

@media (max-width: 1100px) {
    .is-week {
        min-width: 0 !important;
    }

    .col-head,
    .col-body {
        min-width: 0;
    }

    .month-head,
    .month-week {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .month-head.is-weekend,
    .month-week.is-weekend {
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }

    .month-dow {
        padding: 6px 4px;
        text-align: center;
    }

    .month-cell {
        min-height: 108px;
        padding: 6px 4px 8px;
    }

    .month-num {
        width: 24px;
        height: 24px;
        margin-bottom: 4px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 13px;
    }

    .month-cell.is-today .month-num {
        border-radius: 50%;
        background: #1d3557;
        color: #fffefb;
    }

    .month-cell.is-today {
        background: #fffefb;
    }

    .month-event {
        display: flex;
        align-items: center;
        gap: 4px;
        margin-bottom: 2px;
        padding: 1px 2px;
        font-size: 11px;
        line-height: 1.25;
    }

    .month-event:not(.is-allday) {
        background: transparent;
        border-color: transparent;
        color: #1c1c1a;
        border-left-width: 0;
    }

    .month-event.is-allday {
        padding: 2px 5px;
        border-left-width: 3px;
    }

    .month-event-dot {
        display: inline-block;
    }

    .month-event.is-extra {
        display: none;
    }

    .month-more {
        display: block;
    }

    .modal {
        padding: 0;
        align-items: flex-end;
        justify-content: stretch;
    }

    .modal-card,
    .modal-card-sm,
    .modal-card-read {
        width: 100%;
        max-width: none;
        max-height: min(90dvh, calc(100vh - env(safe-area-inset-top, 0px)));
        border-left: none;
        border-right: none;
        border-bottom: none;
    }

    #booking-modal .modal-card,
    #person-modal .modal-card {
        height: min(90dvh, calc(100vh - env(safe-area-inset-top, 0px)));
    }

    .modal-grid {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }

    .modal-actions .btn,
    .modal-actions .btn-accent,
    .modal-actions .btn-danger,
    .modal-actions .btn-save,
    .modal-actions .btn-danger-solid {
        height: 44px;
        min-height: 44px;
    }

    .field input,
    .field select,
    .field textarea {
        font-size: 16px;
        height: 44px;
        min-height: 44px;
    }

    .field textarea {
        height: auto;
        min-height: 88px;
    }

    .toggle {
        min-height: 44px;
    }

    .read-fact {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}

@media (max-width: 960px) {
    .admin-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .person-row {
        grid-template-columns: 8px minmax(120px, 1fr) 140px minmax(140px, 1fr) auto;
    }
}

@media (max-width: 720px) {
    .app-header,
    .toolbar,
    .people-bar,
    .board {
        padding-left: 14px;
        padding-right: 14px;
    }

    .app-header {
        flex-wrap: nowrap;
        justify-content: space-between;
        padding-top: 10px;
        padding-bottom: 10px;
        gap: 10px 12px;
    }

    .brand {
        min-width: 0;
        flex: 1 1 auto;
    }

    .brand h1 {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .brand p,
    .status,
    .header-spacer {
        display: none;
    }

    .tabs {
        flex: none;
        gap: 12px;
        align-self: center;
    }

    .tab {
        font-size: 13px;
    }

    .toolbar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding-top: 10px;
        padding-bottom: 12px;
    }

    .toolbar-nav,
    .toolbar-tools {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
    }

    .toolbar-spacer {
        display: none;
    }

    .range-label {
        min-width: 0;
        text-align: right;
        line-height: 1.25;
    }

    .view-group {
        flex: none;
    }

    .btn-view-week {
        display: none;
    }

    .filter-form {
        display: none;
    }

    .toolbar-tools .btn-accent {
        flex: none;
        white-space: nowrap;
    }

    .people-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .chip {
        flex: none;
    }

    .chip-role {
        display: none;
    }

    .month-cell {
        min-height: 86px;
        padding: 4px 3px 6px;
    }

    .month-dow {
        padding: 6px 2px;
        font-size: 10.5px;
    }

    .month-num {
        width: 22px;
        height: 22px;
        font-size: 12px;
        margin-bottom: 2px;
    }

    .month-event {
        font-size: 10px;
        gap: 3px;
        padding: 1px 1px;
        margin-bottom: 1px;
    }

    .month-event:nth-child(n+4) {
        display: none;
    }

    .month-event-time {
        display: none;
    }

    .board {
        padding-left: 8px;
        padding-right: 8px;
        padding-bottom: 24px;
    }

    .modal {
        padding: 0;
        align-items: flex-end;
        justify-content: stretch;
    }

    .modal-card,
    .modal-card-sm,
    .modal-card-read {
        width: 100%;
        max-width: none;
        max-height: min(92dvh, calc(100vh - env(safe-area-inset-top, 0px)));
        border-left: none;
        border-right: none;
        border-bottom: none;
    }

    #booking-modal .modal-card,
    #person-modal .modal-card {
        height: min(92dvh, calc(100vh - env(safe-area-inset-top, 0px)));
    }

    .modal-head,
    .modal-grid,
    .read-body,
    .confirm-text,
    .confirm-option,
    .conflict {
        padding-left: 16px;
        padding-right: 16px;
    }

    .modal-head {
        padding-top: 14px;
        padding-bottom: 14px;
    }

    .modal-grid {
        grid-template-columns: 1fr;
        padding-top: 16px;
        padding-bottom: 8px;
    }

    .modal-actions {
        gap: 8px;
        padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    }

    .modal-actions .btn,
    .modal-actions .btn-accent,
    .modal-actions .btn-danger,
    .modal-actions .btn-save,
    .modal-actions .btn-danger-solid {
        height: 44px;
        min-height: 44px;
    }

    .field input,
    .field select,
    .field textarea {
        font-size: 16px;
        height: 44px;
        min-height: 44px;
    }

    .field textarea {
        height: auto;
        min-height: 88px;
    }

    .toggle {
        min-height: 44px;
        padding: 10px 14px;
    }

    .read-body {
        padding-top: 14px;
        padding-bottom: 6px;
    }

    .read-fact {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .confirm-text {
        padding-top: 16px;
    }

    .modal-actions {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
    }

    .modal-actions-right {
        display: flex;
        flex-direction: column-reverse;
        order: 1;
        width: 100%;
        margin-left: 0;
        gap: 8px;
    }

    .modal-actions > .btn-danger {
        order: 2;
    }

    .modal-actions .btn,
    .modal-actions .btn-accent,
    .modal-actions .btn-danger,
    .modal-actions .btn-save,
    .modal-actions .btn-danger-solid {
        width: 100%;
    }

    .toggle-row {
        flex-direction: column;
        align-items: stretch;
    }

    .admin {
        padding-left: 14px;
        padding-right: 14px;
    }

    .admin-section { padding: 16px; }

    .admin-grid,
    .person-row {
        grid-template-columns: 1fr;
    }

    .person-bar { height: 8px; width: 100%; }
}
