:root {
    --bg: #fafaf7;
    --panel: #ffffff;
    --surface-muted: #f5f5ef;
    --ink: #252821;
    --muted: #777b70;
    --line: #e7e7df;
    --line-strong: #d7d9cf;
    --primary: #f6fadf;
    --primary-strong: #e8f5ab;
    --primary-dark: #7d8759;
    --brand-black: #151713;
    --accent: #23261f;
    --danger: #b42318;
    --success-bg: #f3f8df;
    --error-bg: #fdecec;
    --multi-bg: #fff7df;
    --multi-line: #cde86b;
    --radius: 8px;
    --shadow-sm: 0 1px 2px rgba(21, 23, 19, .05);
    --shadow-md: 0 14px 32px rgba(21, 23, 19, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 248px;
    background: var(--brand-black);
    color: #f3f4ed;
    padding: 26px 18px;
    border-right: 1px solid rgba(255, 255, 255, .08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
    min-height: 44px;
}

.brand-logo {
    display: block;
    width: 148px;
    height: auto;
}

.login-logo {
    display: block;
    width: 178px;
    height: auto;
}

nav {
    display: grid;
    gap: 6px;
}

nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e4e7dc;
    text-decoration: none;
    padding: 10px 11px;
    border-radius: var(--radius);
    font-weight: 700;
    transition: background-color .16s ease, color .16s ease, box-shadow .16s ease;
}

nav a.active,
nav a:hover {
    background: #20231d;
    color: #fbfcf6;
    box-shadow: inset 3px 0 0 #dce99d;
}

.nav-icon {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 22px;
    height: 22px;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-user {
    position: absolute;
    inset: auto 18px 24px;
    display: grid;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid #2c3028;
}

.sidebar-user span {
    color: #eef0e8;
    font-size: 13px;
    font-weight: 700;
}

.sidebar-user button {
    width: 100%;
    min-height: 34px;
    border: 1px solid #34382f;
    border-radius: var(--radius);
    background: #1f221c;
    color: #f7f8f1;
    font-weight: 700;
    cursor: pointer;
}

.page {
    margin-left: 248px;
    padding: 32px;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    background:
        linear-gradient(180deg, rgba(232, 245, 171, .10), rgba(232, 245, 171, 0) 230px),
        #fafaf7;
}

.login-shell {
    width: min(420px, calc(100vw - 32px));
}

.login-panel {
    padding: 28px;
    border: 1px solid #e2e5d8;
    border-top: 3px solid #dce99d;
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: var(--shadow-md);
}

.login-logo {
    opacity: .95;
}

.login-brand {
    margin-bottom: 24px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    margin: 0 0 4px;
    color: #7d8759;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

h1,
h2 {
    margin: 0;
}

h1 {
    color: #1d201a;
    font-size: 30px;
    font-weight: 750;
    line-height: 1.15;
}

h2 {
    font-size: 18px;
    font-weight: 750;
}

.kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.kpis.compact {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.kpi-board {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.kpi-section {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.kpi-section h2 {
    color: #30342c;
    font-size: 14px;
    text-transform: uppercase;
}

.kpi-section.volume {
    grid-column: span 3;
    border-top: 4px solid #2563eb;
}

.kpi-section.revenue {
    grid-column: span 2;
    border-top: 4px solid var(--primary);
}

.kpi-section.deductions {
    grid-column: span 4;
    border-top: 4px solid #d97706;
}

.kpi-section.result {
    grid-column: span 3;
    border-top: 4px solid #16a34a;
}

.section-kpis {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 0;
}

.kpi,
.panel,
.period-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.kpi {
    position: relative;
    overflow: hidden;
    padding: 18px;
    border-color: #e0e4d6;
    background: #ffffff;
}

.kpi::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--brand-black);
}

.kpi:nth-child(2)::before {
    background: #dce99d;
}

.kpi:nth-child(3)::before {
    background: #a8b76f;
}

.kpi:nth-child(4)::before {
    background: #b42318;
}

.kpi:nth-child(5)::before {
    background: #d97706;
}

.kpi:nth-child(6)::before {
    background: #475569;
}

.kpi:nth-child(7)::before {
    background: #a8b76f;
}

.kpi:nth-child(8)::before {
    background: #16a34a;
}

.kpi span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
}

.kpi strong {
    color: #1d201a;
    font-size: 24px;
    font-weight: 800;
}

.kpi small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.kpi.negative-kpi::before {
    background: var(--danger);
}

.kpi.warning-kpi::before {
    background: #d97706;
}

.kpi.neutral-kpi::before {
    background: #475569;
}

.kpi.profit::before {
    background: #16a34a;
}

.strong-profit {
    background: #fcfdf6;
    border-color: #dde9a5;
}

.profit strong,
.positive {
    color: #5f7d12;
}

.origin-summary-panel {
    margin-bottom: 18px;
}

.origin-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.origin-summary-card {
    display: grid;
    gap: 14px;
    padding: 14px;
    border: 1px solid #cbd7e2;
    border-radius: var(--radius);
    background: #fbfcfa;
}

.origin-summary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.store-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 7px 11px;
    border-radius: var(--radius);
    background: #e8eef4;
    color: #171717;
    font-weight: 900;
}

.store-brand strong {
    font-size: 15px;
}

.store-logo {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: #ffffff;
    color: inherit;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.store-logo::before {
    content: "MK";
}

.store-shopee {
    background: #fff0e8;
    color: #ee4d2d;
}

.store-shopee .store-logo {
    background: #ee4d2d;
    color: #ffffff;
}

.store-shopee .store-logo::before {
    content: "S";
}

.store-shein {
    background: #f0f2f4;
    color: #111827;
}

.store-shein .store-logo {
    background: #111827;
    color: #ffffff;
}

.store-shein .store-logo::before {
    content: "SH";
}

.store-mercado-livre {
    background: #fff8cc;
    color: #1f4e8c;
}

.store-mercado-livre .store-logo {
    background: #ffe600;
    color: #1f4e8c;
    border: 1px solid #f2d300;
}

.store-mercado-livre .store-logo::before {
    content: "ML";
}

.store-tiktok,
.store-tiktok-shop {
    background: #e8f8fb;
    color: #111827;
}

.store-tiktok .store-logo,
.store-tiktok-shop .store-logo {
    background: #111827;
    color: #25f4ee;
    box-shadow: 3px 0 0 #fe2c55;
}

.store-tiktok .store-logo::before,
.store-tiktok-shop .store-logo::before {
    content: "TT";
}

.origin-summary-head small,
.origin-summary-values small {
    color: #52616f;
    font-size: 12px;
    font-weight: 700;
}

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

.origin-summary-values span,
.origin-summary-values strong,
.origin-summary-values small {
    display: block;
}

.origin-summary-values span {
    color: #52616f;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.origin-summary-values strong {
    margin: 5px 0;
    color: #102033;
    font-size: 20px;
}

.negative {
    color: var(--danger);
}

.negative-soft {
    color: #8a2f27;
}

.grid {
    display: grid;
    gap: 18px;
}

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

.import-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    margin-bottom: 18px;
}

.compact-imports {
    align-items: stretch;
}

.general-import-panel {
    margin-bottom: 18px;
}

.general-import-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    align-items: end;
}

.import-card .panel-title {
    margin-bottom: 10px;
}

.compact-import-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: 10px;
    align-items: end;
}

.compact-import-form .check,
.compact-import-form .button {
    grid-column: 1 / -1;
}

.product-layout {
    grid-template-columns: minmax(0, 1.8fr) minmax(340px, .8fr);
}

.movement-layout,
.batch-layout {
    grid-template-columns: minmax(0, 1.45fr) minmax(360px, .85fr);
    align-items: start;
}

.analytics-layout {
    grid-template-columns: minmax(300px, .52fr) minmax(0, 1.48fr);
    align-items: start;
}

.charts-stack {
    display: grid;
    gap: 18px;
}

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

.wide-chart {
    grid-column: 1 / -1;
}

.chart-panel {
    min-width: 0;
}

.chart-panel canvas {
    display: block;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.chart-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.metric-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
}

.metric-toggles label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #263442;
    font-weight: 700;
}

.metric-toggles input {
    width: auto;
    min-height: auto;
}

.panel {
    padding: 20px;
}

.inventory-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -4px 0 20px;
}

.inventory-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #ffffff;
    color: #2f332b;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.inventory-tabs a.active,
.inventory-tabs a:hover {
    border-color: #dde9a5;
    background: #fbfdf1;
    color: #1d201a;
}

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

.vertical-title {
    display: grid;
    justify-content: start;
}

.hint,
.empty {
    color: var(--muted);
}

.period-list,
.mini-stats {
    display: grid;
    gap: 10px;
}

.period-row,
.period-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-decoration: none;
    color: var(--ink);
}

.period-row {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.period-row:hover {
    border-color: var(--primary);
}

.period-row small {
    color: var(--muted);
}

.period-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.period-list-panel {
    margin-top: 18px;
}

.sortable-list {
    display: grid;
    gap: 10px;
}

.sortable-period {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #ffffff;
}

.sortable-period.dragging {
    opacity: .55;
    border-color: var(--primary);
    background: #f5f7ec;
}

.drag-handle {
    display: grid;
    place-items: center;
    height: 38px;
    border-radius: var(--radius);
    background: #f1f2ea;
    color: #52616f;
    cursor: grab;
    font-weight: 900;
}

.period-main h2 {
    margin-bottom: 4px;
}

.period-main p {
    margin: 0;
    color: var(--muted);
}

.period-card {
    padding: 18px;
}

.period-card p {
    color: var(--muted);
    margin: 8px 0 0;
}

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

.compact-button {
    min-height: 38px;
    margin-top: 0;
}

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

.mini-stats span {
    padding: 14px;
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-weight: 700;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #ffffff;
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.button.primary {
    background: var(--brand-black);
    border-color: var(--brand-black);
    color: #fbfcf6;
    box-shadow: inset 0 -2px 0 #dce99d;
}

.button.primary:hover {
    background: #20231d;
}

.button.danger {
    border-color: #efc4bf;
    color: var(--danger);
    margin-top: 12px;
}

.button.danger.compact-button {
    margin-top: 0;
}

.button.ghost {
    margin-top: 10px;
}

.button-spaced {
    margin-top: 14px;
}

.actions {
    display: flex;
    gap: 8px;
}

form label {
    display: grid;
    gap: 6px;
    color: #41473a;
    font-size: 13px;
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 9px 11px;
    color: var(--ink);
    background: #fefefc;
    box-shadow: inset 0 1px 0 rgba(21, 23, 19, .03);
}

textarea {
    width: 100%;
    min-height: 180px;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 11px;
    color: var(--ink);
    background: #fefefc;
    font: inherit;
    line-height: 1.35;
}

select {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 8px 10px;
    color: var(--ink);
    background: #fefefc;
}

input:focus,
textarea:focus,
select:focus {
    outline: 3px solid rgba(220, 233, 157, .36);
    border-color: #cbd982;
    background: #ffffff;
}

.inline-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 140px auto;
    align-items: end;
    gap: 12px;
}

.stack-form {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.check input {
    width: auto;
    min-height: auto;
}

.period-selector {
    display: grid;
    gap: 14px;
}

.filter-group {
    display: grid;
    gap: 8px;
}

.check-list {
    display: grid;
    gap: 8px;
    max-height: 560px;
    overflow: auto;
    padding-right: 4px;
}

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

.period-check {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-muted);
}

.period-check input {
    width: auto;
    min-height: auto;
    margin-top: 4px;
}

.period-check strong,
.period-check small {
    display: block;
}

.period-check small {
    color: var(--muted);
    margin-top: 3px;
}

.search {
    display: flex;
    gap: 8px;
    min-width: 330px;
}

.inventory-search {
    flex-wrap: wrap;
    align-items: center;
}

.compact-filter {
    white-space: nowrap;
}

.compact-filter input {
    margin: 0;
}

.inventory-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    align-items: end;
}

.table-panel {
    padding: 0;
}

.table-panel .panel-title {
    padding: 20px 20px 0;
}

.table-controls {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.report-actions-bar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    padding: 0 18px 14px;
    border-bottom: 1px solid var(--line);
}

.report-actions-bar .table-controls {
    flex: 1 1 520px;
    justify-content: flex-start;
}

.batch-delete-form {
    display: none;
}

.selection-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 6px 8px 6px 12px;
    border: 1px solid #efc4bf;
    border-radius: var(--radius);
    background: #fff7f6;
    color: var(--danger);
    font-weight: 800;
    white-space: nowrap;
}

.selection-toolbar[hidden] {
    display: none;
}

.search-control {
    min-width: 260px;
}

.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #f8fafc;
    text-decoration: none;
}

.sort-link span {
    padding: 2px 5px;
    border-radius: 6px;
    background: #f8fafc;
    color: #162231;
    font-size: 10px;
}

.expenses-panel {
    margin-bottom: 18px;
}

.collapse-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    list-style: none;
    padding: 2px 0;
}

.collapse-summary::-webkit-details-marker {
    display: none;
}

.collapse-summary::after {
    content: "Abrir";
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    font-weight: 700;
}

.report-summary {
    padding: 18px;
    border-bottom: 1px solid transparent;
}

.expenses-panel[open] .collapse-summary {
    margin-bottom: 14px;
}

.expenses-panel[open] .collapse-summary::after {
    content: "Fechar";
}

.report-panel {
    padding: 0;
}

.report-panel[open] .report-summary {
    border-bottom-color: var(--line);
    margin-bottom: 0;
}

.report-panel[open] .report-summary::after {
    content: "Fechar";
}

.report-content {
    padding-top: 14px;
}

.expense-form {
    grid-template-columns: minmax(240px, 1fr) 160px auto;
}

.expense-list {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.expense-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, auto) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-muted);
}

.expense-update-form {
    display: grid;
    grid-template-columns: minmax(110px, 150px) auto;
    align-items: end;
    gap: 8px;
}

.table-wrap {
    width: 100%;
    overflow: auto;
    scrollbar-gutter: stable;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 980px;
}

.financial-table {
    color: #0f1f31;
    border-collapse: separate;
    border-spacing: 0;
}

.financial-table .selection-column {
    width: 44px;
    min-width: 44px;
    padding-inline: 12px;
    text-align: center;
}

.financial-table .selection-column input {
    width: 18px;
    min-height: 18px;
    margin: 0;
    accent-color: var(--danger);
}

.daily-comparison-table {
    min-width: 1120px;
}

.daily-comparison-table td strong,
.daily-comparison-table td small {
    display: block;
    white-space: nowrap;
}

.daily-comparison-table td small {
    margin-top: 3px;
    color: var(--muted);
    font-weight: 700;
}

th,
td {
    padding: 13px 15px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 13px;
}

th {
    position: sticky;
    top: 0;
    background: var(--brand-black);
    color: #f5f6ef;
    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;
    z-index: 1;
}

tbody tr:nth-child(even) {
    background: #fafbf6;
}

tbody tr:nth-child(odd) {
    background: #ffffff;
}

tbody tr:hover {
    background: #f7f9ed;
}

tbody tr:has([data-sale-checkbox]:checked) {
    background: #fff7f6 !important;
    box-shadow: inset 4px 0 0 var(--danger);
}

tr.multi-item {
    background: #fff1c2 !important;
    box-shadow: inset 4px 0 0 var(--multi-line);
}

tr.multi-item:has([data-sale-checkbox]:checked) {
    background: #fff0ed !important;
    box-shadow: inset 4px 0 0 var(--danger);
}

.financial-table td {
    font-weight: 600;
}

.financial-table form {
    margin: 0;
}

.cost-edit-button {
    display: inline-grid;
    gap: 3px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.cost-edit-button span:last-child {
    color: #668512;
    font-size: 12px;
    font-weight: 800;
}

.cost-edit-button:hover span:last-child {
    text-decoration: underline;
}

.description-cell {
    max-width: 420px;
    font-weight: 700;
    color: #1d201a;
}

.strong-cell {
    color: #1d201a;
    font-weight: 800;
}

.origin-badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f1f6d8;
    color: #30342c;
    font-weight: 750;
}

.item-pill {
    display: inline-flex;
    min-width: 34px;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef2e3;
    font-weight: 750;
}

tr.multi-item .item-pill {
    background: var(--accent);
    color: #f8faf2;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.danger-badge {
    background: #fdecec;
    color: var(--danger);
}

.success-badge {
    background: #e7f6ee;
    color: #075e45;
}

.low-stock-row {
    background: #fdecec !important;
    box-shadow: inset 4px 0 0 var(--danger);
}

.low-stock-row:hover {
    background: #fbd5d2 !important;
}

.product-summary {
    display: grid;
    gap: 8px;
    margin: 14px 0 0;
}

.product-summary div {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.product-summary dt {
    color: var(--muted);
    font-weight: 800;
}

.product-summary dd {
    margin: 0;
    color: #1d201a;
    font-weight: 700;
}

.quick-barcode-form {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-muted);
}

.stock-alert-list,
.movement-list {
    display: grid;
    gap: 8px;
}

.stock-alert-row,
.movement-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fbfcfa;
    color: var(--ink);
    text-decoration: none;
}

.stock-alert-row {
    border-color: #f4b4ae;
    background: #fff5f4;
}

.stock-alert-row strong,
.stock-alert-row small,
.movement-row strong,
.movement-row small {
    display: block;
}

.stock-alert-row small,
.movement-row small,
.movement-row time {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.stock-alert-row b {
    display: grid;
    place-items: center;
    min-width: 34px;
    min-height: 34px;
    border-radius: 999px;
    background: var(--danger);
    color: #ffffff;
}

.scan-error-box,
.inline-alert {
    display: grid;
    gap: 4px;
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid #f4b4ae;
    border-radius: var(--radius);
    background: #fdecec;
    color: var(--danger);
    font-weight: 800;
}

.confirm-batch-form {
    padding: 14px 18px 18px;
}

.scan-error-page .page {
    animation: scanFlash .65s ease-in-out 0s 2;
}

@keyframes scanFlash {
    0% {
        background: #fdecec;
    }
    100% {
        background: transparent;
    }
}

.money {
    font-weight: 800;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px 20px;
    color: #41473a;
    font-weight: 700;
}

.cost-modal {
    width: min(480px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #ffffff;
    color: var(--ink);
    box-shadow: var(--shadow-md);
}

.cost-modal::backdrop {
    background: rgba(21, 23, 19, .42);
}

.cost-modal-form {
    display: grid;
    gap: 14px;
    padding: 20px;
}

.cost-modal-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
}

.cost-modal-head .hint {
    margin: 4px 0 0;
    font-weight: 700;
}

.modal-close-button {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #ffffff;
    color: var(--ink);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.cost-modal-description {
    max-height: 110px;
    overflow: auto;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-muted);
    color: #30342c;
    font-weight: 700;
}

.cost-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.page-actions {
    display: flex;
    gap: 8px;
}

.link {
    color: #668512;
    font-weight: 700;
    text-decoration: none;
}

.messages {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.alert {
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    font-weight: 700;
}

.alert.success {
    background: var(--success-bg);
    color: #405800;
}

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

@media (max-width: 980px) {
    .sidebar {
        position: static;
        width: auto;
    }

    .sidebar-user {
        position: static;
        margin-top: 18px;
    }

    .page {
        margin-left: 0;
        padding: 18px;
    }

    .kpis,
    .kpis.compact,
    .kpi-board,
    .grid.two,
    .import-grid,
    .analytics-layout,
    .charts-grid,
    .product-layout,
    .movement-layout,
    .batch-layout,
    .inline-form {
        grid-template-columns: 1fr;
    }

    .kpi-section.volume,
    .kpi-section.revenue,
    .kpi-section.deductions,
    .kpi-section.result {
        grid-column: auto;
    }

    .expense-row {
        grid-template-columns: 1fr;
    }

    .compact-import-form,
    .general-import-form,
    .sortable-period,
    .origin-summary-values {
        grid-template-columns: 1fr;
    }

    .wide-chart {
        grid-column: auto;
    }

    .chart-controls,
    .pagination,
    .report-actions-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .search,
    .inventory-search,
    .product-summary div {
        min-width: 0;
        grid-template-columns: 1fr;
    }

    .search,
    .inventory-search {
        display: grid;
    }

    .page-header {
        display: grid;
    }
}
