:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --ink: #172033;
    --muted: #687386;
    --line: #dfe5ec;
    --primary: #1f7a5c;
    --primary-strong: #166146;
    --accent: #c4822f;
    --danger: #b73737;
    --radius: 8px;
    --shadow: 0 12px 32px rgba(23, 32, 51, .08);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    font-size: 14px;
}
a { color: inherit; text-decoration: none; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 232px;
    flex: 0 0 232px;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: #101722;
    color: #dbe4ef;
    padding: 22px 16px;
}
.sidebar::-webkit-scrollbar { width: 0; height: 0; }
.mobile-sidebar-back { display: none; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background: var(--primary);
    color: white;
    font-weight: 800;
}
.brand strong { display: block; font-size: 20px; }
.brand span { display: block; color: #8fa0b3; margin-top: 2px; }
.nav { display: grid; gap: 5px; }
.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: var(--radius);
    color: #b9c7d7;
}
.nav a:hover, .nav a.active { background: #1d2938; color: #fff; }
.nav-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    color: #8fa0b3;
}
.nav a:hover .nav-icon,
.nav a.active .nav-icon {
    color: #7ed7b1;
}
.sidebar-account {
    display: grid;
    gap: 10px;
    margin-top: auto;
    padding-top: 18px;
    color: #8fa0b3;
}
.sidebar-account .button {
    width: 100%;
    border-color: #263445;
    background: #151f2c;
    color: #dbe4ef;
}

.main { flex: 1; padding: 24px; min-width: 0; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.eyebrow {
    margin: 0 0 4px;
    color: var(--primary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
    font-weight: 700;
}
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 24px; }
h2 { font-size: 17px; }
.userbar { display: none; align-items: center; gap: 10px; color: var(--muted); }
.mobile-home-link { display: none; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.stat-card, .panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.stat-card { padding: 18px; }
.stat-card span { color: var(--muted); display: block; margin-bottom: 10px; }
.stat-card strong { font-size: 28px; }

.grid-two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.settlement-chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr);
    gap: 16px;
}
.dashboard-chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 1fr);
    gap: 16px;
}
.settlement-chart-card {
    min-width: 0;
}
.chart-note {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}
.line-chart-wrap {
    width: 100%;
    overflow: hidden;
}
.line-chart {
    width: 100%;
    min-height: 190px;
    display: block;
}
.line-chart-axis,
.line-chart-grid {
    stroke: #dfe5ec;
    stroke-width: .7;
}
.line-chart-grid {
    stroke-dasharray: 4 8;
}
.line-chart-area {
    fill: rgba(31, 122, 92, .08);
}
.line-chart-line {
    fill: none;
    stroke: var(--primary);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.line-chart-dot {
    fill: #fff;
    stroke: var(--primary);
    stroke-width: 2;
}
.line-chart-label,
.line-chart-value {
    fill: var(--muted);
    font-size: 8px;
}
.line-chart-value {
    font-size: 7px;
}
.comparison-chart,
.profit-chart {
    display: grid;
    gap: 14px;
}
.comparison-row {
    display: grid;
    grid-template-columns: minmax(92px, 140px) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}
.chart-label {
    min-width: 0;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.comparison-bars {
    display: grid;
    gap: 7px;
    min-width: 0;
}
.metric-line {
    display: grid;
    grid-template-columns: 38px minmax(120px, 1fr) minmax(92px, auto);
    gap: 8px;
    align-items: center;
    min-width: 0;
}
.metric-line span {
    color: var(--muted);
    font-size: 12px;
}
.metric-line strong,
.profit-row strong {
    font-size: 13px;
    text-align: right;
    white-space: nowrap;
}
.bar-track,
.profit-axis {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf1f5;
}
.bar-fill,
.profit-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
}
.bar-fill.revenue {
    background: #1f7a5c;
}
.bar-fill.cost {
    background: #c4822f;
}
.profit-row {
    display: grid;
    grid-template-columns: minmax(92px, 140px) minmax(0, 1fr) minmax(92px, auto);
    gap: 10px;
    align-items: center;
}
.profit-fill.positive {
    background: #2f7fb8;
}
.profit-fill.negative {
    background: var(--danger);
}
.positive-text {
    color: #1f7a5c;
}
.negative-text {
    color: var(--danger);
}
.cost-composition {
    display: grid;
    gap: 14px;
}
.expense-pie-layout {
    display: grid;
    grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
    gap: 16px;
    align-items: center;
}
.expense-pie {
    width: min(190px, 100%);
    aspect-ratio: 1;
    justify-self: center;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #edf1f5;
    position: relative;
}
.expense-pie::after {
    content: "";
    position: absolute;
    inset: 28px;
    border-radius: 50%;
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--line);
}
.expense-pie.is-empty::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #edf1f5;
}
.expense-pie > div {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 4px;
    text-align: center;
}
.expense-pie span {
    color: var(--muted);
    font-size: 12px;
}
.expense-pie strong {
    font-size: 16px;
}
.stacked-bar {
    display: flex;
    width: 100%;
    height: 20px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf1f5;
}
.stacked-bar i {
    min-width: 0;
}
.part-internal {
    background: #2f7fb8;
}
.part-order {
    background: #1f7a5c;
}
.part-material {
    background: #1f7a5c;
}
.part-labor {
    background: #c4822f;
}
.part-public {
    background: #b73737;
}
.part-status-planned {
    background: #2f7fb8;
}
.part-status-running {
    background: #1f7a5c;
}
.part-status-paused {
    background: #c4822f;
}
.part-status-done {
    background: #728096;
}
.part-product-finished {
    background: #1f7a5c;
}
.part-product-semi {
    background: #2f7fb8;
}
.part-product-purchase {
    background: #c4822f;
}
.part-product-other,
[class^="part-status-"]:not(.part-status-planned):not(.part-status-running):not(.part-status-paused):not(.part-status-done) {
    background: #728096;
}
.cost-legend {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.compact-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.cost-legend div {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 3px 8px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fbfcfd;
}
.cost-legend strong,
.cost-legend em,
.cost-legend small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cost-legend em {
    grid-column: 2;
    color: var(--ink);
    font-style: normal;
}
.cost-legend small {
    grid-column: 2;
    color: var(--muted);
}
.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 999px;
}
.dashboard-structure {
    display: grid;
    gap: 18px;
}
.structure-block {
    display: grid;
    gap: 10px;
}
.structure-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}
.structure-head strong {
    font-size: 15px;
}
.structure-head span {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}
.panel { padding: 18px; margin-bottom: 16px; }
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.muted { color: var(--muted); }

.button {
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 9px 13px;
    background: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    font: inherit;
}
.button.primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-strong); }
.button.ghost { color: var(--ink); background: #fff; }
.button.danger { border-color: var(--danger); background: var(--danger); color: #fff; }
.button.small { padding: 6px 9px; min-height: 30px; font-size: 13px; }

.flash {
    padding: 12px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    background: #edf8f3;
    border: 1px solid #b7dfcf;
    color: var(--primary-strong);
}
.flash.danger { background: #fff0f0; border-color: #efc1c1; color: var(--danger); }

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.filter-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
    gap: 14px;
    align-items: end;
}
.product-filter-grid {
    grid-template-columns: minmax(260px, 420px) minmax(160px, 200px) auto;
    margin-bottom: 14px;
}
label { display: grid; gap: 7px; color: var(--muted); }
label span { color: var(--ink); font-weight: 650; }
.field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.field-label-row small {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 10px 11px;
    color: var(--ink);
    background: #fff;
    font: inherit;
}
textarea { resize: vertical; }
.wide { grid-column: span 4; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.form-actions.field-actions { align-self: end; }
.inline-form { display: flex; gap: 10px; align-items: center; }
.inline-form input { min-width: 150px; }
.quantity-unit-field {
    display: flex;
    align-items: stretch;
    gap: 6px;
    min-width: 160px;
}
.quantity-unit-field input { min-width: 84px; }
.quantity-unit-field select {
    width: 96px;
    flex: 0 0 96px;
    padding-left: 8px;
    padding-right: 8px;
}
.sort-input {
    width: 86px;
    text-align: center;
}
.menu-sort-table { min-width: 820px; }
.menu-sort-table th:first-child,
.menu-sort-table td:first-child {
    width: 64px;
}
.drag-handle {
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--muted);
    cursor: grab;
    font-size: 17px;
    line-height: 1;
}
.drag-handle:active { cursor: grabbing; }
.menu-sort-table tr.is-dragging {
    opacity: .58;
    background: #f1f5f9;
}
.sort-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 30px;
    border-radius: 7px;
    background: #f1f5f9;
    color: var(--text);
    font-weight: 700;
}
.menu-sort-actions { margin-top: 14px; }
.permission-panel {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    background: #fbfcfd;
}
.permission-panel.is-muted {
    opacity: .62;
}
.permission-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}
.permission-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
}
.permission-item input {
    width: auto;
    padding: 0;
}

.table-wrap { overflow-x: auto; }
.table-link {
    color: var(--primary-strong);
    font-weight: 700;
}
.thumb-link {
    display: inline-flex;
    align-items: center;
}
.product-detail-head {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}
.product-detail-image {
    width: 180px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #f7f9fb;
    color: var(--muted);
    overflow: hidden;
}
.product-detail-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.product-detail-main {
    min-width: 0;
}
.product-detail-main h2 {
    margin: 4px 0 4px;
    font-size: 26px;
}
.product-detail-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0 0;
}
.product-detail-meta div {
    padding: 10px;
    border-radius: 7px;
    background: #f7f9fb;
}
.product-detail-meta dt {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 12px;
}
.product-detail-meta dd {
    margin: 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}
.cost-card-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.cost-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}
.cost-card.is-voided {
    opacity: .68;
}
.order-card.is-voided {
    opacity: .68;
}
.cost-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.cost-card-head strong {
    display: block;
    font-size: 17px;
    overflow-wrap: anywhere;
}
.cost-card-head span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}
.cost-card-head em {
    flex: 0 0 auto;
    padding: 4px 8px;
    border-radius: 999px;
    background: #e8f5ef;
    color: var(--primary-strong);
    font-style: normal;
    font-size: 12px;
}
.cost-card.is-voided .cost-card-head em {
    background: #eef3f7;
    color: var(--muted);
}
.cost-card-amount {
    font-size: 28px;
    font-weight: 800;
    color: var(--danger);
}
.cost-card-amount.income {
    color: var(--primary-strong);
}
.cost-card-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}
.cost-card-meta div {
    min-width: 0;
    padding: 9px 10px;
    border-radius: 7px;
    background: #f7f9fb;
}
.cost-card-meta dt {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 12px;
}
.cost-card-meta dd {
    margin: 0;
    overflow-wrap: anywhere;
}
.cost-card-note {
    margin: 0;
    padding: 10px;
    border-radius: 7px;
    background: #fbfcfd;
    color: var(--muted);
    line-height: 1.6;
    overflow-wrap: anywhere;
}
.cost-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.cost-card-actions form {
    margin: 0;
}
.order-card-list {
    display: grid;
    gap: 14px;
}
.order-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}
.order-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.order-card-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.order-card-title strong {
    display: block;
    font-size: 17px;
}
.order-card-title span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}
.order-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.order-card-actions form {
    margin: 0;
}
.order-card-meta {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}
.order-card-meta div {
    padding: 8px 10px;
    border-radius: 7px;
    background: #f7f9fb;
}
.order-card-meta dt {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 12px;
}
.order-card-meta dd {
    margin: 0;
    font-weight: 650;
}
.order-items-wrap {
    border: 1px solid var(--line);
    border-radius: 7px;
}
.order-items-table {
    min-width: 760px;
}
.empty-state {
    margin: 0;
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    color: var(--muted);
    background: #fbfcfd;
}
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.pagination-summary {
    color: var(--muted);
    font-size: 13px;
}
.pagination-pages {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.pagination-ellipsis {
    color: var(--muted);
    padding: 0 4px;
}
.button.disabled {
    pointer-events: none;
    opacity: .45;
}
.internal-lines-wrap {
    min-height: 560px;
    padding-bottom: 220px;
}
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}
th, td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}
th { color: var(--muted); font-size: 13px; font-weight: 700; background: #f7f9fb; }
td.row-actions {
    width: 96px;
    min-width: 96px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}
.row-actions > a,
.row-actions > form {
    display: inline-flex;
    vertical-align: middle;
}
.row-actions > form { margin: 0 0 0 6px; }
.badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef3f7;
    color: var(--muted);
}
.product-thumb {
    width: 58px;
    height: 58px;
    object-fit: cover;
    border-radius: 7px;
    border: 1px solid var(--line);
    background: #f7f9fb;
}
.thumb-empty {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    border: 1px dashed var(--line);
    color: var(--muted);
    background: #f7f9fb;
    font-size: 12px;
}
.thumb-cell {
    width: 72px;
    min-width: 72px;
    text-align: center;
}
.inline-product-thumb,
.inline-thumb-empty {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 7px;
    border: 1px solid var(--line);
    background: #f7f9fb;
    object-fit: cover;
}
.inline-thumb-empty {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 11px;
}
.product-editor .panel { box-shadow: var(--shadow); }
.product-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 18px;
    align-items: start;
}
.image-uploader {
    display: grid;
    gap: 12px;
}
.image-uploader img,
.image-empty {
    width: 220px;
    aspect-ratio: 1;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #f7f9fb;
    object-fit: cover;
}
.image-empty {
    display: grid;
    place-items: center;
    color: var(--muted);
}
.wide-half { grid-column: span 2; }
.product-picker,
.search-picker { position: relative; }
.line-product-picker { min-width: 260px; }
.product-picker-list,
.search-picker-list {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    display: none;
    max-height: 320px;
    overflow: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}
.product-picker.is-open .product-picker-list,
.search-picker.is-open .search-picker-list { display: grid; gap: 4px; }
.product-picker-item,
.search-picker-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 0;
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
    font: inherit;
}
.product-picker-item:hover,
.search-picker-item:hover { background: #f3f7f5; }
.product-picker-item img,
.product-picker-empty,
.search-picker-item img,
.search-picker-empty,
.search-picker-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 6px;
    border: 1px solid var(--line);
    object-fit: cover;
    background: #f7f9fb;
}
.product-picker-empty,
.search-picker-empty,
.search-picker-icon {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 11px;
}
.search-picker-icon {
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
}
.product-picker-text,
.search-picker-text { display: grid; gap: 2px; min-width: 0; }
.product-picker-text strong,
.product-picker-text small,
.search-picker-text strong,
.search-picker-text small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.product-picker-text small,
.search-picker-text small { color: var(--muted); }
.panel-search {
    width: min(360px, 100%);
}
.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}
.permission-grid-compact {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.permission-item {
    min-height: 66px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}
.permission-item input {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}
.permission-item span:not(.inline-thumb-empty):not(.search-picker-icon) {
    min-width: 0;
    display: grid;
    gap: 2px;
}
.permission-item strong,
.permission-item small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.permission-item small {
    color: var(--muted);
}

.material-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 220px;
    max-width: 520px;
}
.material-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid #9aa9ad;
    border-radius: 999px;
    background: rgba(255, 255, 255, .58);
    color: #46545a;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #edf1f4;
    padding: 24px;
}
.login-panel {
    width: min(920px, 100%);
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.login-copy {
    padding: 52px;
    background: #101722;
    color: white;
}
.login-copy p:last-child { color: #b9c7d7; line-height: 1.8; max-width: 430px; }
.login-copy h1 { font-size: 32px; margin-bottom: 18px; }
.login-form {
    padding: 46px;
    display: grid;
    gap: 16px;
    align-content: center;
}
.login-form h2 { margin-bottom: 8px; }

@media (max-width: 1100px) {
    .stats-grid, .grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .settlement-chart-grid,
    .dashboard-chart-grid { grid-template-columns: 1fr; }
    .cost-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .wide { grid-column: span 2; }
}

@media (max-width: 760px) {
    .shell { display: block; }
    .sidebar {
        width: 100%;
        position: sticky;
        top: 0;
        z-index: 30;
        height: auto;
        display: flex;
        align-items: center;
        overflow: hidden;
        padding: 10px 14px;
        box-shadow: 0 10px 24px rgba(16, 23, 34, .18);
    }
    .mobile-sidebar-back {
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: #fff;
        font-weight: 800;
    }
    .mobile-sidebar-back span {
        width: 34px;
        height: 34px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(255, 255, 255, .24);
        border-radius: var(--radius);
        background: var(--primary);
        font-size: 28px;
        line-height: 1;
    }
    .brand {
        display: none;
    }
    .nav { display: none; }
    .sidebar-account { display: none; }
    .main { padding: 16px; }
    .topbar { align-items: flex-start; flex-direction: column; }
    .userbar {
        width: 100%;
        flex-wrap: wrap;
    }
    .mobile-home-link {
        display: none;
    }
    .stats-grid, .grid-two, .form-grid, .login-panel { grid-template-columns: 1fr; }
    .settlement-chart-grid,
    .dashboard-chart-grid,
    .expense-pie-layout,
    .comparison-row,
    .profit-row,
    .cost-legend,
    .compact-legend {
        grid-template-columns: 1fr;
    }
    .metric-line {
        grid-template-columns: 34px minmax(0, 1fr) minmax(86px, auto);
    }
    .profit-row strong,
    .metric-line strong {
        text-align: left;
    }
    .cost-card-list { grid-template-columns: 1fr; }
    .cost-card-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .order-card-head { align-items: flex-start; flex-direction: column; }
    .order-card-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .wide { grid-column: span 1; }
    .wide-half { grid-column: span 1; }
    .product-layout, .product-detail-head { grid-template-columns: 1fr; }
    .product-detail-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .image-uploader img, .image-empty { width: 100%; max-width: 260px; }
    .product-detail-image { width: 100%; max-width: 240px; }
    .login-copy, .login-form { padding: 28px; }
}
