:root {
    --brand: #00c96b;
    --brand-dark: #00b35f;
    --brand-soft: #e7f8ef;
    --brand-glow: rgba(0, 201, 107, .22);
    --sidebar: #0b1220;
    --sidebar-2: #111827;
    --bg: #dfe5ea;
    --sheet: #eaf4ee;
    --card: #ffffff;
    --soft: #dce8e1;
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --ok: #047857;
    --warn: #b45309;
    --danger: #e11d48;
    --line: #c9d6cf;
    --line-strong: #b3c4ba;
    --ink: #052e1a;
    --radius: 22px;
    --radius-sm: 14px;
    --radius-pill: 999px;
    --shadow: 0 12px 32px rgba(15, 23, 42, .07);
    --shadow-sm: 0 4px 14px rgba(15, 23, 42, .06);
    --tabbar-h: 64px;
    --sidebar-w: 252px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-dark); text-decoration: none; }
.ui-icon { display: block; flex-shrink: 0; width: 20px; height: 20px; }

.app-body { background: var(--bg); }
.app-shell { min-height: 100vh; }
.app-sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    display: none;
    flex-direction: column;
    background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    color: #fff;
    padding: 22px 14px 16px;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    z-index: 80;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 800; font-size: 14px; line-height: 1.35;
    padding: 2px 8px 18px; color: #fff; flex-shrink: 0; min-width: 0;
}
.sidebar-brand > span:last-child {
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-brand .brand-mark {
    width: 40px; height: 40px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand); color: var(--ink); flex-shrink: 0;
}
.sidebar-nav {
    display: flex; flex-direction: column; gap: 4px;
    flex: 1 1 auto; min-height: 0; overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.sidebar-nav::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}
.sidebar-nav a {
    color: rgba(255,255,255,.78);
    border-radius: 14px;
    padding: 11px 12px;
    display: flex; align-items: center; gap: 10px;
    font-weight: 650; font-size: 14px;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav a.active {
    background: var(--brand);
    color: var(--ink);
    font-weight: 800;
}
.sidebar-footer { flex-shrink: 0; margin-top: 12px; padding-top: 10px; }
.user-chip {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 16px; padding: 12px; margin-bottom: 10px;
}
.user-chip strong { display: block; font-size: 14px; }
.user-chip span { font-size: 12px; opacity: .7; }
.btn-sidebar-logout {
    width: 100%;
    background: transparent !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.22) !important;
    box-shadow: none !important;
    min-height: 44px;
    border-radius: 14px !important;
}
.btn-sidebar-logout:hover { background: rgba(255,255,255,.1) !important; color: #fff !important; }

.welcome-banner[hidden], .nav-backdrop[hidden] { display: none !important; }
.nav-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 70;
}

.app-main { min-width: 0; display: flex; flex-direction: column; overflow-x: hidden; }
.app-topbar {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 28px 6px;
    flex-shrink: 0;
}
.page-title {
    font-size: 26px; font-weight: 800; letter-spacing: -.03em;
    margin: 0; flex: 1; min-width: 0; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-chips { display: none; align-items: center; gap: 8px; flex-shrink: 0; }
.pill-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 7px 12px;
    box-shadow: var(--shadow-sm);
    color: var(--text-2); font-size: 13px; font-weight: 650;
    white-space: nowrap;
}
.pill-chip--role { background: var(--brand-soft); border-color: transparent; color: var(--ok); }
.pill-chip--link { color: var(--text); }
.btn-menu {
    display: none;
    width: 44px; height: 44px; border: 0; padding: 0;
    border-radius: 50%;
    background: var(--brand); color: var(--ink);
    align-items: center; justify-content: center;
    box-shadow: 0 10px 20px var(--brand-glow);
    flex-shrink: 0;
}
.btn-back {
    flex-shrink: 0; width: auto !important;
    min-height: 40px !important; height: 40px;
    padding: 8px 14px !important;
    border-radius: 12px !important; box-shadow: none !important;
}
.wrap { padding: 8px 28px 32px; flex: 1; width: 100%; }

.welcome-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: #d8f6e7; color: #166534;
    border-radius: 16px; padding: 13px 16px;
    margin-bottom: 16px; font-weight: 700; font-size: 14px;
}
.welcome-banner button {
    border: 0; background: transparent; color: inherit;
    font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.page-hero { display: none; margin: 4px 0 16px; }
.page-hero .page-kicker { color: var(--muted); font-size: 13px; font-weight: 650; margin-bottom: 4px; }
.page-hero h2 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.04em; line-height: 1.15; }
.page-hero p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.sheet {
    background: var(--sheet);
    border-radius: 24px;
    padding: 18px;
    border: 1px solid var(--line);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
}
.sheet > .list-search-form { margin-bottom: 14px; }
.sheet .list-toolbar .list-search-form { margin-bottom: 0; }
.sheet .empty, .sheet .empty-state { padding-top: 36px; padding-bottom: 28px; }

.grid-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.grid-cards.grid-profit { grid-template-columns: 1fr; }
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.card {
    background: var(--card);
    border-radius: 20px;
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--line);
    color: inherit;
    display: block;
    min-width: 0;
}
.card.form-card, form.card { padding: 22px 22px 20px; }
.card-tap:active { transform: scale(.985); }
.card-label { font-size: 13px; color: var(--muted); font-weight: 650; margin-bottom: 6px; overflow-wrap: anywhere; }
.card-value { font-size: 22px; font-weight: 800; letter-spacing: -.03em; color: var(--text); overflow-wrap: anywhere; }
.card-sub { margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.card-full { grid-column: 1 / -1; }

.stat-card {
    background: var(--card); border-radius: 22px; padding: 16px 18px;
    border: 1px solid var(--line); box-shadow: var(--shadow-sm); min-width: 0;
}
.stat-card .card-label { font-size: 12px; }
.stat-card .card-value { font-size: 28px; margin: 8px 0 4px; }
.stat-card--dark {
    background: #0f172a; color: #fff; border-color: transparent;
}
.stat-card--dark .card-label { color: rgba(255,255,255,.72); }
.stat-card--dark .card-value { color: #fff; }
.stat-card--dark .card-sub { color: #86efac; }

.row-cards { display: flex; flex-direction: column; gap: 12px; }
.list-card {
    background: var(--card);
    border-radius: 22px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    display: block; color: inherit;
}
.list-title { font-weight: 800; margin-bottom: 4px; font-size: 16px; overflow-wrap: anywhere; }
.list-meta { font-size: 13px; color: var(--muted); margin-top: 4px; }

.list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.list-toolbar .list-search-form {
    margin-bottom: 0;
    width: auto;
    flex: 1 1 240px;
    min-width: 0;
}
.list-toolbar > .btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 148px;
    min-height: 44px;
}

.order-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 16px 18px 14px;
}
.order-card-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 28px;
    color: inherit;
    text-decoration: none;
    min-width: 0;
}
.order-card-primary {
    min-width: 0;
    flex: 1 1 220px;
}
.order-card-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.order-card-title-row .list-title { margin-bottom: 0; }
.order-card-figures {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px 28px;
    align-items: flex-end;
    flex: 0 1 auto;
    margin-left: auto;
}
.order-fig {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 96px;
}
.order-fig span {
    font-size: 12px;
    color: var(--muted);
    font-weight: 650;
    line-height: 1.2;
}
.order-fig strong {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    color: var(--text);
}
.order-fig--profit strong { color: var(--ok); }
.order-fig--income strong { color: var(--ok); }
.order-fig--out strong { color: var(--danger); }
.order-fig--due strong { color: var(--warn); }
.order-fig--due.is-clear strong { color: var(--ok); }
.order-fig--time {
    min-width: 148px;
    margin-left: auto;
    text-align: right;
}
.order-fig--time strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-2);
    white-space: nowrap;
}
.order-card-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line-strong);
}
.order-card-actions form { margin: 0; display: inline-flex; }
.order-card-actions .btn {
    width: auto;
    min-width: 0;
    min-height: 38px;
    padding: 8px 16px;
    font-size: 13px;
    box-shadow: none;
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 12px 18px; border-radius: var(--radius-pill); border: 1px solid transparent; cursor: pointer;
    font-size: 15px; font-weight: 800; color: #fff;
    background: var(--brand);
    box-shadow: 0 8px 18px var(--brand-glow);
    text-decoration: none;
}
.btn:hover { background: var(--brand-dark); color: #fff; }
.btn-block { width: 100%; }
.btn-ghost {
    background: var(--card); color: var(--text);
    border-color: var(--line-strong); box-shadow: none;
}
.btn-ghost:hover { background: var(--sheet); color: var(--text); }
.btn-dark {
    background: #0f172a; color: #fff; box-shadow: none;
}
.btn-dark:hover { background: #1e293b; color: #fff; }
.btn-danger { background: var(--card); color: var(--danger); border-color: #fecdd3; box-shadow: none; }
.btn-danger:hover { background: #fff1f2; color: var(--danger); }
.btn-outline {
    background: var(--card); color: var(--brand-dark);
    border-color: #9de7c2; box-shadow: none;
}

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); font-weight: 700; margin-bottom: 6px; }
.field .req { color: var(--danger); }
.field input, .field select, .field textarea {
    width: 100%; padding: 12px 16px; border-radius: 16px;
    border: 1px solid #cdd8d2;
    background: var(--card); color: var(--text); font-size: 16px; min-height: 48px;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 .2rem var(--brand-glow);
}
.field textarea { min-height: 88px; resize: vertical; }
.field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='12' viewBox='0 0 16 12'%3E%3Cpath fill='%2364748b' d='M1.5 2.5 L8 9.5 L14.5 2.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
}
.field-hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 4px 24px; }
.form-grid .field-full { grid-column: 1 / -1; }
.choice-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-pills label {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--line); background: var(--card);
    border-radius: var(--radius-pill); padding: 9px 14px;
    font-size: 13px; font-weight: 700; cursor: pointer; color: var(--text-2);
}
.choice-pills input { accent-color: var(--brand); }
.choice-pills label:has(input:checked) {
    background: var(--brand-soft); border-color: #9de7c2; color: var(--ink);
}

.line-row {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr) minmax(0, 0.85fr);
    gap: 8px; margin-bottom: 10px; align-items: stretch;
}
.line-row > input[type="hidden"] { display: none !important; }
.line-row > select, .line-row > input, .line-row > .product-picker input {
    width: 100%; min-width: 0; max-width: 100%;
    padding: 10px 10px; border-radius: 12px;
    border: 1px solid #cdd8d2; background: var(--card); color: var(--text);
    font-size: 16px; box-sizing: border-box;
}
.line-row > select { overflow: hidden; text-overflow: ellipsis; }
.line-row.line-row--purchase {
    grid-template-columns: 1fr 1fr;
}
.line-row.line-row--purchase { overflow: visible; }
.line-row.line-row--purchase > .product-picker {
    grid-column: 1 / -1;
    position: relative;
    min-width: 0;
    z-index: 1;
}
.line-row.line-row--purchase > .product-picker:focus-within { z-index: 40; }
.product-picker-list {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
    max-height: 240px; overflow: auto;
    background: var(--card); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 10px 28px rgba(11,18,32,.12);
}
.product-picker-item {
    display: block; width: 100%; text-align: left; padding: 10px 12px;
    border: 0; background: transparent; cursor: pointer; color: var(--text);
    font-size: 14px; line-height: 1.35;
}
.product-picker-item small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.product-picker-item:hover, .product-picker-item.is-on { background: var(--brand-soft); }
.product-picker-empty { padding: 12px; color: var(--muted); font-size: 13px; }
@media (max-width: 360px) {
    .line-row { grid-template-columns: minmax(0, 1fr) minmax(0, 0.75fr) minmax(0, 0.75fr); gap: 6px; }
}
.line-row.line-row--order {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.78fr) minmax(0, 0.72fr) minmax(0, 0.72fr);
}
.line-row.line-row-head {
    font-size: 11px; font-weight: 600; color: var(--muted);
    margin-bottom: 4px; align-items: end;
}
.line-row.line-row-head > span { padding: 0 2px 4px; }
.line-row.line-row-head > span:first-child { text-align: left; }
.line-row.line-row-head > span:not(:first-child) { text-align: center; }
.line-row > input.line-cost-display {
    text-align: center; color: var(--warn); font-size: 14px; font-weight: 600; cursor: default;
}
@media (max-width: 520px) {
    .line-row.line-row--order { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .line-row.line-row--order > input.line-product-search { grid-column: 1 / -1; order: 1; }
    .line-row.line-row--order > input.line-cost-display { grid-column: 1 / 2; order: 2; }
    .line-row.line-row--order > input[name="quantity[]"] { grid-column: 2 / 3; order: 3; }
    .line-row.line-row--order > input[name="unit_price[]"] { grid-column: 3 / 4; order: 4; }
    .line-row.line-row-head { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .line-row.line-row-head > span:first-child { grid-column: 1 / -1; text-align: left; }
}

.flash { padding: 12px 14px; border-radius: 16px; margin-bottom: 14px; font-size: 14px; border: 0; }
.flash-ok { background: var(--brand-soft); color: var(--ok); }
.flash-err { background: #feeceb; color: var(--danger); }

.badge {
    display: inline-block; padding: 4px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 700;
}
.badge-ok { background: #d8f6e7; color: var(--ok); }
.badge-warn { background: #fff3d6; color: var(--warn); }
.badge-muted { background: var(--soft); color: #4b5c55; }

.tabbar { display: none; }

.section-title { font-size: 17px; font-weight: 800; margin: 20px 0 12px; color: var(--ink); }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar-tabs { flex-wrap: nowrap; width: auto; max-width: 100%; }
.toolbar-tabs > .btn, .chip-row > a, .chip-row > button {
    flex: 0 1 auto; min-width: 72px;
}
.chip-row {
    display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
    margin-bottom: 14px; -webkit-overflow-scrolling: touch;
}
.chip {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 14px; border-radius: var(--radius-pill);
    background: var(--soft); color: var(--text-2);
    font-size: 13px; font-weight: 750; white-space: nowrap;
    border: 1px solid transparent;
}
.chip.is-on { background: var(--brand); color: var(--ink); }
.list-pager.toolbar { flex-wrap: wrap; justify-content: space-between; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.inline-actions .btn { width: auto; min-height: 40px; padding: 8px 14px; }
.action-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px;
}
.action-grid .btn { min-height: 44px; width: 100%; box-shadow: none; }
.followup-item {
    margin-bottom: 10px; padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}
.followup-item:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
table.simple tfoot tr { font-weight: 700; border-top: 2px solid var(--line); }

.list-search-form {
    display: flex; flex-wrap: nowrap; gap: 8px; align-items: center;
    flex: 1 1 220px; min-width: 0;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-pill);
    padding: 5px 5px 5px 14px;
}
.list-search-form--grow { flex: 1 1 260px; width: 100%; }
.list-search-input, .list-search-month {
    flex: 1 1 80px; min-width: 0; padding: 8px 8px;
    border: 0; outline: none; background: transparent; color: var(--text); font-size: 15px;
}
.list-search-month { flex: 0 0 auto; min-width: 8.5rem; }
.list-search-form .btn { min-height: 40px; padding: 8px 16px; box-shadow: none; border-radius: var(--radius-pill); }
.list-pager-meta { font-size: 13px; color: var(--muted); align-self: center; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding-bottom: 4px; }
.table-scroll table.simple { min-width: 100%; }
.order-items-table th,
.order-items-table .oi-num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.order-items-table .oi-name { min-width: 6.5em; }
.order-items-table .oi-name small {
    display: block; margin-top: 2px; font-weight: 500; font-size: 12px; color: var(--muted);
}
.order-items-table .oi-cost { color: var(--warn); }
.order-items-table .oi-profit { color: var(--ok); font-weight: 700; }
@media (max-width: 991.98px) {
    .order-items-scroll { overflow: visible; margin: 0; padding: 0; }
    table.simple.order-items-table { min-width: 0; display: block; }
    table.simple.order-items-table thead { display: none; }
    table.simple.order-items-table tbody,
    table.simple.order-items-table tfoot { display: flex; flex-direction: column; gap: 10px; }
    table.simple.order-items-table tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px 16px;
        background: var(--card);
        border: 1px solid var(--line);
        border-radius: 18px;
        padding: 14px 14px 12px;
        box-shadow: var(--shadow-sm);
    }
    table.simple.order-items-table td {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        min-width: 0;
        padding: 0;
        border: 0;
        text-align: left;
        background: transparent;
        white-space: normal;
    }
    table.simple.order-items-table td[data-label]::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 11px;
        font-weight: 650;
        line-height: 1.2;
    }
    table.simple.order-items-table .oi-name {
        grid-column: 1 / -1;
        min-width: 0;
        font-weight: 800;
        font-size: 16px;
        line-height: 1.35;
        padding: 0 0 10px;
        border-bottom: 1px solid var(--line);
    }
    table.simple.order-items-table td.oi-name::before { content: none; }
    table.simple.order-items-table .oi-profit {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 2px;
        padding: 10px 0 0;
        border-top: 1px dashed var(--line);
        font-size: 15px;
    }
    table.simple.order-items-table .oi-profit::before { font-size: 13px; }
    table.simple.order-items-table tfoot tr {
        background: var(--sheet);
        box-shadow: none;
        border-top: 0;
    }
    table.simple.order-items-table .oi-foot-label {
        grid-column: 1 / -1;
        padding: 0;
        border: 0;
        font-weight: 800;
        font-size: 14px;
        color: var(--text);
    }
    table.simple.order-items-table tfoot .oi-num,
    table.simple.order-items-table tfoot .oi-profit {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 0;
        padding: 0;
        border-top: 0;
        font-size: 15px;
    }
}
table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.simple th, table.simple td { padding: 12px 8px; text-align: left; border-bottom: 1px solid var(--line); }
table.simple th { color: var(--muted); font-weight: 700; font-size: 12px; background: var(--sheet); }

.empty, .empty-state { text-align: center; color: var(--muted); padding: 36px 12px; font-size: 14px; }
.empty-state .empty-icon, .empty .empty-icon {
    width: 64px; height: 64px; border-radius: 20px;
    background: var(--brand-soft); color: var(--brand-dark);
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}
.empty-state strong, .empty strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }
.empty-state p, .empty p { margin: 0; font-size: 13px; }

.hello-block { margin: 0 0 16px; }
.hello-block > span { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.hello-block h2 { margin: 4px 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
.hello-block p { margin: 0; color: var(--text-2); font-size: 14px; }

.me-menu {
    background: var(--card); border-radius: 24px; overflow: hidden;
    border: 1px solid var(--line); margin-bottom: 16px;
}
.me-menu-item {
    display: flex; align-items: center; gap: 14px; padding: 14px 16px;
    color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); font-weight: 700;
}
.me-menu-item:last-child { border-bottom: 0; }
.me-menu-item .me-label { flex: 1; min-width: 0; }
.me-ico {
    flex: 0 0 40px;
    width: 40px; height: 40px;
    min-width: 40px; max-width: 40px;
    border-radius: 50%;
    background: var(--brand-soft); color: var(--brand-dark);
    display: inline-flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.me-ico .ui-icon { width: 18px; height: 18px; }
.me-menu-item::after { content: "›"; color: #94a3b8; font-size: 22px; font-weight: 400; }
.me-note { color: var(--muted); font-size: 13px; text-align: center; margin: 8px 0 16px; }
.profile-hero {
    display: flex; align-items: center; gap: 14px;
    background: #0f172a;
    color: #fff; border-radius: 28px; padding: 22px 18px; margin-bottom: 16px;
}
.profile-avatar {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--brand); color: var(--ink);
    display: inline-flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800;
}
.profile-hero strong { display: block; font-size: 20px; }
.profile-hero span { display: block; font-size: 13px; opacity: .72; }

.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 18%, rgba(0,201,107,.16), transparent 28%),
        radial-gradient(circle at 88% 12%, rgba(56,189,248,.12), transparent 24%),
        linear-gradient(160deg, #f4f7fb 0%, #eef6f1 48%, #f7f8fa 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 32px 20px;
}
.auth-wrap { width: min(100%, 460px); }
.auth-hero { text-align: center; }
.auth-logo {
    width: 64px; height: 64px; border-radius: 18px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 800; color: var(--ink); background: var(--brand);
}
.auth-hero h1 { font-size: 26px; margin: 18px 0 8px; font-weight: 800; }
.auth-hero p { margin: 0; color: var(--muted); }
.auth-sheet { margin-top: 28px; }
.auth-submit { margin-top: 8px; min-height: 52px; border-radius: var(--radius-pill); width: 100%; }

.stats-cal-legend { font-size: 12px; color: var(--muted); margin: -6px 0 12px; line-height: 1.45; }
.stats-calendar { padding: 12px 10px 14px; margin-bottom: 4px; }
.stats-cal-weekdays {
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px; margin-bottom: 8px; padding: 0 2px;
}
.stats-cal-weekdays span { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); }
.stats-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.stats-cal-cell { border-radius: 10px; min-height: 0; }
.stats-cal-cell--empty { visibility: hidden; pointer-events: none; }
.stats-cal-cell--day {
    background: var(--soft); border: 1px solid var(--line);
    padding: 5px 4px 6px; display: flex; flex-direction: column; align-items: stretch; gap: 4px;
}
.stats-cal-cell--zero { opacity: 0.72; }
.stats-cal-cell--today {
    border-color: #9de7c2; box-shadow: 0 0 0 1px var(--brand-glow); background: var(--brand-soft);
}
.stats-cal-day { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1; }
.stats-cal-metrics { display: flex; flex-direction: column; gap: 3px; flex: 1; justify-content: flex-end; }
.stats-cal-line { display: flex; align-items: baseline; gap: 3px; font-size: 10px; line-height: 1.25; min-width: 0; }
.stats-cal-k { flex-shrink: 0; color: var(--muted); font-weight: 600; width: 1em; }
.stats-cal-v { min-width: 0; font-variant-numeric: tabular-nums; color: var(--text); word-break: break-all; }
.stats-cal-v--gp { color: var(--ok); }
.profit-preview {
    padding: 12px 14px; margin-bottom: 12px;
    background: var(--brand-soft); border: 1px solid #9de7c2;
}
.user-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.pc-only { display: none; }
.mobile-only { display: block; }

@media (min-width: 992px) {
    .app-shell { display: block; }
    .app-sidebar {
        display: flex !important;
        position: fixed; left: 0; top: 0; bottom: 0;
    }
    .app-main { margin-left: var(--sidebar-w); min-height: 100vh; }
    .tabbar { display: none !important; visibility: hidden; pointer-events: none; }
    .topbar-chips { display: flex; }
    .btn-menu { display: none !important; }
    .page-hero { display: none; }
    .welcome-banner { margin: 0 0 18px; }
    .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cards.grid-profit { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr 1fr; }
    .hello-block h2 { font-size: 28px; }
    a.btn.btn-block { width: auto; min-width: 180px; }
    form.card .btn-block, .sheet .btn-block, .action-grid .btn { width: 100%; min-width: 0; }
    .pc-only { display: inline-flex; }
    .mobile-only { display: none; }
    .sheet { padding: 22px 22px 8px; }
    .order-card:hover { border-color: #8ecfad; background: #fbfffd; }
    .order-card-body:hover .list-title { color: var(--brand-dark); }
    .list-toolbar { flex-wrap: nowrap; }
    .list-toolbar > .btn { min-height: 50px; }
    .order-fig { min-width: 96px; }
}

@media (min-width: 1200px) {
    .grid-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .grid-cards.grid-profit { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        display: flex !important;
        position: fixed; left: 0; top: 0; bottom: 0;
        transform: translateX(-110%);
        transition: transform .2s ease;
        box-shadow: 12px 0 40px rgba(15, 23, 42, .25);
    }
    body.nav-open .app-sidebar { transform: translateX(0); }
    body.nav-open .nav-backdrop { display: block; }
    .app-main { margin-left: 0; }
    .app-topbar { padding: 12px 16px 0; }
    .is-tab-root .page-title, .is-tab-root .btn-back { display: none; }
    .is-subpage .page-title { font-size: 0; width: 0; overflow: hidden; }
    .topbar-chips { display: none; }
    .btn-menu { display: inline-flex; }
    .page-hero { display: block; }
    .wrap {
        padding: 8px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
    }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar > .btn { width: 100%; }
    .toolbar-tabs { flex-direction: row; width: 100%; }
    .toolbar-tabs > .btn { width: auto; flex: 1 1 0; box-shadow: none; min-height: 42px; padding: 8px 10px; font-size: 13px; }
    .list-pager.toolbar { flex-direction: row; align-items: center; }
    .list-pager .btn { width: auto; min-height: 40px; padding: 8px 14px; }
    .list-search-form { width: 100%; flex: none; }
    .list-search-month { min-width: 0; max-width: 8.2rem; }
    .list-toolbar { align-items: stretch; }
    .list-toolbar > .btn { width: 100%; min-width: 0; }
    .list-toolbar .list-search-form { width: 100%; }
    .order-card-figures {
        width: 100%;
        margin-left: 0;
        justify-content: space-between;
        gap: 8px 12px;
    }
    .order-fig { min-width: 0; flex: 1 1 72px; }
    .order-fig strong { font-size: 16px; }
    .order-fig--time { min-width: 0; flex: 0 1 auto; }
    .order-fig--time strong { white-space: normal; font-size: 12px; }
    .order-card-actions { justify-content: stretch; }
    .order-card-actions .btn, .order-card-actions form { flex: 1 1 auto; }
    .order-card-actions .btn { min-height: 42px; }
    .order-card-actions form .btn { width: 100%; }
    .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .grid-cards.grid-profit { grid-template-columns: 1fr; }
    .card-full { grid-column: 1 / -1; }
    .btn { min-height: 46px; }
    .tabbar {
        display: flex !important; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
        background: var(--card); border-top: 1px solid var(--line);
        padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
        box-shadow: 0 -8px 24px rgba(15, 23, 42, .06);
        width: 100%;
    }
    .tabbar-inner {
        width: 100%; display: flex; align-items: stretch;
        min-height: 52px; justify-content: space-around;
    }
    .tabbar .tab {
        flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: 3px; color: #94a3b8; font-size: 11px; font-weight: 750;
        padding: 4px 2px; border: 0; background: none; text-decoration: none;
    }
    .tabbar .tab.is-active, .tabbar .tab.is-active .tab-label { color: var(--brand-dark); }
    .tabbar .tab .tab-icon { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
    .hello-block { display: none; }
    .stats-calendar { padding: 10px 8px; }
    .stats-cal-grid, .stats-cal-weekdays { gap: 4px; }
    .stats-cal-cell--day { padding: 4px 3px 5px; }
    .stats-cal-day { font-size: 12px; }
    .stats-cal-line { font-size: 9px; }
    .auth-body {
        padding: calc(20px + env(safe-area-inset-top)) 18px calc(20px + env(safe-area-inset-bottom));
        background: radial-gradient(circle at 50% 8%, rgba(0,201,107,.16), transparent 36%), #eef8f3;
    }
    .auth-wrap {
        width: 100%; max-width: 420px; background: var(--card); border-radius: 32px;
        padding: 36px 22px 28px; box-shadow: 0 18px 48px rgba(15, 23, 42, .08);
    }
}

@media (max-width: 480px) {
    .stats-cal-k { display: none; }
    .stats-cal-line { flex-direction: column; gap: 0; align-items: flex-start; }
    .stats-cal-v { font-size: 8px; }
}

.recv-bar {
    height: 8px;
    background: var(--soft);
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin-top: 10px;
}
.recv-bar > i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--brand), var(--brand-dark));
    border-radius: inherit;
    max-width: 100%;
}
.recv-table-wrap { display: none; }
.recv-table-wrap .table-scroll { margin: 0; padding: 0; }
.recv-table-wrap table.simple { margin: 0; }
.recv-table-wrap table.simple th:last-child,
.recv-table-wrap table.simple td:last-child { text-align: right; }
.recv-table-wrap table.simple tbody tr:hover { background: #fbfffd; }
.recv-table-wrap .btn { min-height: 36px; padding: 6px 12px; font-size: 13px; box-shadow: none; width: auto; }
@media (min-width: 992px) {
    .recv-cards { display: none; }
    .recv-table-wrap { display: block; }
    .recv-table-wrap table.simple { min-width: 980px; }
}
