:root {
    --bg: #e7e0d4;
    --ink: #1b1714;
    --muted: #6d645b;
    --card: rgba(255, 250, 244, 0.9);
    --line: rgba(27, 23, 20, 0.1);
    --green: #12382f;
    --green-deep: #0c2923;
    --gold: #c6a15b;
    --cream: #f6f1e7;
    --danger: #8d3b32;
    --shadow: 0 18px 50px rgba(48, 36, 22, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: Outfit, "Segoe UI", sans-serif;
    background:
        radial-gradient(900px 420px at -10% -10%, rgba(198, 161, 91, 0.35), transparent 60%),
        radial-gradient(800px 480px at 110% -20%, rgba(18, 56, 47, 0.16), transparent 55%),
        var(--bg);
}

a { color: inherit; }

.shell {
    width: min(1080px, calc(100% - 32px));
    margin: 0 auto;
    padding-bottom: 64px;
}

.pagos-ropa-page {
    padding-bottom: 96px;
}

.totals-dock {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    border-top: 1px solid var(--line);
    background:
        radial-gradient(900px 420px at -10% -10%, rgba(198, 161, 91, 0.35), transparent 60%),
        radial-gradient(800px 480px at 110% -20%, rgba(18, 56, 47, 0.16), transparent 55%),
        var(--bg);
    box-shadow: 0 -10px 40px rgba(48, 36, 22, 0.08);
}

.totals-dock-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: min(1080px, calc(100% - 32px));
    margin: 0 auto;
    padding: 16px 0 18px;
}

.totals-dock-item span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.totals-dock-item strong {
    font-family: Fraunces, Georgia, serif;
    font-size: clamp(24px, 4vw, 34px);
    font-weight: 650;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}

.totals-dock-item-right {
    text-align: right;
}

.totals-dock-due span {
    color: #9a6a62;
}

.totals-dock-due strong {
    color: #b56f62;
}

.totals-dock-collected span {
    color: #5f6494;
}

.totals-dock-collected strong {
    color: #4f5aa8;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 26px 0 8px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}

.brand-mark {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    background: linear-gradient(165deg, #2c261f 0%, #141210 72%);
    box-shadow: 0 14px 28px rgba(20, 18, 16, 0.22);
    flex: 0 0 auto;
}

.brand-mark span {
    color: var(--cream);
    font-family: Fraunces, Georgia, serif;
    font-size: 20px;
    font-weight: 650;
    letter-spacing: -0.08em;
}

.brand-mark em {
    font-style: normal;
    color: var(--gold);
}

.brand-name {
    display: block;
    font-family: Fraunces, Georgia, serif;
    font-size: 30px;
    font-weight: 650;
    letter-spacing: -0.04em;
    line-height: 0.95;
}

.brand-tag {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 999px;
    padding: 13px 18px;
    background: var(--green);
    color: var(--cream);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(18, 56, 47, 0.18);
}

.btn:hover { background: var(--green-deep); }

.btn-ghost {
    background: transparent;
    color: var(--ink);
    box-shadow: none;
    border: 1px solid var(--line);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    box-shadow: none;
}

.btn-small {
    padding: 8px 12px;
    box-shadow: none;
    font-size: 14px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 28px 0 18px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--green);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
    margin-bottom: 0;
    font-family: Fraunces, Georgia, serif;
    font-size: clamp(36px, 5vw, 56px);
    font-weight: 650;
    letter-spacing: -0.045em;
    line-height: 0.95;
}

.lede {
    max-width: 46ch;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.5;
}

.panel {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.empty,
.welcome {
    padding: 48px 28px;
    text-align: center;
}

.welcome {
    margin-top: 36px;
}

.welcome h1 {
    margin: 0;
    font-family: Fraunces, Georgia, serif;
    font-size: clamp(42px, 6vw, 68px);
    font-weight: 650;
    letter-spacing: -0.045em;
}

.empty .brand-mark {
    margin: 0 auto 18px;
}

.empty h2 {
    margin-bottom: 8px;
    font-family: Fraunces, Georgia, serif;
    font-size: 32px;
    letter-spacing: -0.04em;
}

.empty p {
    margin: 0 auto 22px;
    max-width: 42ch;
    color: var(--muted);
}

.debtor-list {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
}

.debtor {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 168px;
    padding: 22px;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.debtor:hover {
    transform: translateY(-3px);
    box-shadow: 0 22px 40px rgba(48, 36, 22, 0.12);
}

.debtor-top, .debtor-foot {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.debtor h2 {
    margin-bottom: 0;
    font-family: Fraunces, Georgia, serif;
    font-size: 28px;
    letter-spacing: -0.04em;
}

.amount {
    font-variant-numeric: tabular-nums;
    font-weight: 650;
    letter-spacing: -0.03em;
}

.debtor .amount { font-size: 22px; }

.meta, .hint {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.debtor-foot {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    color: var(--green);
    font-weight: 600;
}

.composer {
    display: grid;
    gap: 18px;
}

@media (min-width: 960px) {
    .composer {
        grid-template-columns: 0.92fr 1.08fr;
        align-items: start;
    }
}

.form-card, .preview {
    padding: 24px;
}

.fields {
    display: grid;
    gap: 16px;
}

@media (min-width: 700px) {
    .split { grid-template-columns: 1fr 1fr; }
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

input:focus {
    outline: 2px solid var(--green);
    outline-offset: 2px;
}

.money {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding-left: 16px;
    background: #fff;
}

.money span {
    color: var(--muted);
    font-weight: 650;
}

.money input {
    border: 0;
    padding-left: 0;
}

.money input:focus {
    outline: none;
}

.money:focus-within {
    outline: 2px solid var(--green);
    outline-offset: 2px;
}

.money input::placeholder {
    color: #a39a90;
    opacity: 1;
}

.field-error {
    margin: 8px 0 0;
    color: var(--danger);
    font-size: 14px;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.preview h2 {
    margin-bottom: 6px;
    font-family: Fraunces, Georgia, serif;
    font-size: 30px;
    letter-spacing: -0.04em;
}

.schedule {
    display: grid;
    gap: 0;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
    max-height: 520px;
    overflow: auto;
}

.schedule li, .week {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 14px 4px;
    border-top: 1px solid var(--line);
}

.week-no {
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.week.is-last {
    background: rgba(198, 161, 91, 0.16);
    border-radius: 12px;
    padding-inline: 10px;
}

.ledger .week {
    grid-template-columns: 78px minmax(0, 1fr) auto auto;
}

.week.is-paid .struck {
    color: var(--muted);
    text-decoration: line-through;
}

.week-action {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.paid-note {
    color: var(--green);
    font-size: 14px;
    font-weight: 650;
}

.text-action {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

dialog {
    width: min(440px, calc(100% - 32px));
    border: 0;
    border-radius: 28px;
    padding: 24px;
    background: #fffaf4;
    color: var(--ink);
    box-shadow: 0 24px 70px rgba(27, 23, 20, 0.28);
}

dialog::backdrop {
    background: rgba(27, 23, 20, 0.46);
}

dialog h2 {
    margin-bottom: 8px;
    font-family: Fraunces, Georgia, serif;
    font-size: 32px;
    letter-spacing: -0.04em;
}

.hero {
    display: grid;
    gap: 18px;
    margin-top: 22px;
}

@media (min-width: 860px) {
    .hero { grid-template-columns: 1.1fr 0.9fr; }
}

.identity, .stats {
    padding: 26px;
}

.identity h1 { margin-bottom: 10px; }

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.stat span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 13px;
}

.stat strong {
    font-family: Fraunces, Georgia, serif;
    font-size: 28px;
    font-weight: 650;
    letter-spacing: -0.04em;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 18px;
    padding: 22px 26px;
}

.edit-plan {
    margin-top: 18px;
}

.edit-plan h2,
.pay-dialog-copy {
    margin-bottom: 16px;
    font-family: Fraunces, Georgia, serif;
    font-size: 28px;
    letter-spacing: -0.04em;
}

@media (min-width: 800px) {
    .edit-grid { grid-template-columns: 1.4fr 1fr 0.8fr; }
}

.ledger {
    margin-top: 18px;
    padding: 8px 22px 18px;
}

.ledger h2 {
    margin: 16px 0 0;
    font-family: Fraunces, Georgia, serif;
    font-size: 28px;
}

.back {
    display: inline-flex;
    margin-top: 22px;
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
}

.danger-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

@media (max-width: 640px) {
    .topbar, .page-head, .debtor-top, .debtor-foot { align-items: flex-start; flex-direction: column; }
    .shell { width: min(1080px, calc(100% - 20px)); }
    .totals-dock-inner { width: min(1080px, calc(100% - 20px)); }
    .schedule li, .week, .ledger .week, .summary-stats { grid-template-columns: 1fr; gap: 8px; }
    .stats { grid-template-columns: 1fr; }
}
