:root {
    --primary: #047857;
    --primary-strong: #065f46;
    --primary-soft: #ecfdf5;
    --success: #047857;
    --info: #0369a1;
    --warning: #b45309;
    --danger: #b91c1c;
    --background: #f6f8f7;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #0f172a;
    --muted: #526175;
    --border: #dce5e1;
    --sidebar: #10241f;
    --sidebar-muted: #a7bbb4;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --focus: 0 0 0 3px rgba(5, 150, 105, .22);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { color-scheme: light; }

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
button, a { touch-action: manipulation; }
a { color: inherit; }
svg { display: block; fill: currentColor; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    z-index: 1000;
    left: 16px;
    top: -64px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--text);
    color: white;
}

.skip-link:focus { top: 16px; }

:focus-visible { outline: none; box-shadow: var(--focus); }

.app-shell { min-height: 100dvh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: 248px;
    display: flex;
    flex-direction: column;
    background: var(--sidebar);
    color: white;
}

.brand {
    min-height: 76px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-mark {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: block;
    border-radius: 11px;
    object-fit: cover;
}

.brand > span:last-child { min-width: 0; display: grid; }
.brand strong { font-size: 16px; letter-spacing: -.01em; }
.brand small { color: var(--sidebar-muted); font-size: 12px; }

.nav-list { min-height: 0; flex: 1; display: grid; align-content: start; gap: 6px; overflow-y: auto; overscroll-behavior: contain; padding: 20px 12px; }

.nav-item {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-muted);
    text-decoration: none;
    font-weight: 650;
    transition: background-color .16s ease, color .16s ease;
}

.nav-item:hover { background: rgba(255, 255, 255, .07); color: white; }
.nav-item.active { background: #0f765b; color: white; }
.nav-item svg { width: 21px; height: 21px; flex: 0 0 21px; }
.nav-group { min-width: 0; }
.nav-group > summary { min-height: 46px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border-radius: var(--radius-sm); color: var(--sidebar-muted); cursor: pointer; font-weight: 650; list-style: none; transition: background-color .16s ease, color .16s ease; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::marker { content: ""; }
.nav-group > summary:hover, .nav-group[open] > summary { background: rgba(255, 255, 255, .07); color: white; }
.nav-group > summary svg { width: 21px; height: 21px; flex: 0 0 21px; }
.nav-group > summary span { min-width: 0; flex: 1; }
.nav-group > summary i { width: 8px; height: 8px; margin: -4px 3px 0 0; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .16s ease; }
.nav-group[open] > summary i { margin-top: 4px; transform: rotate(225deg); }
.nav-children { display: grid; gap: 3px; margin: 4px 0 5px 22px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .16); }
.nav-child { min-height: 38px; display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 7px; color: var(--sidebar-muted); text-decoration: none; font-size: 13px; font-weight: 600; transition: background-color .16s ease, color .16s ease; }
.nav-child::before { width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: currentColor; content: ""; opacity: .65; }
.nav-child:hover { background: rgba(255, 255, 255, .07); color: white; }
.nav-child.active { background: rgba(16, 185, 129, .17); color: #6ee7b7; }
.nav-child.active::before { opacity: 1; }

.sidebar-footer {
    margin-top: auto;
    min-height: 76px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.user-avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(16, 185, 129, .18);
    color: #6ee7b7;
    font-weight: 800;
}

.user-meta { min-width: 0; display: grid; flex: 1; }
.user-meta strong, .user-meta small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta strong { font-size: 13px; }
.user-meta small { color: var(--sidebar-muted); font-size: 11px; }

.icon-button {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.icon-button:hover { background: rgba(255, 255, 255, .08); }
.icon-button svg { width: 21px; height: 21px; }

.main-column { min-height: 100dvh; margin-left: 248px; }

.topbar {
    display: none;
}

.page-content { width: min(1440px, 100%); margin: 0 auto; padding: 28px; }

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

.page-heading.compact { align-items: center; }
.page-heading h1 { margin: 3px 0 5px; font-size: clamp(25px, 3vw, 34px); line-height: 1.2; letter-spacing: -.035em; }
.page-heading p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--primary) !important; font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.heading-actions { display: flex; gap: 10px; }

.button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 17px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

.button-primary { background: var(--primary); color: white; }
.button-primary:hover { background: var(--primary-strong); }
.button-secondary { border-color: var(--border); background: var(--surface); color: var(--text); }
.button-secondary:hover { border-color: #9eb5ac; background: var(--surface-soft); }
.button-block { width: 100%; }
.text-link { color: var(--primary-strong); font-weight: 750; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stats-grid.stats-two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 760px; }

.stat-card {
    min-width: 0;
    display: grid;
    gap: 7px;
    padding: 18px;
    border: 1px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.stat-success { border-top-color: var(--success); }
.stat-info { border-top-color: var(--info); }
.stat-warning { border-top-color: var(--warning); }
.stat-danger { border-top-color: var(--danger); }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 750; }
.stat-value { overflow-wrap: anywhere; font-size: clamp(19px, 2vw, 25px); font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.stat-card small { color: var(--muted); font-size: 11px; }

.panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.content-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .85fr); gap: 18px; margin-bottom: 18px; }
.content-grid.report-grid { align-items: stretch; }

.panel-heading {
    min-height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.panel-heading.outside { min-height: auto; padding: 0 0 12px; border: 0; }
.panel-heading h2 { margin: 0; font-size: 16px; }
.panel-heading p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.panel-heading > a { color: var(--primary-strong); font-size: 13px; font-weight: 750; text-decoration: none; }

.bar-chart {
    height: 248px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    align-items: end;
    gap: 16px;
    padding: 28px 24px 18px;
}

.bar-chart.seven-bars { grid-template-columns: repeat(7, 1fr); gap: 10px; }
.bar-column { height: 100%; min-width: 0; display: grid; grid-template-rows: 20px 1fr 22px; align-items: end; text-align: center; }
.bar-column i { width: min(38px, 72%); height: var(--bar-height); min-height: 4px; justify-self: center; border-radius: 5px 5px 2px 2px; background: #10b981; }
.bar-column small { color: var(--muted); font-size: 11px; }
.bar-value { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }

.quick-list { display: grid; }
.quick-list a { min-height: 72px; display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); text-decoration: none; }
.quick-list a:last-child { border-bottom: 0; }
.quick-list a:hover { background: var(--surface-soft); }
.quick-list a > span:nth-child(2) { min-width: 0; display: grid; flex: 1; }
.quick-list strong { font-size: 14px; }
.quick-list small { color: var(--muted); font-size: 11px; }
.quick-list b { color: #94a3b8; font-size: 25px; font-weight: 400; }
.quick-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: var(--primary-soft); color: var(--primary-strong); font-size: 20px; font-weight: 800; }
.quick-icon.success { background: #ecfdf5; color: var(--success); }
.quick-icon.warning { background: #fff7ed; color: var(--warning); }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { background: var(--surface-soft); color: var(--muted); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
td { font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfc; }
td strong, td small { display: block; }
td small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.money { white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; letter-spacing: .02em; }
.profit { color: var(--success) !important; }
.loss { color: var(--danger) !important; }

.badge { width: max-content; display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: #ecfdf5; color: #047857; }
.badge-danger { background: #fef2f2; color: #b91c1c; }
.badge-neutral { background: #f1f5f9; color: #475569; }

.empty-state { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 28px; text-align: center; }
.empty-state strong { font-size: 16px; }
.empty-state span { color: var(--muted); }
.empty-state .button { margin-top: 8px; }
.page-empty { min-height: 240px; }

.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.page-button { min-height: 36px; display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--border); border-radius: 7px; background: white; color: var(--text); text-decoration: none; }
.page-button:hover { border-color: #9eb5ac; }
.page-button.disabled { opacity: .48; }

.alert { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 12px 14px; border: 1px solid; border-radius: var(--radius-sm); }
.alert svg { width: 20px; height: 20px; flex: 0 0 20px; }
.alert > span, .alert > div { flex: 1; }
.alert > div { display: grid; }
.alert > div span { font-size: 12px; }
.alert-success { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.alert-error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.alert-close { width: 36px; height: 36px; border: 0; border-radius: 6px; background: transparent; color: inherit; font-size: 22px; cursor: pointer; }

.form-layout { max-width: 920px; display: grid; gap: 16px; }
.product-form { max-width: 1100px; }
.product-tabs { position: sticky; top: 76px; z-index: 10; display: flex; gap: 28px; padding: 0 18px; border-bottom: 1px solid var(--border); background: var(--background); }
.product-tabs a { min-height: 48px; display: inline-flex; align-items: center; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 700; text-decoration: none; }
.product-tabs a:hover, .product-tabs a[aria-current="page"] { border-bottom-color: #1677ff; color: #1677ff; }
.form-card { padding: 22px; }
.section-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.section-heading > span { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary-strong); font-weight: 800; }
.section-heading h2 { margin: 2px 0 2px; font-size: 17px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 12px; }

.form-grid, .payment-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { min-width: 0; display: grid; gap: 7px; }
.field-wide { grid-column: 1 / -1; }
.field > span { font-size: 12px; font-weight: 750; }
.field > span b { color: var(--danger); }
.field-label-action { display: flex; justify-content: flex-end; margin-top: -28px; }
.field-label-action a { color: #1677ff; font-size: 12px; font-weight: 700; text-decoration: none; }
.field-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field-heading label { font-size: 12px; font-weight: 750; }
.field-heading label b { color: var(--danger); }
.text-button { min-height: 32px; padding: 2px 0; border: 0; background: transparent; color: var(--primary-strong); font-size: 12px; font-weight: 750; cursor: pointer; }
.text-button:hover { text-decoration: underline; }
.field input[type="file"] { padding: 8px; }
.image-preview { display: flex; flex-wrap: wrap; gap: 8px; }
.image-preview img { width: 72px; height: 72px; object-fit: cover; border: 1px solid var(--border); border-radius: var(--radius-sm); }

.field input, .field select, .field textarea, .period-form select, .select-compact select, .search-field input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text);
    outline: 0;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .period-form select:focus, .select-compact select:focus, .search-field input:focus { border-color: var(--primary); box-shadow: var(--focus); }
.field-error { color: var(--danger); font-size: 12px; }
.field-help { color: var(--muted); font-size: 11px; }
.field-help a { color: var(--primary-strong); font-weight: 750; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 42px; }
.input-suffix i { position: absolute; right: 13px; top: 50%; translate: 0 -50%; color: var(--muted); font-style: normal; }

.debt-preview { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid #fed7aa; border-radius: var(--radius-sm); background: #fff7ed; color: #9a3412; }
.debt-preview.positive { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.debt-preview.negative { border-color: #fecaca; background: #fef2f2; color: var(--danger); }
.debt-preview span { font-size: 12px; font-weight: 750; }
.debt-preview strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.info-callout { display: grid; gap: 3px; padding: 14px 16px; border: 1px solid #bae6fd; border-radius: var(--radius-sm); background: #f0f9ff; color: #075985; }
.info-callout strong { font-size: 13px; }
.info-callout span { font-size: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 4px 0 32px; }
.product-form-actions { align-items: center; justify-content: space-between; }
.form-action-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

.modal-dialog { width: min(680px, calc(100vw - 32px)); max-height: min(90dvh, 720px); padding: 0; overflow: auto; border: 0; border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: 0 28px 80px rgba(15, 23, 42, .28); }
.modal-dialog-product { width: min(980px, calc(100vw - 32px)); max-height: min(92dvh, 920px); }
.modal-dialog::backdrop { background: rgba(15, 23, 42, .56); backdrop-filter: blur(2px); }
.modal-dialog-compact { width: min(590px, calc(100vw - 32px)); }
.modal-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 26px 30px 12px; }
.modal-heading h2 { margin: 0; font-size: 26px; letter-spacing: -.025em; }
.modal-close { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; color: var(--muted); font-size: 28px; }
.modal-form { display: grid; gap: 16px; padding: 18px 30px 0; }
.quick-product-form { gap: 14px; }
.quick-product-section { display: grid; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); }
.quick-product-section h3 { margin: 0; font-size: 15px; }
.quick-product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.quick-product-wide { grid-column: 1 / -1; }
.quick-product-active { padding: 0 30px 12px; }
.modal-dialog-product .modal-heading { position: sticky; top: 0; z-index: 3; padding-bottom: 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.modal-dialog-product .modal-actions { position: sticky; bottom: 0; z-index: 3; margin-top: 0; background: var(--surface); }
.modal-form .field > span { font-size: 14px; font-weight: 500; }
.modal-form .field input, .modal-form .field select { min-height: 48px; font-size: 16px; }
.modal-feedback { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: #fef2f2; color: var(--danger); font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin: 4px -30px 0; padding: 16px 30px 20px; border-top: 1px solid var(--border); }
.modal-actions .button { min-width: 104px; min-height: 46px; }
.modal-actions button:disabled { opacity: .55; cursor: wait; }
.supplier-address-section { display: grid; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); }
.supplier-address-section h3 { margin: 0; font-size: 16px; }

.purchase-entry-form { gap: 16px; }
.purchase-catalog-toolbar { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) auto; align-items: end; gap: 12px; margin-bottom: 14px; }
.purchase-add-product { min-height: 44px; white-space: nowrap; }
.purchase-product-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; max-height: 360px; overflow: auto; padding: 2px; }
.purchase-product-option { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.purchase-product-option[hidden] { display: none; }
.purchase-product-option > div { min-width: 0; display: grid; gap: 2px; }
.purchase-product-option strong, .purchase-items-table td strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.purchase-product-option small, .purchase-items-table td small { color: var(--muted); font-size: 11px; }
.purchase-product-option .button { min-height: 34px; padding: 6px 11px; font-size: 12px; }
.purchase-product-option .button:disabled { opacity: .6; cursor: default; }
.purchase-products-empty { grid-column: 1 / -1; padding: 22px; }
.purchase-items-wrap { overflow-x: auto; }
.purchase-items-table { min-width: 760px; }
.purchase-items-table th { white-space: nowrap; }
.purchase-items-table td { min-width: 120px; vertical-align: top; }
.purchase-items-table td:first-child { min-width: 190px; display: grid; gap: 3px; }
.purchase-items-table td:nth-child(2) { min-width: 250px; }
.purchase-items-table td:nth-child(3) { min-width: 175px; }
.purchase-items-table td input, .purchase-items-table td textarea { width: 100%; min-height: 40px; padding: 9px 10px; border: 1px solid #cbd5e1; border-radius: var(--radius-sm); background: white; color: var(--text); }
.purchase-items-table td textarea { resize: vertical; }
.purchase-items-table td input:focus, .purchase-items-table td textarea:focus { border-color: var(--primary); box-shadow: var(--focus); outline: 0; }
.purchase-items-table td .icon-button { color: var(--danger); }
.purchase-empty-lines { padding: 22px; border: 1px dashed var(--border); border-radius: var(--radius-sm); color: var(--muted); text-align: center; font-size: 13px; }
.form-error-banner { margin: 8px 0 12px; padding: 11px 13px; border: 1px solid #fecaca; border-radius: var(--radius-sm); background: #fef2f2; color: var(--danger); font-size: 13px; }

body.purchase-entry-page { --purchase-primary: var(--primary); --purchase-primary-strong: var(--primary-strong); background: #f8fafc; }
body.purchase-entry-page .sidebar, body.purchase-entry-page .topbar { display: none !important; }
body.purchase-entry-page .main-column { margin-left: 0 !important; }
body.purchase-entry-page .page-content { width: 100%; max-width: none; padding: 0; }
body.purchase-entry-page .button-primary { background: var(--purchase-primary); }
body.purchase-entry-page .button-primary:hover { background: var(--purchase-primary-strong); }
.purchase-entry-page .purchase-pos-table td a, .purchase-entry-page .purchase-grand-total strong { color: var(--purchase-primary); }
.purchase-entry-page .purchase-debt-row strong { color: var(--danger); }
.purchase-workspace { height: 100dvh; min-height: 0; max-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 400px); background: #ffffff; overflow: hidden; }
.purchase-main { min-width: 0; height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: #ffffff; }
.purchase-toolbar { position: sticky; top: 0; z-index: 25; min-height: 64px; height: 64px; display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); background: #ffffff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04); }
.purchase-back { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: #334155; text-decoration: none; transition: background .15s ease, color .15s ease; flex: 0 0 38px; }
.purchase-back:hover { background: #f1f5f9; color: #0f172a; }
.purchase-back svg { display: block; }
.purchase-toolbar h1 { flex: 0 0 auto; margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.02em; color: #0f172a; }
.purchase-search-wrap { position: relative; min-width: 240px; width: min(580px, 60%); height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 12px; border: 1px solid #cbd5e1; border-radius: 9px; background: #f8fafc; transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease; }
.purchase-search-wrap:focus-within { border-color: var(--primary); background: #ffffff; box-shadow: 0 0 0 3px rgba(4, 120, 87, .15); }
.purchase-search-wrap > span svg { width: 18px; height: 18px; color: #94a3b8; }
.purchase-search-wrap > input { min-width: 0; height: 40px; flex: 1; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13.5px; }
.purchase-search-wrap > input:focus { box-shadow: none; }
.purchase-toolbar-icon { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: #64748b; cursor: pointer; transition: background .15s ease, color .15s ease; }
.purchase-toolbar-icon:hover { background: #e2e8f0; color: #0f172a; }
.purchase-toolbar-icon svg { width: 20px; height: 20px; }
.purchase-toolbar-icon.purchase-add-icon { color: var(--primary); background: #ecfdf5; }
.purchase-toolbar-icon.purchase-add-icon:hover { background: #d1fae5; }
.purchase-toolbar-spacer { flex: 1; }
.purchase-quiet-link { color: #64748b; font-size: 13px; font-weight: 600; text-decoration: none; padding: 6px 10px; border-radius: 6px; transition: background .15s ease, color .15s ease; }
.purchase-quiet-link:hover { background: #f1f5f9; color: #0f172a; }
.purchase-group-picker { position: absolute; z-index: 105; top: calc(100% + 8px); right: 34px; width: min(300px, calc(100vw - 48px)); display: grid; gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: white; box-shadow: 0 12px 30px rgba(15, 23, 42, .14); }
.purchase-group-picker[hidden] { display: none; }
.purchase-group-picker label { color: var(--muted); font-size: 12px; font-weight: 700; }
.purchase-group-picker select { width: 100%; min-height: 40px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; background: white; color: var(--text); }
.purchase-product-list { position: absolute; z-index: 100; top: calc(100% + 8px); left: 0; width: min(650px, calc(100vw - 40px)); max-height: min(55dvh, 440px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; overflow-y: auto; padding: 10px; border: 1px solid #e2e8f0; border-radius: 12px; background: white; box-shadow: 0 14px 34px rgba(15, 23, 42, .16); }
.purchase-product-list[hidden] { display: none; }
.purchase-product-option { min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid #f1f5f9; background: #f8fafc; display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.purchase-product-option:hover { border-color: #a7f3d0; background: #ecfdf5; }
.purchase-product-option .button { min-height: 32px; padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.purchase-products-empty { grid-column: 1 / -1; padding: 18px 10px; color: var(--muted); text-align: center; font-size: 13px; }
.purchase-table-scroll { min-width: 0; flex: 1; min-height: 0; overflow-y: auto; overflow-x: auto; background: white; }
.purchase-pos-table { width: 100%; min-width: 930px; border-collapse: separate; border-spacing: 0; }
.purchase-pos-table thead { position: sticky; top: 0; z-index: 10; }
.purchase-pos-table th { height: 42px; padding: 8px 12px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; color: #475569; font-size: 12px; font-weight: 600; letter-spacing: 0; text-align: center; text-transform: none; }
.purchase-pos-table td { height: 54px; padding: 8px 10px; border-bottom: 1px solid #f1f5f9; font-size: 13px; vertical-align: middle; }
.purchase-pos-table td:first-child, .purchase-pos-table td:nth-child(2) { width: 42px; text-align: center; }
.purchase-pos-table td:nth-child(3) { min-width: 92px; }
.purchase-pos-table td:nth-child(4) { min-width: 165px; }
.purchase-pos-table td:nth-child(n+5) { min-width: 110px; }
.purchase-pos-table tbody tr:hover { background: #f8fafc; }
.purchase-pos-table td input, .purchase-pos-table td textarea { width: 100%; min-height: 38px; padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 7px; background: white; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; transition: border-color .15s ease, box-shadow .15s ease; }
.purchase-pos-table td textarea { min-width: 150px; min-height: 55px; resize: vertical; text-align: left; }
.purchase-pos-table td input:focus, .purchase-pos-table td textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(4, 120, 87, .15); outline: 0; }
.purchase-pos-table td a { color: var(--primary); font-weight: 600; text-decoration: none; }
.purchase-pos-table td a:hover { text-decoration: underline; }
.purchase-pos-table .purchase-line-index { color: var(--muted); text-align: center; }
.purchase-imei-cell { min-width: 180px; }
.purchase-imei-cell input[readonly] { background: #f8fafc; color: #334155; }
.purchase-imei-detail-row td { height: auto; padding: 4px 10px 10px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.purchase-imei-detail-row td:first-child { width: auto; }
.purchase-imei-list { min-height: 38px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 2px 0 4px; }
.purchase-imei-tags { display: contents; }
.purchase-imei-tag { max-width: 100%; display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px; background: #ecfdf5; color: #065f46; font-variant-numeric: tabular-nums; font-size: 12px; border: 1px solid #a7f3d0; }
.purchase-imei-tag > span { overflow-wrap: anywhere; }
.purchase-imei-tag button { width: 18px; height: 18px; flex: 0 0 18px; border: 0; border-radius: 3px; background: transparent; color: #065f46; font-size: 16px; line-height: 1; cursor: pointer; }
.purchase-imei-tag button:hover { background: #d1fae5; }
.purchase-imei-list > input[data-imei-entry] { width: min(260px, 100%); min-width: 180px; min-height: 32px; flex: 1 1 200px; padding: 4px 8px; border: 1px dashed #cbd5e1; border-radius: 6px; background: #ffffff; text-align: left; font-size: 12.5px; box-shadow: none; }
.purchase-imei-list > input[data-imei-entry]:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(4, 120, 87, .15); outline: 0; }
.purchase-imei-feedback { display: block; min-height: 0; color: var(--danger); font-size: 12px; }
.purchase-imei-feedback:empty { display: none; }
.purchase-remove-line { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: #94a3b8; font-size: 20px; cursor: pointer; transition: background .15s ease, color .15s ease; }
.purchase-remove-line:hover { background: #fef2f2; color: var(--danger); }
.purchase-empty-lines { margin: 24px; padding: 16px; border: 1px dashed var(--border); border-radius: 9px; color: var(--muted); text-align: center; font-size: 13px; }
.purchase-empty-lines[hidden] { display: none; }
.purchase-summary { position: sticky; top: 0; height: 100dvh; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 16px 18px 0; overflow-y: auto; border-left: 1px solid var(--border); background: #ffffff; }
.purchase-summary-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.purchase-summary-user { min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: #0f172a; }
.purchase-user-icon { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid #dce5e1; border-radius: 50%; color: var(--primary); background: #ecfdf5; }
.purchase-date { width: 185px; min-width: 0; min-height: 38px; padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: #ffffff; color: #475569; font-size: 12.5px; }
.purchase-supplier-row { display: flex; gap: 6px; }
.purchase-supplier-row select { width: 100%; min-width: 0; min-height: 42px; padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: #ffffff; color: var(--text); font-size: 13.5px; }
.purchase-supplier-row select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(4, 120, 87, .15); outline: 0; }
.supplier-combobox { position: relative; width: 100%; min-width: 0; }
.supplier-combobox > input[type="search"] { width: 100%; min-height: 42px; padding: 8px 42px 8px 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: #ffffff; color: var(--text); font-size: 13.5px; }
.supplier-combobox > input[type="search"]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(4, 120, 87, .15); outline: 0; }
.supplier-combobox-toggle { position: absolute; z-index: 2; top: 3px; right: 3px; width: 36px; height: 36px; border: 0; border-radius: 6px; background: transparent; color: #475569; font-size: 22px; cursor: pointer; }
.supplier-combobox-options { position: absolute; z-index: 50; top: calc(100% + 5px); right: 0; left: 0; max-height: min(40vh, 280px); overflow-y: auto; padding: 4px; border: 1px solid #cbd5e1; border-radius: 9px; background: #ffffff; box-shadow: 0 12px 28px rgba(15, 23, 42, .16); }
.supplier-combobox-options[hidden] { display: none; }
.supplier-combobox-option { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.supplier-combobox-option:hover, .supplier-combobox-option:focus-visible, .supplier-combobox-option[aria-selected="true"] { outline: 0; background: #eff6ff; }
.supplier-combobox-option strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.supplier-combobox-option small { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
.supplier-combobox-option[hidden] { display: none; }
.supplier-combobox-empty { padding: 12px 10px; color: var(--muted); font-size: 12px; }
.supplier-combobox-empty[hidden] { display: none; }
.purchase-supplier-row .purchase-toolbar-icon { width: 42px; height: 42px; flex: 0 0 42px; border: 1px solid #a7f3d0; border-radius: 8px; background: #ecfdf5; color: var(--primary); font-size: 24px; }
.purchase-supplier-row .purchase-toolbar-icon:hover { background: #d1fae5; }
.purchase-meta-list { display: grid; gap: 4px; margin: 0; }
.purchase-meta-list > div { min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.purchase-meta-list dt, .purchase-meta-list dd { margin: 0; font-size: 13px; }
.purchase-meta-list dt { color: #64748b; }
.purchase-meta-list dd { color: #0f172a; font-weight: 500; }
.purchase-number { min-width: 130px; padding: 6px 10px; border: 1px solid #e2e8f0; border-radius: 7px; background: #f8fafc; color: #64748b; font-size: 12.5px; text-align: center; }
.purchase-status { color: #ea580c; font-weight: 700; font-size: 12.5px; }
.purchase-totals { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid #f1f5f9; border-bottom: 1px solid #f1f5f9; }
.purchase-totals > div { min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: #475569; }
.purchase-totals > div strong { font-variant-numeric: tabular-nums; color: #0f172a; }
.purchase-grand-total { margin-top: 4px; padding-top: 6px; border-top: 1px dashed #e2e8f0; font-weight: 700; }
.purchase-grand-total span { color: #0f172a; font-weight: 700; }
.purchase-grand-total strong { color: var(--primary) !important; font-size: 18px !important; }
.purchase-paid-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.purchase-paid-field > span { font-size: 13px; font-weight: 600; color: #334155; }
.purchase-paid-field .input-suffix { width: 150px; position: relative; display: flex; align-items: center; }
.purchase-paid-field .input-suffix input { width: 100%; min-height: 38px; padding: 6px 26px 6px 10px; border: 1px solid #cbd5e1; border-radius: 8px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13.5px; font-weight: 600; }
.purchase-paid-field .input-suffix input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(4, 120, 87, .15); outline: 0; }
.purchase-paid-field .input-suffix i { position: absolute; right: 9px; color: #94a3b8; font-style: normal; font-size: 12px; }
.purchase-debt-row { padding-top: 8px; border-top: 1px solid #f1f5f9; font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.purchase-debt-row span { color: #0f172a; font-size: 13px; }
.purchase-debt-row strong { color: var(--danger, #b91c1c) !important; font-size: 17px !important; font-variant-numeric: tabular-nums; }
.purchase-notes-field { display: flex; flex-direction: column; gap: 6px; }
.purchase-notes-field span { font-size: 12.5px; font-weight: 600; color: #475569; }
.purchase-notes-field textarea { width: 100%; min-height: 72px; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 13px; resize: vertical; }
.purchase-notes-field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(4, 120, 87, .15); outline: 0; }
.purchase-summary-actions { position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: auto -18px 0; padding: 14px 18px 18px; border-top: 1px solid #f1f5f9; background: #ffffff; }
.purchase-summary-actions .button { min-height: 44px; border-radius: 8px; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
.purchase-summary-actions .button-secondary { background: #ffffff; border: 1px solid #cbd5e1; color: #475569; }
.purchase-summary-actions .button-secondary:hover { background: #f8fafc; color: #0f172a; }
.purchase-summary-actions .button-primary { background: var(--primary, #047857) !important; border: 0; color: #ffffff; }
.purchase-summary-actions .button-primary:hover { background: var(--primary-strong, #065f46) !important; }
.purchase-error-banner ul { margin: 6px 0 0; padding-left: 20px; }

body.sales-entry-page { --sales-primary: var(--primary); --sales-primary-strong: var(--primary-strong); background: #eef0f4; }
body.sales-entry-page .sidebar, body.sales-entry-page .topbar { display: none; }
body.sales-entry-page .main-column { margin-left: 0; }
body.sales-entry-page .page-content { width: 100%; max-width: none; padding: 0; }
body.sales-entry-page .button-primary { background: var(--sales-primary); }
.sales-workspace { height: 100dvh; min-height: 0; padding-bottom: 54px; display: grid; grid-template-columns: minmax(0, 1.38fr) minmax(390px, 1fr); background: #eef0f4; }
.sales-main { min-width: 0; height: calc(100dvh - 54px); min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.sales-toolbar { position: sticky; top: 0; z-index: 20; min-height: 62px; display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-bottom: 1px solid #dce2eb; background: #f8fafc; }
.sales-back { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: #334155; text-decoration: none; transition: background .15s ease, color .15s ease; }
.sales-back:hover { background: #e2e8f0; color: #0f172a; }
.sales-back svg { display: block; }
.sales-toolbar h1 { margin: 0; font-size: 19px; }
.sales-invoice-label { padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: white; color: #334155; font-size: 13px; font-weight: 700; }
.sales-toolbar-spacer { flex: 1; }
.sales-date { width: 188px; min-height: 40px; padding: 7px 9px; border: 1px solid #cbd5e1; border-radius: 8px; background: white; color: #475569; font-size: 12px; }
.sales-global-product-search { min-width: 150px; max-width: 560px; flex: 1 1 220px; }
.sales-workspace[data-mode="quick"] { grid-template-columns: minmax(0, 1fr) clamp(380px, 32vw, 560px); }
.sales-workspace[data-mode="quick"] .sales-main { padding-top: 72px; padding-right: 20px; }
.sales-workspace[data-mode="quick"] .sales-toolbar { position: fixed; inset: 0 0 auto; z-index: 60; min-height: 72px; justify-content: flex-start; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%); border-bottom: 0; color: white; box-shadow: 0 4px 14px rgba(4, 120, 87, 0.18); }
.sales-workspace[data-mode="quick"] .sales-toolbar h1,
.sales-workspace[data-mode="quick"] .sales-date { display: none; }
.sales-workspace[data-mode="quick"] .sales-back { order: 0; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: rgba(255, 255, 255, 0.16); color: #ffffff; text-decoration: none; margin-right: 4px; flex-shrink: 0; transition: background 0.15s ease, transform 0.1s ease; }
.sales-workspace[data-mode="quick"] .sales-back:hover { background: rgba(255, 255, 255, 0.28); }
.sales-workspace[data-mode="quick"] .sales-back:active { transform: scale(0.95); }
.sales-workspace[data-mode="quick"] .sales-back svg { display: block; }
.sales-workspace[data-mode="quick"] .sales-global-product-search { order: 1; width: min(560px, 29vw); max-width: 560px; flex: 0 1 560px; }
.sales-workspace[data-mode="quick"] .sales-invoice-label { order: 2; border-color: rgba(255,255,255,.35); background: rgba(255,255,255,0.92); color: var(--primary-strong); }
.sales-workspace[data-mode="quick"] .sales-toolbar-spacer { order: 3; }
.sales-workspace[data-mode="quick"] .sales-catalog { display: none; }
.sales-workspace[data-mode="quick"] .sales-payment-panel.is-quick { top: 84px; right: 16px; bottom: 74px; width: clamp(380px, 32vw, 560px); border-radius: 16px; box-shadow: 0 10px 25px -5px rgba(15, 23, 42, .08), 0 8px 10px -6px rgba(15, 23, 42, .04); border: 1px solid #e2e8f0; }
.sales-workspace[data-mode="quick"] .sales-payment-header { min-height: 104px; padding: 16px 20px 14px; border-bottom: 1px solid #f1f5f9; background: #ffffff; }
.sales-workspace[data-mode="quick"] .sales-payment-header-main { min-width: 0; flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; gap: 9px 10px; }
.sales-workspace[data-mode="quick"] .sales-payment-header-fields { min-width: 0; grid-column: 1 / -1; grid-row: 2; display: flex; align-items: center; gap: 7px; }
.sales-workspace[data-mode="quick"] .sales-customer-lookup { min-width: 0; flex: 1; gap: 6px; }
.sales-workspace[data-mode="quick"] .sales-customer-lookup .sales-search-wrap { min-height: 42px; padding-inline: 10px; border-radius: 10px; border-color: #e2e8f0; background: #f8fafc; }
.sales-workspace[data-mode="quick"] .sales-customer-lookup .sales-search-wrap:focus-within { border-color: var(--sales-primary); background: #ffffff; box-shadow: 0 0 0 3px rgba(4, 120, 87, .15); }
.sales-workspace[data-mode="quick"] .sales-customer-lookup input { font-size: 13px; }
.sales-workspace[data-mode="quick"] .sales-add-customer { width: 42px; height: 42px; flex-basis: 42px; border-radius: 10px; }
.sales-workspace[data-mode="quick"] .sales-customer-phone { width: 104px; min-height: 42px; padding-inline: 8px; border-radius: 10px; font-size: 12px; }
.sales-workspace[data-mode="quick"] .sales-payment-header-main > small { font-size: 12px; color: #94a3b8; font-weight: 500; }
.sales-workspace[data-mode="quick"] [data-close-payment] { display: none; }
.sales-workspace[data-mode="quick"] [data-payment-customer] { display: none; }
.sales-workspace[data-mode="quick"]:not([data-customer-selected="true"]) .sales-payment-header-fields .sales-customer-phone { display: none; }
.sales-workspace[data-mode="quick"]:not([data-has-items="true"]) .sales-payment-received,
.sales-workspace[data-mode="quick"]:not([data-has-items="true"]) .sales-payment-methods,
.sales-workspace[data-mode="quick"]:not([data-has-items="true"]) .sales-excess-option { display: none; }
.sales-workspace[data-mode="normal"] .sales-payment-header-fields { display: none; }
.sales-workspace[data-mode="quick"] .sales-product-list { position: fixed; z-index: 90; top: 76px; left: 68px; width: min(560px, 34vw); max-height: min(62dvh, 620px); display: none; grid-template-columns: minmax(0, 1fr); align-content: start; overflow-y: auto; padding: 9px; border: 1px solid #dce2eb; border-radius: 12px; background: white; box-shadow: 0 12px 32px rgba(15,23,42,.2); }
.sales-workspace[data-mode="quick"][data-search-open="true"] .sales-product-list { display: grid; }
.sales-workspace[data-mode="quick"] .sales-catalog-content.is-quick-covered { visibility: hidden; }
.sales-workspace[data-mode="quick"]:not([data-search-open="true"]) .sales-product-count { visibility: hidden; }
.sales-cart-scroll { min-width: 0; min-height: 0; flex: 1; overflow: auto; padding: 12px 14px; }
.sales-cart-table { min-width: 660px; border-collapse: separate; border-spacing: 0; border: 1px solid #d4d9e2; border-radius: 12px; background: white; box-shadow: 0 3px 10px rgba(15, 23, 42, .08); }
.sales-cart-table th { position: sticky; top: 0; z-index: 2; height: 39px; padding: 8px 10px; border-bottom: 1px solid #e2e8f0; background: #fff; color: #64748b; font-size: 11px; letter-spacing: 0; text-align: left; text-transform: none; }
.sales-cart-table td { height: 60px; padding: 8px 10px; font-size: 13px; }
.sales-cart-table td:first-child { width: 42px; color: #64748b; text-align: center; }
.sales-cart-table td:nth-child(2) { min-width: 88px; }
.sales-cart-table td:nth-child(3) { min-width: 145px; }
.sales-cart-table td:nth-child(4) { width: 90px; text-align: center; }
.sales-cart-table td:nth-child(5) { width: 130px; }
.sales-cart-table td:nth-child(6) { min-width: 120px; text-align: right; }
.sales-line-name strong { display: block; }
.sales-line-name small { display: block; margin-top: 3px; color: #64748b; font-size: 11px; }
.sales-line-name .sales-imei-search { width: min(100%, 280px); min-height: 36px; margin-top: 6px; padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 7px; background: white; color: #334155; text-align: left; }
.sales-imei-menu { position: fixed; z-index: 10000; display: grid; gap: 2px; overflow: auto; padding: 6px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; box-shadow: 0 12px 30px rgba(15, 23, 42, .2); }
.sales-imei-menu[hidden] { display: none; }
.sales-imei-option { min-height: 42px; padding: 8px 12px; border: 0; border-radius: 6px; background: #fff; color: #1e293b; font: inherit; text-align: left; cursor: pointer; }
.sales-imei-option:hover, .sales-imei-option:focus-visible { background: #ecfdf5; outline: 2px solid var(--sales-primary); outline-offset: -2px; }
.sales-line-name .sales-imei-selected-list { max-width: 440px; display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.sales-imei-chip { min-height: 27px; display: inline-flex; align-items: center; gap: 5px; padding: 2px 5px 2px 9px; border: 1px solid #a7f3d0; border-radius: 7px; background: #ecfdf5; color: var(--primary-strong); font-size: 12px; font-weight: 600; }
.sales-imei-chip span { overflow-wrap: anywhere; }
.sales-imei-chip button { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #64748b; font-size: 17px; line-height: 1; cursor: pointer; }
.sales-imei-chip button:hover, .sales-imei-chip button:focus-visible { background: #d1fae5; color: var(--primary-strong); outline: 2px solid var(--sales-primary); }
.sales-excess-option[hidden] { display: none !important; }
.sales-cart-table td input { width: 100%; min-height: 36px; padding: 6px 8px; border: 1px solid #d5dbe3; border-radius: 7px; background: white; text-align: right; font-variant-numeric: tabular-nums; }
.sales-cart-table td input:focus { border-color: var(--sales-primary); box-shadow: 0 0 0 3px rgba(4, 120, 87, .16); outline: 0; }
.sales-line-total { color: var(--sales-primary); font-weight: 750; white-space: nowrap; }
.sales-remove-line { width: 38px; height: 38px; border: 0; border-radius: 8px; background: transparent; color: #64748b; font-size: 24px; cursor: pointer; }
.sales-remove-line:hover { background: #fef2f2; color: #b91c1c; }
.sales-empty-cart { margin: 16px 0; padding: 18px; border: 1px dashed #cbd5e1; border-radius: 10px; background: rgba(255,255,255,.78); color: #64748b; text-align: center; font-size: 13px; }
.sales-cart-footer { min-height: 92px; display: flex; align-items: center; gap: 20px; margin: 0 14px 12px; padding: 12px 16px; border-radius: 12px; background: white; box-shadow: 0 2px 8px rgba(15,23,42,.06); }
.sales-note { min-width: 0; flex: 1; display: grid; gap: 5px; color: #64748b; font-size: 12px; }
.sales-note textarea { width: 100%; min-height: 42px; padding: 7px 9px; border: 1px solid #e2e8f0; border-radius: 7px; resize: vertical; }
.sales-cart-total { min-width: 180px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 12px; font-size: 12px; }
.sales-cart-total > span { color: #64748b; }
.sales-cart-total > span:nth-child(2) { color: #1e293b; text-align: right; }
.sales-cart-total strong { grid-column: 2; color: var(--sales-primary); font-size: 20px; text-align: right; font-variant-numeric: tabular-nums; }
.sales-cart-total small { grid-column: 2; color: #dc2626; text-align: right; font-size: 11px; }
.sales-line-price { position: relative; min-width: 108px; }
.sales-line-price-trigger { display: block; width: 100%; min-height: 40px; margin-left: auto; padding: 6px 2px; border: 0; border-radius: 6px; background: transparent; color: #1e293b; font: inherit; text-align: right; cursor: pointer; }
.sales-line-price-trigger strong { display: block; color: inherit; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sales-line-price-trigger:hover strong { color: var(--sales-primary); }
.sales-line-price-trigger:focus-visible { outline: 2px solid var(--sales-primary); outline-offset: 2px; }
.sales-discount-editor { position: absolute; z-index: 25; top: 100%; left: 50%; width: 248px; display: grid; gap: 9px; padding: 14px; border: 1px solid #e2e8f0; border-radius: 10px; background: white; box-shadow: 0 12px 28px rgba(15,23,42,.2); }
.sales-discount-editor[hidden] { display: none; }
.sales-discount-editor label { display: grid; grid-template-columns: 82px minmax(0,1fr); align-items: center; gap: 8px; color: #475569; font-size: 12px; }
.sales-discount-editor label input { min-height: 34px; padding: 5px 7px; border: 1px solid #cbd5e1; border-radius: 6px; text-align: right; }
.sales-discount-modes { display: flex; justify-content: flex-end; gap: 5px; }
.sales-discount-modes button { min-width: 38px; min-height: 30px; border: 1px solid #cbd5e1; border-radius: 6px; background: white; color: #334155; cursor: pointer; }
.sales-discount-modes button.active { border-color: var(--sales-primary); background: var(--sales-primary); color: white; }
.sales-discount-final { display: flex; align-items: center; justify-content: space-between; color: #334155; font-size: 12px; }
.sales-discount-final strong { color: var(--sales-primary); font-size: 16px; }
.sales-discount-done { min-height: 32px; border: 0; border-radius: 6px; background: var(--sales-primary); color: white; cursor: pointer; }
.sales-mode-switch { position: fixed; z-index: 30; inset: auto 0 0; min-height: 54px; display: flex; align-items: stretch; gap: 5px; padding: 0 16px; border-top: 1px solid #dce2eb; background: white; box-shadow: 0 -3px 12px rgba(15,23,42,.06); }
.sales-mode-switch button { min-width: 142px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 14px; border: 0; border-top: 2px solid transparent; background: transparent; color: #64748b; font-weight: 700; cursor: pointer; }
.sales-mode-switch button[aria-selected="true"] { border-top-color: var(--sales-primary); color: var(--sales-primary); }
.sales-mode-switch button span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #f1f5f9; font-size: 19px; }
.sales-mode-switch button[aria-selected="true"] span { background: #d1fae5; }
.sales-main { min-height: calc(100dvh - 54px); }
.sales-catalog { height: calc(100dvh - 54px); min-height: 0; }
.sales-catalog-content[hidden] { display: none; }
.sales-payment-scrim { position: fixed; z-index: 40; inset: 0; background: rgba(15,23,42,.48); }
.sales-payment-scrim[hidden], .sales-payment-panel[hidden] { display: none; }
.sales-payment-panel { position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: min(650px, 88vw); display: flex; flex-direction: column; overflow: hidden; border-radius: 18px 0 0 18px; background: white; box-shadow: -12px 0 32px rgba(15,23,42,.2); }
.sales-payment-panel.is-quick { top: 0; bottom: 54px; width: min(42vw, 860px); border-radius: 14px 0 0 14px; box-shadow: 0 2px 14px rgba(15,23,42,.12); }
.sales-payment-header { position: relative; z-index: 30; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; border-bottom: 1px dashed #cbd5e1; }
.sales-payment-header > div { display: flex; align-items: center; gap: 16px; }
.sales-payment-header strong { overflow: hidden; color: #1e293b; text-overflow: ellipsis; white-space: nowrap; }
.sales-payment-header small { color: #64748b; white-space: nowrap; }
.sales-payment-header button { width: 38px; height: 38px; border: 0; background: transparent; color: #64748b; font-size: 30px; cursor: pointer; }
.sales-payment-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.sales-payment-customer { min-height: 38px; display: flex; align-items: center; gap: 10px; margin-bottom: 2px; color: var(--sales-primary); font-size: 14px; }
.sales-payment-customer > span { color: #64748b; font-size: 20px; }
.sales-payment-summary { display: grid; gap: 14px; padding: 18px 20px; border-radius: 14px; background: #f8fafc; border: 1px solid #e8eef5; margin-bottom: 0; }
.sales-payment-summary > div, .sales-payment-summary > label { min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sales-payment-summary > div > span, .sales-payment-summary > label > span { font-size: 13.5px; color: #475569; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.sales-payment-summary > div > span b { margin-left: 0; display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; background: #e2e8f0; color: #334155; font-size: 11px; font-weight: 700; }
.sales-payment-summary > div > strong { font-size: 15px; font-weight: 600; color: #1e293b; font-variant-numeric: tabular-nums; }
.sales-payment-summary > label > span { color: #475569; }
.sales-payment-summary > label > input { width: 120px; min-height: 34px; padding: 4px 10px; border: 1px solid #cbd5e1; border-radius: 7px; background: #ffffff; font-weight: 600; font-size: 13px; color: #1e293b; text-align: right; font-variant-numeric: tabular-nums; transition: border-color .15s ease, box-shadow .15s ease; }
.sales-payment-summary > label > input:focus { border-color: var(--sales-primary); box-shadow: 0 0 0 3px rgba(4, 120, 87, .12); outline: 0; }
.sales-payment-summary .sales-payment-due { margin-top: 6px; padding-top: 14px; border-top: 1px dashed #cbd5e1; min-height: 44px; }
.sales-payment-summary .sales-payment-due strong:first-child { font-size: 15px; font-weight: 700; color: #0f172a; }
.sales-payment-summary .sales-payment-due strong:last-child { color: var(--sales-primary); font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.sales-payment-received { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-radius: 12px; background: #ffffff; border: 1px solid #e2e8f0; margin: 0; }
.sales-payment-received strong { font-size: 13px; color: #334155; font-weight: 600; }
.sales-payment-received > span { width: 170px; display: flex; align-items: center; border: 0; border-bottom: 2px solid var(--sales-primary); padding-bottom: 2px; }
.sales-payment-received input { width: 100%; min-width: 0; min-height: 34px; border: 0; outline: 0; text-align: right; font-size: 18px; font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; }
.sales-payment-received > span b { color: #64748b; font-weight: 500; }
.sales-payment-methods { display: flex; flex-wrap: wrap; gap: 12px 18px; margin: 4px 0 8px; padding: 0; border: 0; }
.sales-payment-methods label, .sales-excess-option { display: inline-flex; align-items: center; gap: 8px; color: #334155; cursor: pointer; }
.sales-payment-methods input, .sales-excess-option input { width: 17px; height: 17px; accent-color: var(--sales-primary); }
.sales-excess-option { min-height: 38px; display: flex; }
.sales-excess-option span { flex: 1; font-size: 13px; }
.sales-excess-option strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.sales-payment-footer { display: grid; gap: 8px; padding: 16px 20px 20px; border-top: 1px solid #f1f5f9; }
.sales-payment-footer .sales-checkout-button { width: 100%; height: 48px; border-radius: 10px; font-size: 15px; font-weight: 700; letter-spacing: 0.02em; box-shadow: 0 4px 14px rgba(4, 120, 87, .25); }
.sales-payment-footer .sales-checkout-button:disabled { background: #cbd5e1; color: #94a3b8; box-shadow: none; cursor: not-allowed; }
.sales-error-banner { margin: 10px 14px 0; flex: 0 0 auto; max-height: 22dvh; overflow-y: auto; }
.sales-error-banner ul { margin: 6px 0 0; padding-left: 20px; }
.sales-catalog { position: sticky; top: 0; height: calc(100dvh - 54px); min-height: 570px; display: flex; flex-direction: column; gap: 13px; padding: 14px 16px 12px; overflow-y: auto; border-left: 1px solid #e2e8f0; border-radius: 14px 0 0 14px; background: white; }
.sales-catalog { min-height: 0; }
.sales-catalog-content { min-height: 0; flex: 1; display: flex; flex-direction: column; gap: 13px; }
.sales-customer-fields { display: grid; grid-template-columns: minmax(0, 1fr) 145px; gap: 8px; }
.sales-customer-lookup { position: relative; min-width: 0; display: flex; gap: 8px; }
.sales-customer-lookup .sales-search-wrap { flex: 1; }
.sales-customer-dropdown { position: absolute; top: calc(100% + 6px); left: 0; width: max(100%, 320px); max-width: 460px; max-height: 300px; overflow-y: auto; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 14px 30px -5px rgba(15, 23, 42, .18), 0 6px 12px -3px rgba(15, 23, 42, .08); padding: 6px; display: flex; flex-direction: column; gap: 3px; z-index: 150; overscroll-behavior: contain; }
.sales-customer-dropdown[hidden] { display: none !important; }
.sales-customer-dropdown-item { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 8px; cursor: pointer; transition: background-color .15s ease, color .15s ease; user-select: none; text-align: left; border: none; background: transparent; width: 100%; color: #1e293b; }
.sales-customer-dropdown-item:hover, .sales-customer-dropdown-item.is-active { background-color: #ecfdf5; outline: none; }
.sales-customer-item-avatar { width: 32px; height: 32px; border-radius: 50%; background: #d1fae5; color: #047857; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1px solid #a7f3d0; letter-spacing: .5px; }
.sales-customer-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sales-customer-item-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.sales-customer-item-name { font-size: 13px; font-weight: 600; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sales-customer-item-name mark { background: #fef08a; color: #854d0e; padding: 0 1px; border-radius: 2px; font-weight: 700; }
.sales-customer-item-code { font-size: 11px; font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; background: #f1f5f9; color: #475569; padding: 1px 5px; border-radius: 4px; flex-shrink: 0; }
.sales-customer-item-sub { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #64748b; }
.sales-customer-item-sub svg { width: 13px; height: 13px; color: #94a3b8; flex-shrink: 0; }
.sales-customer-dropdown-empty { padding: 14px 12px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.sales-customer-empty-text { font-size: 13px; color: #64748b; line-height: 1.4; }
.sales-customer-empty-text strong { color: #0f172a; font-weight: 700; }
.sales-customer-dropdown button.sales-customer-add-quick-btn,
.sales-customer-dropdown .sales-customer-add-quick-btn { width: auto !important; height: auto !important; min-height: 36px !important; font-size: 13px !important; line-height: 1.4 !important; font-weight: 600 !important; color: #ffffff !important; background: var(--sales-primary, #047857) !important; border: none !important; border-radius: 8px !important; padding: 7px 14px !important; display: inline-flex !important; align-items: center !important; justify-content: center !important; gap: 6px !important; cursor: pointer !important; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important; text-transform: none !important; }
.sales-customer-dropdown button.sales-customer-add-quick-btn:hover,
.sales-customer-dropdown .sales-customer-add-quick-btn:hover { background: #065f46 !important; }
.sales-customer-dropdown button.sales-customer-add-quick-btn:active,
.sales-customer-dropdown .sales-customer-add-quick-btn:active { transform: scale(0.98); }
.sales-add-customer { width: 44px; height: 44px; flex: 0 0 44px; border: 1px solid #a7f3d0; border-radius: 9px; background: #ecfdf5; color: var(--sales-primary); font-size: 28px; line-height: 1; cursor: pointer; }
.sales-add-customer:hover { border-color: var(--sales-primary); background: #d1fae5; }
.sales-search-wrap { min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; }
.sales-search-wrap:focus-within { border-color: var(--sales-primary); box-shadow: 0 0 0 3px rgba(4, 120, 87, .14); }
.sales-search-wrap svg { width: 18px; height: 18px; flex: 0 0 18px; color: #94a3b8; }
.sales-search-wrap input { width: 100%; min-width: 0; min-height: 40px; padding: 0; border: 0; outline: 0; background: transparent; color: #1e293b; }
.sales-search-wrap input:focus { box-shadow: none; }
.sales-customer-phone { width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; }
.sales-product-search-wrap { flex: 0 0 auto; }
.sales-product-count { min-width: 25px; color: #64748b; font-size: 12px; text-align: center; }
.sales-product-card { min-width: 0; min-height: 82px; display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; user-select: none; transition: border-color .15s ease, background-color .15s ease; }
.sales-product-card:hover { border-color: #a7f3d0; background: #f0fdf4; }
.sales-product-card:active { background: #ecfdf5; }
.sales-product-card:focus-visible { outline: 2px solid var(--sales-primary); outline-offset: 1px; }
.sales-product-card[hidden] { display: none; }
.sales-product-image { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 8px; background: #f1f5f9; color: #8b5cf6; }
.sales-product-image svg { width: 25px; height: 25px; fill: currentColor; }
.sales-product-copy { min-width: 0; display: grid; gap: 2px; }
.sales-product-copy strong { overflow: hidden; font-size: 13px; line-height: 1.3; text-overflow: ellipsis; }
.sales-product-copy small { overflow: hidden; color: #64748b; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.sales-product-copy b { color: var(--sales-primary); font-size: 14px; font-variant-numeric: tabular-nums; }
.sales-add-product { display: none !important; }
.sales-no-products { grid-column: 1 / -1; padding: 25px 12px; color: #64748b; text-align: center; font-size: 13px; }
.sales-checkout { display: grid; gap: 9px; margin-top: auto; padding-top: 12px; border-top: 1px solid #e2e8f0; }
.sales-paid-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #334155; font-size: 13px; }
.sales-money-input { width: min(210px, 55%); display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid #cbd5e1; border-radius: 8px; }
.sales-money-input input { width: 100%; min-width: 0; min-height: 42px; border: 0; outline: 0; background: transparent; text-align: right; font-variant-numeric: tabular-nums; }
.sales-money-input b { color: #64748b; font-weight: 500; }
.sales-debt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; color: #475569; font-size: 13px; }
.sales-debt-row strong { color: #1e293b; font-variant-numeric: tabular-nums; }
.sales-checkout-button { min-height: 58px; border: 0; border-radius: 10px; background: var(--sales-primary); color: white; font-size: 17px; font-weight: 800; text-transform: uppercase; cursor: pointer; }
.sales-checkout-button:hover:not(:disabled) { background: var(--sales-primary-strong); }
.sales-checkout-button:disabled { opacity: .5; cursor: not-allowed; }
.sales-cancel-link { color: #64748b; font-size: 12px; text-align: center; text-decoration: none; }
.sales-cancel-link:hover { color: #1e293b; text-decoration: underline; }

.modal-dialog-customer { width: min(1860px, calc(100vw - 64px)); max-height: min(92dvh, 1120px); overflow: auto; }
.modal-dialog-customer .modal-heading { position: sticky; top: 0; z-index: 3; min-height: 76px; padding: 18px 32px 12px; background: var(--surface); }
.customer-modal-title { display: flex; align-items: center; gap: 14px; }
.customer-modal-title h2 { font-size: 23px; }
.customer-modal-title > span { color: #cbd5e1; }
.customer-modal-title p { margin: 0; font-size: 15px; }
.modal-heading > div { min-width: 0; }
.modal-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.customer-modal-form { gap: 0; padding: 0; }
.customer-modal-tabs { position: sticky; top: 76px; z-index: 2; display: flex; gap: 36px; padding: 0 32px; border-bottom: 1px solid var(--border); background: var(--surface); }
.customer-modal-tabs button { min-height: 54px; padding: 0; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-size: 15px; font-weight: 700; cursor: pointer; }
.customer-modal-tabs button[aria-selected="true"] { border-bottom-color: var(--sales-primary); color: var(--sales-primary); }
.customer-modal-panel { min-height: 430px; padding: 26px 32px 20px; }
.customer-general-layout { display: grid; grid-template-columns: 168px minmax(0, 1fr); align-items: start; gap: 28px; }
.customer-photo-picker { display: grid; justify-items: center; gap: 12px; padding-top: 5px; }
.customer-photo-preview { width: 148px; height: 148px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: #f1f3f5; color: #64717f; }
.customer-photo-preview svg { width: 54px; height: 54px; fill: currentColor; }
.customer-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.customer-photo-button { min-width: 148px; min-height: 44px; border-color: var(--sales-primary); color: var(--sales-primary); cursor: pointer; }
.customer-photo-help { color: var(--muted); font-size: 11px; text-align: center; }
.customer-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "code group" "name birthday" "phone email" "address facebook" "region notes" "ward notes"; align-items: start; gap: 17px 38px; }
.customer-field-code { grid-area: code; }
.customer-field-group { grid-area: group; }
.customer-field-name { grid-area: name; }
.customer-field-birthday { grid-area: birthday; grid-template-columns: minmax(0, 1fr) minmax(220px, 1fr); align-items: end; gap: 12px; }
.customer-birth-date { min-width: 0; }
.customer-field-phone { grid-area: phone; }
.customer-field-gender { min-width: 0; margin: 0; padding: 0; border: 0; }
.customer-field-gender legend { margin-bottom: 7px; padding: 0; color: var(--text); font-size: 14px; font-weight: 500; }
.customer-gender-options { min-height: 48px; display: flex; align-items: center; gap: 24px; }
.customer-gender-options label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.customer-gender-options input { width: 18px; min-height: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--sales-primary); }
.customer-field-email { grid-area: email; }
.customer-field-facebook { grid-area: facebook; }
.customer-field-address { grid-area: address; }
.customer-field-region { grid-area: region; }
.customer-field-ward { grid-area: ward; }
.customer-field-notes { grid-area: notes; align-self: stretch; }
.customer-field-notes textarea { min-height: 122px; resize: vertical; }
.customer-form-grid > .field { grid-template-columns: minmax(110px, .8fr) minmax(0, 1.35fr); align-items: center; gap: 10px 14px; min-height: 50px; }
.customer-form-grid .field > span { font-size: 14px; font-weight: 600; }
.customer-form-grid .field input:not([type="radio"]), .customer-form-grid .field select, .customer-form-grid .field textarea { min-width: 0; min-height: 48px; border: 0; border-bottom: 1px solid #cbd5e1; border-radius: 0; padding-inline: 0; background: transparent; box-shadow: none; }
.customer-form-grid .field input:not([type="radio"]):focus, .customer-form-grid .field select:focus, .customer-form-grid .field textarea:focus { border-bottom: 2px solid var(--sales-primary); }
.customer-form-grid .field input:not([type="radio"])::placeholder, .customer-form-grid .field textarea::placeholder { color: #8995a4; opacity: 1; }
.customer-form-grid .field input[readonly] { color: #8995a4; }
.customer-form-grid .field > .field-error { grid-column: 2; }
.customer-invoice-grid { grid-template-areas: none; }
.customer-invoice-address { grid-column: 1 / -1; }
.customer-modal-actions { position: sticky; bottom: 0; z-index: 2; margin: 0; padding: 16px 32px 22px; background: var(--surface); }
.customer-modal-actions .button { min-width: 132px; min-height: 50px; font-size: 15px; }

@media (max-width: 980px) {
    .customer-general-layout { grid-template-columns: 120px minmax(0, 1fr); gap: 18px; }
    .customer-photo-preview { width: 110px; height: 110px; }
    .customer-photo-button { min-width: 110px; }
    .customer-form-grid { gap: 14px 18px; }
    .customer-form-grid > .field { grid-template-columns: minmax(88px, .75fr) minmax(0, 1.25fr); gap: 8px; }
    .customer-field-birthday { grid-template-columns: minmax(0, 1fr); }
}
.customer-management-panel { overflow: hidden; }
.customer-filter { padding: 16px; border-bottom: 1px solid var(--border); }
.customer-filter .search-field { max-width: 620px; }
.customer-record-count { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.customer-record-count strong { color: var(--text); }
.customer-table td { vertical-align: middle; }
.customer-table td strong, .customer-table td small { display: block; }
.customer-table td small { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-edit-link { color: var(--primary); font-weight: 750; text-decoration: none; }
.customer-edit-link:hover { text-decoration: underline; }
.customer-page-heading .button span { font-size: 20px; line-height: 1; }
.customer-edit-form { max-width: 1000px; display: grid; gap: 16px; }
.customer-table .customer-summary-row { cursor: default; }
.customer-summary-row[aria-expanded="true"] { background: #eff6ff; }
.customer-balance { font-weight: 750; white-space: nowrap; }
.customer-balance.is-debt { color: #b42318; }
.customer-balance.is-credit { color: #087443; }
.customer-expand-button { width: 34px; height: 34px; margin-left: 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); background: var(--surface); cursor: pointer; }
.customer-expand-button svg { width: 18px; height: 18px; vertical-align: middle; }
.customer-expand-button[aria-expanded="true"] { color: var(--primary); transform: rotate(180deg); }
.supplier-table .supplier-summary-row { cursor: pointer; }
.supplier-summary-row:hover { background: #f8fbff; }
.supplier-summary-row[aria-expanded="true"] { background: #eff6ff; }
.supplier-current-payable { font-weight: 750; white-space: nowrap; }
.supplier-current-payable.is-debt { color: #b42318; }
.supplier-detail-row > td { padding: 0 !important; background: #fff; }
.supplier-detail { border: 2px solid var(--primary); background: var(--surface); }
.supplier-profile-heading { min-height: 90px; margin-bottom: 20px; }
.supplier-debt-total { color: var(--text); white-space: nowrap; }
.supplier-ledger-table { min-width: 760px; }
.supplier-ledger-table th:nth-child(4), .supplier-ledger-table td:nth-child(4), .supplier-ledger-table th:nth-child(5), .supplier-ledger-table td:nth-child(5) { text-align: right; white-space: nowrap; }
.supplier-ledger-reference { color: var(--primary); font-weight: 650; white-space: nowrap; }
.customer-detail-row > td { padding: 0 !important; background: #fff; }
.customer-detail { border: 2px solid var(--primary); background: var(--surface); }
.customer-detail-tabs { display: flex; gap: 26px; padding: 0 22px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.customer-detail-tabs button { min-height: 48px; border: 0; border-bottom: 2px solid transparent; padding: 0 2px; color: var(--muted); background: transparent; font: inherit; font-weight: 700; white-space: nowrap; cursor: pointer; }
.customer-detail-tabs button[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.customer-detail-content { padding: 20px 24px; }
.customer-profile-heading { display: flex; align-items: center; gap: 24px; min-height: 156px; margin-bottom: 34px; }
.customer-avatar { width: 112px; height: 112px; flex: 0 0 112px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: #e8f1ff; }
.customer-avatar img { width: 100%; height: 100%; object-fit: cover; }
.customer-avatar svg { width: 78%; height: 78%; fill: #4285f4; }
.customer-profile-heading-main { min-width: 0; }
.customer-profile-name { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; }
.customer-profile-name h2 { margin: 0; font-size: 23px; letter-spacing: .06em; }
.customer-profile-name > span { color: var(--muted); }
.customer-profile-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; color: var(--muted); }
.customer-profile-meta > span + span { padding-left: 12px; border-left: 1px solid var(--border); }
.customer-profile-meta strong { color: var(--text); font-weight: 600; }
.customer-info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 28px; margin: 0 0 18px; }
.customer-info-grid div { min-width: 0; }
.customer-info-grid dt { margin-bottom: 5px; color: var(--muted); font-size: 13px; }
.customer-info-grid dd { margin: 0; overflow-wrap: anywhere; font-weight: 650; }
.customer-profile-fields { row-gap: 0; margin-bottom: 18px; }
.customer-profile-fields > div { min-height: 76px; padding: 8px 0 10px; border-bottom: 1px solid var(--border); }
.customer-profile-fields dt { margin-bottom: 8px; }
.customer-profile-fields dd { font-size: 15px; font-weight: 500; }
.customer-profile-fields dd a { color: inherit; }
.customer-profile-address { grid-column: 1 / -1; }
.customer-address-region { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; }
.customer-value-empty { color: var(--muted); }
.customer-profile-invoice { padding: 6px 0 14px; }
.customer-profile-invoice a { color: var(--primary); font-weight: 700; text-decoration: none; }
.customer-profile-invoice a:hover { text-decoration: underline; }
.customer-profile-note { display: flex; align-items: center; gap: 10px; min-height: 42px; color: var(--muted); }
.customer-profile-note > span:first-child { font-size: 19px; }
.customer-profile-actions { display: flex; justify-content: flex-end; margin: 12px -24px -20px; padding: 14px 24px; border-top: 1px solid var(--border); }
.customer-profile-actions .button { min-width: 140px; }
.customer-history-toolbar, .customer-debt-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.customer-history-toolbar label { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.customer-history-toolbar select { min-height: 40px; }
.customer-debt-summary > div { display: grid; gap: 4px; }
.customer-debt-summary span { color: var(--muted); font-size: 13px; }
.customer-debt-summary strong { font-size: 20px; }
.customer-ledger-table { width: 100%; border-collapse: collapse; }
.customer-ledger-table th { background: #f1f3f5; text-align: left; }
.customer-ledger-table th, .customer-ledger-table td { padding: 12px; border-bottom: 1px solid var(--border); }
.customer-ledger-table td:nth-last-child(-n+2), .customer-ledger-table th:nth-last-child(-n+2) { text-align: right; white-space: nowrap; }
.customer-ledger-table td.is-negative { color: #087443; }
.customer-ledger-table td[data-type="sale"] { font-weight: 650; }
.customer-order-table { width: 100%; border-collapse: collapse; }
.customer-order-table th { background: #f1f3f5; text-align: left; }
.customer-order-table th, .customer-order-table td { padding: 12px; border-bottom: 1px solid var(--border); }
.customer-order-table th:nth-child(4), .customer-order-table td:nth-child(4) { text-align: right; white-space: nowrap; }
.customer-order-number { color: var(--primary); font-weight: 650; }
.customer-order-total { font-variant-numeric: tabular-nums; }
.customer-order-status { display: inline-flex; padding: 4px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.customer-order-status.is-paid { color: #087443; background: #e8f7ef; }
.customer-order-status.is-due { color: #b45309; background: #fff2df; }
.customer-data-table { width: 100%; overflow-x: auto; }
.customer-detail-actions { display: flex; justify-content: flex-start; margin: 18px -24px -20px; padding: 14px 24px; border-top: 1px solid var(--border); }
.customer-debt-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 18px -24px -20px; padding: 14px 24px; border-top: 1px solid var(--border); }
.customer-export-actions, .customer-ledger-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.customer-ledger-actions .button { min-height: 44px; }
.customer-allocation-table { width: 100%; min-width: 870px; border-collapse: collapse; }
.customer-allocation-table th { background: #f1f3f5; text-align: left; }
.customer-allocation-table th, .customer-allocation-table td { padding: 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.customer-allocation-table th:nth-child(n+4), .customer-allocation-table td:nth-child(n+4) { text-align: right; }
.customer-allocation-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }
.supplier-payment-distribution { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.supplier-payment-distribution input { width: 18px; height: 18px; accent-color: var(--primary); }
.supplier-payment-allocation-table input[data-supplier-invoice-allocation] { width: 118px; min-height: 38px; padding: 6px 10px; text-align: right; }
.supplier-payment-allocation-table input[readonly] { background: #f1f3f5; }
.supplier-payment-allocation-table tfoot td { padding-top: 14px; border-bottom: 0; font-weight: 750; }
.customer-transaction-dialog { width: min(1120px, calc(100vw - 36px)); max-height: min(92dvh, 1120px); overflow: auto; }
.customer-transaction-dialog.customer-small-dialog { width: min(720px, calc(100vw - 36px)); }
.customer-transaction-form { display: grid; gap: 18px; padding: 0 28px 24px; }
.customer-transaction-heading { position: sticky; top: 0; z-index: 3; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin: 0 -28px; padding: 22px 28px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.customer-transaction-heading h2 { margin: 0; font-size: 24px; }
.customer-transaction-heading p { margin: 6px 0 0; color: var(--muted); }
.customer-transaction-heading p strong { display: inline-block; padding: 2px 6px; border-radius: 5px; background: #fff1f0; color: #b42318; }
.customer-transaction-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 22px; }
.customer-transaction-wide { grid-column: 1 / -1; }
.customer-payment-balance { margin: -9px 0 0; grid-column: 1 / -1; color: var(--muted); text-align: right; }
.customer-allocation-toggle { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.customer-allocation-toggle input { width: 18px; height: 18px; accent-color: var(--primary); }
.customer-payment-allocation { max-height: 280px; overflow: auto; }
.customer-unallocated { display: flex; justify-content: flex-end; gap: 20px; font-weight: 650; }
.customer-transaction-actions { position: sticky; bottom: -24px; z-index: 2; display: flex; justify-content: flex-end; gap: 10px; margin: 0 -28px; padding: 16px 28px 0; border-top: 1px solid var(--border); background: var(--surface); }
.customer-transaction-actions .button { min-height: 46px; }
.customer-qr-preview { display: grid; justify-items: center; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; }
.customer-qr-preview img { width: min(360px, 100%); aspect-ratio: 1; object-fit: contain; }
.customer-detail-content .muted { margin-top: 12px; }
@media (max-width: 820px) {
    .customer-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .customer-detail-content { padding: 16px; }
    .customer-profile-heading { min-height: 0; gap: 16px; margin-bottom: 22px; }
    .customer-avatar { width: 84px; height: 84px; flex-basis: 84px; }
    .customer-profile-name h2 { font-size: 19px; }
    .customer-profile-actions { margin: 12px -16px -16px; padding-inline: 16px; }
    .customer-history-toolbar, .customer-debt-summary { align-items: flex-start; flex-direction: column; }
    .customer-ledger-table, .customer-order-table { min-width: 720px; }
    .customer-debt-actions { align-items: flex-start; flex-direction: column; margin-inline: -16px; padding-inline: 16px; }
    [data-customer-history-table], [data-customer-orders-table], [data-customer-order-history-table], [data-customer-debt-table] { overflow-x: auto; }
    .customer-transaction-form { padding-inline: 18px; }
    .customer-transaction-heading { margin-inline: -18px; padding-inline: 18px; }
    .customer-transaction-actions { align-items: stretch; flex-wrap: wrap; margin-inline: -18px; padding-inline: 18px; }
}
@media (max-width: 560px) {
    .customer-info-grid, .customer-profile-fields { grid-template-columns: minmax(0, 1fr); }
    .customer-profile-address { grid-column: auto; }
    .customer-profile-meta { gap: 6px; margin-top: 9px; font-size: 13px; }
    .customer-profile-meta > span + span { padding-left: 0; border-left: 0; }
    .customer-transaction-grid { grid-template-columns: minmax(0, 1fr); }
    .customer-transaction-wide, .customer-payment-balance { grid-column: auto; }
    .customer-transaction-heading h2 { font-size: 20px; }
    .customer-transaction-actions .button { flex: 1 1 100%; }
    .customer-ledger-actions, .customer-export-actions { width: 100%; }
}

@media (max-width: 1080px) {
    .sales-workspace { grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr); }
    .sales-cart-footer { gap: 12px; padding-inline: 12px; }
    .sales-cart-total { min-width: 155px; }
    .sales-catalog { padding-inline: 12px; }
}

@media (max-width: 820px) {
    .sales-workspace { height: auto; min-height: 100dvh; grid-template-columns: minmax(0, 1fr); }
    .sales-workspace[data-mode="quick"] { grid-template-columns: minmax(0, 1fr); }
    .sales-main { height: auto; overflow: visible; }
    .sales-main { min-height: 58dvh; }
    .sales-cart-scroll { min-height: 220px; }
    .sales-catalog { position: relative; top: auto; height: auto; min-height: 560px; border-top: 1px solid #e2e8f0; border-left: 0; border-radius: 0; }
    .sales-main { min-height: calc(58dvh - 54px); }
    .sales-product-list { min-height: 260px; max-height: 44dvh; }
    .sales-payment-panel.is-quick { width: min(100vw, 600px); }
    .sales-workspace[data-mode="quick"] .sales-payment-panel.is-quick { width: min(100vw, 600px); }
    .sales-workspace[data-mode="quick"] .sales-product-list { width: min(560px, calc(100vw - 28px)); }
}

@media (max-width: 560px) {
    body.sales-entry-page .topbar { min-height: 64px; }
    body.sales-entry-page .page-content { padding: 0; }
    .sales-workspace { min-height: 100dvh; }
    .sales-main { min-height: 58dvh; }
    .sales-toolbar { top: 0; min-height: 58px; flex-wrap: wrap; gap: 7px; padding: 7px 9px; }
    .sales-toolbar h1 { font-size: 17px; }
    .sales-invoice-label { padding: 6px 8px; font-size: 11px; }
    .sales-date { width: 144px; font-size: 10px; }
    .sales-global-product-search { min-width: 100%; max-width: none; flex-basis: 100%; order: 5; }
    .sales-workspace[data-mode="quick"] .sales-toolbar { min-height: 62px; flex-wrap: nowrap; }
    .sales-workspace[data-mode="quick"] .sales-main { padding-top: 62px; }
    .sales-workspace[data-mode="quick"] .sales-global-product-search { width: min(560px, 58vw); min-width: 0; max-width: none; flex: 1 1 auto; order: 1; }
    .sales-workspace[data-mode="quick"] .sales-invoice-label { order: 2; }
    .sales-workspace[data-mode="quick"] .sales-product-list { top: 66px; width: min(560px, calc(100vw - 28px)); }
    .sales-cart-scroll { padding: 9px; }
    .sales-cart-footer { align-items: stretch; flex-direction: column; margin: 0 9px 9px; }
    .sales-cart-total { grid-template-columns: 1fr auto; }
    .sales-catalog { min-height: 540px; padding: 12px 10px; }
    .sales-customer-fields { grid-template-columns: minmax(0, 1fr); }
    .sales-product-list { grid-template-columns: minmax(0, 1fr); }
    .sales-mode-switch { padding-inline: 6px; }
    .sales-mode-switch button { min-width: 0; flex: 1; padding-inline: 6px; font-size: 12px; }
    .sales-payment-panel, .sales-payment-panel.is-quick { inset: 0; width: 100vw; border-radius: 0; }
    .sales-workspace[data-mode="quick"] .sales-payment-panel.is-quick { top: 62px; right: 0; bottom: 54px; width: 100vw; border-radius: 0; }
    .sales-payment-scroll { padding: 14px 16px; }
    .sales-payment-footer { padding: 12px 16px 18px; }
    .modal-dialog-customer { width: calc(100vw - 20px); max-height: 94dvh; border-radius: 16px; }
    .modal-dialog-customer .modal-heading { min-height: 62px; padding: 12px 18px 8px; }
    .customer-modal-title { gap: 8px; }
    .customer-modal-title h2 { font-size: 19px; }
    .customer-modal-title p { font-size: 12px; }
    .customer-modal-tabs { top: 62px; gap: 18px; padding-inline: 18px; }
    .customer-modal-tabs button { min-height: 48px; font-size: 13px; }
    .customer-modal-panel { min-height: 0; padding: 16px 18px 10px; }
    .customer-general-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
    .customer-photo-picker { grid-template-columns: 70px auto; justify-content: start; justify-items: start; align-items: center; gap: 5px 12px; }
    .customer-photo-preview { width: 70px; height: 70px; grid-row: span 2; }
    .customer-photo-preview svg { width: 32px; height: 32px; }
    .customer-photo-button { min-width: 116px; min-height: 38px; }
    .customer-photo-help { text-align: left; }
    .customer-form-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; gap: 14px; }
    .customer-form-grid > .field, .customer-form-grid > fieldset { grid-area: auto; }
    .customer-form-grid > .field { grid-template-columns: minmax(0, 1fr); gap: 7px; }
    .customer-form-grid .field > .field-error { grid-column: auto; }
    .customer-field-birthday { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .customer-invoice-address { grid-column: auto; }
    .customer-modal-actions { padding: 12px 18px 16px; }
    .customer-modal-actions .button { min-width: 110px; }
    .customer-filter { align-items: stretch; flex-wrap: wrap; }
    .customer-filter .search-field { max-width: none; }
    .customer-record-count { width: 100%; margin-left: 0; }
}

@media (max-width: 1080px) {
    .purchase-workspace { grid-template-columns: minmax(0, 1fr) 340px; }
    .purchase-summary { padding-inline: 13px; }
    .purchase-summary-actions { margin-inline: -13px; padding-inline: 13px; }
    .purchase-toolbar { gap: 8px; padding-inline: 12px; }
    .purchase-toolbar h1 { font-size: 19px; }
}

@media (max-width: 820px) {
    .purchase-workspace { grid-template-columns: minmax(0, 1fr); }
    .purchase-main { min-height: 56dvh; }
    .purchase-summary { position: relative; top: auto; height: auto; min-height: 0; overflow: visible; border-top: 1px solid var(--border); border-left: 0; }
    .purchase-summary-actions { position: sticky; bottom: 0; z-index: 10; }
}

@media (max-width: 560px) {
    body.purchase-entry-page .topbar { display: none !important; }
    body.purchase-entry-page .page-content { padding: 0; }
    .purchase-workspace { min-height: 100dvh; }
    .purchase-main { min-height: 52dvh; }
    .purchase-toolbar { top: 0; min-height: 60px; flex-wrap: wrap; gap: 5px 8px; padding: 8px 10px; }
    .purchase-toolbar h1 { font-size: 18px; }
    .purchase-toolbar-spacer { display: none; }
    .purchase-search-wrap { order: 2; width: 100%; flex: 1 0 100%; }
    .purchase-quiet-link { margin-left: auto; }
    .purchase-product-list { width: min(100%, calc(100vw - 20px)); grid-template-columns: minmax(0, 1fr); }
    .purchase-group-picker { right: 0; }
    .purchase-pos-table { min-width: 900px; }
    .purchase-summary { gap: 13px; padding: 14px 12px 0; }
    .purchase-summary-actions { margin-inline: -12px; padding-inline: 12px; }
    .purchase-date { width: 155px; font-size: 11px; }
}

.inventory-total { min-width: 220px; display: grid; padding: 12px 16px; border-left: 3px solid var(--info); background: #f0f9ff; }
.inventory-total span { color: var(--muted); font-size: 11px; font-weight: 700; }
.inventory-total strong { color: #075985; font-size: 20px; font-variant-numeric: tabular-nums; }
.filter-panel { margin-bottom: 16px; padding: 14px; }
.purchase-index-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.purchase-imei-trigger { display: grid; gap: 3px; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.purchase-imei-trigger strong { color: var(--primary-strong); }
.purchase-imei-trigger:hover strong, .purchase-imei-trigger:focus-visible strong { text-decoration: underline; text-underline-offset: 3px; }
.purchase-imei-trigger:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 4px; }
.purchase-imei-dialog { width: min(720px, calc(100vw - 32px)); }
.purchase-imei-dialog .modal-heading { position: sticky; top: 0; z-index: 2; padding-bottom: 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.purchase-imei-content { display: grid; gap: 14px; padding: 18px 30px 26px; }
.purchase-imei-dialog .purchase-imei-list { display: grid; gap: 8px; max-height: min(58dvh, 560px); overflow: auto; }
.purchase-imei-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.purchase-imei-row > div { min-width: 0; display: grid; gap: 3px; }
.purchase-imei-number { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; overflow-wrap: anywhere; }
.purchase-imei-row small { color: var(--muted); font-size: 12px; }
.purchase-imei-status { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; background: #f1f5f9; color: var(--muted); font-size: 12px; font-weight: 750; }
.purchase-imei-status.is-in_stock { background: #dcfce7; color: #166534; }
.purchase-imei-status.is-sold { background: #dbeafe; color: #1d4ed8; }
.purchase-imei-status.is-returned { background: #fef3c7; color: #92400e; }
.purchase-imei-dialog .purchase-imei-feedback { margin: 0; color: var(--muted); font-size: 13px; }
.purchase-imei-dialog .purchase-imei-feedback.is-error { color: var(--danger); }
.purchase-imei-actions { display: flex; justify-content: center; }
.filter-form { display: flex; align-items: center; gap: 10px; }
.search-field { position: relative; flex: 1; max-width: 480px; }
.search-field svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search-field input { padding-left: 39px; }
.select-compact { width: 180px; }

.debt-section { margin-top: 26px; }
.debt-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.debt-card { min-width: 0; padding: 17px; }
.debt-card-head, .debt-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.debt-card-head > div { min-width: 0; display: grid; }
.debt-card-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.debt-card-head small, .debt-meta { color: var(--muted); font-size: 11px; }
.debt-amount { display: grid; gap: 2px; margin: 16px 0; padding: 13px; border-radius: var(--radius-sm); background: #fff7ed; }
.debt-amount span { color: var(--warning); font-size: 11px; font-weight: 750; }
.debt-amount strong { color: #9a3412; font-size: 22px; font-variant-numeric: tabular-nums; }
.payment-details { margin-top: 15px; border-top: 1px solid var(--border); }
.payment-details summary { min-height: 44px; display: flex; align-items: center; color: var(--primary-strong); font-size: 12px; font-weight: 800; cursor: pointer; }
.payment-details[open] summary { margin-bottom: 12px; }

.period-form select { min-width: 190px; font-weight: 700; }
.report-list { display: grid; }
.report-list > div { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.report-list > div:last-child { border-bottom: 0; }
.report-list span { min-width: 0; display: grid; }
.report-list strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.report-list small { color: var(--muted); font-size: 10px; }
.align-right { text-align: right; }

.report-heading { align-items: flex-start; gap: 24px; margin-bottom: 22px; }
.report-heading > div { min-width: 260px; }
.report-filter { width: min(680px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.report-filter label { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 750; }
.report-filter input { width: 100%; min-height: 42px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); background: white; font: inherit; }
.report-filter input:focus { outline: 0; border-color: var(--primary); box-shadow: var(--focus); }
.report-filter .button { min-height: 42px; padding-inline: 14px; white-space: nowrap; }
.report-presets { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 7px; }
.report-presets a { padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: var(--surface-soft); font-size: 11px; font-weight: 750; text-decoration: none; }
.report-presets a:hover { border-color: var(--primary); color: var(--primary-strong); }
.report-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.report-stats .stat-card { min-height: 112px; }
.report-trend-panel { overflow: hidden; margin-bottom: 18px; }
.report-net-total { color: var(--primary-strong); font-size: 14px; white-space: nowrap; }
.report-trend { min-height: 240px; display: grid; grid-auto-columns: minmax(28px, 1fr); grid-auto-flow: column; align-items: stretch; gap: 6px; overflow-x: auto; padding: 22px 20px 8px; }
.report-trend-column { min-width: 28px; display: grid; grid-template-rows: 1fr 22px; align-items: end; gap: 7px; text-align: center; }
.report-trend-bars { height: 100%; min-height: 180px; display: flex; align-items: end; justify-content: center; gap: 3px; border-bottom: 1px solid var(--border); }
.report-trend-bars i { width: min(15px, 42%); height: var(--bar-height); min-height: 2px; border-radius: 4px 4px 0 0; }
.report-trend-bars .trend-sale, .report-chart-legend .trend-sale { background: #10b981; }
.report-trend-bars .trend-return, .report-chart-legend .trend-return { background: #f59e0b; }
.report-trend-column small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.report-chart-legend { display: flex; justify-content: center; gap: 18px; padding: 9px 14px 15px; color: var(--muted); font-size: 11px; }
.report-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.report-chart-legend i { width: 9px; height: 9px; border-radius: 2px; }
.report-detail-grid { grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); margin-bottom: 18px; }
.report-detail-grid .panel, .report-invoices { min-width: 0; overflow: hidden; }
.report-invoices { margin-bottom: 20px; }
.report-invoices .panel-heading > div + strong, .report-detail-grid .panel-heading > strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
.report-category-panel .report-list > div { min-height: 58px; }
.report-invoices td, .report-detail-grid td { white-space: nowrap; }
.report-invoices td:first-child, .report-detail-grid td:first-child { white-space: normal; }
.report-invoices td strong { font-size: 12px; }

@media (max-width: 1180px) {
    .report-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .report-detail-grid { grid-template-columns: 1fr; }
    .report-heading { align-items: stretch; flex-direction: column; }
}

@media (max-width: 640px) {
    .report-filter { grid-template-columns: 1fr 1fr; }
    .report-filter .button { grid-column: 1 / -1; }
    .report-stats { grid-template-columns: 1fr; }
    .report-trend { min-height: 210px; padding-inline: 12px; }
    .report-trend-bars { min-height: 155px; }
    .report-net-total { font-size: 12px; }
    .report-invoices .panel-heading, .report-detail-grid .panel-heading { align-items: flex-start; }
}

.auth-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: #eef4f1; }
.login-card { width: min(430px, 100%); padding: 30px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: white; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.login-brand > div { display: grid; }
.login-brand > div strong { font-size: 16px; }
.login-brand > div span { color: var(--muted); font-size: 12px; }
.login-heading h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -.035em; }
.login-heading p { margin: 0 0 22px; color: var(--muted); }
.stack-form { display: grid; gap: 16px; }
.check-field { min-height: 32px; display: flex; align-items: center; gap: 9px; font-size: 13px; cursor: pointer; }
.check-field input { width: 18px; height: 18px; accent-color: var(--primary); }

.sidebar-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(15, 23, 42, .52); }

@media (max-width: 1180px) {
    .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .debt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    .sidebar.open { transform: translateX(0); }
    .main-column { margin-left: 0; }
    .topbar {
        position: sticky;
        top: 0;
        z-index: 30;
        min-height: 54px;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 0 16px;
        border-bottom: 1px solid var(--border);
        background: rgba(255, 255, 255, .96);
    }
    .menu-button { display: inline-flex; align-items: center; justify-content: center; color: var(--text); }
    .topbar-title strong { font-size: 16px; }
    .content-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    body { font-size: 16px; }
    .topbar { min-height: 52px; padding: 0 14px; }
    .page-content { padding: 20px 14px; }
    .page-heading, .page-heading.compact { align-items: stretch; flex-direction: column; gap: 15px; }
    .page-heading h1 { font-size: 26px; }
    .heading-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .stats-grid, .stats-grid.stats-two { grid-template-columns: 1fr; }
    .stat-card { padding: 16px; }
    .bar-chart { gap: 7px; padding-inline: 12px; }
    .bar-value { font-size: 9px; }
    .form-card { padding: 17px; }
    .form-grid, .payment-form { grid-template-columns: 1fr; }
    .field-wide { grid-column: auto; }
    .form-actions { position: sticky; bottom: 0; z-index: 20; padding: 12px 0; background: var(--background); }
    .form-actions .button { flex: 1; }
    .product-form-actions { align-items: stretch; flex-direction: column; }
    .form-action-buttons { width: 100%; }
    .modal-dialog { width: calc(100vw - 20px); max-height: 92dvh; border-radius: 16px; }
    .modal-heading { padding: 20px 20px 8px; }
    .modal-heading h2 { font-size: 22px; }
    .modal-form { padding: 14px 20px 0; }
    .quick-product-grid { grid-template-columns: minmax(0, 1fr); }
    .quick-product-wide { grid-column: auto; }
    .quick-product-active { padding-inline: 20px; }
    .modal-actions { margin-inline: -20px; padding: 14px 20px 18px; }
    .filter-form { align-items: stretch; flex-direction: column; }
    .search-field, .select-compact { width: 100%; max-width: none; }
    .debt-grid { grid-template-columns: 1fr; }
    .inventory-total { min-width: 0; }
    .period-form select { width: 100%; }
    .login-card { padding: 24px 20px; }
}

@media (max-width: 760px) {
    .purchase-catalog-toolbar { grid-template-columns: 1fr; }
    .purchase-add-product { width: 100%; }
    .purchase-product-list { grid-template-columns: 1fr; max-height: 300px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Cashbook ledger: compact filters, period totals, and expandable transaction details. */
.cashbook-page { min-width: 0; }
.cashbook-toolbar { display: grid; grid-template-columns: auto minmax(220px, 1fr) auto; align-items: center; gap: 20px; margin-bottom: 15px; }
.cashbook-toolbar h1 { margin: 0; font-size: 23px; letter-spacing: -.025em; }
.cashbook-actions .button-outline { border-color: var(--primary); color: var(--primary-strong); background: var(--surface); }
.cashbook-actions .button-outline:hover { background: var(--primary-soft); }
.cashbook-search { display: flex; gap: 8px; min-width: 0; }
.cashbook-search .search-field { max-width: 620px; }
.cashbook-actions { display: flex; align-items: center; gap: 8px; }
.cashbook-actions .button { white-space: nowrap; }
.cashbook-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 14px; align-items: start; }
.cashbook-filters { position: sticky; top: 16px; display: grid; gap: 20px; padding: 17px; }
.cashbook-filters fieldset { display: grid; gap: 11px; margin: 0; padding: 0; border: 0; }
.cashbook-filters legend { margin-bottom: 11px; font-size: 14px; font-weight: 800; }
.cashbook-choice { min-height: 28px; display: flex; align-items: center; gap: 9px; cursor: pointer; }
.cashbook-choice input { width: 17px; height: 17px; margin: 0; accent-color: var(--primary); }
.cashbook-date-fields { display: grid; gap: 9px; padding-left: 26px; }
.cashbook-date-fields[hidden] { display: none; }
.cashbook-date-fields label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.cashbook-date-fields input { min-width: 0; padding: 8px; }
.cashbook-reset { justify-self: center; color: var(--muted); font-size: 12px; }
.cashbook-main { display: grid; gap: 14px; min-width: 0; }
.cashbook-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 18px 20px; }
.cashbook-summary > div { display: grid; gap: 6px; justify-items: end; padding-inline: 12px; }
.cashbook-summary > div > span { color: var(--muted); font-size: 13px; font-weight: 650; }
.cashbook-summary strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.cashbook-income, .cashbook-balance { color: #16a34a; }
.cashbook-expense { color: #dc2626; }
.cashbook-list { min-width: 0; padding: 0; overflow: hidden; }
.cashbook-list .table-wrap { overflow-x: auto; }

body.supplier-return-entry-page { background: #f8fafc; }
input[data-money-input] { text-align: right; font-variant-numeric: tabular-nums; }

/* Customer return list and invoice based return workspace. */
.customer-return-heading, .customer-return-heading-actions { display:flex; align-items:center; justify-content:space-between; gap:14px; }
.customer-return-heading-actions { flex-wrap:wrap; }
.customer-return-filters, .customer-return-invoice-filters { display:flex; align-items:center; gap:12px; flex-wrap:wrap; padding:16px; margin-bottom:18px; }
.customer-return-filters select, .customer-return-filters input, .customer-return-invoice-filters input { min-height:44px; border:1px solid var(--border, #d5dce5); border-radius:9px; padding:0 12px; background:#fff; color:var(--text, #172033); }
.customer-return-search { display:flex; align-items:center; gap:10px; min-width:min(440px, 100%); flex:1; min-height:44px; border:1px solid var(--border, #d5dce5); border-radius:9px; padding:0 12px; background:#fff; }
.customer-return-search input { width:100%; min-width:0; min-height:40px; border:0; outline:0; background:transparent; }
.customer-return-invoice { display:block; color:#64748b; font-size:.82em; margin-top:3px; }
.customer-return-empty { min-height:360px; }
.customer-return-workspace { display:grid; grid-template-columns:minmax(0, 1fr) minmax(300px, 360px); align-items:stretch; gap:18px; }
.customer-return-main, .customer-return-summary { min-width:0; border:1px solid var(--border, #d5dce5); border-radius:12px; background:#fff; }
.customer-return-main { overflow:hidden; }
.customer-return-toolbar { display:flex; align-items:center; gap:12px; padding:14px 16px; border-bottom:1px solid var(--border, #d5dce5); }
.customer-return-toolbar h1 { margin:0; white-space:nowrap; font-size:1.35rem; }
.customer-return-toolbar .customer-return-search { min-width:160px; }
.customer-return-invoice-banner { display:flex; flex-wrap:wrap; align-items:center; gap:10px 18px; padding:12px 16px; background:#f1f7ff; color:#334155; }
.customer-return-invoice-banner strong, .customer-return-source strong { color:#0875f5; }
.customer-return-lines-wrap { overflow:auto; border:0; border-radius:0; }
.customer-return-lines-table { width:100%; min-width:1380px; table-layout:fixed; }
.customer-return-lines-table td, .customer-return-lines-table th { vertical-align:middle; }
.customer-return-lines-table th { white-space:normal; line-height:1.3; text-align:center; }
.customer-return-lines-table td:first-child, .customer-return-lines-table th:first-child { width:4%; text-align:center; }
.customer-return-lines-table th:nth-child(2), .customer-return-lines-table td:nth-child(2) { width:4%; }
.customer-return-lines-table th:nth-child(3), .customer-return-lines-table td:nth-child(3) { width:9%; }
.customer-return-lines-table th:nth-child(4), .customer-return-lines-table td:nth-child(4) { width:30%; }
.customer-return-lines-table th:nth-child(5), .customer-return-lines-table td:nth-child(5) { width:5%; }
.customer-return-lines-table th:nth-child(6), .customer-return-lines-table td:nth-child(6) { width:7%; }
.customer-return-lines-table th:nth-child(7), .customer-return-lines-table td:nth-child(7) { width:8%; min-width:120px; }
.customer-return-lines-table th:nth-child(8), .customer-return-lines-table td:nth-child(8) { width:9%; min-width:130px; }
.customer-return-lines-table th:nth-child(9), .customer-return-lines-table td:nth-child(9) { width:12%; min-width:150px; }
.customer-return-lines-table th:nth-child(10), .customer-return-lines-table td:nth-child(10) { width:12%; white-space:nowrap; }
.customer-return-lines-table td:first-child input { width:18px; height:18px; }
.customer-return-lines-table tr[hidden] { display:none; }
.customer-return-lines-table .customer-return-price { width:120px; min-height:38px; border:1px solid #cbd5e1; border-radius:8px; padding:0 8px; }
.customer-return-lines-table .customer-return-quantity { width:78px; min-height:38px; border:1px solid #cbd5e1; border-radius:8px; padding:0 8px; text-align:center; }
.customer-return-lines-table input:disabled { opacity:.55; }
.customer-return-imei-picker { margin-top:6px; }
.customer-return-imei-picker summary { width:max-content; max-width:100%; color:#0875f5; cursor:pointer; font-size:.86rem; }
.customer-return-imei-options { display:flex; flex-wrap:wrap; gap:6px; max-width:460px; padding-top:8px; }
.customer-return-imei-options label, .customer-return-imei-unavailable { display:inline-flex; align-items:center; gap:6px; padding:5px 8px; border:1px solid #dbe3ed; border-radius:7px; background:#fff; font-size:.82rem; }
.customer-return-imei-options input { width:16px; height:16px; }
.customer-return-imei-unavailable { color:#94a3b8; background:#f8fafc; }
.customer-return-unavailable { display:block; color:#9a3412; font-size:.82em; }
.customer-return-note { display:block; padding:14px 16px; }
.customer-return-note textarea { width:100%; border:1px solid #cbd5e1; border-radius:9px; padding:10px 12px; resize:vertical; }
.customer-return-summary { display:flex; flex-direction:column; gap:14px; padding:16px; }
.customer-return-summary-header { display:grid; grid-template-columns:1fr auto; gap:10px; align-items:center; padding-bottom:12px; border-bottom:1px solid #e2e8f0; }
.customer-return-summary-header input { max-width:190px; min-height:38px; border:1px solid #cbd5e1; border-radius:8px; padding:0 8px; }
.customer-return-customer, .customer-return-source { display:grid; gap:4px; }
.customer-return-customer span, .customer-return-source span, .customer-return-money-field span { color:#64748b; font-size:.9rem; }
.customer-return-summary .field { display:grid; gap:6px; margin:0; }
.customer-return-summary select, .customer-return-summary .customer-return-money-field input { width:100%; min-height:40px; border:1px solid #cbd5e1; border-radius:8px; padding:0 10px; background:#fff; }
.customer-return-method strong { display:flex; align-items:center; width:100%; min-height:40px; padding:0 10px; border:1px solid #cbd5e1; border-radius:8px; background:#fff; font-weight:500; }
.customer-return-total-row, .customer-return-due { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.customer-return-total-row span { color:#475569; }
.customer-return-due { padding-top:10px; border-top:1px solid #e2e8f0; font-size:1.06rem; font-weight:700; }
.customer-return-due strong { color:#0875f5; }
.customer-return-paid input { text-align:right; }
.customer-return-credit { margin:0; color:#64748b; text-align:right; }
.customer-return-submit { width:100%; min-height:48px; margin-top:auto; font-weight:700; }
.customer-return-invoice-panel { overflow:hidden; }
.customer-return-detail-summary, .customer-return-detail-totals { display:grid; grid-template-columns:repeat(auto-fit, minmax(180px, 1fr)); gap:16px; padding:18px; margin-bottom:16px; }
.customer-return-detail-summary > div, .customer-return-detail-totals > div { display:grid; gap:5px; }
.customer-return-detail-summary span, .customer-return-detail-totals span { color:#64748b; font-size:.9rem; }
.customer-return-detail-note { grid-column:1 / -1; }
@media (max-width:1050px) {
    .customer-return-workspace { grid-template-columns:1fr; }
    .customer-return-summary { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); }
    .customer-return-summary-header, .customer-return-customer, .customer-return-source, .customer-return-submit { grid-column:1 / -1; }
}
@media (max-width:650px) {
    .customer-return-heading, .customer-return-toolbar { align-items:stretch; flex-direction:column; }
    .customer-return-filters > *, .customer-return-invoice-filters > * { width:100%; }
    .customer-return-search { min-width:0; }
    .customer-return-summary { grid-template-columns:1fr; }
    .customer-return-summary-header, .customer-return-customer, .customer-return-source, .customer-return-submit { grid-column:auto; }
}
body.supplier-return-entry-page .sidebar, body.supplier-return-entry-page .topbar { display: none !important; }
body.supplier-return-entry-page .main-column { margin-left: 0 !important; }
body.supplier-return-entry-page .page-content { width: 100%; max-width: none; padding: 0; }
.supplier-return-workspace { grid-template-columns: minmax(0, 1fr) minmax(360px, 410px); }
.supplier-return-toolbar { gap: 10px; }
.supplier-return-toolbar h1 { white-space: nowrap; }
.supplier-return-search-wrap { flex: 1 1 420px; width: auto; }
.supplier-return-search-wrap > span { color: #64748b; font-size: 24px; }
.supplier-return-import { min-height: 40px; padding: 0 11px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.supplier-return-table { min-width: 1180px; }
.supplier-return-table td:nth-child(5) { min-width: 140px; }
.supplier-return-table td:nth-child(5) input { text-align: left; }
.supplier-return-table td:nth-child(6) { min-width: 54px; text-align: center; }
.supplier-return-table td:nth-child(7) input { max-width: 94px; }
.supplier-return-table td:nth-child(9) input { max-width: 140px; }
.return-line-remove { width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 7px; background: white; color: var(--danger); font-size: 19px; cursor: pointer; }
.return-line-remove:hover { border-color: var(--danger); background: #fff7f7; }
.supplier-return-feedback { min-height: 0; padding: 0 18px; color: var(--muted); font-size: 12px; }
.supplier-return-feedback:empty { display: none; }
.supplier-return-feedback.is-error { color: var(--danger); }
.supplier-return-current-debt { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.supplier-return-current-debt strong { color: var(--text); font-variant-numeric: tabular-nums; }
.supplier-return-summary .purchase-totals { gap: 14px; }
.supplier-return-summary .purchase-grand-total strong { color: var(--primary); }
.supplier-return-summary .purchase-debt-row strong { color: var(--info); }
.supplier-return-discount, .supplier-return-refund { margin: 0; }
.supplier-return-actions { grid-template-columns: 1fr 1fr; }
.supplier-return-workspace .purchase-product-list { z-index: 40; }
.return-imei-trigger { min-height: 38px; padding: 0; border: 0; background: transparent; color: var(--primary); font: inherit; font-weight: 650; cursor: pointer; white-space: nowrap; }
.return-imei-trigger:hover { color: var(--primary-strong); text-decoration: underline; }
.return-imei-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.return-imei-tags:empty { display: none; }
.return-imei-dialog { width: min(1100px, calc(100vw - 32px)); max-height: min(90dvh, 780px); overflow: hidden; }
.return-imei-dialog .modal-heading { padding: 26px 30px 16px; }
.return-imei-content { display: grid; gap: 20px; padding: 18px 30px 28px; }
.return-imei-search { min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 16px; border: 1.5px solid var(--primary); border-radius: 12px; }
.return-imei-search > span { color: var(--muted); font-size: 26px; }
.return-imei-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 18px; }
.return-imei-options { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 12px; max-height: min(46dvh, 440px); overflow: auto; padding: 2px; }
.return-imei-option { min-height: 48px; padding: 8px 18px; border: 1.5px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-weight: 650; cursor: pointer; }
.return-imei-option:hover { border-color: var(--primary); color: var(--primary); }
.return-imei-option.is-selected { border-color: var(--primary); background: #eff6ff; color: var(--primary-strong); }
.return-imei-option:disabled { opacity: .42; cursor: not-allowed; }
.return-imei-empty { margin: 0; padding: 24px 8px; color: var(--muted); text-align: center; }
.return-imei-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 30px 22px; border-top: 1px solid var(--border); }
.return-imei-select-all { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.return-imei-select-all input { width: 18px; height: 18px; accent-color: var(--primary); }
.return-imei-actions { display: flex; gap: 10px; }
.return-imei-actions .button { min-width: 120px; min-height: 48px; }
@media (max-width: 600px) {
    .return-imei-dialog { width: calc(100vw - 20px); border-radius: 16px; }
    .return-imei-dialog .modal-heading { padding: 18px 20px 12px; }
    .return-imei-content { padding: 12px 20px 20px; }
    .return-imei-footer { align-items: flex-start; padding: 14px 20px 18px; }
    .return-imei-actions { flex-wrap: wrap; justify-content: flex-end; }
    .return-imei-actions .button { min-width: 96px; }
}
@media print {
    body.supplier-return-entry-page .sidebar, body.supplier-return-entry-page .topbar,
    .supplier-return-toolbar, .supplier-return-summary, .supplier-return-feedback,
    .return-line-remove, .supplier-return-search-wrap { display: none !important; }
    body.supplier-return-entry-page .page-content { padding: 0; }
    .supplier-return-workspace, .supplier-return-workspace .purchase-main { display: block; width: 100%; height: auto; max-height: none; overflow: visible; }
    .supplier-return-table { min-width: 0; }
}

/* Product list rows expand in place to keep catalog context visible. */
.product-list-panel { overflow-x: auto; }
.product-summary-heading { min-width: 1180px; display: grid; grid-template-columns: 26px 28px 44px minmax(110px, .8fr) minmax(170px, 1.4fr) repeat(3, minmax(78px, .55fr)) 42px minmax(120px, .9fr) 72px; align-items: center; gap: 18px; padding: 10px 18px; border-bottom: 1px solid var(--border); background: #f0f2f4; color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.25; }
.product-summary-heading span:nth-child(n+6) { text-align: right; }
.product-summary-heading span:nth-child(10) { text-align: left; }
.product-list-item { border-bottom: 1px solid var(--border); }
.product-list-item:last-of-type { border-bottom: 0; }
.product-summary { min-width: 1180px; display: grid; grid-template-columns: 26px 28px 44px minmax(110px, .8fr) minmax(170px, 1.4fr) repeat(3, minmax(78px, .55fr)) 42px minmax(120px, .9fr) 72px; align-items: center; gap: 18px; min-height: 76px; padding: 12px 18px; background: #f3f8ff; font-size: 14px; }
.product-list-item:not(.is-expanded) .product-summary { background: var(--surface); }
.product-select { display: grid; place-items: center; }
.product-select input { width: 17px; height: 17px; accent-color: var(--primary); }
.product-expand { width: 28px; height: 28px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 20px; cursor: pointer; }
.product-expand:hover, .product-list-item.is-expanded .product-expand { color: var(--primary); background: var(--primary-soft); }
.product-image { width: 40px; height: 44px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-soft); text-decoration: none; }
.product-image img { width: 100%; height: 100%; object-fit: cover; }
.product-image span, .product-overview-image span { color: var(--muted); font-size: 19px; font-weight: 800; }
.product-summary-sku, .product-summary-name, .product-summary-date { overflow: hidden; text-overflow: ellipsis; }
.product-summary-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.product-summary-number, .product-summary-link, .product-summary-age { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.product-summary-link { color: var(--primary-strong); text-decoration: none; }
.product-summary-link:hover { text-decoration: underline; }
.product-detail { border: 2px solid #1677ff; background: var(--surface); }
.product-detail-tabs { display: flex; gap: 26px; padding: 0 22px; overflow-x: auto; border-bottom: 1px solid var(--border); }
.product-detail-tabs [role="tab"] { min-height: 48px; flex: 0 0 auto; border: 0; border-bottom: 2px solid transparent; padding: 0 2px; color: var(--muted); background: transparent; font: inherit; font-weight: 700; white-space: nowrap; cursor: pointer; }
.product-detail-tabs [aria-selected="true"] { color: #1677ff; border-bottom-color: #1677ff; }
.product-detail-content { min-height: 190px; padding: 20px 22px; }
.product-overview { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 22px; }
.product-overview-image { width: 112px; height: 112px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.product-overview-image img { width: 100%; height: 100%; object-fit: contain; }
.product-overview-copy h2 { margin: 0; font-size: 19px; }
.product-overview-copy p { margin: 9px 0; color: var(--muted); }
.product-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.product-tags span, .product-pill { display: inline-flex; align-items: center; border-radius: 5px; padding: 3px 8px; background: #f0f2f4; color: var(--text); font-size: 12px; font-weight: 700; }
.product-info-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 22px; }
.product-info-grid > div { min-width: 0; display: grid; gap: 7px; padding: 7px 0 10px; border-bottom: 1px solid var(--border); }
.product-info-grid span { color: var(--muted); font-size: 13px; }
.product-info-grid strong { overflow-wrap: anywhere; font-size: 14px; font-weight: 600; }
.product-detail-content h3 { margin: 0 0 12px; font-size: 16px; }
.product-description { white-space: pre-wrap; overflow-wrap: anywhere; }
.product-detail-table { min-width: 760px; }
.product-detail-table thead { background: #f0f2f4; }
.product-detail-table th { color: var(--text); font-size: 13px; white-space: nowrap; }
.product-detail-table td { height: 52px; }
.product-detail-table .money { text-align: right; font-variant-numeric: tabular-nums; }
.serial-toolbar { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.serial-toolbar .search-field { max-width: 560px; flex: 1 1 400px; }
.serial-toolbar .select-compact { min-width: 160px; }
.serial-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding-top: 14px; }
.serial-pagination span { color: var(--muted); font-size: 13px; }
.serial-pagination button { min-height: 36px; }
.serial-pagination button:disabled { cursor: not-allowed; opacity: .55; }
.product-detail-actions { min-height: 60px; display: flex; align-items: center; gap: 10px; padding: 12px 22px; border-top: 1px solid var(--border); }
.product-detail-feedback { flex: 1; font-size: 12px; }
.product-detail-left-actions, .product-detail-right-actions { display: flex; align-items: center; gap: 8px; }
.product-detail-right-actions { margin-left: auto; }
.product-detail-actions .button { min-height: 38px; padding: 0 12px; }

@media (max-width: 820px) {
    .product-detail-content { padding: 16px; }
    .product-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; }
    .product-detail-tabs { gap: 20px; padding: 0 16px; }
    .product-detail-actions { flex-wrap: wrap; padding: 12px 16px; }
    .product-detail-feedback { flex-basis: 100%; }
    .product-detail-left-actions, .product-detail-right-actions { flex-wrap: wrap; }
    .product-detail-right-actions { margin-left: 0; }
}
@media (max-width: 560px) {
    .product-overview { gap: 12px; }
    .product-overview-image { width: 76px; height: 76px; }
    .product-overview-copy h2 { font-size: 16px; }
    .serial-toolbar { align-items: stretch; flex-direction: column; }
    .serial-toolbar .select-compact { width: 100%; }
}
.cashbook-table { min-width: 860px; }
.cashbook-table thead { background: #e7f1ff; }
.cashbook-table th { padding: 13px 14px; color: #334155; white-space: nowrap; }
.cashbook-table td { padding: 12px 14px; }
.cashbook-entry-row { transition: background-color .12s ease; }
.cashbook-entry-row:hover, .cashbook-entry-row.is-expanded { background: #f0f7ff; }
.cashbook-row-toggle { min-height: 42px; display: inline-flex; align-items: center; gap: 10px; padding: 0; border: 0; color: var(--text); background: transparent; cursor: pointer; }
.cashbook-row-toggle strong { color: var(--primary-strong); font-weight: 750; }
.cashbook-chevron { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; color: var(--muted); font-size: 17px; transition: rotate .14s ease; }
.cashbook-row-toggle[aria-expanded="true"] .cashbook-chevron { rotate: 180deg; color: var(--primary); }
.cashbook-type { white-space: nowrap; }
.cashbook-type.is-income, .cashbook-amount.is-income { color: #15803d; }
.cashbook-type.is-expense, .cashbook-amount.is-expense { color: #b91c1c; }
.cashbook-amount { white-space: nowrap; font-weight: 750; font-variant-numeric: tabular-nums; }
.cashbook-open-button { min-height: 38px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; color: #475569; background: white; cursor: pointer; }
.cashbook-open-button:hover { border-color: var(--primary); color: var(--primary); }
.cashbook-detail-row > td { padding: 0 14px 15px; border-bottom: 2px solid var(--primary); background: #f0f7ff; }
.cashbook-detail-panel { display: grid; gap: 18px; padding: 20px; border: 1px solid #cbdcf2; border-top: 0; border-radius: 0 0 10px 10px; background: white; }
.cashbook-detail-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.cashbook-detail-heading > div { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.cashbook-detail-heading strong { font-size: 17px; }
.cashbook-detail-heading > span { color: #475569; white-space: nowrap; }
.cashbook-status, .cashbook-accounting-status { padding: 5px 9px; border-radius: 6px; color: #15803d; background: #e8f8ee; font-size: 12px; font-weight: 750; }
.cashbook-accounting-status { color: #475569; background: #eef2f7; }
.cashbook-detail-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; color: #475569; }
.cashbook-detail-meta span + span { padding-left: 18px; border-left: 1px solid var(--border); }
.cashbook-detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 22px; margin: 0; }
.cashbook-detail-grid > div { min-width: 0; display: grid; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.cashbook-detail-grid .is-wide { grid-column: 1 / -1; }
.cashbook-detail-grid dt { color: var(--muted); font-size: 12px; }
.cashbook-detail-grid dd { margin: 0; overflow-wrap: anywhere; font-size: 15px; font-weight: 600; }
.cashbook-related-document { padding: 12px; border: 1px solid var(--border); border-radius: 9px; }
.cashbook-related-document summary { padding: 4px 0 12px; color: #334155; cursor: pointer; }
.cashbook-related-document table { min-width: 700px; }
.cashbook-related-document th { background: #f1f3f5; }
.cashbook-related-document a { color: var(--primary-strong); font-weight: 700; }
.cashbook-note { display: flex; align-items: center; gap: 8px; margin: 0; color: #475569; }
.cashbook-detail-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.cashbook-detail-actions > span { color: var(--muted); font-size: 12px; }
.cashbook-voucher-dialog { width: min(1060px, calc(100vw - 36px)); max-height: min(92dvh, 980px); }
.cashbook-voucher-dialog .modal-heading { padding-bottom: 6px; }
.cashbook-voucher-form { gap: 18px; padding-top: 14px; }
.cashbook-party-input { display: flex; align-items: center; }
.cashbook-party-input input { min-width: 0; flex: 1; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cashbook-party-input button { min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-left: 0; border-radius: 0 10px 10px 0; background: #f4f7f6; color: var(--muted); font-size: 24px; cursor: pointer; }
.cashbook-party-search { position: relative; display: block; }
.cashbook-customer-suggestions { position: absolute; inset: calc(100% + 4px) 0 auto; z-index: 30; display: grid; max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: 9px; background: white; box-shadow: 0 12px 28px #172b4d2b; }
.cashbook-customer-suggestions[hidden] { display: none; }
.cashbook-customer-option { display: grid; gap: 3px; min-height: 54px; padding: 9px 13px; border: 0; border-bottom: 1px solid #edf1f5; background: white; color: var(--text); text-align: left; cursor: pointer; }
.cashbook-customer-option:hover, .cashbook-customer-option:focus-visible { background: #eff6ff; }
.cashbook-customer-option small, .cashbook-customer-empty { color: var(--muted); font-size: 12px; }
.cashbook-customer-empty { padding: 13px; }
.cashbook-category-picker { position: relative; }
.cashbook-category-trigger { width: 100%; min-height: 48px; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--border); border-radius: 9px; background: white; color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.cashbook-category-trigger::after { content: '⌄'; color: var(--muted); }
.cashbook-category-menu { position: absolute; inset: calc(100% + 4px) 0 auto; z-index: 20; display: grid; gap: 8px; max-height: 360px; padding: 10px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; background: white; box-shadow: 0 14px 32px #172b4d2b; }
.cashbook-category-menu[hidden], .cashbook-category-options [hidden], [data-category-create-panel][hidden], [data-category-feedback][hidden] { display: none; }
.cashbook-category-menu > input { min-height: 44px; padding: 9px 12px; border: 1px solid var(--primary); border-radius: 8px; font: inherit; }
.cashbook-category-options { display: grid; }
.cashbook-category-options button, .cashbook-category-create > button { min-height: 46px; padding: 9px 12px; border: 0; border-radius: 6px; background: white; color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.cashbook-category-options button:hover, .cashbook-category-options button:focus-visible { background: #eff6ff; color: var(--primary); }
.cashbook-category-create { border-top: 1px solid var(--border); }
.cashbook-category-create > button { width: 100%; color: var(--primary); font-weight: 700; }
.cashbook-category-create [data-category-create-panel] { display: flex; gap: 8px; padding: 4px 2px; }
.cashbook-category-create input { min-width: 0; flex: 1; min-height: 42px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.cashbook-category-create [data-category-save] { padding: 8px 13px; border: 0; border-radius: 8px; background: var(--primary); color: white; font-weight: 700; cursor: pointer; }
.cashbook-category-create [data-category-feedback] { margin: 0; padding: 6px 2px; color: #b91c1c; font-size: 13px; }
.cashbook-voucher-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 22px; }
.cashbook-voucher-wide { grid-column: 1 / -1; }
.cashbook-voucher-form textarea { min-height: 100px; resize: vertical; }
.cashbook-payment-method { margin: 0; padding: 11px 14px; border-radius: 8px; background: var(--surface-soft); color: var(--muted); }
.cashbook-payment-method strong { color: var(--text); }
.cashbook-accounting-choice { display: flex; align-items: center; gap: 10px; min-height: 42px; font-weight: 650; cursor: pointer; }
.cashbook-accounting-choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.cashbook-voucher-form .modal-actions { position: sticky; bottom: -1px; z-index: 2; margin-top: 0; background: var(--surface); }

.badge-warning { background: #fff7ed; color: #c2410c; }
@media (max-width: 820px) {
    .supplier-return-workspace { grid-template-columns: minmax(0, 1fr); }
    .supplier-return-workspace .purchase-main { height: auto; min-height: 56dvh; }
    .supplier-return-workspace .supplier-return-summary { position: relative; top: auto; height: auto; min-height: 0; overflow: visible; border-top: 1px solid var(--border); border-left: 0; }
}
@media (max-width: 560px) {
    body.supplier-return-entry-page .page-content { padding: 0; }
    .supplier-return-workspace { height: auto; min-height: 100dvh; max-height: none; overflow: visible; }
    .supplier-return-toolbar { height: auto; min-height: 60px; flex-wrap: wrap; padding: 8px 10px; }
    .supplier-return-search-wrap { order: 2; width: 100%; flex: 1 0 100%; }
    .supplier-return-import { margin-left: auto; }
    .supplier-return-summary { gap: 13px; padding: 14px 12px 0; }
    .supplier-return-actions { margin-inline: -12px; padding-inline: 12px; }
}

@media (max-width: 1120px) {
    .cashbook-toolbar { grid-template-columns: 1fr auto; }
    .cashbook-search { grid-column: 1 / -1; grid-row: 2; }
    .cashbook-actions { grid-column: 1 / -1; grid-row: 3; }
    .cashbook-layout { grid-template-columns: 215px minmax(0, 1fr); }
    .cashbook-summary { padding-inline: 10px; }
    .cashbook-summary strong { font-size: 17px; }
}
@media (max-width: 760px) {
    .cashbook-toolbar { display: flex; align-items: stretch; flex-direction: column; gap: 12px; }
    .cashbook-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .cashbook-actions .button { justify-content: center; padding-inline: 8px; font-size: 12px; }
    .cashbook-layout { grid-template-columns: 1fr; }
    .cashbook-filters { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cashbook-filters > .button, .cashbook-reset { grid-column: 1 / -1; }
    .cashbook-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 0; }
    .cashbook-summary > div { justify-items: start; padding-inline: 10px; }
    .cashbook-detail-panel { padding: 15px; }
    .cashbook-detail-heading { align-items: flex-start; flex-direction: column; }
    .cashbook-detail-meta { display: grid; }
    .cashbook-detail-meta span + span { padding-left: 0; border-left: 0; }
    .cashbook-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cashbook-voucher-dialog { width: calc(100vw - 20px); max-height: 94dvh; }
    .cashbook-voucher-grid { grid-template-columns: 1fr; gap: 13px; }
    .cashbook-voucher-wide { grid-column: auto; }
}
