:root {
    --ink: #111827;
    --muted: #4b5563;
    --line: #d7dde5;
    --surface: #ffffff;
    --surface-soft: #f4f6f8;
    --accent: #d9f99d;
    --accent-strong: #84cc16;
    --danger-soft: #fee2e2;
    --shadow: 0 8px 24px rgba(17, 24, 39, 0.07);
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
    background: var(--surface-soft);
}

body,
body * {
    color: var(--ink) !important;
}

body {
    min-width: 320px;
    margin: 0;
    background: var(--surface-soft);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

html[lang="fa"] body {
    font-family: Tahoma, "Segoe UI", Arial, sans-serif;
}

a {
    color: var(--ink);
    text-decoration-color: #9ca3af;
    text-underline-offset: 3px;
}

a:hover {
    text-decoration-color: var(--ink);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}

.header-inner,
.nav-inner,
.page-shell {
    width: min(1440px, calc(100% - 40px));
    margin-inline: auto;
}

.header-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid #a3e635;
    border-radius: 12px;
    background: var(--accent);
    font-size: 14px;
    font-weight: 800;
}

.brand-copy {
    display: grid;
    line-height: 1.2;
}

.brand-copy strong {
    font-size: 17px;
}

.brand-copy small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.main-nav {
    border-top: 1px solid #edf0f3;
}

.nav-inner {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-block: 8px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.main-nav a {
    flex: 0 0 auto;
    padding: 8px 11px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
}

.main-nav a:hover,
.main-nav a:focus-visible,
.main-nav a.is-active {
    background: var(--accent);
    outline: none;
}

.main-nav a.is-active {
    box-shadow: inset 0 0 0 1px #84cc16;
    font-weight: 800;
}

.page-shell {
    padding-block: 28px 48px;
}

h1,
h2,
h3 {
    margin-top: 0;
    line-height: 1.2;
}

h1 {
    margin-bottom: 22px;
    font-size: clamp(26px, 3vw, 36px);
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(21px, 2vw, 27px);
}

h3 {
    font-size: 17px;
}

.card {
    margin: 16px 0;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    gap: 16px;
}

.dashboard-grid .card {
    margin: 0;
}

.metric-card {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-top: 4px solid var(--accent-strong);
}

.metric-card h3 {
    margin-bottom: 18px;
    color: var(--muted);
    font-weight: 650;
}

.metric-card h2 {
    margin: 0;
    font-size: clamp(25px, 2.2vw, 34px);
    overflow-wrap: anywhere;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 11px;
}

.compact-return-table th,
.compact-return-table td {
    white-space: nowrap;
    vertical-align: middle;
}

.compact-return-table td:nth-child(5) {
    min-width: 220px;
}

.movement-primary-metrics .metric-primary {
    border-color: #93c5fd;
    background: #eff6ff;
}

.movement-table-wrap {
    overflow: visible !important;
    border-radius: 0;
}

.movement-summary-table {
    min-width: 0;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: clamp(9px, 0.78vw, 12px);
}

.card:has(.movement-summary-table) {
    overflow: visible;
}

.movement-summary-table th,
.movement-summary-table td {
    padding: 7px 4px;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.movement-summary-table tbody td {
    font-size: clamp(12px, 0.95vw, 14px);
    font-weight: 600;
}

.movement-summary-table thead {
    position: sticky;
    top: var(--movement-sticky-top, 116px);
    z-index: 15;
}

.movement-summary-table thead th {
    position: static;
    background: #e5eaf0;
    border-top: 1px solid var(--line);
    border-bottom: 2px solid #9ca3af;
    box-shadow: 0 4px 8px rgba(17, 24, 39, 0.12);
}

@media (max-width: 820px) {
    .movement-summary-table,
    .movement-summary-table tbody,
    .movement-summary-table tr,
    .movement-summary-table td {
        display: block;
        width: 100%;
    }

    .movement-summary-table thead,
    .movement-summary-table tfoot {
        display: none;
    }

    .movement-summary-table tbody tr {
        margin-bottom: 12px;
        border: 1px solid var(--line);
        border-radius: 10px;
        overflow: hidden;
    }

    .movement-summary-table td {
        display: grid;
        grid-template-columns: minmax(135px, 45%) 1fr;
        gap: 10px;
        padding: 8px 10px;
        text-align: start;
    }

    .movement-summary-table td::before {
        content: attr(data-label);
        font-weight: 750;
    }
}

.metric-kind,
.column-kind {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.column-kind {
    margin-inline-start: 5px;
}

.kind-qty {
    color: #1e3a8a;
    background: #dbeafe;
}

.kind-money {
    color: #166534;
    background: #dcfce7;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.page-heading h1 {
    margin-bottom: 6px;
}

.page-heading p {
    margin: 0;
    color: var(--muted) !important;
}

.card > .table-wrap {
    margin-top: 8px;
}

table {
    width: 100%;
    min-width: 680px;
    margin: 0;
    border-collapse: collapse;
    background: var(--surface);
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    background: #eef2f5;
    font-size: 13px;
    font-weight: 750;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover td {
    background: #fafcf7;
}

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

button {
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid #94a3b8;
    border-radius: 9px;
    background: #ffffff;
    font-weight: 700;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

button:hover {
    border-color: #65a30d;
    background: var(--accent);
}

button:active {
    transform: translateY(1px);
}

button[type="submit"] {
    border-color: #65a30d;
    background: var(--accent);
}

.lang-box {
    display: flex;
    gap: 8px;
}

.header-actions,
.user-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-box form {
    margin: 0;
}

.user-box button {
    min-height: 36px;
    padding: 6px 11px;
}

.login-shell {
    min-height: calc(100vh - 220px);
    display: grid;
    place-items: center;
}

.login-card {
    width: min(100%, 520px);
}

.lang-box button {
    min-height: 36px;
    padding: 6px 11px;
    font-size: 13px;
}

input,
select,
textarea {
    width: min(100%, 560px);
    min-width: 0;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #aeb8c5;
    border-radius: 8px;
    background: #fff;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(132, 204, 22, 0.3);
    outline-offset: 2px;
    border-color: #65a30d;
}

input[readonly] {
    background: #f1f3f5;
}

.jalali-date-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
    max-width: 100%;
}

.jalali-date-group .jalali-year,
.jalali-date-group .jalali-month,
.jalali-date-group .jalali-day {
    flex: 0 0 auto;
    width: auto;
    min-width: 72px;
    min-height: 34px;
    padding: 4px 7px;
    margin: 0;
    font-size: 14px;
}

.jalali-date-group .jalali-month {
    min-width: 92px;
}

.jalali-filter-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
}
.jalali-filter-group select {
    width: auto;
    min-width: 72px;
    min-height: 34px;
    padding: 4px 7px;
}
.jalali-filter-group .jalali-filter-month { min-width: 92px; }
.jalali-filter-source {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.smart-select {
    position: relative;
    display: block;
    width: min(100%, 560px);
    min-width: 0;
}

.smart-select .smart-select-search {
    width: 100%;
}

.smart-select .smart-select-search {
    min-height: 34px;
    padding: 5px 9px;
    border-color: #7c8a9b;
    background: #fff;
}

.smart-select .smart-select-search::placeholder {
    color: #4b5563;
}

.smart-select-native {
    position: absolute !important;
    width: 1px !important;
    min-width: 1px !important;
    max-width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.smart-select-dropdown {
    position: absolute;
    z-index: 1200;
    top: calc(100% + 3px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    padding: 5px;
    border: 1px solid #94a3b8;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}

.smart-select-summary,
.smart-select-empty {
    padding: 6px 8px;
    color: #475569;
    font-size: 12px;
}

.smart-select-option {
    display: block;
    width: 100%;
    min-height: 34px;
    padding: 6px 9px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #111827;
    text-align: left;
}

.smart-select-option:hover,
.smart-select-option:focus,
.smart-select-option.is-selected {
    background: #e8f5d0;
}

td .smart-select {
    min-width: 210px;
}

form p {
    display: grid;
    grid-template-columns: minmax(130px, 210px) minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    margin: 14px 0;
}

form p label {
    padding-top: 9px;
    font-weight: 700;
}

form ul.errorlist {
    margin: 6px 0;
    padding: 10px 14px 10px 32px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: var(--danger-soft);
}

#itemsTable {
    min-width: 940px;
}

#itemsTable select {
    min-width: 280px;
}

#itemsTable input {
    min-width: 110px;
}

.messages {
    margin-bottom: 18px;
    padding: 13px 16px;
    border: 1px solid #facc15;
    border-radius: 10px;
    background: #fef9c3;
    font-weight: 650;
}

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

.actions-print a {
    text-decoration: none;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
}

.filter-field {
    display: grid;
    gap: 5px;
    min-width: min(240px, 100%);
}

.filter-field label {
    font-size: 13px;
    font-weight: 750;
}

.pagination {
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-weight: 750;
}

.pagination a,
.pagination span {
    padding: 7px 10px;
    border-radius: 8px;
}

.pagination a {
    border: 1px solid #94a3b8;
    text-decoration: none;
}

.movement-sale {
    font-weight: 750;
    color: #9a3412 !important;
}

.movement-return {
    font-weight: 750;
    color: #166534 !important;
}

hr {
    margin-block: 24px;
    border: 0;
    border-top: 1px solid var(--line);
}

@media (max-width: 720px) {
    .header-inner,
    .nav-inner,
    .page-shell {
        width: min(100% - 24px, 1440px);
    }

    .header-inner {
        min-height: 64px;
    }

    .brand-copy small {
        display: none;
    }

    .lang-box button {
        padding-inline: 8px;
    }

    .page-shell {
        padding-top: 20px;
    }

    .card {
        padding: 16px;
        border-radius: 12px;
    }

    .page-heading {
        display: grid;
    }

    form p {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    form p label {
        padding-top: 0;
    }
}

/* Application shell and sidebar navigation */
.app-shell {
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    inset-block: 0;
    right: 0;
    left: auto;
    z-index: 50;
    width: 268px;
    padding: 18px 14px 24px;
    overflow-y: auto;
    background: linear-gradient(180deg, #182313 0%, #111a0d 100%);
    border-inline-end: 1px solid rgba(217, 249, 157, .16);
    box-shadow: 10px 0 28px rgba(17, 24, 39, .12);
    scrollbar-width: thin;
    scrollbar-color: rgba(217, 249, 157, .3) transparent;
}

.app-sidebar,
.app-sidebar * {
    color: #fff !important;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    margin: 0 4px 18px;
    padding: 0 4px 17px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    text-decoration: none;
}

.sidebar-brand .brand-mark {
    color: #17210f !important;
    border-color: #a3e635;
    background: var(--accent);
    box-shadow: 0 8px 20px rgba(132, 204, 22, .18);
}

.sidebar-brand .brand-copy strong {
    font-size: 16px;
    letter-spacing: .01em;
}

.sidebar-brand .brand-copy small {
    color: rgba(255, 255, 255, .58) !important;
}

.app-sidebar .main-nav {
    border: 0;
}

.app-sidebar .nav-group {
    margin-bottom: 18px;
}

.app-sidebar .nav-title {
    margin: 0 10px 7px;
    color: rgba(255, 255, 255, .43) !important;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.app-sidebar .main-nav a {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 42px;
    margin-bottom: 3px;
    padding: 9px 12px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: rgba(255, 255, 255, .82) !important;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
}

.app-sidebar .main-nav a:hover,
.app-sidebar .main-nav a:focus-visible {
    transform: translateX(-2px);
    background: rgba(255, 255, 255, .09);
    border-color: rgba(255, 255, 255, .08);
    outline: none;
}

.app-sidebar .main-nav a.is-active {
    color: #16200f !important;
    background: var(--accent);
    border-color: #a3e635;
    box-shadow: 0 8px 18px rgba(132, 204, 22, .14);
}

.app-sidebar .main-nav a.nav-primary:not(.is-active) {
    background: rgba(217, 249, 157, .12);
    border-color: rgba(217, 249, 157, .18);
    color: #e9fbc7 !important;
}

.app-main {
    min-width: 0;
    min-height: 100vh;
    margin-right: 268px;
    margin-left: 0;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 72px;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 10px 24px;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}

.topbar-brand {
    display: grid;
    min-width: 190px;
    line-height: 1.2;
}

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

.topbar-brand small {
    margin-top: 4px;
    color: var(--muted) !important;
    font-size: 11px;
}

.app-topbar .header-actions {
    margin-inline-start: auto;
}

.sidebar-toggle {
    display: none;
    min-width: 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 11px;
    font-size: 21px;
    line-height: 1;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: none;
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(2px);
}

.app-main .page-shell {
    width: min(1520px, calc(100% - 40px));
    padding-block: 26px 48px;
}

@media (max-width: 1120px) {
    .app-sidebar { width: 232px; }
    .app-main { margin-right: 232px; margin-left: 0; }
    .app-topbar { padding-inline: 18px; }
    .app-sidebar .main-nav a { min-height: 39px; padding: 8px 10px; font-size: 12px; }
}

@media (max-width: 900px) {
    body.sidebar-open { overflow: hidden; }
    .app-sidebar {
        width: min(286px, 86vw);
        transform: translateX(105%);
        transition: transform .22s ease;
    }
    body.sidebar-open .app-sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-overlay { display: block; }
    .app-main { margin-right: 0; margin-left: 0; }
    .sidebar-toggle { display: inline-grid; place-items: center; }
    .app-topbar { min-height: 64px; padding: 9px 14px; }
    .app-main .page-shell { width: min(100% - 24px, 1520px); padding-block: 18px 32px; }
    .topbar-brand { min-width: 0; }
    .topbar-brand small { display: none; }
}

@media (max-width: 680px) {
    .app-topbar { align-items: center; flex-wrap: wrap; }
    .app-topbar .header-actions { width: 100%; margin: 0; padding-top: 8px; border-top: 1px solid var(--line); }
    .app-topbar .lang-box { display: flex; flex: 1 1 auto; }
    .app-topbar .lang-box button { flex: 1 1 0; min-width: 0; }
    .app-topbar .print-page-button { display: none; }
    .app-topbar .user-box { margin-inline-start: auto; }
}

@media print {
    .app-sidebar,
    .app-topbar,
    .sidebar-overlay { display: none !important; }
    .app-main { margin: 0 !important; }
    @page {
        size: A4;
        margin: 12mm;
    }

    .site-header,
    .messages,
    .actions-print,
    .print-page-button,
    .pagination {
        display: none !important;
    }

    html,
    body {
        background: #fff !important;
    }

    body {
        font-size: 11px;
        line-height: 1.35;
    }

    .page-shell {
        width: 100%;
        padding: 0;
    }

    .card {
        margin: 8px 0;
        padding: 0;
        border: 0;
        box-shadow: none;
    }

    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .metric-card {
        min-height: auto;
        padding: 8px;
        border: 1px solid #d7dde5;
    }

    .metric-card h2 {
        font-size: 18px;
    }

    .table-wrap {
        overflow: visible;
        border: 0;
    }

    table {
        min-width: 0;
        font-size: 10px;
    }

    th,
    td {
        padding: 6px 7px;
    }

    a {
        text-decoration: none;
    }
}

/* RIAL-style invoice list: filters, summary cards and compact actions. */
.invoice-page-header { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:14px; }
.invoice-page-header h1 { margin-bottom:6px; }
.page-subtitle { margin:0; color:var(--muted) !important; }
.btn { min-height:40px; display:inline-flex; align-items:center; justify-content:center; padding:8px 14px; border:1px solid #65a30d; border-radius:9px; background:var(--accent); color:var(--ink); font-weight:700; line-height:1.35; text-decoration:none; white-space:nowrap; }
.btn:hover { background:#c7f277; text-decoration:none; }
.btn.ghost { border-color:#94a3b8; background:#fff; }
.btn.compact { min-height:34px; padding:6px 9px; font-size:12px; }
.btn.danger-button { border-color:#ef4444; background:var(--danger-soft); }
.filter-form { display:grid; grid-template-columns:minmax(220px,1.6fr) minmax(180px,1.25fr) minmax(150px,.9fr) minmax(150px,.9fr) minmax(230px,1.35fr) auto auto; align-items:end; gap:10px; }
.filter-form > * { width:100%; min-width:0; }
.invoice-filter-card { padding:18px; }
.invoice-filter-form { grid-template-columns:minmax(240px,1.35fr) minmax(210px,1.15fr) minmax(250px,1fr) minmax(250px,1fr); align-items:end; gap:14px; }
.invoice-filter-field { display:flex; min-width:0; flex-direction:column; gap:7px; }
.invoice-filter-field > label { color:var(--muted) !important; font-size:12px; font-weight:800; line-height:1.3; }
.invoice-filter-field > input,.invoice-filter-field > select,.invoice-filter-field > .smart-select { width:100%; min-width:0; }
.invoice-filter-field--sort { grid-column:span 2; }
.invoice-filter-actions { display:grid; grid-column:span 2; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:end; gap:10px; }
.invoice-filter-actions > * { width:100%; min-width:0; }
.invoice-date-filter .jalali-filter-source { display:none !important; }
.invoice-date-filter .jalali-filter-group { display:grid; grid-template-columns:minmax(72px,.8fr) minmax(92px,1.2fr) minmax(72px,.8fr); width:100%; max-width:none; gap:6px; }
.invoice-date-filter .jalali-filter-group select { width:100%; min-width:0; min-height:44px; padding:8px 7px; }
.summary-grid,.invoice-summary-grid { display:grid; grid-template-columns:repeat(4,minmax(170px,1fr)); gap:14px; }
.summary-grid .card { margin:0; }
.stat-card { min-height:118px; display:flex; flex-direction:column; justify-content:space-between; border-top:4px solid var(--accent-strong); }
.stat-card h3 { min-height:20px; margin:0 0 14px; color:var(--muted) !important; font-size:13px; line-height:1.55; }
.stat-card h2 { margin:0; font-size:24px; line-height:1.35; overflow-wrap:anywhere; }
.stat-card__balance { display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; }
.stat-card__balance b { font:inherit; }
.invoice-table-card { padding:0; overflow:hidden; }
.invoice-table-card .table-wrap { margin:0; border:0; border-radius:0; }
.invoice-list-table { min-width:1100px; }
.invoice-list-table th,.invoice-list-table td { text-align:right; padding:10px 9px; }
.invoice-list-table th { font-size:12px; }
.invoice-actions { display:flex; align-items:center; gap:5px; flex-wrap:wrap; }
.credit-text { color:#047857 !important; font-weight:800; }
.empty-state { padding:34px !important; text-align:center !important; color:var(--muted) !important; }
.badge { display:inline-flex; align-items:center; padding:5px 9px; border-radius:999px; background:#eef2f7; font-size:12px; font-weight:800; white-space:nowrap; }
.badge.success { background:#dcfce7; color:#047857 !important; }.badge.danger { background:#fee2e2; color:#b91c1c !important; }
.pagination { display:flex; align-items:center; justify-content:center; gap:10px; padding:14px; border-top:1px solid var(--line); flex-wrap:wrap; }
.pagination span { color:var(--muted) !important; font-size:13px; font-weight:800; }
@media (max-width:1180px) { .filter-form,.invoice-filter-form { grid-template-columns:repeat(2,minmax(0,1fr)); } .invoice-filter-field--sort,.invoice-filter-actions { grid-column:span 1; } .summary-grid,.invoice-summary-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:720px) { .invoice-page-header { align-items:stretch; flex-direction:column; } .invoice-page-header .btn { width:100%; } .filter-form,.invoice-filter-form { grid-template-columns:1fr; } .invoice-filter-field--sort,.invoice-filter-actions { grid-column:1; } .invoice-filter-actions { grid-template-columns:1fr; } .summary-grid,.invoice-summary-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; } .stat-card { min-height:98px; padding:13px; } .stat-card h3 { font-size:11px; } .stat-card h2 { font-size:18px; } .invoice-table-card { padding:10px; overflow:visible; } .invoice-table-card .table-wrap { overflow:visible; } .invoice-list-table { min-width:0; border:0; background:transparent; } .invoice-list-table thead { display:none; } .invoice-list-table tbody,.invoice-list-table tr,.invoice-list-table td { display:block; width:100%; } .invoice-list-table tr { margin-bottom:11px; padding:8px 12px; border:1px solid var(--line); border-radius:15px; background:#fff; box-shadow:0 5px 16px rgba(15,23,42,.05); } .invoice-list-table td { display:grid; grid-template-columns:minmax(102px,38%) 1fr; align-items:center; gap:10px; min-height:39px; padding:7px 2px; text-align:right; } .invoice-list-table td::before { content:attr(data-label); color:var(--muted) !important; font-size:11px; font-weight:800; } .invoice-list-table td:last-child::before { align-self:start; padding-top:8px; } }
@media (max-width:390px) { .summary-grid,.invoice-summary-grid { grid-template-columns:1fr; } }
.auto-row-number-head,.auto-row-number-cell { width:54px; min-width:54px; text-align:center !important; font-weight:900; white-space:nowrap; }
.auto-row-number-cell { color:#4d7c0f !important; }
.table-total-row th {
    background: #eefbd7;
    border-top: 2px solid #78c900;
    font-weight: 800;
}
/* Mobile progressive-disclosure workspace: readable records without zoom. */
.mobile-detail-control,
.mobile-filter-toggle,
.mobile-more-records { display: none; }

@media (max-width: 760px) {
    html, body { width: 100%; max-width: 100%; overflow-x: clip !important; }
    .app-main, .page-shell, .card, .table-wrap { width: 100% !important; max-width: 100% !important; min-width: 0 !important; }
    .table-wrap { overflow: visible !important; }

    table.mobile-record-table,
    table.mobile-record-table tbody,
    table.mobile-record-table tr,
    table.mobile-record-table td { display: block; width: 100%; min-width: 0 !important; }
    table.mobile-record-table { border: 0; background: transparent; }
    table.mobile-record-table thead { display: none; }
    table.mobile-record-table tbody tr {
        margin: 0 0 12px;
        padding: 7px 12px;
        overflow: hidden;
        border: 1px solid #dbe3e8;
        border-radius: 15px;
        background: #fff;
        box-shadow: 0 6px 18px rgba(15, 23, 42, .06);
    }
    table.mobile-record-table tbody td {
        display: grid;
        grid-template-columns: minmax(104px, 38%) minmax(0, 1fr);
        align-items: center;
        gap: 9px;
        min-height: 40px;
        padding: 8px 0;
        border-bottom: 1px dashed #e5eaee;
        text-align: start;
        overflow-wrap: anywhere;
    }
    table.mobile-record-table tbody td::before {
        content: attr(data-mobile-label);
        color: #64748b !important;
        font-size: 11px;
        font-weight: 800;
        line-height: 1.45;
    }
    table.mobile-record-table tbody td.mobile-row-number { display: none !important; }
    table.mobile-record-table tbody td.mobile-secondary { display: none !important; }
    table.mobile-record-table tbody tr.mobile-details-open td.mobile-secondary { display: grid !important; }
    table.mobile-record-table tbody td.mobile-action-cell { border-bottom: 0; }
    table.mobile-record-table tbody td[colspan] { display: block; text-align: center; }
    table.mobile-record-table tbody td[colspan]::before { display: none; }
    table.mobile-record-table tbody td.mobile-detail-control {
        display: block !important;
        min-height: 0;
        padding: 8px 0 3px;
        border: 0;
    }
    table.mobile-record-table tbody td.mobile-detail-control::before { display: none; }
    .mobile-details-toggle,
    .mobile-action-menu > summary,
    .mobile-filter-toggle,
    .mobile-more-records {
        width: 100%;
        min-height: 42px;
        justify-content: center;
        border: 1px solid #b9c8d1;
        border-radius: 11px;
        background: #f4f7f8;
        color: #244057;
        box-shadow: none;
        font: inherit;
        font-weight: 800;
        cursor: pointer;
    }
    .mobile-action-menu { width: 100%; }
    .mobile-action-menu > summary {
        display: flex;
        align-items: center;
        list-style: none;
        background: #eaf6c9;
        border-color: #84cc16;
        color: #263b12;
    }
    .mobile-action-menu > summary::-webkit-details-marker { display: none; }
    .mobile-action-menu > summary::after { content: "⌄"; margin-inline-start: 8px; }
    .mobile-action-menu[open] > summary::after { transform: rotate(180deg); }
    .mobile-action-menu__body { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 8px; }
    .mobile-action-menu__body > * { flex: 1 1 120px; margin: 0 !important; }
    .mobile-action-menu__body a,
    .mobile-action-menu__body button { width: 100%; min-height: 40px; }

    .mobile-filter-toggle { display: flex; margin: 0 0 9px; }
    .mobile-more-records { display: flex; margin: 10px 0 2px; }
    .mobile-record-row.mobile-record-hidden { display: none !important; }
    form.mobile-collapsible-filter:not(.mobile-filter-open) { display: none !important; }
    form.mobile-collapsible-filter.mobile-filter-open { display: grid !important; grid-template-columns: 1fr !important; }
}

@media print {
    .mobile-detail-control,
    .mobile-filter-toggle,
    .mobile-more-records { display: none !important; }
    table.mobile-record-table td.mobile-secondary { display: table-cell !important; }
}
