:root {
    --ink: #17312e;
    --ink-soft: #5d6e6b;
    --green-950: #0b2421;
    --green-900: #10332e;
    --green-800: #17473f;
    --green-700: #246356;
    --green-100: #dbece6;
    --green-50: #eff7f4;
    --gold-700: #9f6d12;
    --gold-500: #d9a329;
    --gold-300: #efd585;
    --gold-100: #fbf2d8;
    --cream: #f5f2ea;
    --paper: #fffefa;
    --line: #dfe6e2;
    --danger: #9c3e35;
    --danger-soft: #f9e9e6;
    --success: #247459;
    --shadow-sm: 0 8px 24px rgba(14, 44, 39, 0.07);
    --shadow-lg: 0 24px 70px rgba(8, 33, 29, 0.14);
    --radius-sm: 12px;
    --radius: 20px;
    --radius-lg: 30px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--cream);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
}

.shell {
    width: min(1160px, calc(100% - 40px));
    margin-inline: auto;
}

.site-header {
    position: sticky;
    z-index: 40;
    top: 0;
    border-bottom: 1px solid rgba(23, 49, 46, 0.08);
    background: rgba(245, 242, 234, 0.92);
    backdrop-filter: blur(18px);
}

.header-inner {
    display: flex;
    min-height: 78px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
}

.brand-mark {
    position: relative;
    display: inline-grid;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(239, 213, 133, 0.45);
    border-radius: 50%;
    color: var(--gold-300);
    background: var(--green-900);
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.06);
    font-family: Georgia, serif;
    font-size: 22px;
    font-weight: 700;
}

.brand-mark::after {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--gold-300);
    box-shadow: 28px 0 var(--gold-300), 0 28px var(--gold-300), 28px 28px var(--gold-300);
    content: "";
    left: 6px;
    top: 6px;
    opacity: 0.65;
}

.brand > span:last-child {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand small {
    margin-top: 3px;
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-nav > a,
.link-button {
    padding: 10px 14px;
    border: 0;
    border-radius: 999px;
    color: var(--ink-soft);
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.main-nav > a:hover,
.link-button:hover {
    color: var(--ink);
    background: rgba(23, 49, 46, 0.06);
}

.main-nav > a.active {
    color: var(--paper);
    background: var(--green-900);
}

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

.main-content {
    padding-block: 40px 64px;
}

.flash {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 14px 16px;
    border: 1px solid;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    font-size: 14px;
    font-weight: 650;
}

.flash-success {
    border-color: #b8dccc;
    color: #185c45;
    background: #eaf6f1;
}

.flash-error {
    border-color: #edc8c2;
    color: #87342c;
    background: var(--danger-soft);
}

.flash-icon {
    display: grid;
    width: 25px;
    height: 25px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    font-size: 13px;
}

.flash-success .flash-icon { background: var(--success); }
.flash-error .flash-icon { background: var(--danger); }

.flash > button {
    margin-left: auto;
    padding: 0 4px;
    border: 0;
    color: currentColor;
    background: none;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--green-700);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.eyebrow.light {
    color: var(--gold-300);
}

.dashboard-hero {
    position: relative;
    display: grid;
    min-height: 330px;
    grid-template-columns: 1.2fr 0.8fr;
    align-items: center;
    gap: 60px;
    overflow: hidden;
    padding: 48px 62px;
    border-radius: var(--radius-lg);
    color: var(--paper);
    background:
        radial-gradient(circle at 16% 130%, rgba(91, 145, 125, 0.5), transparent 42%),
        linear-gradient(120deg, #0b2925 0%, #123d36 68%, #174a40 100%);
    box-shadow: var(--shadow-lg);
}

.dashboard-hero::before,
.dashboard-hero::after {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    content: "";
}

.dashboard-hero::before {
    width: 330px;
    height: 330px;
    right: -120px;
    top: -170px;
}

.dashboard-hero::after {
    width: 230px;
    height: 230px;
    bottom: -150px;
    left: 31%;
}

.hero-copy {
    position: relative;
    z-index: 1;
}

.hero-copy h1 {
    max-width: 620px;
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(48px, 6vw, 74px);
    font-weight: 500;
    letter-spacing: -0.055em;
    line-height: 0.93;
}

.hero-copy p {
    max-width: 540px;
    margin: 24px 0 0;
    color: rgba(255, 255, 255, 0.68);
    font-size: 15px;
}

.hero-copy p strong {
    color: rgba(255, 255, 255, 0.9);
}

.pot-card {
    position: relative;
    z-index: 2;
    display: flex;
    min-height: 222px;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    padding: 32px;
    border: 1px solid rgba(249, 225, 151, 0.43);
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.035));
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.15), 0 20px 50px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

.pot-shine {
    position: absolute;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(229, 183, 61, 0.16);
    filter: blur(25px);
    right: -50px;
    top: -55px;
}

.pot-label {
    color: var(--gold-300);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.pot-card > strong {
    margin-top: 8px;
    color: #fff7df;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(38px, 4.5vw, 57px);
    font-weight: 500;
    letter-spacing: -0.055em;
    line-height: 1;
}

.pot-note {
    margin-top: 14px;
    color: rgba(255, 255, 255, 0.58);
    font-size: 13px;
}

.coin-stack {
    position: absolute;
    right: 24px;
    bottom: 22px;
    width: 53px;
    height: 40px;
    opacity: 0.72;
}

.coin-stack i {
    position: absolute;
    display: block;
    width: 44px;
    height: 12px;
    border: 2px solid var(--gold-300);
    border-radius: 50%;
    background: rgba(217, 163, 41, 0.2);
}

.coin-stack i:nth-child(1) { bottom: 0; left: 0; }
.coin-stack i:nth-child(2) { bottom: 8px; left: 5px; }
.coin-stack i:nth-child(3) { bottom: 16px; left: 9px; }

.summary-strip {
    display: grid;
    width: calc(100% - 72px);
    margin: -1px auto 0;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 var(--radius) var(--radius);
    background: rgba(255, 254, 250, 0.9);
    box-shadow: var(--shadow-sm);
}

.summary-strip > div {
    display: flex;
    min-height: 104px;
    flex-direction: column;
    justify-content: center;
    padding: 22px 32px;
}

.summary-strip > div + div {
    border-left: 1px solid var(--line);
}

.summary-strip span {
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.summary-strip strong {
    margin-top: 6px;
    font-family: Georgia, serif;
    font-size: 24px;
    font-weight: 600;
}

.summary-strip small {
    color: var(--ink-soft);
    font-family: Inter, sans-serif;
    font-size: 12px;
    font-weight: 600;
}

.ok-text { color: var(--success); }
.due-text { color: var(--danger); }
.gold-text { color: var(--gold-700) !important; }

.section-block {
    margin-top: 52px;
}

.section-title {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
}

.section-title h2,
.page-heading h1,
.form-card h2,
.setup-card h2,
.login-box h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 600;
    letter-spacing: -0.035em;
}

.section-title h2 {
    font-size: 32px;
}

.period-chip {
    padding: 8px 12px;
    border: 1px solid #d9e4df;
    border-radius: 999px;
    color: var(--ink-soft);
    background: rgba(255, 255, 255, 0.62);
    font-size: 12px;
    font-weight: 700;
}

.status-list {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow-sm);
}

.status-row {
    display: grid;
    min-height: 92px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 18px 24px;
}

.status-row + .status-row {
    border-top: 1px solid var(--line);
}

.avatar {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid #cfddd7;
    border-radius: 50%;
    color: var(--green-700);
    background: var(--green-50);
    font-family: Georgia, serif;
    font-size: 18px;
    font-weight: 700;
}

.avatar.mini {
    width: 34px;
    height: 34px;
    font-size: 14px;
}

.person {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.person strong {
    font-size: 16px;
}

.person span {
    margin-top: 3px;
    overflow: hidden;
    color: var(--ink-soft);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.status-badge i {
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.status-ok {
    color: #216a52;
    background: #e3f2eb;
}

.status-due {
    color: #994237;
    background: #f8eae6;
}

.due-copy {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    justify-items: end;
    gap: 2px 12px;
}

.due-copy .status-badge {
    grid-row: span 2;
}

.due-copy strong {
    color: var(--danger);
    font-size: 16px;
}

.due-copy small {
    color: var(--ink-soft);
    font-size: 11px;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}

.history-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow-sm);
}

.history-card-head {
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 17px 20px;
    border-bottom: 1px solid var(--line);
}

.history-card-head h3 {
    margin: 0;
    font-family: Georgia, serif;
    font-size: 19px;
}

.history-card-head > span {
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.history-list {
    max-height: 530px;
    overflow: auto;
}

.history-item {
    position: relative;
    display: grid;
    min-height: 72px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
}

.history-item + .history-item {
    border-top: 1px solid #edf0ee;
}

.movement-icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 11px;
    font-size: 15px;
    font-weight: 800;
}

.payment-icon {
    color: var(--green-700);
    background: var(--green-50);
}

.prize-icon {
    color: var(--gold-700);
    background: var(--gold-100);
}

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

.expense-text {
    color: var(--danger) !important;
}

.movement-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.movement-copy strong {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.movement-copy span {
    margin-top: 2px;
    overflow: hidden;
    color: var(--ink-soft);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.movement-amount {
    font-size: 13px;
    white-space: nowrap;
}

.empty-state {
    display: flex;
    min-height: 155px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--ink-soft);
    text-align: center;
}

.empty-state > span {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 50%;
    color: var(--green-700);
    background: var(--green-50);
    font-family: Georgia, serif;
    font-weight: 700;
}

.empty-state p {
    margin: 10px 0 0;
    font-size: 13px;
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 56px;
    color: var(--ink-soft);
}

.site-footer p {
    font-family: Georgia, serif;
    font-size: 14px;
    font-style: italic;
}

.brand-mark.mini-mark {
    width: 28px;
    height: 28px;
    font-size: 14px;
}

.brand-mark.mini-mark::after {
    display: none;
}

/* Forms and administration */
.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin: 8px 0 32px;
}

.page-heading h1 {
    font-size: 46px;
}

.page-heading p {
    margin: 8px 0 0;
    color: var(--ink-soft);
}

.button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(0);
}

.button-primary {
    color: #fff;
    background: var(--green-900);
    box-shadow: 0 9px 22px rgba(16, 51, 46, 0.18);
}

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

.button-gold {
    color: #352407;
    background: var(--gold-500);
    box-shadow: 0 9px 22px rgba(159, 109, 18, 0.19);
}

.button-gold:hover {
    background: #e0ad39;
}

.button-secondary {
    border-color: #cfdbd6;
    color: var(--ink);
    background: var(--paper);
}

.button-secondary:hover {
    background: var(--green-50);
}

.button-rust {
    color: #fff;
    background: #9c4d3d;
    box-shadow: 0 9px 22px rgba(124, 54, 43, 0.18);
}

.button-rust:hover {
    background: #ad5846;
}

.button:disabled {
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.48;
    transform: none;
}

.button-wide {
    width: 100%;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.payment-card {
    grid-column: 1 / -1;
}

.form-card {
    position: relative;
    overflow: hidden;
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow-sm);
}

.form-card::before {
    position: absolute;
    height: 4px;
    content: "";
    inset: 0 0 auto;
}

.form-card.accent-green::before { background: var(--green-700); }
.form-card.accent-gold::before { background: var(--gold-500); }
.form-card.accent-rust::before { background: #a85543; }

.form-card-icon {
    position: absolute;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 13px;
    right: 30px;
    top: 30px;
    color: var(--green-700);
    background: var(--green-50);
    font-family: Georgia, serif;
    font-size: 21px;
    font-weight: 700;
}

.accent-gold .form-card-icon {
    color: var(--gold-700);
    background: var(--gold-100);
}

.accent-rust .form-card-icon {
    color: var(--danger);
    background: var(--danger-soft);
}

.form-card h2 {
    padding-right: 54px;
    font-size: 27px;
}

.form-card > div > p {
    margin: 6px 0 22px;
    color: var(--ink-soft);
    font-size: 13px;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stack-form label {
    display: flex;
    color: var(--ink);
    flex-direction: column;
    gap: 7px;
    font-size: 12px;
    font-weight: 750;
}

.hint {
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 500;
}

.optional {
    color: #899592;
    font-size: 10px;
    font-weight: 600;
}

input,
textarea,
select {
    width: 100%;
    min-height: 46px;
    padding: 11px 13px;
    border: 1px solid #ced9d5;
    border-radius: 10px;
    outline: none;
    color: var(--ink);
    background: #fff;
    transition: border 0.15s ease, box-shadow 0.15s ease;
}

textarea {
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #9aa5a2;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--green-700);
    box-shadow: 0 0 0 3px rgba(36, 99, 86, 0.11);
}

.input-money {
    position: relative;
}

.input-money input {
    padding-right: 42px;
}

.input-money > span {
    position: absolute;
    top: 50%;
    right: 15px;
    color: var(--ink-soft);
    transform: translateY(-50%);
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.field-note {
    min-height: 17px;
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 500;
}

.quick-weeks {
    display: flex;
    gap: 7px;
    margin-top: -7px;
}

.quick-weeks button {
    padding: 6px 10px;
    border: 1px solid #d4ded9;
    border-radius: 999px;
    color: var(--green-700);
    background: var(--green-50);
    cursor: pointer;
    font-size: 10px;
    font-weight: 750;
}

.quick-weeks button:hover {
    border-color: var(--green-700);
}

.payment-mode {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.payment-mode legend {
    margin-bottom: 7px;
    color: var(--ink);
    font-size: 12px;
    font-weight: 750;
}

.segmented-control {
    display: grid;
    padding: 4px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid #d4ded9;
    border-radius: 12px;
    background: #f0f4f2;
}

.segmented-control label {
    display: block;
    cursor: pointer;
}

.segmented-control input {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 0;
    opacity: 0;
    pointer-events: none;
}

.segmented-control span {
    display: flex;
    min-height: 39px;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 750;
    transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.segmented-control input:checked + span {
    color: var(--green-900);
    background: #fff;
    box-shadow: 0 3px 10px rgba(16, 51, 46, 0.1);
}

.segmented-control input:focus-visible + span {
    outline: 3px solid rgba(36, 99, 86, 0.18);
}

.payment-panel {
    padding: 16px;
    border: 1px solid #dce7e2;
    border-radius: 13px;
    background: #f7faf8;
}

.payment-panel[hidden] {
    display: none;
}

.payment-panel .quick-weeks {
    margin-top: 10px;
}

.calculation-note {
    display: block;
    margin-top: 10px;
    color: var(--green-700);
    font-size: 11px;
    font-weight: 650;
}

.calculation-note.calculation-error {
    color: var(--danger);
}

.payment-breakdown {
    margin-top: 14px;
    overflow: hidden;
    border: 1px solid #d8e3de;
    border-radius: 10px;
    background: #fff;
}

.payment-breakdown[hidden] {
    display: none;
}

.breakdown-heading,
.breakdown-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 82px;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
}

.breakdown-heading {
    color: var(--ink-soft);
    background: #eef4f1;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.breakdown-heading span:last-child {
    grid-column: 2 / 4;
    text-align: right;
}

.breakdown-row + .breakdown-row {
    border-top: 1px solid #e9eeeb;
}

.breakdown-name {
    overflow: hidden;
    font-size: 12px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.breakdown-weeks {
    color: var(--ink-soft);
    font-size: 10px;
    white-space: nowrap;
}

.breakdown-row strong {
    color: var(--green-700);
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
}

.breakdown-row strong.breakdown-zero {
    color: #8a9693;
}

.available-pot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 4px 0 20px;
    padding: 11px 13px;
    border: 1px solid #ead5cf;
    border-radius: 11px;
    color: var(--danger);
    background: #fcf4f1;
}

.available-pot span {
    font-size: 11px;
    font-weight: 700;
}

.available-pot strong {
    font-family: Georgia, serif;
    font-size: 19px;
}

.status-list.compact .status-row {
    min-height: 76px;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    padding-block: 13px;
}

.due-amount {
    min-width: 75px;
    color: var(--danger);
    font-size: 14px;
    text-align: right;
}

.delete-form {
    display: flex;
    margin-left: -4px;
}

.delete-form button {
    display: grid;
    width: 26px;
    height: 26px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: #8c9996;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
}

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

.admin-page .history-item {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}

.settings-page .settings-block {
    margin-top: 8px;
}

.settings-card {
    padding: 25px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow-sm);
}

.settings-card h3 {
    margin: 0;
    font-family: Georgia, serif;
    font-size: 21px;
}

.settings-card > p {
    min-height: 39px;
    margin: 6px 0 20px;
    color: var(--ink-soft);
    font-size: 12px;
}

.participant-input {
    position: relative;
}

.participant-input .avatar {
    position: absolute;
    z-index: 1;
    left: 6px;
    top: 6px;
}

.participant-input input {
    padding-left: 49px;
}

.fixed-rules dl {
    margin: 20px 0 0;
}

.fixed-rules dl > div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.fixed-rules dt {
    color: var(--ink-soft);
    font-size: 12px;
}

.fixed-rules dd {
    margin: 0;
    font-size: 12px;
    font-weight: 750;
    text-align: right;
}

.fixed-rules .settings-note {
    min-height: 0;
    margin: 18px 0 0;
    padding: 11px 12px;
    border-radius: 10px;
    color: var(--green-700);
    background: var(--green-50);
}

/* Login */
.login-page {
    min-height: 100vh;
    background: var(--paper);
}

.login-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(380px, 0.92fr) minmax(440px, 1.08fr);
}

.login-visual {
    position: relative;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: 48px clamp(40px, 6vw, 86px) 70px;
    color: #fff;
    background:
        radial-gradient(circle at 15% 95%, rgba(89, 149, 127, 0.48), transparent 38%),
        linear-gradient(145deg, #0b2824 0%, #16483f 100%);
}

.login-visual .brand {
    color: #fff;
}

.login-visual .brand small {
    color: rgba(255, 255, 255, 0.55);
}

.visual-copy {
    position: relative;
    z-index: 2;
    max-width: 520px;
}

.visual-copy h1 {
    margin: 0;
    font-family: Georgia, serif;
    font-size: clamp(52px, 6vw, 80px);
    font-weight: 500;
    letter-spacing: -0.06em;
    line-height: 0.94;
}

.visual-copy p {
    max-width: 430px;
    margin: 25px 0 0;
    color: rgba(255, 255, 255, 0.66);
    font-size: 16px;
}

.visual-orbit {
    position: absolute;
    border: 1px solid rgba(239, 213, 133, 0.13);
    border-radius: 50%;
}

.orbit-one {
    width: 500px;
    height: 500px;
    top: 80px;
    right: -275px;
}

.orbit-two {
    width: 350px;
    height: 350px;
    left: -220px;
    bottom: -90px;
}

.visual-coin {
    position: absolute;
    display: grid;
    place-items: center;
    border: 1px solid rgba(239, 213, 133, 0.35);
    border-radius: 50%;
    color: rgba(239, 213, 133, 0.7);
    background: rgba(239, 213, 133, 0.08);
    font-family: Georgia, serif;
}

.coin-one {
    width: 76px;
    height: 76px;
    right: 18%;
    top: 25%;
    font-size: 30px;
    transform: rotate(12deg);
}

.coin-two {
    width: 42px;
    height: 42px;
    right: 8%;
    bottom: 20%;
    font-size: 17px;
    transform: rotate(-16deg);
}

.login-panel {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--paper);
}

.login-box {
    width: min(420px, 100%);
}

.login-box h2 {
    font-size: 39px;
}

.login-box .muted {
    margin: 11px 0 29px;
    color: var(--ink-soft);
    font-size: 14px;
}

.login-form {
    gap: 18px;
}

.admin-access {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.admin-access span:last-child {
    margin-left: auto;
    font-size: 17px;
}

.admin-access:hover {
    color: var(--green-700);
}

.lock-icon {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 50%;
    background: var(--green-50);
}

.login-foot {
    width: min(420px, 100%);
    margin: 48px 0 0;
    color: #9ca5a3;
    font-size: 11px;
    text-align: center;
}

/* Setup */
.setup-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 8% 5%, rgba(61, 120, 104, 0.18), transparent 26%),
        var(--green-950);
}

.setup-shell {
    display: grid;
    width: min(1160px, calc(100% - 40px));
    min-height: 100vh;
    margin: 0 auto;
    grid-template-columns: minmax(0, 0.83fr) minmax(480px, 1fr);
    align-items: center;
    gap: clamp(50px, 8vw, 110px);
    padding-block: 60px;
}

.setup-intro {
    color: #fff;
}

.setup-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--gold-300);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.brand-mark-large {
    width: 55px;
    height: 55px;
    font-size: 26px;
}

.setup-intro h1 {
    margin: 42px 0 0;
    font-family: Georgia, serif;
    font-size: clamp(51px, 6vw, 77px);
    font-weight: 500;
    letter-spacing: -0.06em;
    line-height: 0.96;
}

.setup-intro > p {
    max-width: 480px;
    margin: 25px 0 0;
    color: rgba(255, 255, 255, 0.62);
}

.setup-points {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 45px;
}

.setup-points span {
    display: flex;
    align-items: center;
    gap: 13px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 13px;
    font-weight: 650;
}

.setup-points b {
    display: grid;
    width: 27px;
    height: 27px;
    place-items: center;
    border: 1px solid rgba(239, 213, 133, 0.3);
    border-radius: 50%;
    color: var(--gold-300);
    font-size: 11px;
}

.setup-card {
    padding: clamp(28px, 4vw, 45px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    background: var(--paper);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.27);
}

.setup-card h2 {
    font-size: 34px;
}

.setup-card h3 {
    margin: 0;
    font-family: Georgia, serif;
    font-size: 19px;
}

.setup-card hr {
    width: 100%;
    margin: 4px 0;
    border: 0;
    border-top: 1px solid var(--line);
}

.setup-card > .stack-form {
    margin-top: 26px;
}

.form-errors {
    margin-top: 20px;
    padding: 13px 15px;
    border: 1px solid #ecc7c1;
    border-radius: 10px;
    color: var(--danger);
    background: var(--danger-soft);
    font-size: 12px;
}

.form-errors ul {
    margin: 6px 0 0;
    padding-left: 18px;
}

@media (max-width: 960px) {
    .dashboard-hero {
        gap: 30px;
        padding-inline: 42px;
    }

    .settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .login-shell {
        grid-template-columns: 0.8fr 1.2fr;
    }

    .login-visual {
        padding-inline: 38px;
    }

    .setup-shell {
        grid-template-columns: 0.72fr 1fr;
        gap: 45px;
    }
}

@media (max-width: 760px) {
    .shell {
        width: min(100% - 28px, 640px);
    }

    .header-inner {
        min-height: 68px;
    }

    .brand small {
        display: none;
    }

    .main-nav {
        gap: 1px;
    }

    .main-nav > a,
    .link-button {
        padding: 8px 9px;
        font-size: 12px;
    }

    .main-content {
        padding-block: 22px 45px;
    }

    .dashboard-hero {
        min-height: 0;
        grid-template-columns: 1fr;
        gap: 32px;
        padding: 36px 25px 25px;
        border-radius: 23px;
    }

    .hero-copy h1 {
        font-size: 51px;
    }

    .pot-card {
        min-height: 172px;
        padding: 26px;
    }

    .pot-card > strong {
        font-size: 43px;
    }

    .summary-strip {
        width: calc(100% - 20px);
        grid-template-columns: 1fr 1fr;
    }

    .summary-strip > div {
        min-height: 86px;
        padding: 17px;
    }

    .summary-strip > div:nth-child(3) {
        grid-column: 1 / -1;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .summary-strip strong {
        font-size: 19px;
    }

    .section-block {
        margin-top: 40px;
    }

    .section-title {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .section-title h2 {
        font-size: 27px;
    }

    .status-row {
        min-height: 83px;
        grid-template-columns: auto minmax(0, 1fr);
        gap: 12px;
        padding: 15px;
    }

    .status-row > .status-badge,
    .status-row > .due-copy {
        grid-column: 2;
        justify-self: start;
    }

    .status-row > .status-badge {
        margin-top: -5px;
    }

    .due-copy {
        justify-items: start;
    }

    .due-copy .status-badge {
        grid-row: auto;
    }

    .person span {
        white-space: normal;
    }

    .history-grid,
    .admin-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .history-list {
        max-height: none;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-heading h1 {
        font-size: 38px;
    }

    .form-card {
        padding: 24px 20px;
    }

    .form-card-icon {
        right: 20px;
        top: 24px;
    }

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

    .breakdown-heading,
    .breakdown-row {
        grid-template-columns: minmax(0, 1fr) auto 74px;
        gap: 8px;
        padding-inline: 10px;
    }

    .status-list.compact .status-row {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .status-list.compact .status-row > .status-badge,
    .status-list.compact .due-amount {
        grid-column: 2;
        justify-self: start;
    }

    .status-list.compact .due-amount {
        margin-top: -7px;
        text-align: left;
    }

    .login-shell {
        display: block;
    }

    .login-visual {
        min-height: 290px;
        padding: 28px 25px 35px;
    }

    .visual-copy h1 {
        font-size: 46px;
    }

    .visual-copy p {
        margin-top: 15px;
        font-size: 13px;
    }

    .coin-one {
        right: 8%;
        top: 42%;
    }

    .login-panel {
        min-height: calc(100vh - 290px);
        padding: 42px 24px;
    }

    .login-box h2 {
        font-size: 33px;
    }

    .setup-shell {
        display: block;
        width: min(100% - 28px, 620px);
        padding-block: 35px;
    }

    .setup-intro {
        padding: 10px 5px 37px;
    }

    .setup-intro h1 {
        margin-top: 30px;
        font-size: 49px;
    }

    .setup-points {
        display: none;
    }

    .setup-card {
        padding: 28px 20px;
        border-radius: 22px;
    }
}

@media (max-width: 420px) {
    .brand strong {
        max-width: 115px;
        overflow: hidden;
        font-size: 17px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .brand-mark {
        width: 39px;
        height: 39px;
    }

    .main-nav > a:first-child {
        display: none;
    }

    .history-item {
        padding-inline: 13px;
    }

    .movement-icon {
        width: 32px;
        height: 32px;
    }

    .admin-page .history-item {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .admin-page .history-item .delete-form {
        position: absolute;
        right: 8px;
        top: 2px;
    }
}

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