* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

body.auth-body--wide {
    align-items: flex-start;
    justify-content: center;
    padding: 1.5rem 1rem 2rem;
}

.box {
    background: #1e293b;
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.box.box--wide {
    max-width: min(1200px, 100%);
}

h1 {
    margin: 0 0 1.25rem;
    font-size: 1.25rem;
}

label {
    display: block;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 0.35rem;
}

input,
textarea,
select {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #f8fafc;
    margin-bottom: 0.9rem;
    font: inherit;
}

textarea {
    min-height: 2.5rem;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #14b8a6;
    border-color: transparent;
}

.patients-search {
    margin: 0 0 1rem;
    max-width: 28rem;
}

.patients-search__label {
    display: block;
    margin-bottom: 0.35rem;
}

.patients-search__input {
    width: 100%;
    margin-bottom: 0;
}

.patients-filters {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem 1.75rem;
    margin: 0 0 1rem;
}

.patients-filters .patients-filter-row {
    flex: 1 1 17rem;
    min-width: min(100%, 14rem);
}

.patients-filter-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.patients-filter-row label {
    margin-bottom: 0;
}

.patients-filter-row select {
    width: auto;
    min-width: 14rem;
    max-width: 100%;
    flex: 1 1 12rem;
    margin-bottom: 0;
}

.btn {
    width: 100%;
    padding: 0.65rem;
    border: none;
    border-radius: 8px;
    background: #14b8a6;
    color: #0f172a;
    font-weight: 600;
    cursor: pointer;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.err {
    color: #f87171;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.muted {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
}

.muted a {
    color: #2dd4bf;
}

.app-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin: 0 0 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #334155;
}

.app-nav a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
}

.app-nav a:hover {
    color: #e2e8f0;
}

.app-nav a.is-active {
    color: #2dd4bf;
}

.user-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
    overflow: visible;
}

.user-bar__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    overflow: visible;
}

.user-bar__meta {
    margin: 0;
    color: #94a3b8;
    font-size: 0.95rem;
}

.muted--left {
    text-align: left;
    margin-top: 0.5rem;
}

.btn--inline {
    width: auto;
    min-width: 6rem;
    padding: 0.5rem 1rem;
}

.btn--small {
    width: auto;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin: 0.5rem 0 1rem;
}

.page-header__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.btn--danger {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.45);
    color: #fecaca;
}

.btn--danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.22);
    border-color: #f87171;
    color: #fff;
}

.btn--patient-notes {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    min-height: 2.25rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1;
    color: #0f172a;
    border: 1px solid rgba(15, 23, 42, 0.2);
}

.btn--patient-notes .btn-patient-notes__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.btn--patient-notes .btn-patient-notes__icon svg {
    display: block;
    flex-shrink: 0;
}

.btn--patient-notes--has {
    border-color: rgba(56, 189, 248, 0.45);
    background: rgba(14, 165, 233, 0.12);
    color: #e0f2fe;
}

.btn--patient-notes--has:hover:not(:disabled) {
    border-color: rgba(56, 189, 248, 0.65);
    background: rgba(14, 165, 233, 0.2);
    color: #f0f9ff;
}

.page-title {
    margin: 1rem 0 0.75rem;
    font-size: 1.35rem;
}

.page-title--flush {
    margin: 0;
}

.back-link {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
}

.back-link a {
    color: #2dd4bf;
    text-decoration: none;
}

.back-link a:hover {
    text-decoration: underline;
}

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

.section-title {
    margin: 1.25rem 0 0.5rem;
    font-size: 1.05rem;
}

.hint {
    color: #94a3b8;
    font-size: 0.85rem;
    margin: 0 0 0.5rem;
}

.list-status {
    color: #94a3b8;
    font-size: 0.9rem;
    margin: 0 0 0.5rem;
}

.form-stack {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.form-result {
    margin-top: 0;
    margin-bottom: 0;
    color: #94a3b8;
}

.entity-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.entity-list__item {
    padding: 0.6rem 0;
    border-bottom: 1px solid #334155;
}

.entity-list__meta {
    color: #94a3b8;
    font-size: 0.85rem;
    display: block;
    margin-top: 0.15rem;
    white-space: pre-wrap;
}

.edit-panel {
    display: none;
    margin-top: 0.5rem;
    gap: 0.4rem;
    flex-direction: column;
}

.edit-panel__msg {
    margin: 0;
    font-size: 0.8rem;
}

.edit-panel__actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.stat-card {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 1rem 1.1rem;
}

.stat-card__label {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 0.35rem;
    line-height: 1.35;
}

.stat-card__value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #f8fafc;
}

.panel-add {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #334155;
}

.panel-list {
    margin-top: 0.5rem;
}

.section-title--tight {
    margin-top: 0;
}

.form-stack--add label {
    margin-bottom: 0.35rem;
}

.form-stack--add input,
.form-stack--add textarea {
    margin-bottom: 0;
}

.form-row {
    display: grid;
    gap: 0.75rem 1rem;
}

@media (min-width: 640px) {
    .form-row {
        grid-template-columns: 1fr 1fr;
    }
}

.btn--secondary {
    background: #334155;
    color: #e2e8f0;
}

.btn--secondary:hover:not(:disabled) {
    background: #475569;
}

.table-wrap {
    overflow-x: auto;
    margin: 0.75rem 0 1rem;
    border: 1px solid #334155;
    border-radius: 10px;
    background: #0f172a;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table thead th {
    text-align: left;
    padding: 0.65rem 0.85rem;
    background: #1e293b;
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #334155;
}

.data-table tbody td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid #1e293b;
    vertical-align: top;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table__cell-muted {
    color: #94a3b8;
    max-width: 14rem;
    word-break: break-word;
}

/* Patient name links: anchor + nested strong (some browsers don’t paint strong from parent <a>) */
.data-table tbody td a.data-table__patient-name,
.data-table tbody td a.data-table__patient-name:link,
.data-table tbody td a.data-table__patient-name:visited {
    color: #f8fafc;
    font-weight: 500;
    text-decoration: none;
}

.data-table tbody td a.data-table__patient-name:hover,
.data-table tbody td a.data-table__patient-name:active {
    color: #fff;
    text-decoration: underline;
}

.data-table tbody td a.data-table__patient-name strong {
    color: inherit;
    font-weight: 600;
}

.data-table__actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.data-table__actions-inner {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.data-table__col-num {
    width: 2.5rem;
    text-align: right;
}

.data-table__row-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: #94a3b8;
}

.data-table__empty {
    text-align: center;
    color: #94a3b8;
    padding: 1.5rem 1rem !important;
}

.pagination-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-top: 1rem;
    padding-top: 0.5rem;
}

.pagination-bar__info {
    font-size: 0.85rem;
    color: #94a3b8;
}

.pagination-bar__buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.pagination-bar__page {
    font-size: 0.85rem;
    color: #cbd5e1;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal[hidden] {
    display: none !important;
}

.modal--notes {
    z-index: 1001;
}

.patient-notes-view {
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    max-height: min(50vh, 22rem);
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.95rem;
    line-height: 1.55;
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid #334155;
    border-radius: 8px;
}

.patient-notes-textarea {
    box-sizing: border-box;
    width: 100%;
    min-height: 12rem;
    margin: 0 0 0.75rem;
    padding: 0.75rem 0.85rem;
    font: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #e2e8f0;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    resize: vertical;
}

.patient-notes-textarea::placeholder {
    color: #64748b;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    cursor: pointer;
}

.modal__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 26rem;
    max-height: min(90vh, 36rem);
    overflow-y: auto;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 1.25rem 1.35rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

/* Long forms (e.g. edit patient): wider dialog, more vertical room */
.modal__dialog--wide {
    max-width: min(42rem, calc(100vw - 2rem));
    max-height: min(90vh, 52rem);
    padding: 1.35rem 1.5rem;
}

.modal__title {
    margin: 0 0 0.75rem;
    font-size: 1.15rem;
}

.modal__msg {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    min-height: 1.25rem;
}

.modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

.modal .form-stack input,
.modal .form-stack textarea {
    margin-bottom: 0;
}

.payments-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.65rem 1rem;
    margin-bottom: 0.35rem;
}

.payments-section-head__lead {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    flex: 1 1 14rem;
    min-width: 0;
}

.payments-view-toggle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
}

.payments-view-toggle__btn.is-active {
    border-color: rgba(148, 163, 184, 0.55);
    background: rgba(51, 65, 85, 0.85);
    color: #f8fafc;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
}

.payments-view-toggle__btn.payments-back-to-window-btn.is-active {
    border-color: rgba(59, 130, 246, 0.55);
    background: rgba(30, 58, 138, 0.4);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.payments-view-toggle__btn.overdue-unpaid-btn.is-active {
    border-color: rgba(248, 113, 113, 0.55);
    background: rgba(127, 29, 29, 0.45);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.25);
}

.payments-section-title--calendar-day {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #e2e8f0;
}

.payments-section-head .section-title {
    margin-bottom: 0;
}

/* Return from calendar day / unpaid view to the 5-day list */
.payments-back-to-window-btn {
    border-color: rgba(59, 130, 246, 0.4);
    color: #bfdbfe;
}

.payments-back-to-window-btn:hover:not(:disabled) {
    border-color: rgba(59, 130, 246, 0.65);
    background: rgba(30, 58, 138, 0.35);
    color: #fff;
}

/* Switches main table to unpaid-through-today rows (same pattern as calendar day) */
.overdue-unpaid-btn {
    border-color: rgba(248, 113, 113, 0.45);
    color: #fecaca;
}

.overdue-unpaid-btn:hover:not(:disabled) {
    border-color: rgba(248, 113, 113, 0.65);
    background: rgba(127, 29, 29, 0.35);
    color: #fff;
}

.data-table__row--paid {
    background: rgba(34, 197, 94, 0.08);
}

.data-table__row--paid:hover {
    background: rgba(34, 197, 94, 0.14);
}

.data-table__row--paid:focus-visible {
    outline: 2px solid #22c55e;
    outline-offset: -2px;
}

.payment-subrow td {
    padding: 0;
    border-bottom: 1px solid #334155;
    background: #0f172a;
}

.payment-subrow__inner {
    padding: 0.55rem 0.85rem 0.65rem;
    font-size: 0.82rem;
    color: #cbd5e1;
    line-height: 1.45;
}

tr[data-history-expand="1"] {
    cursor: pointer;
}

tr[data-history-expand="1"] a.data-table__patient-name,
tr[data-history-expand="1"] a.data-table__patient-name strong,
tr[data-history-expand="1"] button {
    cursor: pointer;
}

.pay-history-chevron {
    display: inline-block;
    margin-right: 0.25rem;
    color: #64748b;
    font-size: 0.75rem;
    transition: transform 0.15s ease;
    vertical-align: middle;
}

tr[data-history-expand="1"].is-history-open .pay-history-chevron {
    transform: rotate(90deg);
    color: #94a3b8;
}

.payment-history-subrow td {
    padding: 0;
    border-bottom: 1px solid #334155;
    background: #0f172a;
    vertical-align: top;
}

.payment-history-subrow__inner {
    padding: 0.65rem 0.85rem 0.85rem;
}

.payment-history-panel__title {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.payment-history-panel__empty {
    margin: 0;
    font-size: 0.85rem;
    color: #94a3b8;
}

.payment-history-panel__table-wrap {
    margin: 0;
    border-radius: 8px;
}

.payment-history-mini {
    font-size: 0.82rem;
}

.payment-history-mini thead th {
    font-size: 0.68rem;
    padding: 0.45rem 0.55rem;
}

.payment-history-mini tbody td {
    padding: 0.45rem 0.55rem;
}

.detail-card {
    margin-bottom: 1.5rem;
    padding: 1rem 1.1rem;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 10px;
}

.detail-card--highlight {
    border-color: #14b8a6;
}

.detail-card__title {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
    color: #94a3b8;
    font-weight: 600;
}

.detail-dl {
    margin: 0;
    display: grid;
    gap: 0.5rem 1rem;
}

.detail-dl__row {
    display: grid;
    grid-template-columns: minmax(8rem, 11rem) 1fr;
    gap: 0.5rem 1rem;
    font-size: 0.9rem;
}

.detail-dl dt {
    color: #94a3b8;
    margin: 0;
}

.detail-dl dd {
    margin: 0;
    color: #e2e8f0;
}

.detail-meta {
    margin: 0;
    font-size: 0.95rem;
    color: #e2e8f0;
}

.detail-payable {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #2dd4bf;
}

.calendar-panel {
    margin-top: 2rem;
    border: 1px solid #334155;
    border-radius: 12px;
    background: #0f172a;
    overflow: hidden;
}

.calendar-panel--open {
    border-color: #475569;
}

.calendar-panel__toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.15rem;
    margin: 0;
    border: none;
    background: #1e293b;
    color: #e2e8f0;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.calendar-panel__toggle:hover {
    background: #334155;
}

.calendar-panel__toggle-title {
    flex: 1;
}

.calendar-panel__chevron {
    color: #94a3b8;
    font-size: 0.75rem;
}

.calendar-panel__body {
    padding: 1rem 1.15rem 1.25rem;
    border-top: 1px solid #334155;
}

.calendar-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.calendar-toolbar__label {
    font-weight: 600;
    color: #f8fafc;
    min-width: 10rem;
    text-align: center;
}

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: #94a3b8;
}

.cal-dot {
    display: inline-block;
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    margin-right: 0.35rem;
    vertical-align: middle;
}

.cal-dot--red {
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.35);
}

.cal-dot--orange {
    background: #f97316;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.35);
}

.cal-dot--green {
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.35);
}

.cal-dot--blue {
    background: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}

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

.calendar-grid__dow {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    padding: 0.35rem 0;
}

.calendar-grid__cell {
    aspect-ratio: 1;
    max-height: 3.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 600;
    color: #94a3b8;
    background: transparent;
}

.calendar-grid__cell--empty {
    pointer-events: none;
}

.calendar-grid__cell--plain .calendar-grid__num {
    color: #64748b;
}

.calendar-grid__num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
}

.calendar-grid__cell--red .calendar-grid__num {
    color: #fecaca;
    border: 2px solid #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

.calendar-grid__cell--orange .calendar-grid__num {
    color: #ffedd5;
    border: 2px solid #f97316;
    background: rgba(249, 115, 22, 0.15);
}

.calendar-grid__cell--green .calendar-grid__num {
    color: #bbf7d0;
    border: 2px solid #22c55e;
    background: rgba(34, 197, 94, 0.12);
}

.calendar-grid__cell--blue .calendar-grid__num {
    color: #bfdbfe;
    border: 2px solid #3b82f6;
    background: rgba(59, 130, 246, 0.18);
}

/* Candies page: calendar next to Log out (header) */
.calendar-dock {
    position: relative;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
}

.calendar-dock .calendar-flyout {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    z-index: 50;
    margin-top: 0;
}

.calendar-fab {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    border: 1px solid #334155;
    background: #1e293b;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #e2e8f0;
}

.calendar-fab:hover {
    background: #334155;
}

.calendar-fab:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 2px;
}

.calendar-fab__icon {
    font-size: 1.35rem;
    line-height: 1;
}

.calendar-flyout {
    width: min(18.5rem, calc(100vw - 2.5rem));
    max-height: min(58vh, 26rem);
    overflow: auto;
    border: 1px solid #334155;
    border-radius: 12px;
    background: #0f172a;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    padding: 0.65rem 0.75rem 0.85rem;
}

.calendar-flyout__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.calendar-flyout__title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #f1f5f9;
}

.calendar-toolbar--compact {
    margin-bottom: 0.5rem;
}

.calendar-legend--compact {
    margin-bottom: 0.5rem;
    font-size: 0.72rem;
    gap: 0.45rem 0.75rem;
}

.calendar-grid-wrap--compact {
    margin-bottom: 0.65rem;
}

.calendar-grid--compact {
    gap: 0.2rem;
}

.calendar-grid--compact .calendar-grid__dow {
    padding: 0.2rem 0;
    font-size: 0.62rem;
}

button.calendar-grid__cell {
    border: none;
    font: inherit;
    cursor: pointer;
    padding: 0;
    width: 100%;
    max-height: 2.35rem;
}

.calendar-grid--compact .calendar-grid__num {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.75rem;
}

.calendar-grid__cell--selected .calendar-grid__num {
    box-shadow: 0 0 0 2px #38bdf8, 0 0 0 4px rgba(56, 189, 248, 0.25);
}

.day-detail {
    border-top: 1px solid #334155;
    padding-top: 0.65rem;
    margin-top: 0.25rem;
}

.day-detail__title {
    font-size: 0.85rem;
    margin: 0 0 0.45rem;
    color: #f8fafc;
}

.day-detail__placeholder,
.day-detail__empty,
.day-detail__loading,
.day-detail__err {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0;
}

.day-detail__err {
    color: #f87171;
}

.day-detail__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.day-detail__item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.78rem;
    color: #e2e8f0;
}

.day-detail__meta {
    font-size: 0.72rem;
    color: #94a3b8;
}

.day-detail__item--unpaid .js-to-pay-inline {
    align-self: flex-start;
    margin-top: 0.15rem;
}

.checkbox-card-fieldset {
    border: none;
    margin: 0 0 0.5rem;
    padding: 0;
    min-width: 0;
}

.checkbox-card-fieldset__legend {
    display: block;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 0.35rem;
    padding: 0;
    font-weight: 600;
}

.checkbox-card-fieldset__intro {
    margin: 0 0 0.65rem;
    font-size: 0.75rem;
    line-height: 1.45;
}

.checkbox-card-grid {
    display: grid;
    gap: 0.65rem;
}

.checkbox-card {
    display: block;
    cursor: pointer;
    margin: 0;
}

.checkbox-card input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
    opacity: 0;
}

.checkbox-card__surface {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    border: 1px solid #334155;
    background: #0f172a;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.checkbox-card:hover .checkbox-card__surface {
    border-color: #475569;
}

.checkbox-card input:focus-visible + .checkbox-card__surface {
    outline: 2px solid #14b8a6;
    outline-offset: 2px;
}

.checkbox-card input:checked + .checkbox-card__surface {
    border-color: #14b8a6;
    box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.28);
}

.checkbox-card__check {
    flex-shrink: 0;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 4px;
    border: 2px solid #64748b;
    margin-top: 0.1rem;
    position: relative;
    box-sizing: border-box;
}

.checkbox-card input:checked + .checkbox-card__surface .checkbox-card__check {
    border-color: #14b8a6;
    background: #14b8a6;
}

.checkbox-card input:checked + .checkbox-card__surface .checkbox-card__check::after {
    content: '';
    position: absolute;
    left: 0.2rem;
    top: 0.02rem;
    width: 0.28rem;
    height: 0.55rem;
    border: solid #0f172a;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-card__text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.checkbox-card__title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #f1f5f9;
    line-height: 1.25;
}

.checkbox-card__desc {
    font-size: 0.72rem;
    color: #94a3b8;
    line-height: 1.4;
}

.pay-receipt-option {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
    margin: 0 0 0.35rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid #334155;
    background: #0f172a;
}

.pay-receipt-option:hover {
    border-color: #475569;
}

.pay-receipt-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
    opacity: 0;
}

.pay-receipt-option__box {
    flex-shrink: 0;
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 4px;
    border: 2px solid #64748b;
    margin-top: 0.12rem;
    position: relative;
    box-sizing: border-box;
}

.pay-receipt-option input:checked + .pay-receipt-option__box {
    border-color: #14b8a6;
    background: #14b8a6;
}

.pay-receipt-option input:checked + .pay-receipt-option__box::after {
    content: '';
    position: absolute;
    left: 0.18rem;
    top: 0.02rem;
    width: 0.26rem;
    height: 0.52rem;
    border: solid #0f172a;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.pay-receipt-option input:focus-visible + .pay-receipt-option__box {
    outline: 2px solid #14b8a6;
    outline-offset: 2px;
}

.pay-receipt-option__text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.pay-receipt-option__title {
    font-size: 0.84rem;
    font-weight: 600;
    color: #f1f5f9;
}

.pay-receipt-option__desc {
    font-size: 0.72rem;
    color: #94a3b8;
    line-height: 1.4;
}
