/* Sunshine Fund — ported from design/*.dc.html */

:root {
    --sun: #FFD23F;
    --cream: #FFF8DC;
    --ink: #1F1A17;
    --muted: #5C4F3D;
    --in: #1F7A3A;
    --out: #C2410C;
    --danger: #B42318;
    --rule: #E8DFC4;
    --hover: #7A2E00;
    --white: #FFFFFF;

    --tint-pink: #FFE9EC;
    --tint-blue: #E3F2FF;
    --tint-green: #E6F7E9;

    --font-display: 'Fredoka', system-ui, sans-serif;
    --font-body: 'DM Sans', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--ink);
    line-height: 1.4;
}

body.theme-sun { background: var(--sun); }
body.theme-cream { background: var(--cream); }

a { color: var(--ink); }
a:hover { color: var(--hover); }

h1, h2 { margin: 0; font-family: var(--font-display); font-weight: 600; }
p { margin: 0; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.card {
    background: var(--white);
    border: 3px solid var(--ink);
    border-radius: 28px;
    box-shadow: 8px 8px 0 var(--ink);
}

.quiet-link { font-size: 14px; color: var(--muted); padding: 12px; }

/* Buttons --------------------------------------------------------------- */

.button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 54px;
    border: 0;
    border-radius: 14px;
    color: var(--white);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 19px;
    text-decoration: none;
    cursor: pointer;
}
.button:hover { color: var(--white); filter: brightness(1.1); }
.button:active { transform: translateY(1px); }
.button--ink { background: var(--ink); }
.button--in { background: var(--in); }
.button--out { background: var(--out); }

.link-button {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    border: 0;
    background: none;
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}
.link-button:hover { color: var(--hover); }
.link-button--danger, .link-button--danger:hover { color: var(--danger); }

/* Form fields ----------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; font-size: 15px; }

.input {
    width: 100%;
    height: 52px;
    border: 2px solid var(--ink);
    border-radius: 14px;
    padding: 0 16px;
    background: var(--white);
    color: var(--ink);
    font-family: inherit;
    font-size: 17px;
    -webkit-appearance: none;
    appearance: none;
}
.input::placeholder { color: #8A7C66; }
.input--money { font-family: var(--font-display); font-size: 20px; }
.input[type="date"] { display: flex; align-items: center; }
.input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }

.field__hint { margin-top: -4px; font-size: 13px; color: var(--muted); }
.field__error { color: var(--danger); font-size: 14px; font-weight: 500; }

/* Public page ----------------------------------------------------------- */

.public {
    padding: 56px 16px 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.public__inner {
    width: 100%;
    max-width: 620px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.brand { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.brand__name { font-size: 22px; letter-spacing: 0.02em; }

.balance {
    width: 100%;
    padding: 40px 24px 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}
.balance__label {
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}
.balance__amount {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(64px, 16vw, 112px);
    line-height: 1.05;
    overflow-wrap: anywhere;
}
.balance__thanks { font-size: 15px; color: var(--muted); }

.recent { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.recent__heading { margin: 0 0 4px 4px; font-size: 24px; }

.purchase-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }

.purchase {
    background: var(--white);
    border: 3px solid var(--ink);
    border-radius: 20px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.purchase--empty { justify-content: center; color: var(--muted); font-size: 17px; }

.purchase__icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tint-green);
}
.purchase__icon--flower { background: var(--tint-pink); }
.purchase__icon--card { background: var(--tint-blue); }
.purchase__icon--gift { background: var(--tint-green); }

.purchase__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.purchase__item { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.purchase__meta { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.purchase__amount { font-family: var(--font-display); font-weight: 600; font-size: 22px; white-space: nowrap; }

@media (max-width: 420px) {
    .purchase { padding: 16px; gap: 12px; }
    .purchase__icon { width: 40px; height: 40px; }
    .purchase__amount { font-size: 20px; }
}

/* Login ----------------------------------------------------------------- */

.login { padding: 96px 16px; display: flex; flex-direction: column; align-items: center; }

.login__card {
    width: 100%;
    max-width: 420px;
    padding: 40px 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.login__intro { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.login__intro h1 { font-size: 32px; }
.login__intro p { font-size: 15px; color: var(--muted); }
.login__back { align-self: center; padding: 8px; }

@media (max-width: 420px) {
    .login { padding: 48px 16px; }
    .login__card { padding: 32px 22px; }
}

/* Keeper ---------------------------------------------------------------- */

.topbar { background: var(--sun); border-bottom: 3px solid var(--ink); padding: 18px 16px; }
.topbar__inner {
    max-width: 1040px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.topbar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 22px;
    text-decoration: none;
}
.topbar__nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; }
.topbar__nav > a { font-size: 15px; font-weight: 700; padding: 10px 4px; }
.topbar__nav .link-button { font-size: 15px; padding: 0 4px; }
.topbar__balance { font-size: 15px; }
.topbar__balance span { color: var(--muted); }
.topbar__balance strong { font-family: var(--font-display); font-weight: 600; font-size: 20px; }

.keeper {
    max-width: 1040px;
    margin: 0 auto;
    padding: 40px 16px 64px;
    display: flex;
    flex-direction: column;
    gap: 40px;
}
.keeper--narrow { max-width: 560px; gap: 24px; }

.flash {
    background: var(--tint-green);
    border: 3px solid var(--ink);
    border-radius: 16px;
    padding: 14px 18px;
    font-weight: 700;
    margin-bottom: -12px;
}

.entry-forms { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }

.entry-form {
    flex: 1 1 400px;
    min-width: 0;
    border-radius: 24px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
[id^="add-"] { scroll-margin-top: 16px; }
.entry-form--in { box-shadow: 6px 6px 0 var(--in); }
.entry-form--out { box-shadow: 6px 6px 0 var(--out); }

.entry-form__head { display: flex; align-items: center; gap: 12px; }
.entry-form__head h1, .entry-form__head h2 { font-size: 26px; }
.entry-form__badge {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
}
.entry-form__badge--in { background: var(--tint-green); }
.entry-form__badge--out { background: var(--tint-pink); }

@media (max-width: 420px) {
    .entry-form { padding: 22px 20px; }
}

.back-link { align-self: flex-start; padding: 8px 0; }
.delete-form { align-self: center; }

.ledger { display: flex; flex-direction: column; gap: 14px; }
.ledger h2 { font-size: 26px; }
.ledger__empty {
    background: var(--white);
    border: 3px solid var(--ink);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    color: var(--muted);
}

.ledger__scroll { overflow-x: auto; background: var(--white); border: 3px solid var(--ink); border-radius: 20px; }
.ledger__table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 15px; }
.ledger__table th {
    padding: 14px 18px;
    font-weight: 700;
    text-align: left;
    color: var(--muted);
    border-bottom: 2px solid var(--ink);
}
.ledger__table td { padding: 14px 18px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.ledger__table tr:last-child td { border-bottom: 0; }
.ledger__table .num { text-align: right; }
.ledger__table .muted { color: var(--muted); }
.ledger__table .nowrap { white-space: nowrap; }
.ledger__table .actions { padding: 6px 12px; text-align: right; white-space: nowrap; }
.ledger__table .actions form { display: inline; }

.money { font-weight: 700; white-space: nowrap; }
.money--in { color: var(--in); }
.money--out { color: var(--out); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; }
.pager__link { padding: 10px 4px; }
.pager__link.is-disabled { color: var(--muted); opacity: 0.5; }
.pager__status { color: var(--muted); font-weight: 500; font-size: 15px; }

@media (max-width: 600px) {
    .topbar { padding: 14px 16px 8px; }
    .topbar__nav { width: 100%; gap: 0 20px; }
    .topbar__balance { flex: 1 1 100%; padding: 2px 0 4px; }
}
