/* Salón Pro — ERP SaaS (estilo Finanzas Pro + acento petróleo) */
:root {
    --bg: #f0f3f8;
    --card: #ffffff;
    --primary: #2f6f8f;
    --primary-dark: #245a74;
    --primary-soft: rgba(47, 111, 143, 0.12);
    --gold: #c4a35a;
    --gold-soft: rgba(196, 163, 90, 0.16);
    --success: #00c875;
    --success-soft: rgba(0, 200, 117, 0.14);
    --error: #e2445c;
    --error-soft: rgba(226, 68, 92, 0.14);
    --warning: #fdab3d;
    --warning-soft: rgba(253, 171, 61, 0.16);
    --text: #323338;
    --text-secondary: #676879;
    --border: #e6e9ef;
    --shadow: 0 4px 16px rgba(50, 51, 56, 0.06);
    --shadow-lg: 0 12px 32px rgba(50, 51, 56, 0.1);
    --header-bg: rgba(255, 255, 255, 0.94);
    --input-bg: #ffffff;
    --muted-bg: #f6f7fb;
    --nav-active-bg: #d7eaf3;
    --radius: 14px;
    --radius-sm: 10px;
    --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
    --transition: 0.2s ease;
    --bottom-nav-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background:
        radial-gradient(1200px 400px at 10% -10%, rgba(47, 111, 143, 0.1), transparent 55%),
        radial-gradient(900px 360px at 90% 0%, rgba(196, 163, 90, 0.07), transparent 50%),
        var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
.hidden { display: none !important; }

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 22px 24px 100px;
}

@media (min-width: 1101px) {
    .container { padding: 28px 20px 40px; }
}

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-wrap { width: 100%; max-width: 420px; }
.login-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 28px 26px;
}
.login-brand { text-align: center; margin-bottom: 22px; }
.logo-icon {
    width: 56px; height: 56px; margin: 0 auto 12px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), #4a93b5);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.1rem; letter-spacing: 0.5px;
}
.login-brand h1 { font-size: 1.55rem; font-weight: 800; }
.login-brand p { color: var(--text-secondary); font-size: 0.92rem; margin-top: 4px; }
.login-error {
    background: var(--error-soft); color: var(--error);
    padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 0.9rem;
}
.login-footer {
    text-align: center; margin-top: 18px; color: var(--text-secondary); font-size: 0.8rem;
}
.login-footer a { color: var(--primary); }
.demo-hint {
    margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
    background: var(--primary-soft); color: var(--primary-dark); font-size: 0.85rem; text-align: center;
}

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--text);
}
.form-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

input, select, textarea {
    width: 100%; padding: 11px 12px;
    border: 2px solid var(--border); border-radius: 8px;
    background: var(--input-bg); color: var(--text); font: inherit;
    transition: border-color var(--transition);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary);
}
textarea { min-height: 80px; resize: vertical; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 8px; font-weight: 700; font-size: 0.92rem;
    border: 2px solid transparent; cursor: pointer; font-family: inherit;
    transition: transform 0.15s ease, background var(--transition), border-color var(--transition);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: none; }
.btn-danger { background: var(--error); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; }
.btn-lg { padding: 13px 20px; font-size: 1rem; }
.w-full { width: 100%; }
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mb-12 { margin-bottom: 12px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.text-right { text-align: right; }

/* Header */
.app-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--header-bg); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.header-top {
    display: flex; align-items: center; justify-content: space-between;
    max-width: 1280px; margin: 0 auto; padding: 12px 20px; gap: 12px;
}
.brand {
    display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem;
}
.brand .logo-icon { width: 40px; height: 40px; margin: 0; font-size: 0.85rem; border-radius: 12px; }
.header-meta {
    display: flex; align-items: center; gap: 12px; color: var(--text-secondary); font-size: 0.85rem;
}
.header-nav {
    display: flex; justify-content: center; gap: 4px; flex-wrap: wrap;
    max-width: 1280px; margin: 0 auto; padding: 0 12px 10px;
}
.nav-link {
    padding: 8px 12px; border-radius: 999px; font-size: 0.86rem; font-weight: 600;
    color: var(--text-secondary); border: none; background: transparent; cursor: pointer; font-family: inherit;
}
.nav-link:hover { background: var(--muted-bg); color: var(--text); }
.nav-link.active { background: var(--nav-active-bg); color: var(--primary-dark); }

.demo-banner {
    background: linear-gradient(90deg, var(--primary), #3d87a8);
    color: #fff; text-align: center; padding: 8px 12px; font-size: 0.88rem; font-weight: 600;
}
.demo-banner strong { color: #ffe9b0; }

/* Pages */
.page { display: none; animation: fadeIn 0.22s ease; }
.page.active { display: block; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.page-head h2 { font-size: 1.45rem; font-weight: 800; }
.page-head p { color: var(--text-secondary); font-size: 0.9rem; }

/* Cards / stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px; margin-bottom: 18px;
}
.stat-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.stat-card .label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 600; }
.stat-card .value { font-size: 1.35rem; font-weight: 800; margin-top: 4px; }
.stat-card .hint { font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; }

.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.card h3 { font-size: 1rem; font-weight: 750; margin-bottom: 12px; }
.grid-2 {
    display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px;
}
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data {
    width: 100%; border-collapse: collapse; font-size: 0.9rem;
}
table.data th, table.data td {
    text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
table.data th {
    font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em;
    color: var(--text-secondary); font-weight: 700;
}
table.data tr:hover td { background: var(--muted-bg); }

.badge {
    display: inline-flex; align-items: center; padding: 3px 8px;
    border-radius: 999px; font-size: 0.75rem; font-weight: 700;
}
.badge-ok { background: var(--success-soft); color: #0a7a48; }
.badge-warn { background: var(--warning-soft); color: #9a6200; }
.badge-err { background: var(--error-soft); color: var(--error); }
.badge-info { background: var(--primary-soft); color: var(--primary-dark); }
.badge-gold { background: var(--gold-soft); color: #8a6d2b; }

/* Mobile cards for tables */
.mobile-cards { display: none; }
@media (max-width: 768px) {
    .desktop-table { display: none; }
    .mobile-cards { display: block; }
    .m-card {
        background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
        padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow);
    }
    .m-card .m-title { font-weight: 750; margin-bottom: 6px; }
    .m-card .m-row { display: flex; justify-content: space-between; gap: 8px; font-size: 0.88rem; padding: 3px 0; }
    .m-card .m-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
}

/* Modal */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(20, 28, 40, 0.45);
    display: flex; align-items: flex-end; justify-content: center; z-index: 100;
    padding: 0;
}
@media (min-width: 769px) {
    .modal-backdrop { align-items: center; padding: 20px; }
}
.modal {
    background: var(--card); width: 100%; max-width: 560px;
    border-radius: 18px 18px 0 0; max-height: 92vh; overflow: auto;
    padding: 18px 18px 24px; box-shadow: var(--shadow-lg);
    animation: slideUp 0.22s ease;
}
@media (min-width: 769px) {
    .modal { border-radius: var(--radius); }
}
@keyframes slideUp {
    from { transform: translateY(24px); opacity: 0; }
    to { transform: none; opacity: 1; }
}
.modal-head {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px;
}
.modal-head h3 { font-size: 1.1rem; font-weight: 800; }
.modal-actions {
    display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap;
}

/* Toast */
.toast-wrap {
    position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px;
}
.toast {
    background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--primary);
    padding: 12px 14px; border-radius: 10px; box-shadow: var(--shadow-lg);
    font-size: 0.9rem; font-weight: 600; min-width: 220px; max-width: 340px;
    animation: fadeIn 0.2s ease;
}
.toast.error { border-left-color: var(--error); }
.toast.ok { border-left-color: var(--success); }

/* POS */
.pos-layout {
    display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px;
}
@media (max-width: 900px) { .pos-layout { grid-template-columns: 1fr; } }
.pos-catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.pos-item {
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px;
    background: var(--muted-bg); cursor: pointer; transition: border-color var(--transition), transform 0.15s;
}
.pos-item:hover { border-color: var(--primary); transform: translateY(-1px); }
.pos-item .name { font-weight: 700; font-size: 0.88rem; }
.pos-item .price { color: var(--primary); font-weight: 800; margin-top: 4px; }
.pos-cart-line {
    display: flex; justify-content: space-between; gap: 8px; padding: 8px 0;
    border-bottom: 1px solid var(--border); font-size: 0.9rem;
}
.pos-total { font-size: 1.4rem; font-weight: 800; margin: 10px 0; }

/* Agenda */
.agenda-toolbar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px;
}
.agenda-day {
    border-left: 3px solid var(--primary); padding: 10px 12px; margin-bottom: 8px;
    background: var(--card); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    border: 1px solid var(--border); border-left-width: 3px;
}
.agenda-day .time { font-weight: 800; color: var(--primary); }
.agenda-day .title { font-weight: 700; }
.agenda-day .meta { font-size: 0.85rem; color: var(--text-secondary); }

/* Chart simple */
.chart-bars {
    display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-top: 10px;
}
.chart-bars .bar-col {
    flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end;
}
.chart-bars .bar {
    width: 100%; max-width: 36px; background: linear-gradient(180deg, #4a93b5, var(--primary));
    border-radius: 6px 6px 2px 2px; min-height: 4px; transition: height 0.35s ease;
}
.chart-bars .bar-label { font-size: 0.68rem; color: var(--text-secondary); margin-top: 6px; }

/* Filters */
.filters {
    display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: end;
}
.filters .form-group { margin-bottom: 0; min-width: 140px; }

/* Bottom nav mobile */
.bottom-nav {
    display: none;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--header-bg); border-top: 1px solid var(--border);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around;
}
.bottom-nav button {
    flex: 1; border: none; background: transparent; color: var(--text-secondary);
    font-family: inherit; font-size: 0.68rem; font-weight: 700; padding: 6px 4px;
    display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer;
}
.bottom-nav button.active { color: var(--primary); }
.bottom-nav .ico { font-size: 1.15rem; line-height: 1; }

.more-sheet {
    position: fixed; inset: 0; z-index: 90; background: rgba(20,28,40,0.4);
    display: flex; align-items: flex-end;
}
.more-sheet .sheet {
    width: 100%; background: var(--card); border-radius: 18px 18px 0 0;
    padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
    max-height: 70vh; overflow: auto;
}
.more-sheet .sheet button {
    width: 100%; text-align: left; padding: 14px 12px; border: none; border-bottom: 1px solid var(--border);
    background: transparent; font-family: inherit; font-weight: 650; font-size: 0.95rem; cursor: pointer;
}

@media (max-width: 900px) {
    .header-nav { display: none; }
    .bottom-nav { display: flex; }
    .header-meta .clock { display: none; }
    .container { padding-bottom: calc(var(--bottom-nav-h) + 24px); }
}

.search-box { position: relative; min-width: 180px; max-width: 280px; flex: 1; }
.search-results {
    position: absolute; top: 100%; left: 0; right: 0; background: var(--card);
    border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
    z-index: 40; max-height: 260px; overflow: auto;
}
.search-results button {
    width: 100%; text-align: left; padding: 10px 12px; border: none; background: transparent;
    border-bottom: 1px solid var(--border); cursor: pointer; font-family: inherit; font-size: 0.88rem;
}
.search-results button:hover { background: var(--muted-bg); }

.empty {
    text-align: center; padding: 28px 12px; color: var(--text-secondary); font-size: 0.95rem;
}

.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Listas tipo app */
.app-list { display: flex; flex-direction: column; gap: 8px; }
.app-list-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 4px; border-bottom: 1px solid var(--border);
}
.app-list-item:last-child { border-bottom: none; }
.app-list-item .rank {
    width: 28px; height: 28px; border-radius: 9px;
    background: var(--primary-soft); color: var(--primary-dark);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.78rem; font-weight: 800; flex-shrink: 0;
}
.rank.inline {
    display: inline-flex; width: 24px; height: 24px; border-radius: 8px;
    background: var(--primary-soft); color: var(--primary-dark);
    align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 800; margin-right: 6px; vertical-align: middle;
}
.app-list-body { flex: 1; min-width: 0; }
.app-list-title { font-weight: 700; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-list-sub { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }
.app-list-value { font-weight: 800; color: var(--primary-dark); white-space: nowrap; }

.stat-card.highlight {
    border-color: rgba(47, 111, 143, 0.25);
    background: linear-gradient(135deg, #fff, #eef6fa);
}
.m-card.compact { padding: 12px 14px; }
.m-card .m-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.mobile-only-block { display: none; }
.filters-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.filters .form-group.grow { flex: 1 1 180px; }

/* ========== App nativa (móvil) ========== */
html, body {
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

button, a, .pos-item, .nav-link, .m-card {
    -webkit-user-select: none;
    user-select: none;
}

@media (max-width: 900px) {
    :root {
        --bottom-nav-h: 72px;
        --app-header-h: 56px;
    }

    .mobile-only-block { display: block; }

    .cash-actions {
        width: 100%;
    }
    .cash-actions .btn { flex: 1; }

    .page-head .toolbar-actions {
        width: 100%;
    }
    .page-head .toolbar-actions .btn { flex: 1; }

    .report-filters {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: 16px;
        padding: 12px;
        margin-bottom: 14px;
        box-shadow: var(--shadow);
    }
    .report-filters .form-group {
        min-width: 0 !important;
        flex: none !important;
        margin: 0;
    }
    .report-filters .form-group.grow {
        grid-column: 1 / -1;
    }
    .report-filters .filters-actions {
        grid-column: 1 / -1;
    }
    .report-filters .filters-actions .btn { flex: 1; }

    #r-out .desktop-table { display: none; }
    #r-out .mobile-cards { display: block; }

    .m-card .m-row strong {
        color: var(--primary-dark);
        font-size: 1rem;
    }

    .app-list-item {
        padding: 12px 2px;
    }

    html, body {
        height: 100%;
        height: 100dvh;
        overflow: hidden;
        overscroll-behavior: none;
        background: var(--bg);
    }

    body {
        background: var(--bg);
    }

    #app-view {
        height: 100%;
        height: 100dvh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    #app-view.hidden { display: none !important; }

    .demo-banner {
        flex-shrink: 0;
        padding: 7px 12px;
        padding-top: calc(7px + env(safe-area-inset-top));
        font-size: 0.78rem;
        letter-spacing: 0.01em;
    }

    .app-header {
        position: relative;
        flex-shrink: 0;
        top: auto;
        border-bottom: 1px solid var(--border);
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: saturate(180%) blur(16px);
        -webkit-backdrop-filter: saturate(180%) blur(16px);
        box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
    }

    .header-top {
        padding: 8px 14px;
        min-height: var(--app-header-h);
        gap: 8px;
    }

    .brand {
        min-width: 0;
        flex: 1;
        font-size: 1rem;
    }

    .brand .logo-icon {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 0.72rem;
        flex-shrink: 0;
    }

    .brand span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 42vw;
    }

    .header-meta {
        gap: 4px;
        flex-shrink: 0;
    }

    .header-meta #user-chip { display: none; }

    .header-meta .clock { display: none !important; }

    #logout-btn {
        min-height: 40px;
        min-width: 40px;
        padding: 8px 10px;
        border-radius: 12px;
        background: var(--muted-bg);
        font-size: 0.78rem;
    }

    .search-box {
        position: absolute;
        left: 12px;
        right: 12px;
        top: calc(100% + 6px);
        max-width: none;
        min-width: 0;
        z-index: 45;
        display: none;
    }

    .search-box.open { display: block; }

    .search-box input {
        min-height: 44px;
        font-size: 16px;
        border-radius: 12px;
        box-shadow: var(--shadow-lg);
    }

    .btn-search-toggle,
    .btn-share {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: none;
        border-radius: 12px;
        background: var(--muted-bg);
        color: var(--text);
        font-size: 1.05rem;
        cursor: pointer;
        font-family: inherit;
    }

    .btn-share {
        font-weight: 800;
        color: var(--primary-dark);
    }

    .container {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        padding: 14px 14px calc(var(--bottom-nav-h) + 20px + env(safe-area-inset-bottom));
        width: 100%;
        max-width: none;
    }

    .page-head {
        margin-bottom: 14px;
        align-items: center;
        position: sticky;
        top: 0;
        z-index: 5;
        background: linear-gradient(180deg, var(--bg) 70%, transparent);
        padding: 2px 0 8px;
    }

    .page-head h2 {
        font-size: 1.35rem;
        letter-spacing: -0.02em;
    }

    .page-head p {
        font-size: 0.82rem;
        display: none;
    }

    .page-head .btn,
    .page-head .toolbar-actions .btn {
        min-height: 44px;
        padding: 10px 16px;
        border-radius: 12px;
        font-size: 0.9rem;
    }

    .stats-grid {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        padding-bottom: 4px;
        margin: 0 -14px 16px;
        padding-left: 14px;
        padding-right: 14px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .stats-grid::-webkit-scrollbar { display: none; }

    .stat-card {
        flex: 0 0 148px;
        scroll-snap-align: start;
        padding: 14px;
        border-radius: 16px;
    }

    .stat-card .value { font-size: 1.2rem; }

    .card {
        border-radius: 16px;
        padding: 14px;
        margin-bottom: 12px;
    }

    .m-card {
        border-radius: 16px;
        padding: 14px 14px 12px;
        margin-bottom: 10px;
        transition: transform 0.15s ease;
    }

    .m-card:active { transform: scale(0.985); }

    .m-card .m-actions .btn {
        min-height: 40px;
        flex: 1;
        border-radius: 11px;
    }

    input, select, textarea {
        min-height: 46px;
        font-size: 16px !important;
        border-radius: 12px;
        padding: 12px 14px;
    }

    textarea { min-height: 96px; }

    .btn {
        min-height: 46px;
        border-radius: 12px;
        font-size: 0.95rem;
    }

    .btn-sm { min-height: 40px; }

    .btn-lg { min-height: 52px; font-size: 1.05rem; }

    .filters {
        gap: 8px;
    }

    .filters .form-group {
        min-width: calc(50% - 4px);
        flex: 1 1 calc(50% - 4px);
    }

    .filters .form-group:first-child:nth-last-child(1),
    .filters .btn {
        flex: 1 1 100%;
    }

    .agenda-day {
        border-radius: 14px;
        padding: 14px;
        margin-bottom: 10px;
        border-left-width: 4px;
    }

    .agenda-day .toolbar-actions .btn {
        flex: 1;
        min-height: 40px;
    }

    .pos-layout { gap: 12px; }

    .pos-catalog {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        max-height: none;
    }

    .pos-item {
        min-height: 88px;
        border-radius: 14px;
        padding: 14px;
        background: var(--card);
        box-shadow: var(--shadow);
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .pos-item:active { transform: scale(0.97); }

    .pos-item .name { font-size: 0.92rem; }

    .chart-bars { height: 140px; }

    .toast-wrap {
        top: auto;
        bottom: calc(var(--bottom-nav-h) + 12px + env(safe-area-inset-bottom));
        left: 12px;
        right: 12px;
        align-items: stretch;
    }

    .toast {
        min-width: 0;
        max-width: none;
        border-radius: 14px;
        text-align: center;
    }

    .modal-backdrop {
        align-items: flex-end;
        padding: 0;
        background: rgba(15, 23, 32, 0.48);
        backdrop-filter: blur(2px);
    }

    .modal {
        width: 100%;
        max-width: none;
        border-radius: 22px 22px 0 0;
        max-height: min(92dvh, 92vh);
        padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
        animation: sheetUp 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .modal::before {
        content: "";
        display: block;
        width: 40px;
        height: 4px;
        border-radius: 99px;
        background: #d0d5dd;
        margin: 2px auto 12px;
    }

    .modal-head h3 { font-size: 1.15rem; }

    .modal-actions {
        position: sticky;
        bottom: 0;
        background: linear-gradient(180deg, transparent, var(--card) 28%);
        padding-top: 12px;
        gap: 8px;
    }

    .modal-actions .btn { flex: 1; }

    .bottom-nav {
        display: flex;
        height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.94);
        backdrop-filter: saturate(180%) blur(18px);
        -webkit-backdrop-filter: saturate(180%) blur(18px);
        border-top: 1px solid rgba(230, 233, 239, 0.95);
        box-shadow: 0 -8px 28px rgba(20, 30, 40, 0.06);
    }

    .bottom-nav button {
        position: relative;
        min-height: 56px;
        gap: 3px;
        font-size: 0.64rem;
        font-weight: 750;
        letter-spacing: 0.01em;
        border-radius: 14px;
        color: #8b93a7;
        transition: color 0.15s ease, background 0.15s ease, transform 0.12s ease;
    }

    .bottom-nav button:active { transform: scale(0.94); }

    .bottom-nav button.active {
        color: var(--primary);
        background: transparent;
    }

    .bottom-nav .ico-wrap {
        width: 44px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 16px;
        transition: background 0.18s ease;
    }

    .bottom-nav button.active .ico-wrap {
        background: var(--primary-soft);
    }

    .bottom-nav .ico {
        display: flex;
        width: 22px;
        height: 22px;
        font-size: 0;
    }

    .bottom-nav .ico svg {
        width: 22px;
        height: 22px;
        stroke: currentColor;
        fill: none;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .more-sheet {
        background: rgba(15, 23, 32, 0.45);
        backdrop-filter: blur(3px);
        animation: fadeDim 0.2s ease;
    }

    .more-sheet .sheet {
        border-radius: 22px 22px 0 0;
        padding: 10px 14px calc(18px + env(safe-area-inset-bottom));
        max-height: min(78dvh, 78vh);
        animation: sheetUp 0.28s cubic-bezier(0.22, 1, 0.36, 1);
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.12);
    }

    .more-sheet .sheet::before {
        content: "";
        display: block;
        width: 40px;
        height: 4px;
        border-radius: 99px;
        background: #d0d5dd;
        margin: 2px auto 14px;
    }

    .more-sheet .sheet h3 {
        font-size: 1.1rem;
        margin: 0 0 12px !important;
        padding: 0 4px;
    }

    .more-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        margin-bottom: 8px;
    }

    .more-grid button {
        width: 100%;
        border: 1px solid var(--border) !important;
        border-bottom: 1px solid var(--border) !important;
        border-radius: 16px !important;
        background: var(--muted-bg) !important;
        padding: 16px 8px !important;
        text-align: center !important;
        font-size: 0.78rem !important;
        font-weight: 700 !important;
        color: var(--text);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        min-height: 92px;
    }

    .more-grid button:active {
        transform: scale(0.96);
        background: var(--primary-soft) !important;
        color: var(--primary-dark);
    }

    .more-grid .m-ico {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        background: #fff;
        border: 1px solid var(--border);
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--primary);
        font-size: 1.1rem;
        font-weight: 800;
    }

    .more-sheet .sheet #more-close {
        margin-top: 8px;
        border: none !important;
        border-radius: 14px !important;
        background: var(--error-soft) !important;
        color: var(--error) !important;
        text-align: center !important;
        min-height: 48px;
        font-weight: 750 !important;
    }

    .login-page {
        padding: 16px;
        padding-top: calc(16px + env(safe-area-inset-top));
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
        align-items: stretch;
        justify-content: center;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        height: 100dvh;
    }

    .login-wrap { max-width: none; margin: auto 0; }

    .login-box {
        border-radius: 22px;
        padding: 26px 20px;
        border: none;
        box-shadow: 0 16px 48px rgba(30, 40, 55, 0.1);
    }

    .login-box .btn {
        min-height: 50px;
        border-radius: 14px;
        font-size: 1rem;
    }

    .login-footer { font-size: 0.75rem; }
}

.btn-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: var(--muted-bg);
    color: var(--primary-dark);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
}

.btn-share:hover { background: var(--primary-soft); }

.share-more-btn {
    margin-top: 4px !important;
    background: var(--primary-soft) !important;
    color: var(--primary-dark) !important;
    border-color: transparent !important;
    font-weight: 750 !important;
}

@media (min-width: 901px) {
    .btn-search-toggle { display: none !important; }
}

@keyframes sheetUp {
    from { transform: translateY(100%); opacity: 0.6; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeDim {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .page, .modal, .more-sheet .sheet, .toast { animation: none !important; }
}
