:root {
    --ink: #16383c;
    --muted: #5c6f70;
    --teal: #1d6b63;
    --teal-dark: #145249;
    --paper: #f3efe6;
    --card: #fffcf8;
    --line: #e4dccf;
    --danger: #8a3d34;
    --danger-bg: #f8ece8;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: clip;
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--ink);
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    background:
        radial-gradient(900px 420px at 50% -12%, #e5f2ef 0%, transparent 60%),
        var(--paper);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.login-card {
    width: min(420px, 100%);
    padding: 36px 32px 28px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(22, 56, 60, 0.08);
}

a {
    color: var(--teal-dark);
}

.brand {
    display: block;
    width: min(280px, 86%);
    height: auto;
    margin: 0 auto 8px;
}

.lead {
    margin: 0 0 28px;
    text-align: center;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.78rem;
}

.alert {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--danger-bg);
    color: var(--danger);
}

form {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 6px;
    font-size: 0.92rem;
    font-weight: 650;
}

input, select, textarea {
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 16px;
}

input:not([type="checkbox"]):not([type="radio"]),
select {
    height: 44px;
}

textarea {
    height: auto;
    min-height: 96px;
    padding: 12px 14px;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(29, 107, 99, 0.35);
    border-color: var(--teal);
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 0;
    border-radius: 999px;
    padding: 0 18px;
    background: var(--teal);
    color: #fff;
    font: inherit;
    font-weight: 650;
    letter-spacing: 0.01em;
    line-height: 1.2;
    text-align: center;
    box-shadow: 0 1px 2px rgba(22, 56, 60, 0.08), 0 6px 16px rgba(29, 107, 99, 0.14);
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    appearance: none;
    -webkit-appearance: none;
}

button:hover,
.button:hover {
    background: var(--teal-dark);
    box-shadow: 0 2px 4px rgba(22, 56, 60, 0.1), 0 8px 20px rgba(20, 82, 73, 0.18);
}

button:focus-visible,
.button:focus-visible {
    outline: 2px solid rgba(29, 107, 99, 0.45);
    outline-offset: 2px;
}

a.button {
    text-decoration: none;
}

.note {
    margin: 18px 0 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.panel .note {
    margin: 0;
    text-align: left;
    font-size: 0.92rem;
    font-weight: 400;
    line-height: 1.4;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 20;
    padding: max(18px, env(safe-area-inset-top)) 28px 18px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
}

.app-header .brand {
    width: 180px;
    margin: 0;
}

.brand-link {
    display: block;
    line-height: 0;
}

.header-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-left: auto;
}

.main-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--teal-dark);
    text-decoration: none;
    font-weight: 650;
    box-shadow: 0 1px 2px rgba(22, 56, 60, 0.05);
    touch-action: manipulation;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.menu-link:hover,
.menu-link[aria-current="page"] {
    background: #e7f3f1;
    border-color: #b7d5cf;
    box-shadow: none;
}

.menu-link:focus-visible {
    outline: 2px solid rgba(29, 107, 99, 0.45);
    outline-offset: 2px;
}

.icon {
    width: 22px;
    height: 22px;
    display: block;
}

.menu-account {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.signed-in {
    max-width: 16rem;
    overflow: hidden;
    color: var(--teal-dark);
    font-weight: 650;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-link.menu-gear {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
}

.app-main,
.app-main.wide {
    flex: 1 0 auto;
}

.logout {
    margin: 36px 0 0;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    justify-items: start;
}

.app-main,
.app-main.wide {
    width: 100%;
    margin: 28px 0 48px;
    padding-inline: 28px;
}

h1 {
    margin: 0 0 8px;
    font-size: 1.8rem;
    font-weight: 650;
}

h2 {
    margin: 28px 0 8px;
    font-size: 1.25rem;
    font-weight: 650;
}

.app-main > p {
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
}

.actions {
    margin-top: 24px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin: 24px 0 0;
    border-bottom: 1px solid var(--line);
}

.tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 14px;
    margin-bottom: -1px;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 12px 12px 0 0;
    color: var(--muted);
    text-decoration: none;
    font-weight: 650;
    touch-action: manipulation;
}

.tabs a[aria-selected="true"] {
    color: var(--ink);
    background: var(--card);
    border-color: var(--line);
}

.panel {
    max-width: 420px;
    margin-top: 24px;
}

.ok {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #e7f3f1;
    color: var(--teal-dark);
}

.app-main .alert,
.app-main .ok {
    margin: 20px 0 0;
}

.app-main > .toolbar {
    display: flex;
    align-items: center;
    margin: 16px 0;
}

.app-main > p + .filters,
.app-main > .cal-nav + .filters,
.app-main > .cal-nav + p,
.app-main > .filters + p,
.app-main > .filters + .table-wrap,
.app-main > .toolbar + .table-wrap {
    margin-top: 16px;
}

    .table-wrap {
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

.list {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
}

.list th,
.list td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.list th {
    color: var(--muted);
    font-size: 0.82rem;
}

.list tr:last-child td {
    border-bottom: 0;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.row-actions .button {
    margin: 0;
    padding: 8px 12px;
}

.role {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e7f3f1;
    color: var(--teal-dark);
    font-size: 0.82rem;
    font-weight: 650;
}

.role-admin {
    background: #f3e6c8;
    color: #6a4b16;
}

label.check {
    display: flex;
    align-items: center;
    gap: 10px;
}

.calendar-choices {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 16px;
}

.calendar-choices label.check {
    justify-content: flex-start;
    width: auto;
    max-width: 100%;
}

label.check input[type="radio"] {
    width: 1.15rem;
    height: 1.15rem;
    min-width: 1.15rem;
    min-height: 1.15rem;
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
    accent-color: var(--teal);
}

.credit-log {
    margin: 0;
    padding-left: 1.1rem;
}

label.check input[type="checkbox"] {
    width: 44px;
    height: 26px;
    min-height: 26px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #d9d0c3;
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    cursor: pointer;
    flex: 0 0 auto;
}

label.check input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
}

label.check input[type="checkbox"]:checked {
    background: var(--teal);
}

label.check input[type="checkbox"]:checked::after {
    transform: translateX(18px);
}

label.check input[type="checkbox"]:focus {
    outline: 2px solid rgba(29, 107, 99, 0.35);
}

.pay-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
}

.pay-switch legend {
    width: 100%;
    padding: 0;
    font-size: 0.92rem;
    font-weight: 650;
}

.pay-switch label {
    position: relative;
    display: block;
    flex: 1;
    min-width: 5.5rem;
    margin: 0;
}

.pay-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
}

.pay-switch span {
    display: block;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    text-align: center;
    cursor: pointer;
}

.pay-switch input:checked + span {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
}

.pay-switch input:focus-visible + span {
    outline: 2px solid rgba(29, 107, 99, 0.35);
}

.button-quiet,
button.danger {
    background: var(--card);
    color: var(--teal-dark);
    border: 1px solid var(--line);
    box-shadow: 0 1px 2px rgba(22, 56, 60, 0.05);
}

.button-quiet:hover {
    background: #e7f3f1;
    border-color: #b7d5cf;
    box-shadow: none;
}

button.danger {
    color: var(--danger);
    border-color: #e7c7c1;
    box-shadow: none;
}

button.danger:hover {
    background: var(--danger-bg);
    border-color: #e7c7c1;
    box-shadow: none;
}

.app-main .balance {
    margin: 16px 0 0;
    color: var(--ink);
    font-size: 1.15rem;
    font-weight: 650;
}

.cal-pager {
    display: none;
}

.cal-nav {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin-top: 20px;
}

.cal-nav h2 {
    margin: 0;
    font-size: 1.15rem;
    line-height: 44px;
    text-align: center;
}

.cal-nav-buttons,
.filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.cal-nav-arrow {
    width: 44px;
    padding: 0;
    font-size: 1.25rem;
}

.filters {
    align-items: flex-end;
    gap: 12px;
    margin: 0;
}

.filters label {
    min-width: 220px;
}

.cal-nav-tools {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.cal-views {
    display: inline-flex;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 999px;
    overflow: hidden;
    background: var(--card);
    box-shadow: 0 1px 2px rgba(22, 56, 60, 0.05);
}

.cal-views a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 0;
    padding: 0 14px;
    color: var(--teal-dark);
    text-decoration: none;
    font-weight: 650;
    touch-action: manipulation;
}

.cal-views a + a {
    border-left: 1px solid var(--line);
}

.cal-views a[aria-current="page"] {
    background: var(--teal);
    color: #fff;
}

.cal-scroll {
    margin-top: 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.cal {
    --slot: 32px;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    min-width: 0;
}

.cal-time-col {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border-right: 1px solid var(--line);
    border-bottom-left-radius: 15px;
}

.cal-time-spacer {
    height: 58px;
    flex: 0 0 58px;
    border-top-left-radius: 15px;
}

.cal-times {
    position: relative;
    z-index: 4;
    display: grid;
    grid-template-rows: repeat(28, var(--slot, 32px));
    height: calc(var(--slot, 32px) * 28);
}

.cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    min-width: 0;
}

.cal-col {
    min-width: 0;
}

.cal-col:last-child .cal-dayhead {
    border-top-right-radius: 15px;
}

.cal-col:last-child .cal-body {
    border-bottom-right-radius: 15px;
}

.cal-dayhead {
    position: sticky;
    top: 82px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    box-sizing: border-box;
    height: 58px;
    padding: 6px 4px;
    border-bottom: 1px solid var(--line);
    background: var(--card);
    text-align: center;
}

.cal-dayhead span {
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.cal-dayhead.is-today,
.cal-day.is-today {
    background: #f3faf8;
}

.cal-body {
    position: relative;
    height: calc(var(--slot, 32px) * 28);
}

.cal-slots {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    display: grid;
    grid-template-rows: repeat(28, var(--slot, 32px));
    height: calc(var(--slot, 32px) * 28);
}

.cal-events {
    position: absolute;
    z-index: 2;
    top: 0;
    right: 0;
    left: 0;
    height: calc(var(--slot, 32px) * 28);
    pointer-events: none;
}

.cal-col.is-today .cal-events {
    left: 0;
}

.cal-hours {
    position: absolute;
    z-index: 4;
    top: 0;
    left: 0;
    display: grid;
    grid-template-rows: repeat(28, var(--slot, 32px));
    width: 42px;
    height: calc(var(--slot, 32px) * 28);
    pointer-events: none;
}

.cal-hour {
    padding: 2px 0 0 4px;
    color: var(--muted);
    font-size: 0.68rem;
    line-height: 1;
    pointer-events: none;
}

.cal-time {
    align-self: start;
    justify-self: end;
    margin: 2px 6px 0 0;
    color: var(--muted);
    font-size: 0.68rem;
    line-height: 1;
    pointer-events: none;
}

.cal-hour-full {
    color: var(--ink);
    font-weight: 650;
}

.cal-col + .cal-col .cal-dayhead,
.cal-col + .cal-col .cal-day {
    border-left: 1px solid var(--line);
}

.cal-day {
    height: calc(var(--slot, 32px) * 28);
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent calc(var(--slot, 32px) - 1px),
        #efe8dc calc(var(--slot, 32px) - 1px),
        #efe8dc var(--slot, 32px)
    );
}

.cal-slot {
    position: relative;
    z-index: 1;
    min-height: 0;
}

.cal-slot {
    pointer-events: none;
}

.cal-event {
    position: absolute;
    z-index: 2;
    box-sizing: border-box;
    pointer-events: auto;
    min-width: 0;
    overflow: hidden;
    padding: 3px 6px;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
    font-size: 0.75rem;
    font-weight: 650;
    line-height: 1.25;
    text-decoration: none;
}

.cal-event-when {
    display: block;
    font-size: 0.68rem;
    font-weight: 650;
    line-height: 1.1;
}

.cal-event:focus-visible,
.cal-slot:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: -2px;
}

.dialog-layer {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding:
        max(16px, env(safe-area-inset-top))
        16px
        max(16px, env(safe-area-inset-bottom));
    background: rgba(22, 56, 60, 0.46);
    overflow: auto;
}

dialog.popup {
    position: relative;
    width: min(440px, 100%);
    max-height: none;
    margin: 0;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card);
    color: var(--ink);
    box-shadow: 0 24px 60px rgba(22, 56, 60, 0.16);
}

.dialog-close {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0 0;
}

.dialog-close .button,
.dialog-close button {
    flex: 1 1 140px;
    justify-content: center;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.form-actions > button,
.form-actions > .button {
    flex: 1 1 160px;
}

dialog.popup h2 {
    margin-top: 0;
    padding-right: 36px;
}

.popup-x {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 1.6rem;
    line-height: 1;
    text-decoration: none;
}

.popup-x:hover,
.popup-x:focus-visible {
    background: var(--paper);
    color: var(--ink);
}

.agenda {
    display: grid;
    gap: 8px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.agenda li {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr);
    grid-template-areas:
        "mark when"
        "mark name"
        "mark meta";
    align-items: center;
    column-gap: 12px;
    row-gap: 2px;
    padding: 12px 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
}

.agenda li .swatch {
    grid-area: mark;
}

.agenda-when {
    grid-area: when;
    color: var(--muted);
    font-size: 0.92rem;
}

.agenda li strong {
    grid-area: name;
    color: var(--ink);
}

.agenda-meta {
    grid-area: meta;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    color: var(--muted);
    font-size: 0.92rem;
}

.cal-hint {
    display: none;
}

.month {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    margin-top: 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
}

.month-head {
    padding: 10px 4px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 650;
    text-align: center;
    text-transform: uppercase;
}

.month-head + .month-head {
    border-left: 1px solid var(--line);
}

.month-day {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 118px;
    padding: 6px;
    border-top: 1px solid var(--line);
    background: var(--card);
}

.month-day:not(:nth-child(7n + 1)) {
    border-left: 1px solid var(--line);
}

.month-day.is-outside {
    background: #f6f3ec;
}

.month-day.is-today {
    background: #f3faf8;
}

.month-add {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.month-date {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    font-weight: 650;
    pointer-events: none;
}

.month-day.is-outside .month-date {
    color: var(--muted);
}

.month-day.is-today .month-date {
    background: var(--teal);
    color: #fff;
}

.month-tasks {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 3px;
    min-width: 0;
    margin-top: 4px;
}

.month-task {
    display: block;
    min-width: 0;
    overflow: hidden;
    padding: 2px 4px;
    border-radius: 4px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
    font-size: 0.72rem;
    font-weight: 650;
    line-height: 1.3;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.month-task-when {
    margin-right: 4px;
}

.month-add:focus-visible,
.month-task:focus-visible,
.cal-views a:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: -2px;
}

.swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 auto;
}

@media (min-width: 801px) {
    .cal-nav:has(h2) {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        align-items: end;
    }

    .cal-nav:has(.cal-nav-tools) {
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        flex-wrap: wrap;
        column-gap: 16px;
        row-gap: 12px;
    }

    .cal-nav:has(.cal-nav-tools) > h2 {
        flex: 1 1 auto;
        min-width: max-content;
    }

    .cal-nav:has(h2) > .button,
    .cal-nav:has(h2) > .cal-views,
    .cal-nav:has(h2) > .cal-nav-tools {
        justify-self: end;
    }

    .cal-nav-tools {
        flex: 0 0 auto;
        flex-wrap: nowrap;
    }
}

@media (max-width: 800px) {
    .app-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "brand"
            "nav";
        align-items: center;
        gap: 8px;
        padding: max(10px, env(safe-area-inset-top)) 16px 8px;
    }

    .brand-link {
        grid-area: brand;
        min-width: 0;
        max-width: 100%;
    }

    .app-header .brand {
        width: 120px;
        max-width: 100%;
        min-width: 0;
        height: auto;
    }

    .header-tools {
        display: contents;
    }

    .logout button {
        width: 100%;
    }

    .main-menu {
        grid-area: nav;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .menu-link {
        min-width: 0;
        background: #f6f3ec;
    }

    .menu-account {
        justify-content: flex-end;
    }

    .menu-link.menu-gear {
        flex: 0 0 44px;
    }

    .app-main,
    .app-main.wide {
        width: 100%;
        margin: 16px 0 32px;
        padding-inline: 16px;
    }

    h1 {
        font-size: 1.45rem;
    }

    .tabs {
        max-width: 100%;
    }

    .tabs a {
        flex: 1 1 0;
        min-width: 0;
        padding-inline: 8px;
    }

    .panel {
        max-width: none;
    }

    .cal {
        min-width: 0;
    }

    .cal-days {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    .cal-col {
        flex: 0 0 100%;
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }

    .cal {
        --slot: 40px;
    }

    .cal-hours {
        display: none;
    }

    .cal-col.is-today .cal-events {
        left: 0;
    }

    .cal-dayhead {
        top: 0;
        z-index: 15;
    }

    .cal-col + .cal-col .cal-dayhead,
    .cal-col + .cal-col .cal-day {
        border-left: 0;
    }

    .cal-hint {
        display: block;
        margin-top: 8px;
    }

    .cal-nav {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .cal-nav-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        width: 100%;
    }

    .cal-nav-buttons .cal-nav-arrow {
        display: none;
    }

    .cal-nav-buttons {
        display: flex;
        width: auto;
    }

    .cal-pager {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin: 12px 0 8px;
    }

    .cal-pager .button {
        width: 100%;
    }

    .cal-pager + .cal-scroll,
    .cal-pager + .month {
        margin-top: 0;
    }

    .cal-nav > .button,
    .cal-nav-tools,
    .cal-nav-tools > .button,
    .cal-nav-tools > .inline-form,
    .cal-nav-tools > .inline-form button,
    .filters,
    .filters button {
        width: 100%;
    }

    .cal-nav-tools {
        display: grid;
        justify-content: stretch;
    }

    .cal-views {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .month-head {
        padding: 8px 1px;
        font-size: 0.68rem;
    }

    .month-day {
        min-height: 76px;
        padding: 4px 2px;
    }

    .month-date {
        width: 24px;
        height: 24px;
        font-size: 0.78rem;
    }

    .month-task {
        min-height: 36px;
        padding: 2px;
        font-size: 0.68rem;
        line-height: 1.15;
        white-space: normal;
    }

    .month-task-when,
    .month-task-name {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .month-task-when {
        margin-right: 0;
    }

    .filters {
        display: grid;
    }

    .filters label {
        min-width: 0;
        width: 100%;
    }

    .toolbar .button,
    .pager .button,
    .button-row,
    .button-row .inline-form,
    .button-row .button,
    .button-row button {
        width: 100%;
    }

    .pager {
        display: grid;
    }

    .table-wrap {
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .list,
    .list tbody,
    .list tr,
    .list td {
        display: block;
        width: 100%;
    }

    .list {
        background: transparent;
    }

    .list thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .list tr {
        margin: 0 0 12px;
        padding: 4px 0;
        background: var(--card);
        border: 1px solid var(--line);
        border-radius: 14px;
    }

    .list td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 10px 14px;
        border-bottom: 1px solid var(--line);
        text-align: right;
        overflow-wrap: anywhere;
    }

    .list td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 0.82rem;
        font-weight: 650;
        text-align: left;
    }

    .list td[data-label=""]::before {
        content: none;
    }

    .list tr td:last-child {
        border-bottom: 0;
    }

    .list td.row-actions {
        display: grid;
        justify-content: stretch;
        white-space: normal;
    }

    .list td.row-actions .button {
        width: 100%;
    }

    .agenda li strong {
        font-size: 1.05rem;
    }

    .app-main .balance {
        overflow-wrap: anywhere;
    }

    dialog.popup {
        width: 100%;
    }
}

.cal-busy,
.cal-personal {
    position: absolute;
    z-index: 2;
    left: 2px;
    right: 2px;
    box-sizing: border-box;
    overflow: hidden;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 650;
    line-height: 1.25;
    text-decoration: none;
    pointer-events: auto;
}

.cal-busy,
.cal-allday.is-busy,
.month-busy {
    background: repeating-linear-gradient(-45deg, #ece7df, #ece7df 4px, #e2dbd1 4px, #e2dbd1 8px);
    color: #5c564e;
}

.cal-personal,
.cal-allday.is-personal,
.month-personal {
    background: #efe8f4;
    color: #4a3560;
}

.cal-allday,
.month-busy,
.month-personal {
    display: block;
    margin: 2px 4px 0;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.75rem;
    line-height: 1.25;
    text-decoration: none;
}

.month-span.month-busy,
.month-span.month-personal {
    min-height: calc(1.25em + 4px);
    margin: 2px -7px 0;
    padding: 2px 8px;
    border-radius: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.month-span.is-start {
    margin-left: 4px;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.month-span.is-end {
    margin-right: 4px;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.month-span-gap {
    display: block;
    height: calc(1.25em + 4px);
    margin: 2px 0 0;
    font-size: 0.75rem;
}

.chart {
    margin: 18px 0 0;
}

.chart-row {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    margin: 4px 0;
}

.chart-track {
    display: block;
    height: 12px;
    border-radius: 4px;
    background: #f3efe8;
}

.chart-bar {
    display: block;
    height: 12px;
    border-radius: 4px;
    background: #6a1b9a;
}

.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}

.google-section {
    position: relative;
}

.google-section > h2 {
    display: flex;
    align-items: center;
    min-height: 44px;
    margin-right: 340px;
}

.config-aside > summary {
    position: absolute;
    top: 0;
    right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--muted);
    font-weight: 650;
    list-style: none;
    white-space: nowrap;
    cursor: pointer;
}

.config-aside > summary::-webkit-details-marker {
    display: none;
}

.config-aside > summary::marker {
    content: "";
}

.config-aside > summary:hover {
    background: #e7f3f1;
    border-color: #b7d5cf;
    color: var(--teal-dark);
}

.config-aside > summary:focus-visible {
    outline: 2px solid rgba(29, 107, 99, 0.45);
    outline-offset: 2px;
}

.config-aside .panel {
    clear: both;
}

@media (max-width: 800px) {
    .google-section > h2 {
        margin-right: 0;
    }

    .config-aside > summary {
        position: static;
        width: 100%;
        margin: 0 0 12px;
        white-space: normal;
    }
}

.dialog-layer[hidden] {
    display: none;
}

#overlap-confirm,
#cancel-confirm {
    z-index: 60;
}
