:root {
    --bg: #faf4ee;
    --bg-glow: rgba(201, 138, 60, .10);
    --panel: #ffffff;
    --panel-alt: #fdf6f0;
    --ink: #2b1c25;
    --muted: #74596a;
    --line: #efe1d8;
    --primary: #bf2c5b;
    --primary-dark: #8f1f44;
    --primary-light: #ef9fb8;
    --primary-ink: #ffffff;
    --secondary: #fae3ec;
    --accent: #c98a3c;
    --accent-soft: #f6ead6;
    --danger: #c0392b;
    --danger-bg: #fdecea;
    --ok: #0a7350;
    --ok-bg: #e3f6ee;
    --warning: #a06a10;
    --warning-bg: #fbeed3;
    --accent-ink: #7e5113;
    --focus-ring: 0 0 0 3px rgba(191, 44, 91, .30);
    --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-number: "Poppins", Inter, ui-sans-serif, system-ui, sans-serif;
    --radius: 20px;
    --radius-sm: 13px;
    --shadow: 0 10px 26px rgba(143, 31, 68, .08), 0 2px 6px rgba(143, 31, 68, .05);
    --shadow-strong: 0 20px 48px rgba(143, 31, 68, .20);
    --gradient-primary: linear-gradient(135deg, #e0598a 0%, var(--primary) 52%, var(--primary-dark) 100%);
    --gradient-soft: linear-gradient(160deg, #fdeef4 0%, #fae3ec 100%);

    --tab-dashboard: var(--primary);
    --tab-dashboard-bg: var(--secondary);
    --tab-orders: #c2632c;
    --tab-orders-bg: #f8e7d7;
    --tab-calculator: #0c9a6e;
    --tab-calculator-bg: #e1f4ec;
    --tab-finances: #5a5bc4;
    --tab-finances-bg: #e8e8f8;
}

:root[data-theme="dark"] {
    --bg: #191119;
    --bg-glow: rgba(201, 138, 60, .08);
    --panel: #271a24;
    --panel-alt: #2f2030;
    --ink: #f6e9f1;
    --muted: #c49eb4;
    --line: #3c2a39;
    --primary: #ef85a8;
    --primary-dark: #c14b75;
    --primary-light: #f7b3c8;
    --primary-ink: #2b1018;
    --secondary: #3a2433;
    --accent: #e0ac63;
    --accent-soft: #3a2f20;
    --danger: #f08a7f;
    --danger-bg: #3a2222;
    --ok: #4fd2a4;
    --ok-bg: #173028;
    --warning: #e3b566;
    --warning-bg: #352c19;
    --accent-ink: #e0ac63;
    --focus-ring: 0 0 0 3px rgba(239, 133, 168, .35);
    --shadow: 0 12px 30px rgba(0, 0, 0, .38);
    --shadow-strong: 0 20px 48px rgba(0, 0, 0, .50);
    --gradient-primary: linear-gradient(135deg, #d96a90 0%, #bf2c5b 60%, #8f1f44 100%);
    --gradient-soft: linear-gradient(160deg, #3a2433 0%, #271a24 100%);
    --tab-dashboard: #ef85a8;
    --tab-dashboard-bg: #3a2433;
    --tab-orders: #e09a63;
    --tab-orders-bg: #392a1d;
    --tab-calculator: #4fd2a4;
    --tab-calculator-bg: #173028;
    --tab-finances: #9b9cf0;
    --tab-finances-bg: #25243f;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
    background: var(--panel);
    color: var(--ink);
}

:root[data-theme="dark"] .optional-box {
    background: var(--panel);
}

:root[data-theme="dark"] .action-button {
    background: var(--panel);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at 100% 0%, var(--bg-glow), transparent 42%),
        radial-gradient(circle at 0% 8%, rgba(191, 44, 91, .05), transparent 36%),
        var(--bg);
    background-attachment: fixed;
    color: var(--ink);
    font-family: var(--font-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

a {
    color: var(--primary);
    text-decoration: none;
}

:focus-visible {
    outline: 2px solid transparent;
    box-shadow: var(--focus-ring);
}

a:focus-visible,
.tabs a:focus-visible,
.filter-bar a:focus-visible {
    border-radius: 10px;
}

::selection {
    background: var(--primary-light);
    color: var(--ink);
}

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

.app-shell {
    max-width: 920px;
    min-height: 100dvh;
    margin: 0 auto;
    background: var(--bg);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    row-gap: 8px;
    padding: 14px 16px;
    background: rgba(250, 244, 238, .82);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

:root[data-theme="dark"] .topbar {
    background: rgba(25, 17, 25, .80);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.brand-mark {
    display: grid;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    place-items: center;
    border-radius: 10px;
    background: var(--gradient-primary);
    color: var(--primary-ink);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
}

.tabs a {
    flex: 0 0 auto;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    background: transparent;
    font-weight: 700;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
}

.tabs a.active {
    color: var(--primary);
    background: var(--secondary);
}

/* === Filtros (chips de estado / periodo) === */
.filters-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.filter-bar a {
    flex: 0 0 auto;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--muted);
    font-weight: 700;
    font-size: .85rem;
    white-space: nowrap;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

@media (hover: hover) {
    .filter-bar a:hover {
        border-color: var(--primary-light);
        color: var(--primary);
    }
}

.filter-bar a.active {
    background: var(--primary);
    border-color: transparent;
    color: var(--primary-ink);
}

.filter-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    min-height: 38px;
    padding: 8px 13px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--primary);
    font-weight: 700;
    font-size: .82rem;
    white-space: nowrap;
}

.filter-export svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

@media (hover: hover) {
    .filter-export:hover {
        border-color: var(--primary-light);
    }
}

.tabs {
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    overflow: visible;
}

.tabs a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 64px;
    height: 56px;
    padding: 0;
}

.tabs a .tab-icon {
    width: 26px;
    height: 26px;
    color: var(--muted);
    opacity: .55;
    transition: color .15s ease, opacity .15s ease;
}

.tabs a .tab-label {
    font-size: .68rem;
    font-weight: 700;
    color: var(--muted);
    transition: color .15s ease;
}

.tabs a.active {
    background: var(--gradient-soft);
    color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(214, 51, 108, .12);
}

.tabs a.active .tab-icon {
    opacity: 1;
}

.tabs a.tab-dashboard .tab-icon { color: var(--tab-dashboard); }
.tabs a.tab-orders .tab-icon { color: var(--tab-orders); }
.tabs a.tab-calculator .tab-icon { color: var(--tab-calculator); }
.tabs a.tab-finances .tab-icon { color: var(--tab-finances); }

.tabs a.tab-dashboard.active { background: var(--tab-dashboard-bg); color: var(--tab-dashboard); box-shadow: none; }
.tabs a.tab-orders.active { background: var(--tab-orders-bg); color: var(--tab-orders); box-shadow: none; }
.tabs a.tab-calculator.active { background: var(--tab-calculator-bg); color: var(--tab-calculator); box-shadow: none; }
.tabs a.tab-finances.active { background: var(--tab-finances-bg); color: var(--tab-finances); box-shadow: none; }

.tabs a.active .tab-label {
    color: inherit;
}

.tabs a:active {
    transform: scale(.94);
}

.theme-toggle {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    background: var(--secondary);
    color: var(--primary);
    flex-shrink: 0;
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.theme-toggle .icon-moon {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
    display: block;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: -60px;
    left: 12px;
    z-index: 60;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: var(--primary-ink);
    font-weight: 800;
    box-shadow: var(--shadow-strong);
    transition: top .18s ease;
}

.skip-link:focus {
    top: calc(10px + env(safe-area-inset-top));
    outline: none;
}

.content {
    padding: 18px 16px calc(72px + env(safe-area-inset-bottom));
}

.hero {
    display: grid;
    min-height: 62vh;
    align-content: center;
    gap: 18px;
    padding: 22px 0;
}

.hero h1,
.page-head h1,
.panel h1,
.auth-card h1 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    font-optical-sizing: auto;
    letter-spacing: -0.015em;
    font-size: clamp(2rem, 8vw, 4.5rem);
    line-height: 1.04;
}

.page-head h1,
.panel h1 {
    font-size: clamp(1.7rem, 5vw, 2.8rem);
}

.hero p,
.muted {
    margin: 0;
    color: var(--muted);
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--primary);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button,
.link-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 800;
    transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}

.button.primary {
    background: var(--gradient-primary);
    color: var(--primary-ink);
    box-shadow: 0 8px 20px rgba(143, 31, 68, .22);
}

.button.secondary {
    background: var(--secondary);
    color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(191, 44, 91, .12);
}

.button.secondary:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.button.danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.button:active {
    transform: scale(.97);
}

.button.primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-strong);
}

.button.full {
    width: 100%;
}

.action-button {
    gap: 8px;
    min-width: 112px;
    white-space: nowrap;
}

.button-image {
    display: block;
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 8px;
    filter: drop-shadow(0 2px 3px rgba(37, 27, 30, .18));
}

.icon-plus {
    display: block;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.link-button {
    min-height: 36px;
    padding: 0 4px;
    background: transparent;
    color: var(--primary);
}

.feature-list,
.stats-grid,
.finance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.finance-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 14px;
}

.feature-list article,
.panel,
.stat,
.metric-card,
.message-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.stat,
.metric-card {
    transition: transform .18s ease, box-shadow .18s ease;
}

.stat:hover,
.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-strong);
}

.feature-list article {
    display: grid;
    gap: 6px;
    padding: 14px;
}

.feature-list span,
.stat span,
.details dt,
.order-row small,
.message-card p,
.footer-link {
    color: var(--muted);
}

.panel,
.stat,
.metric-card {
    padding: 16px;
}

.panel + .panel,
.stats-grid + .panel,
.page-head + .panel,
.page-head + .stats-grid {
    margin-top: 14px;
}

.narrow {
    max-width: 440px;
    margin: 32px auto;
}

.auth-card {
    text-align: center;
    padding: 32px 24px;
    background:
        radial-gradient(circle at 90% -10%, rgba(255, 179, 108, .16), transparent 45%),
        var(--panel);
}

.auth-card h1 {
    font-size: clamp(1.6rem, 6vw, 2.2rem);
}

.auth-card .muted {
    margin-bottom: 4px;
}

.auth-card .form {
    margin-top: 18px;
    text-align: left;
}

.auth-card .footer-link {
    text-align: center;
}

.auth-logo {
    display: grid;
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    place-items: center;
    border-radius: 16px;
    background: var(--gradient-primary);
    box-shadow: var(--shadow-strong);
    overflow: hidden;
}

.auth-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.form,
.form-grid {
    display: grid;
    gap: 13px;
}

.form label,
.form-grid label,
.inline-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 700;
}

label small,
.optional-box p {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 500;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink);
    padding: 12px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-light);
    outline: none;
    box-shadow: 0 0 0 3px rgba(138, 47, 75, .12);
}

textarea {
    resize: vertical;
}

.optional-box {
    border: 1px dashed var(--line);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: #fff8fb;
}

.optional-box summary {
    cursor: pointer;
    color: var(--primary);
    font-weight: 900;
}

.optional-box p {
    margin: 8px 0 12px;
}

.form-grid.compact {
    gap: 10px;
}

.check {
    grid-template-columns: auto 1fr;
    align-items: center;
}

.check input {
    width: auto;
}

.page-head,
.section-title,
.inline-form {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.page-head {
    margin-bottom: 14px;
}

.section-title {
    margin-bottom: 10px;
}

.section-title h2 {
    margin: 0;
    font-size: 1.05rem;
}

.stat,
.metric-card {
    display: grid;
    min-height: 120px;
    align-content: space-between;
    gap: 8px;
}

.stat strong,
.metric-card strong {
    font-family: var(--font-number);
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 1.05;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.stat.danger strong,
.metric-card.danger strong {
    color: var(--danger);
}

.metric-card.highlight {
    background: var(--gradient-primary);
    color: var(--primary-ink);
    border-color: transparent;
    box-shadow: var(--shadow-strong);
}

.metric-card.highlight span,
.metric-card.highlight small {
    color: rgba(255, 255, 255, .78);
}

.metric-card.warning strong {
    color: var(--warning);
}

.metric-card small {
    color: var(--muted);
}

.metric-card span {
    color: var(--muted);
    font-size: .86rem;
    font-weight: 800;
}

@media (display-mode: standalone) {
    body {
        background: var(--bg);
        user-select: none;
    }

    input,
    select,
    textarea {
        user-select: text;
    }
}

.order-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 12px;
    margin: 0 -12px;
    border-top: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
    transition: background-color .15s ease;
}

.order-row:first-of-type {
    border-top: 0;
}

@media (hover: hover) {
    .order-row:hover {
        background: var(--panel-alt);
    }
}

.order-row:active {
    background: var(--secondary);
}

.order-row span {
    display: grid;
    gap: 3px;
}

.pill {
    border-radius: 999px;
    padding: 5px 11px;
    background: var(--ok-bg);
    color: var(--ok);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
    white-space: nowrap;
}

.details {
    display: grid;
    gap: 10px;
    margin: 14px 0 0;
}

.details div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.details dt {
    font-weight: 700;
}

.details dd {
    margin: 0;
    text-align: right;
}

.message-list {
    display: grid;
    gap: 12px;
}

.message-card {
    padding: 14px;
}

.message-card p {
    margin: 8px 0 12px;
}

.notice,
.alert {
    margin-bottom: 14px;
    border-radius: var(--radius-sm);
    padding: 12px;
    font-weight: 700;
}

.notice {
    background: var(--ok-bg);
    color: var(--ok);
}

.alert {
    background: var(--danger-bg);
    color: var(--danger);
}

.alert ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.locked-banner {
    display: grid;
    gap: 4px;
    margin-bottom: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background:
        linear-gradient(0deg, rgba(201, 138, 60, .06), rgba(201, 138, 60, .06)),
        var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

.locked-banner strong {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-ink);
    font-family: var(--font-display);
    font-weight: 600;
}

.locked-banner strong::before {
    content: "";
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 11V8a5 5 0 0 1 10 0v3' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3Crect x='5' y='11' width='14' height='10' rx='2.5' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 11V8a5 5 0 0 1 10 0v3' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3Crect x='5' y='11' width='14' height='10' rx='2.5' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}

.locked-banner span {
    color: var(--muted);
    font-size: .9rem;
}

.empty,
.footer-link {
    margin: 10px 0 0;
}

.result {
    display: grid;
    gap: 4px;
    text-align: center;
}

.result strong {
    color: var(--primary);
    font-family: var(--font-number);
    font-weight: 700;
    font-size: 2rem;
    font-variant-numeric: tabular-nums;
}

.ingredient-rows {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

.ingredient-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 28px;
    align-items: center;
    gap: 8px;
}

.ingredient-row--head {
    color: var(--muted);
    font-size: .76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.ingredient-row input {
    padding: 9px;
}

.ing-subtotal {
    font-weight: 800;
    text-align: right;
    overflow-wrap: anywhere;
}

.ing-remove {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 999px;
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1;
}

.ing-remove:hover {
    background: var(--secondary);
    color: var(--primary);
}

.calc-subtotal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    font-weight: 800;
}

.calc-subtotal span {
    color: var(--muted);
    font-weight: 700;
}

.calc-result {
    display: grid;
    gap: 4px;
}

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

.calc-result__row span {
    color: var(--muted);
    font-weight: 700;
}

.calc-result__row strong {
    font-family: var(--font-number);
    font-weight: 700;
    font-size: 1.4rem;
    font-variant-numeric: tabular-nums;
}

.calc-result__row--highlight {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.calc-result__row--highlight strong {
    color: var(--primary);
    font-family: var(--font-number);
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.calc-result .button {
    margin-top: 14px;
}

.balance-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: -2px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--secondary);
    color: var(--primary);
    font-weight: 800;
}

.balance-preview strong {
    font-size: 1.15rem;
}

.balance-preview__zero {
    color: var(--ok);
}

.trend-chart {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    align-items: end;
    gap: 8px;
    height: 140px;
    margin-top: 12px;
    padding-top: 22px;
}

.trend-bar-wrap {
    display: grid;
    grid-template-rows: 1fr auto;
    align-items: end;
    justify-items: center;
    height: 100%;
    gap: 6px;
    position: relative;
}

.trend-value {
    position: absolute;
    top: -20px;
    font-size: .7rem;
    font-weight: 800;
    color: var(--muted);
    white-space: nowrap;
}

.trend-bar {
    width: 100%;
    max-width: 28px;
    min-height: 2px;
    border-radius: 6px 6px 2px 2px;
    background: var(--gradient-primary);
}

.trend-label {
    font-size: .68rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: capitalize;
}

/* === Campana de avisos === */
.bell {
    position: relative;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--secondary);
    color: var(--primary);
}

.bell svg {
    width: 20px;
    height: 20px;
}

.bell-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--primary);
    color: var(--primary-ink);
    font-size: .66rem;
    font-weight: 800;
    border: 2px solid var(--bg);
}

/* === Ícono "Más" de la barra superior === */
.topbar-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--secondary);
    color: var(--primary);
}

.topbar-icon svg {
    width: 20px;
    height: 20px;
}

.topbar-icon.active {
    background: var(--primary);
    color: var(--primary-ink);
}

/* === Botón central (+) de la barra inferior === */
.tabs a.tab-fab {
    flex: 0 0 auto;
    width: 54px;
    height: 54px;
    min-height: 0;
    padding: 0;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: var(--primary-ink);
    box-shadow: 0 8px 18px rgba(143, 31, 68, .30);
    align-self: center;
}

.tabs a.tab-fab svg {
    width: 26px;
    height: 26px;
}

.tabs a.tab-fab:active {
    transform: scale(.92);
}

.tabs a.tab-more .tab-icon {
    color: var(--muted);
}

.tabs a.tab-more.active .tab-icon {
    color: var(--primary);
    opacity: 1;
}

/* === Saludo del panel === */
.greeting {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.greeting-text {
    flex: 1;
    min-width: 0;
}

.greeting-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: 14px;
    background: var(--secondary);
    color: var(--primary);
}

.greeting-mark svg {
    width: 26px;
    height: 26px;
}

.greeting h1 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.015em;
    font-size: clamp(1.5rem, 6vw, 2.1rem);
}

.greeting .eyebrow {
    margin-bottom: 2px;
}

/* === Resumen de hoy (3 tarjetas) === */
.summary-card {
    margin-bottom: 16px;
    padding: 14px;
    border-radius: var(--radius);
    background: var(--gradient-soft);
    border: 1px solid var(--line);
}

.summary-title {
    margin: 2px 2px 10px;
    color: var(--primary-dark);
    font-weight: 800;
    font-size: .9rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.summary-tile {
    display: grid;
    gap: 5px;
    justify-items: center;
    text-align: center;
    padding: 13px 6px;
    border-radius: var(--radius-sm);
    background: var(--panel);
    color: var(--ink);
    box-shadow: var(--shadow);
}

.summary-ico {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--st-bg, var(--secondary));
    color: var(--st, var(--primary));
}

.summary-ico svg {
    width: 20px;
    height: 20px;
}

.summary-tile strong {
    font-family: var(--font-number);
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.summary-tile small {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
}

/* === Filas de próximas entregas === */
.entry-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin: 0 -12px;
    border-top: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
    transition: background-color .15s ease;
}

.entry-row:first-of-type {
    border-top: 0;
}

@media (hover: hover) {
    .entry-row:hover {
        background: var(--panel-alt);
    }
}

.date-chip {
    display: grid;
    justify-items: center;
    width: 46px;
    flex-shrink: 0;
    padding: 5px 0;
    border-radius: 12px;
    background: var(--secondary);
    color: var(--primary-dark);
    line-height: 1.1;
}

.date-chip small {
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .04em;
}

.date-chip strong {
    font-family: var(--font-number);
    font-weight: 700;
    font-size: 1.2rem;
}

.entry-info {
    display: grid;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.entry-info strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entry-info small {
    color: var(--muted);
    font-size: .78rem;
}

.entry-info small:first-child {
    color: var(--primary);
    font-weight: 800;
    font-size: .7rem;
}

/* === Pills de estado por color === */
.pill.is-pending {
    background: var(--warning-bg);
    color: #875612;
}

.pill.is-confirmed {
    background: var(--tab-finances-bg);
    color: var(--tab-finances);
}

.pill.is-delivered {
    background: var(--tab-orders-bg);
    color: #8f4419;
}

:root[data-theme="dark"] .pill.is-pending {
    color: var(--warning);
}

:root[data-theme="dark"] .pill.is-delivered {
    color: var(--tab-orders);
}

.pill.is-paid {
    background: var(--ok-bg);
    color: var(--ok);
}

.pill.is-cancelled {
    background: var(--danger-bg);
    color: var(--danger);
}

/* === Accesos rápidos === */
.quick-access {
    margin-top: 16px;
}

.section-label {
    margin: 0 2px 10px;
    font-weight: 800;
    font-size: .95rem;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.quick-tile {
    display: grid;
    gap: 8px;
    justify-items: center;
    text-align: center;
    padding: 14px 6px;
    border-radius: var(--radius-sm);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    color: var(--ink);
    font-weight: 700;
    font-size: .74rem;
    line-height: 1.2;
    transition: transform .15s ease, box-shadow .15s ease;
}

.quick-tile:active {
    transform: scale(.96);
}

@media (hover: hover) {
    .quick-tile:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-strong);
    }
}

.quick-ico {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--qt-bg, var(--secondary));
    color: var(--qt, var(--primary));
}

.quick-ico svg {
    width: 24px;
    height: 24px;
}

.quick-ico--primary {
    background: var(--gradient-primary);
    color: var(--primary-ink);
    box-shadow: 0 6px 14px rgba(143, 31, 68, .25);
}

/* === Buscador de clientes === */
.search-form {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.search-form input {
    flex: 1;
}

.search-form .button {
    flex-shrink: 0;
}

/* === Menú "Más" === */
.more-menu {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.more-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: var(--radius);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    color: var(--ink);
    transition: transform .15s ease, box-shadow .15s ease;
}

.more-item:active {
    transform: scale(.99);
}

@media (hover: hover) {
    .more-item:hover {
        box-shadow: var(--shadow-strong);
    }
}

.more-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 14px;
    background: var(--more-bg, var(--secondary));
    color: var(--more-color, var(--primary));
}

.more-icon svg {
    width: 24px;
    height: 24px;
}

.more-text {
    display: grid;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.more-text strong {
    font-weight: 800;
}

.more-text small {
    color: var(--muted);
    font-size: .82rem;
}

.more-chevron {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--muted);
}

@media (max-width: 760px) {
    .tabs a.tab-fab {
        transform: translateY(-14px);
        width: 58px;
        height: 58px;
        box-shadow: 0 12px 22px rgba(143, 31, 68, .35);
    }

    .tabs a.tab-fab:active {
        transform: translateY(-14px) scale(.92);
    }
}

@media (max-width: 380px) {
    .summary-tile strong {
        font-size: .92rem;
    }

    .quick-tile {
        font-size: .68rem;
    }
}

.help-button {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--primary);
    font-weight: 900;
    font-size: .85rem;
    vertical-align: middle;
    margin-left: 8px;
}

.section-title .help-button {
    margin-left: 0;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    align-items: end;
    justify-items: center;
    padding: 16px;
    background: rgba(58, 31, 48, .45);
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow-strong);
    padding: 18px;
    margin-bottom: calc(8px + env(safe-area-inset-bottom));
}

@media (min-width: 540px) {
    .modal-overlay {
        align-items: center;
    }

    .modal {
        margin-bottom: 0;
    }
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.modal-close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    padding: 0;
    border-radius: 999px;
    background: var(--secondary);
    color: var(--primary);
    font-size: 1.2rem;
    line-height: 1;
}

.modal-body p {
    margin: 0 0 10px;
    color: var(--muted);
}

.modal-body p:last-child {
    margin-bottom: 0;
}

@media (max-width: 430px) {
    .ingredient-row {
        grid-template-columns: 1.6fr 0.8fr 0.9fr 0.9fr 24px;
        gap: 4px;
    }

    .ingredient-row input {
        padding: 8px 6px;
        font-size: .85rem;
    }

    .ing-subtotal {
        font-size: .85rem;
    }
}

@media (min-width: 720px) {
    .content {
        padding-inline: 24px;
    }

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

    .span-2 {
        grid-column: span 2;
    }
}

@media (max-width: 760px) {
    .topbar {
        padding-top: max(14px, env(safe-area-inset-top));
    }

    .tabs {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 30;
        justify-content: space-around;
        gap: 4px;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        background: var(--panel);
        border-top: 1px solid var(--line);
        border-bottom: 0;
        box-shadow: 0 -10px 30px rgba(108, 38, 56, .08);
    }

    .tabs a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        min-width: 0;
        min-height: 54px;
        flex: 1 1 0;
        padding: 6px 4px;
        border-radius: var(--radius-sm);
        font-size: .78rem;
    }

    .tabs a .tab-icon {
        width: 24px;
        height: 24px;
    }

    .tabs a .tab-label {
        font-size: .65rem;
    }

    .brand span:last-child {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .content {
        padding-bottom: calc(94px + env(safe-area-inset-bottom));
    }

    .filter-bar a {
        padding: 7px 13px;
        font-size: .82rem;
    }

    .page-head {
        align-items: flex-start;
    }

    .inline-form {
        display: grid;
    }

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

    .metric-card {
        min-height: 118px;
        align-content: space-between;
        padding: 13px;
    }

    .metric-card strong {
        font-size: 1.28rem;
        overflow-wrap: anywhere;
    }

    .metric-card small {
        font-size: .78rem;
    }
}

@media (max-width: 430px) {
    .content {
        padding-inline: 14px;
    }

    .page-head h1 {
        font-size: 2rem;
    }

    .action-button {
        min-width: 56px;
        width: 56px;
        height: 56px;
        padding: 0;
        border-radius: 16px;
        background: #fff;
        color: var(--primary);
        box-shadow: var(--shadow);
    }

    .action-button span:last-child {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .button-image {
        width: 48px;
        height: 48px;
    }

    .action-button .icon-plus {
        width: 28px;
        height: 28px;
    }
}
