.page-title {
    font-family: "Bakbak One", sans-serif;
    font-size: 1.5em;
    line-height: 1.2;
    margin: 0 0 0em;
    color: var(--primary);
}

@media (max-width: 511px) {
    .page-title {
        font-size: 2em;
    }
}

.section-gap {
    margin-bottom: 2em;
}

.flex-row {
    display: flex;
    gap: 0.5em;
    align-items: flex-start;
    flex-wrap: wrap;
}

.flex-row + .flex-row {
    margin-top: 0.5em;
}

.group-grid + .flex-row,
.person-grid + .flex-row,
#expenseList + .flex-row {
    margin-top: 0.75em;
}

.flex-row > input,
.flex-row > button,
.flex-row > .btn,
.flex-row > .dropdown,
.tally-control > .btn,
.group-grid > *,
.dialog-actions > .btn {
    margin: 0;
    width: auto;
}

.flex-row > input {
    width: 100%;
}

.flex-row > input#amountInput {
    min-width: 5.5em;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75em;
    margin-bottom: 0.5em;
    font-size: 0.9em;
}

.entry-remove {
    flex: 0 0 auto;

    margin-left: auto;
    padding: 0;
    width: auto;
    font: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    background: none;
    border: none;
    text-decoration: dashed underline;
    cursor: pointer;
    white-space: nowrap;
}

.entry-remove:hover,
.entry-remove:focus-visible {
    color: var(--primary);
}

.entry {
    align-items: flex-start;
    padding-bottom: 0;
    border-bottom: none;
}

.entry + .entry {
    margin-top: 0.6em;
}

.entry-text {
    display: flex;
    flex-direction: column;
    gap: 0.15em;
    min-width: 0;
    flex: 1;
}

.entry-desc {
    color: var(--primary);
    font-size: 1em;
    overflow-wrap: anywhere;
}

.entry-meta {
    display: flex;
    align-items: baseline;
    gap: 0.6em;
    font-size: 0.72em;
    line-height: 1.4;
    color: var(--text);
    opacity: 70%;

    flex-wrap: nowrap;
}

.entry-meta-text {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.entry-meta b {
    font-weight: 400;
    color: var(--primary);
}

.sep {
    padding: 0 0.15em;
    opacity: 50%;
}

.entry-amount {
    font-family: "Kode", monospace;
    font-variant-numeric: tabular-nums;
    color: var(--primary);
}

#settlementDetails {
    display: flex;
    flex-direction: column;
    gap: 0.4em;
    margin-bottom: 1em;
}

.spend-row .who {
    color: var(--primary);
    display: flex;
    align-items: baseline;
    gap: 0.3em;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.spend-row .verb {
    flex: 0 0 auto;
    font-size: 0.75em;
    opacity: 60%;
}

#spendDetails {
    display: flex;
    flex-direction: column;
    gap: 0.4em;
    margin-bottom: 1em;
}

.spend-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75em;
    min-width: 0;
}

.spend-row .who {
    color: var(--primary);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.spend-row .entry-amount {
    flex: 0 0 auto;
    font-size: 1em;
}

.total-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1em;
    padding: 0.6em 1em;
    border: var(--text) 0.05em dashed;
    text-align: center;
}

.total-line code {
    font-family: "Kode", monospace;
    font-size: 1.5em;
    line-height: 1.2;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.total-label {
    font-size: 0.75em;
    opacity: 60%;
}

.copy-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.6em;
}

.debt-empty {
    opacity: 60%;
}

.muted {
    opacity: 60%;
}

.participant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5em;
    margin-top: 0.5em;
}

.person-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-top: 0.75em;
}

.person-grid:empty {
    display: none;
}

.tally-control {
    margin-top: 0.5em;
}

.tally-control[hidden] {
    display: none;
}

.tally-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75em;
}

.tally-summary {
    min-width: 0;
    font-size: 0.8em;
    color: var(--text);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.tally-summary.warn {
    color: var(--primary);
    text-decoration: underline dashed;
}

.group-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-top: 0.75em;
}

.group-grid:empty {
    display: none;
}

.privacy-note {
    margin: 0;
    line-height: 1.5;
}

.privacy-note[hidden] {
    display: none;
}

.privacy-note:empty {
    display: none;
}

.muted-section {
    opacity: 60%;
}

.muted-section h2 {
    opacity: 80%;
}

.tally-quick {
    display: flex;
    gap: 0.75em;
    flex: 0 0 auto;
}

.link-btn {
    padding: 0;
    font: inherit;
    font-size: inherit;
    color: var(--text);
    background: none;
    border: none;
    text-decoration: dashed underline;
    cursor: pointer;
}

.link-btn:hover {
    color: var(--primary);
}

.tally-preview {
    margin: 0.5em 0 0;
    font-family: "Kode", monospace;
    font-size: 0.7em;
    color: var(--primary);
    opacity: 80%;
}

.tally-preview[hidden] {
    display: none;
}

.person-grid .item-row {
    grid-column: 1 / -1;
}

.group-chip,
.person-chip {
    display: flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.3em 0.6em;
    font-size: 0.8em;
    line-height: 1.3;
    border: var(--text) 0.05em dashed;
    color: var(--text);
    background: transparent;
    max-width: 100%;
    min-width: 0;
}

.group-chip {
    cursor: pointer;
}

.group-chip:hover,
.person-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.group-chip.active {
    border-style: solid;
    border-color: var(--primary);
    color: var(--primary);
}

.group-chip .group-name,
.person-chip .chip-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.person-chip .chip-name {
    color: var(--primary);
}

.group-chip .group-count {
    font-family: "Kode", monospace;
    font-size: 0.85em;
    opacity: 60%;
}

.group-chip .group-remove,
.person-chip .chip-remove {
    padding: 0 0.1em;
    margin: 0;
    width: auto;
    flex: 0 0 auto;
    font: inherit;
    line-height: 1;
    color: var(--text);
    background: none;
    border: none;
    cursor: pointer;
    opacity: 60%;
}

.group-chip .group-remove:hover,
.person-chip .chip-remove:hover {
    color: var(--primary);
    opacity: 100%;
}

.chip-upi {
    padding: 0;
    margin: 0;
    width: auto;
    min-width: 0;
    max-width: 9em;
    flex: 0 1 auto;
    font-family: "Kode", monospace;
    font-size: 0.85em;
    line-height: 1;
    color: var(--text);
    background: none;
    border: none;
    text-decoration: dashed underline;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    opacity: 70%;
}

.chip-upi:hover {
    color: var(--primary);
    opacity: 100%;
}

.chip-upi.is-empty {
    font-family: inherit;
    opacity: 45%;
}

.upi-tag {
    font-family: "Kode", monospace;
    font-size: 0.85em;
    opacity: 60%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.dialog input {
    margin: 0 0 1em;
}

.toast {
    position: fixed;
    left: 50%;
    top: 1.5em;
    transform: translate(-50%, -1em);
    z-index: 100;
    max-width: min(90vw, 30em);
    padding: 0.4em 0.9em;
    font-size: 0.75em;
    text-align: center;
    color: var(--background);
    background: var(--text);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.toast.show {
    opacity: 100%;
    visibility: visible;
    transform: translate(-50%, 0);
}

.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1em;
    background: color-mix(in srgb, var(--background) 75%, transparent);
    backdrop-filter: blur(2px);
}

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

.dialog {
    width: 100%;
    max-width: 26em;
    padding: 1em 1.2em;
    background: var(--background);
    border: var(--text) 0.05em dashed;
    animation: dialogIn 0.12s ease;
}

@keyframes dialogIn {
    from {
        opacity: 0;
        transform: scale(0.97);
    }
}

.dialog-title {
    margin: 0 0 0.5em !important;
    font-size: 110% !important;
}

.dialog-body {
    margin: 0 0 1em;
    font-size: 0.85em;
    white-space: pre-line;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5em;
}

.dialog-actions .btn {
    width: auto;
    padding: 0.35em 1em;
    font-size: 0.8em !important;
}

.dialog-ok {
    color: var(--primary);
    border-color: var(--primary);
}

.dropdown {
    position: relative;
    flex: 1;
    min-width: 0;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5em;
    width: 100%;
    text-align: left;
    margin: 0;
}

.dropdown-toggle::after {
    content: "v";
    flex: 0 0 auto;
    font-family: "Kode", monospace;
    font-size: 0.8em;
    opacity: 60%;
}

.dropdown-toggle:disabled {
    cursor: not-allowed;
    opacity: 50%;
}

.dropdown-toggle .dropdown-label {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    margin-top: -0.4em;
    max-height: 14em;
    overflow-y: auto;
    background: var(--background);
    border: var(--text) 0.05em dashed;
    border-top: none;
}

.dropdown-menu[hidden] {
    display: none;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.45em 1em;
    font: inherit;
    font-size: 0.8em !important;
    text-align: left;
    color: var(--text);
    background: transparent;
    border: none;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.dropdown-item:hover,
.dropdown-item.active {
    color: var(--primary);
    text-decoration: underline dashed;
}

.dropdown-item.active::before {
    content: "> ";
    font-family: "Kode", monospace;
}

.participant-option {
    cursor: pointer;
    opacity: 50%;
    transition: opacity 0.1s ease, border-color 0.1s ease;
}

.participant-option:hover {
    border-color: var(--primary);
}

.participant-option:has(input:checked) {
    opacity: 100%;
    border-color: var(--primary);
    color: var(--primary);
}

.participant-option input {
    width: auto;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.participant-option input:focus-visible {
    outline: var(--text) 0.05em dashed;
    outline-offset: 0.15em;
}
