:root {
    --bg: #f3efe8;
    --panel: #fffdf9;
    --panel-strong: #ffffff;
    --text: #201811;
    --muted: #77685c;
    --line: rgba(32, 24, 17, 0.1);
    --accent: #d7653c;
    --accent-deep: #b9512c;
    --accent-soft: rgba(215, 101, 60, 0.14);
    --success: #2e8b57;
    --warning: #d18b1f;
    --navy: #22314d;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
    --shadow: 0 18px 44px rgba(75, 49, 26, 0.12);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top, rgba(215, 101, 60, 0.1), transparent 24%),
        linear-gradient(180deg, #f8f4ee 0%, #f1ece4 100%);
}

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

button,
.action-link {
    cursor: pointer;
}

.app-shell {
    width: min(100%, 560px);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding: 18px 14px 106px;
}

.app-header {
    display: grid;
    gap: 14px;
    margin-bottom: 20px;
}

.app-header-actions {
    justify-content: flex-end;
}

.language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
}

.language-switcher button {
    min-width: 38px;
    min-height: 38px;
    padding: 0 6px;
    border: 0;
    border-radius: 999px;
    color: var(--muted);
    background: transparent;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 800;
}

.language-switcher-label {
    padding: 0 8px 0 6px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
}

.language-switcher button.is-active {
    color: #fff;
    background: var(--accent);
}

.language-chooser {
    position: fixed;
    z-index: 20;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(32, 24, 17, 0.42);
    backdrop-filter: blur(7px);
}

.language-chooser-card {
    width: min(100%, 410px);
    padding: 32px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 28px;
    background: var(--panel-strong);
    box-shadow: var(--shadow);
    text-align: center;
}

.language-chooser-brand,
.language-chooser-card h1,
.language-chooser-card p {
    margin: 0;
}

.language-chooser-brand {
    color: var(--accent-deep);
    font-weight: 900;
}

.language-chooser-card h1 {
    margin-top: 12px;
    color: var(--navy);
    font-size: 2rem;
}

.language-chooser-card h1 + p {
    margin-top: 12px;
}

.language-chooser-card p {
    color: var(--muted);
}

.language-chooser-options {
    display: grid;
    gap: 10px;
    margin-top: 24px;
}

.language-chooser-options button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 60px;
    border: 1px solid var(--line);
    border-radius: 18px;
    color: var(--text);
    background: var(--panel);
    font: inherit;
    font-size: 1rem;
    font-weight: 800;
}

.language-chooser-options button:focus-visible {
    border-color: var(--accent);
    outline: 2px solid rgba(215, 101, 60, 0.24);
    outline-offset: 2px;
}

.app-brand,
.muted-label,
.support-text,
.empty-copy p {
    margin: 0;
    color: var(--muted);
}

.app-branding {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.app-brand-kicker {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.app-brand {
    color: var(--navy);
    font-size: 1.65rem;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.screen-context {
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(32, 24, 17, 0.08);
    text-align: right;
}

.screen-head h2,
.card-title,
.money-large,
.money-xl,
.customer-name {
    margin: 0;
}

.screen-kicker,
.screen-title {
    margin: 0;
}

.screen-kicker {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.screen-title {
    margin-top: 4px;
    color: var(--navy);
    font-size: 1.25rem;
    font-weight: 800;
}

.ghost-button,
.filter-button,
.nav-item,
.button-solid,
.button-muted,
.chip-button,
.mini-action {
    border: 0;
    border-radius: 999px;
    min-height: 46px;
    padding: 0 16px;
}

.ghost-button,
.filter-button,
.button-muted {
    background: rgba(255, 255, 255, 0.75);
    color: var(--text);
    border: 1px solid var(--line);
}

.button-solid,
.nav-item.is-active,
.chip-button {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 12px 20px rgba(215, 101, 60, 0.22);
}

.reset-button {
    justify-self: end;
}

.screen {
    display: none;
}

.screen.is-active {
    display: block;
}

.stack {
    display: grid;
    gap: 14px;
}

.summary-grid,
.stat-card-grid {
    display: grid;
    gap: 12px;
}

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

.panel,
.job-card,
.customer-card,
.charge-card,
.empty-copy,
.hero-summary {
    background: rgba(255, 253, 249, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.panel,
.empty-copy,
.hero-summary {
    padding: 18px;
}

.hero-summary {
    display: grid;
    gap: 14px;
    padding: 20px;
}

.money-large {
    font-size: 1.95rem;
    font-weight: 800;
    line-height: 1.05;
}

.money-xl {
    font-size: clamp(2rem, 7vw, 3rem);
    font-weight: 800;
}

.summary-button {
    text-align: left;
    border: 0;
    padding: 20px;
    width: 100%;
}

.welcome-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.date-copy {
    margin: 0;
    color: var(--text);
    font-weight: 700;
}

.summary-card {
    display: grid;
    gap: 8px;
    padding: 20px;
    align-content: start;
}

.summary-card-primary {
    background: linear-gradient(180deg, #fff8ef 0%, #fffdf9 100%);
}

.summary-label {
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.summary-count {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--navy);
}

.summary-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.screen-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.filter-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.filter-button.is-active {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid rgba(215, 101, 60, 0.35);
}

.job-card,
.customer-card,
.charge-card {
    padding: 18px;
}

.job-meta,
.customer-meta,
.charge-meta,
.detail-list,
.card-actions {
    display: grid;
    gap: 8px;
}

.job-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.time-pill,
.status-pill,
.done-pill,
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-weight: 700;
}

.time-pill,
.status-pill,
.status-badge.pending {
    background: rgba(215, 101, 60, 0.1);
    color: var(--accent);
}

.done-pill,
.status-badge.paid {
    background: rgba(46, 139, 87, 0.12);
    color: var(--success);
}

.status-badge.partial {
    background: rgba(209, 139, 31, 0.14);
    color: var(--warning);
}

.status-badge.done {
    background: rgba(34, 49, 77, 0.08);
    color: var(--navy);
}

.card-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 14px;
}

.mini-action {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.mini-action.primary {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}

.job-title,
.job-location,
.job-price,
.customer-location,
.customer-pending {
    margin: 0;
}

.job-title {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--navy);
}

.job-location,
.customer-location {
    color: var(--muted);
}

.job-price {
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--text);
}

.support-text {
    font-size: 0.94rem;
    line-height: 1.45;
}

.search-field input,
.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(32, 24, 17, 0.14);
    background: #fff;
}

.field textarea {
    min-height: 94px;
    resize: vertical;
}

.field {
    display: grid;
    gap: 8px;
}

.form-card {
    display: grid;
    gap: 14px;
}

.customer-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.customer-card {
    cursor: pointer;
}

.customer-name {
    color: var(--navy);
    font-size: 1.08rem;
}

.customer-pending {
    display: inline-flex;
    width: fit-content;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(215, 101, 60, 0.1);
    color: var(--accent-deep);
    font-weight: 800;
}

.quiet-button {
    min-height: 38px;
    padding-inline: 14px;
    font-size: 0.88rem;
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    width: min(calc(100% - 18px), 560px);
    padding: 10px 8px;
    border-radius: 24px;
    background: rgba(255, 253, 249, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.nav-item {
    background: transparent;
    color: var(--muted);
    min-height: 52px;
    padding-inline: 10px;
    font-weight: 800;
    display: grid;
    place-items: center;
    gap: 4px;
}

.nav-icon {
    font-size: 0.82rem;
    line-height: 1;
}

.app-dialog {
    border: 0;
    padding: 0;
    background: transparent;
    width: min(calc(100% - 20px), 460px);
}

.app-dialog::backdrop {
    background: rgba(32, 24, 17, 0.38);
}

.dialog-card {
    background: var(--panel-strong);
    border-radius: 28px;
    padding: 22px;
    box-shadow: var(--shadow);
}

.pilot-dialog {
    max-height: min(92vh, 860px);
    overflow-y: auto;
}

.pilot-form {
    gap: 18px;
}

.pilot-heading h2,
.pilot-heading p,
.pilot-form fieldset,
.pilot-help,
.pilot-error,
.pilot-success h2,
.pilot-success p {
    margin: 0;
}

.pilot-heading p,
.pilot-help {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.4;
}

.pilot-form fieldset {
    display: grid;
    gap: 10px;
    padding: 0;
    border: 0;
}

.pilot-form legend,
.pilot-field > span {
    font-weight: 800;
    line-height: 1.35;
}

.pilot-choice-row {
    display: grid;
    gap: 8px;
}

.pilot-choice-row label {
    position: relative;
}

.pilot-choice-row input {
    position: absolute;
    opacity: 0;
}

.pilot-choice-row span {
    display: block;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    font-weight: 700;
}

.pilot-choice-row input:checked + span {
    border-color: rgba(215, 101, 60, 0.5);
    color: var(--accent-deep);
    background: var(--accent-soft);
}

.pilot-contact {
    display: grid;
    gap: 14px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(215, 101, 60, 0.08);
}

.pilot-error {
    color: #a63120;
    font-weight: 700;
}

.pilot-success {
    display: grid;
    gap: 14px;
    text-align: center;
}

.pilot-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0 14px;
}

.choice-card {
    position: relative;
}

.choice-card input {
    position: absolute;
    inset: 0;
    opacity: 0;
}

.choice-card span {
    display: grid;
    place-items: center;
    min-height: 74px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    text-align: center;
    font-weight: 800;
}

.choice-card input:checked + span {
    border-color: rgba(215, 101, 60, 0.36);
    background: var(--accent-soft);
    color: var(--accent);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.dialog-summary {
    padding: 14px 16px;
    margin: 16px 0;
    border-radius: 18px;
    background: rgba(215, 101, 60, 0.08);
}

.cobranzas-hero {
    display: grid;
    gap: 8px;
}

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

.charge-stats div,
.charge-balance {
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 248, 239, 0.85);
    border: 1px solid rgba(32, 24, 17, 0.06);
}

.charge-balance {
    display: grid;
    gap: 6px;
}

.charge-actions {
    grid-template-columns: 1fr 1.2fr;
}

.empty-copy {
    text-align: center;
}

.empty-illustration {
    min-height: 180px;
    margin-bottom: 12px;
    border-radius: 20px;
    background:
        radial-gradient(circle at top, rgba(215, 101, 60, 0.12), transparent 35%),
        repeating-linear-gradient(
            135deg,
            rgba(32, 24, 17, 0.03),
            rgba(32, 24, 17, 0.03) 12px,
            transparent 12px,
            transparent 24px
        ),
        #f7f0e6;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 700;
}

.empty-illustration-image {
    display: block;
    width: 100%;
    min-height: 180px;
    border-radius: 20px;
    object-fit: cover;
}

.paid-label {
    color: var(--success);
    font-weight: 800;
}

@media (max-width: 420px) {
    .app-shell {
        padding-inline: 10px;
    }

    .summary-grid,
    .choice-grid {
        grid-template-columns: 1fr;
    }

    .card-actions,
    .charge-actions {
        grid-template-columns: 1fr;
    }

    .app-branding,
    .welcome-row,
    .screen-head,
    .customer-row {
        grid-template-columns: 1fr;
        display: grid;
    }

    .screen-context {
        justify-self: stretch;
        text-align: left;
    }

    .reset-button {
        justify-self: end;
    }

    .nav-item {
        font-size: 0.86rem;
    }

    .dialog-actions {
        flex-direction: column-reverse;
    }

    .dialog-actions button {
        width: 100%;
    }
}

@media (min-width: 768px) {
    .app-shell {
        width: min(100%, 900px);
        padding-bottom: 110px;
    }

    .bottom-nav {
        width: min(calc(100% - 24px), 900px);
    }

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

    .stack > .job-card,
    .stack > .customer-card,
    .stack > .charge-card {
        max-width: 100%;
    }
}
