/* ============================================================
   Jazeema. N Dain Family Get Together — Fund Ledger
   Palette: deep teal #1B4B43, marigold #C9973D, paper #FAF4E8,
            ink #26312B, ledger green #3E7C59, ledger red #B5482F
   Type: Fraunces (display) + Public Sans (body/data)
   ============================================================ */

:root {
    --teal-deep: #1B4B43;
    --teal-deeper: #123028;
    --marigold: #C9973D;
    --marigold-soft: #E6C787;
    --paper: #FAF4E8;
    --paper-card: #FFFFFF;
    --ink: #26312B;
    --ink-soft: #5B685F;
    --line: #E4DBC7;
    --green: #3E7C59;
    --green-bg: #E6F0E7;
    --red: #B5482F;
    --red-bg: #F7E7E1;
    --radius: 14px;
    --shadow: 0 2px 10px rgba(27, 75, 67, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.5;
}

h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; margin: 0; }

a { color: inherit; }

/* ---------- Masthead ---------- */
.masthead {
    background: linear-gradient(160deg, var(--teal-deep) 0%, var(--teal-deeper) 100%);
    color: var(--paper);
    padding: 56px 24px 64px;
    text-align: center;
    position: relative;
}
.masthead::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 18px;
    background:
        radial-gradient(circle at 10px 0, transparent 9px, var(--paper) 10px) 0 -9px / 20px 20px repeat-x;
}
.masthead-inner { max-width: 720px; margin: 0 auto; }
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 12px;
    font-weight: 600;
    color: var(--marigold-soft);
    margin: 0 0 14px;
}
.masthead h1 {
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 600;
    line-height: 1.15;
    margin: 0 0 14px;
}
.masthead-sub {
    color: #CFE0D9;
    font-size: 15px;
    max-width: 480px;
    margin: 0 auto;
}

/* ---------- Layout ---------- */
.wrap { max-width: 1040px; margin: 0 auto; padding: 40px 20px 60px; }

/* ---------- Stat cards ---------- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: -48px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--paper-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 4px solid var(--marigold);
}
.stat-collected { border-top-color: var(--green); }
.stat-spent { border-top-color: var(--red); }
.stat-balance { border-top-color: var(--marigold); }
.stat-negative { border-top-color: var(--red); }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); font-weight: 600; }
.stat-value { font-family: 'Fraunces', serif; font-size: 28px; font-weight: 600; }
.stat-foot { font-size: 12.5px; color: var(--ink-soft); }

/* ---------- Ledger strip ---------- */
.ledger-strip {
    background: var(--paper-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    margin-bottom: 32px;
}
.ledger-strip-row {
    display: flex;
    align-items: center;
    gap: 14px;
}
.ledger-tick { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; font-weight: 600; }
.ledger-bar {
    flex: 1;
    height: 10px;
    background: var(--green-bg);
    border-radius: 999px;
    overflow: hidden;
}
.ledger-bar-fill { height: 100%; background: var(--red); border-radius: 999px; transition: width 0.4s ease; }

.goal-row { margin-top: 16px; }
.goal-bar {
    position: relative;
    height: 26px;
    background: #F1E9D8;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--line);
}
.goal-bar-fill { height: 100%; background: linear-gradient(90deg, var(--marigold), var(--green)); }
.goal-bar-label {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; color: var(--teal-deeper);
}

.goal-form {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.goal-form label { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.goal-form input {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 10px;
    font-family: inherit;
    width: 140px;
}
.btn-ghost {
    background: transparent;
    border: 1px solid var(--teal-deep);
    color: var(--teal-deep);
    border-radius: 8px;
    padding: 7px 14px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}
.btn-ghost:hover { background: var(--teal-deep); color: #fff; }

/* ---------- Two column panels ---------- */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.panel {
    background: var(--paper-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}
.panel-head { margin-bottom: 18px; }
.panel-head h2 { font-size: 21px; font-weight: 600; }
.panel-sub { color: var(--ink-soft); font-size: 13.5px; margin: 4px 0 0; }

/* ---------- Forms ---------- */
.entry-form {
    background: #FBF8F0;
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}
.field-row { display: flex; gap: 12px; margin-bottom: 12px; }
.field { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.field-amount { flex: 0.7; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.field input, .field select {
    font-family: inherit;
    font-size: 14px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}
.field input:focus, .field select:focus, .goal-form input:focus {
    outline: 2px solid var(--marigold);
    outline-offset: 1px;
    border-color: var(--marigold);
}
.btn-primary {
    width: 100%;
    background: var(--teal-deep);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 11px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}
.btn-primary:hover { background: var(--teal-deeper); }

/* ---------- Chips (per-person totals) ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
    background: var(--green-bg);
    color: var(--teal-deeper);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12.5px;
    font-weight: 500;
}
.chip strong { font-weight: 700; margin-left: 4px; }

/* ---------- Receipt list (signature element) ---------- */
.receipt-list { list-style: none; margin: 0; padding: 0; }
.receipt-item {
    padding: 13px 2px;
    border-bottom: 1px dashed var(--line);
}
.receipt-item:last-child { border-bottom: none; }
.receipt-main { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.receipt-name { font-weight: 600; font-size: 14.5px; }
.receipt-amount { font-family: 'Fraunces', serif; font-weight: 600; font-size: 15.5px; white-space: nowrap; }
.amount-in { color: var(--green); }
.amount-out { color: var(--red); }
.receipt-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
    font-size: 12px;
    color: var(--ink-soft);
}
.receipt-note { font-style: italic; }
.tag {
    background: var(--marigold-soft);
    color: var(--teal-deeper);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 10.5px;
    font-weight: 600;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.inline-delete { margin-left: auto; }
.btn-delete {
    background: none;
    border: none;
    color: var(--red);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 4px;
    font-family: inherit;
    text-decoration: underline;
    opacity: 0.75;
}
.btn-delete:hover { opacity: 1; }

.empty-state {
    color: var(--ink-soft);
    font-size: 13.5px;
    padding: 14px 2px;
    font-style: italic;
}

/* ---------- Footer ---------- */
.page-foot {
    text-align: center;
    color: var(--ink-soft);
    font-size: 12px;
    margin-top: 40px;
}
.page-foot code {
    background: #F1E9D8;
    padding: 1px 5px;
    border-radius: 4px;
}

/* ---------- PIN Gate ---------- */
.gate-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--teal-deep) 0%, var(--teal-deeper) 100%);
    margin: 0;
    font-family: 'Public Sans', sans-serif;
}
.gate-card {
    background: var(--paper-card);
    border-radius: var(--radius);
    padding: 40px 32px;
    max-width: 340px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.gate-eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 11px; color: var(--marigold); font-weight: 700; margin: 0 0 10px; }
.gate-card h1 { font-size: 22px; color: var(--teal-deep); margin-bottom: 10px; }
.gate-sub { color: var(--ink-soft); font-size: 13.5px; margin-bottom: 20px; }
.gate-card input {
    width: 100%;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 15px;
    text-align: center;
}
.gate-card button {
    width: 100%;
    background: var(--teal-deep);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 11px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
}
.gate-error { color: var(--red); font-size: 12.5px; margin-top: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
    .stats-row { grid-template-columns: 1fr; margin-top: -32px; }
    .two-col { grid-template-columns: 1fr; }
    .field-row { flex-direction: column; }
    .masthead { padding: 44px 20px 56px; }
    .ledger-strip-row { flex-wrap: wrap; }
    .ledger-bar { order: 3; width: 100%; flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .ledger-bar-fill, .goal-bar-fill { transition: none; }
}
