:root {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: #172b3a;
    background: #f3f6f9;
    --navy: #173f5f;
    --navy-2: #245978;
    --teal: #139b97;
    --teal-soft: #e0f3f2;
    --gold: #f4b740;
    --line: #dce5ec;
    --muted: #6c7f8e;
    --danger: #c63b48;
    --surface: #fff;
    --shadow: 0 6px 24px rgba(23, 63, 95, .08);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; background: #f3f6f9; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
h1, h2 { color: #16344b; }
h1 { margin: 0; font-size: 27px; line-height: 1.15; }
h2 { margin: 0; font-size: 20px; }
code { font-family: "Cascadia Mono", Consolas, monospace; }

.topbar {
    position: fixed; inset: 0 0 auto 0; z-index: 50; height: 68px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; color: #fff;
    background: linear-gradient(105deg, #123752, var(--navy));
    box-shadow: 0 2px 14px rgba(10, 42, 63, .25);
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.brand small { padding: 2px 6px; border: 1px solid #ffffff55; border-radius: 6px; font-size: 10px; letter-spacing: .4px; }
.brand-mark { display: inline-grid; place-items: center; width: 39px; height: 39px; border-radius: 12px; background: var(--teal); color: #fff; font-size: 14px; font-weight: 900; box-shadow: inset 0 0 0 1px #ffffff2b; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { padding: 7px 11px; border-radius: 999px; background: #ffffff14; font-size: 13px; }
.topbar form { margin: 0; }
.logout-button, .install-button { border: 0; color: #fff; cursor: pointer; }
.logout-button { width: 40px; height: 40px; border-radius: 12px; background: #ffffff10; font-size: 22px; }
.install-button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: 10px; background: var(--teal); font-weight: 700; }
.install-button[hidden] { display: none; }

.side-nav {
    position: fixed; z-index: 40; left: 0; top: 68px; bottom: 0; width: 96px;
    display: flex; flex-direction: column; gap: 7px; padding: 18px 10px;
    background: #fff; border-right: 1px solid var(--line);
}
.side-nav a { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 11px 5px; border-radius: 13px; color: #657988; text-decoration: none; font-size: 12px; font-weight: 700; }
.side-nav a:hover { background: #f0f6f8; color: var(--navy); }
.side-nav a.active { color: var(--navy); background: var(--teal-soft); box-shadow: inset 3px 0 var(--teal); }
.nav-icon { font-size: 23px; line-height: 1; }
.bottom-nav { display: none; }

.app-content { max-width: 1540px; min-height: 100vh; margin: 0 auto; padding: 98px 28px 44px; }
.login-content { min-height: 100vh; display: grid; align-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #daf0ef 0, transparent 34%), linear-gradient(145deg, #eef4f7, #dce9ee); }
.screen-title, .page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.screen-title { justify-content: flex-start; }
.screen-title .save-indicator { margin-left: auto; }
.screen-code, .page-count { color: var(--muted); font-size: 13px; }
.page-count { padding: 7px 11px; border-radius: 999px; background: #e7eef3; }

.button, button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 9px 14px; border: 1px solid #cbd8e1; border-radius: 10px; background: #fff; color: var(--navy); text-decoration: none; cursor: pointer; }
.button:hover, button:hover { border-color: #91a9b9; }
.primary { background: var(--teal); color: #fff; border-color: var(--teal); font-weight: 700; }
.primary:hover { background: #0d8985; border-color: #0d8985; }
.full { width: 100%; }
.small { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.icon-button, .icon-action, .danger-icon, .import-icon { display: inline-grid; place-items: center; text-decoration: none; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--navy); font-size: 21px; }
.icon-action { min-width: 46px; padding: 8px; font-size: 22px; }
.danger-icon { width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 10px; color: var(--danger); background: #fff1f2; border-color: #ffd5d9; font-size: 22px; }

.toast { position: relative; z-index: 5; padding: 13px 16px; margin-bottom: 18px; border-radius: 12px; box-shadow: var(--shadow); }
.toast.success, .alert.success { background: #dff7ea; color: #15633d; }
.toast.error, .alert.error { background: #ffeaec; color: #9b2732; }
.alert { padding: 12px 15px; border-radius: 10px; margin-bottom: 16px; }
.validation, .is-error { color: #b82e3b !important; }
.validation { font-size: 13px; }
.validation ul { padding-left: 18px; }

.live-search-card, .erp-panel, .form-card, .login-card { background: var(--surface); border: 1px solid #e4ebf0; border-radius: 16px; box-shadow: var(--shadow); }
.live-search-card { padding: 13px; margin-bottom: 16px; }
.live-search-card input { border: 0; background: #f4f7f9; font-size: 16px; }
.search-status, .operation-status { min-height: 18px; margin-top: 7px; color: var(--muted); font-size: 12px; }
.form-card { max-width: 680px; padding: 24px; }
.login-card { width: min(430px, 100%); margin: auto; padding: 32px; }
.login-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 28px; }
.login-brand .brand-mark { width: 52px; height: 52px; border-radius: 16px; }
.login-brand h1 { margin-bottom: 3px; }
.login-brand span:last-child { color: var(--muted); font-size: 13px; }
.install-login-button { margin-top: 10px; border-color: #bdd0dc; background: #eef5f7; color: var(--navy); font-weight: 700; }
.install-login-button[hidden] { display: none; }
.home-back { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 7px 12px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--navy); text-decoration: none; font-size: 13px; font-weight: 800; box-shadow: 0 3px 12px rgba(23, 63, 95, .05); }
.home-back span { font-size: 19px; line-height: 1; }
.home-hero { padding: 26px; margin-bottom: 18px; overflow: hidden; border-radius: 20px; background: linear-gradient(120deg, #123752, #1f6177); color: #fff; box-shadow: var(--shadow); }
.home-hero h1 { margin: 5px 0 7px; color: #fff; font-size: 31px; }
.home-hero p { margin: 0; color: #d6e7ee; }
.home-kicker { color: #6fe1db; font-size: 11px; font-weight: 900; letter-spacing: 1.4px; }
.home-menu { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.home-menu-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; min-height: 118px; padding: 19px; border: 1px solid #dfe8ee; border-radius: 18px; background: #fff; color: var(--navy); text-decoration: none; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
.home-menu-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(23, 63, 95, .13); }
.home-menu-card > span:nth-child(2) { display: grid; gap: 5px; min-width: 0; }
.home-menu-card strong { font-size: 18px; }
.home-menu-card small { color: var(--muted); line-height: 1.4; }
.home-menu-card > b { font-size: 28px; }
.home-menu-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 15px; background: var(--teal-soft); color: #087773; font-size: 27px; }
.form-card label, .login-card label { display: block; margin: 15px 0 6px; color: #314c5f; font-weight: 700; font-size: 13px; }
input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #cfdbe3; border-radius: 10px; background: #fff; color: #172b3a; outline: none; }
input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(19, 155, 151, .12); }
.check { display: flex !important; align-items: center; gap: 9px; font-weight: 500 !important; }
.check input, .select-all input, .row-check { width: 18px; height: 18px; min-height: 0; accent-color: var(--teal); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

.table-wrap { overflow: auto; background: #fff; border: 1px solid #e2e9ee; border-radius: 14px; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 12px 13px; border-bottom: 1px solid #e8eef2; text-align: left; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 2; background: #edf3f6; color: #4d6474; font-size: 11px; letter-spacing: .35px; text-transform: uppercase; }
tbody tr:hover { background: #f8fbfc; }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.row-end { text-align: right; }
.icon-column, .check-column { width: 48px; text-align: center; }
.import-icon { width: 34px; height: 34px; margin: auto; border-radius: 10px; background: var(--teal-soft); color: #087773; font-size: 21px; font-weight: 900; }
.sale-action { display: inline-flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 9px 6px 13px; border-radius: 10px; background: var(--navy); color: #fff; text-decoration: none; font-size: 13px; font-weight: 700; }
.sale-action b { font-size: 20px; }
.cari-name-balance { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.cari-name { min-width: 160px; white-space: normal; font-weight: 600; }
.balance-list { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.balance-item { display: inline-flex; gap: 4px; padding: 5px 9px; border-radius: 999px; background: #eaf1f5; color: #173f5f; font-size: 12px; }
.balance-empty { color: #8b9aa5; font-size: 12px; }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.badge.ok { background: #dcf6e8; color: #15633d; }
.badge.off { background: #e8ecef; color: #586873; }
.badge.group { background: #e3edff; color: #2856a6; }

.filter-bar { display: grid; grid-template-columns: minmax(160px, .5fr) minmax(240px, 1fr) auto; gap: 10px; margin-bottom: 12px; }
.list-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.select-all { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.button-icon { font-size: 20px; }
.stock-name-cell { max-width: 290px; overflow: hidden; text-overflow: ellipsis; }

.customer-strip { display: flex; align-items: center; width: fit-content; max-width: 100%; padding: 9px 13px; margin-bottom: 12px; border-radius: 12px; background: linear-gradient(100deg, #e1f2f2, #eef6f7); border: 1px solid #d1e8e8; }
.customer-strip > strong { overflow: hidden; color: #27495d; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.customer-strip .avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--teal); color: #fff; font-weight: 900; }
.customer-strip div:last-child { display: grid; gap: 2px; }
.customer-strip span { color: #547180; font-size: 12px; }
.save-indicator { padding: 6px 10px; border-radius: 999px; background: #e5f4eb; color: #26704b; font-size: 11px; font-weight: 800; }
.save-indicator.saving { background: #fff4d9; color: #936814; }
.panel-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: #23465d; }
.panel-icon { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; background: var(--teal-soft); color: #087773; font-size: 19px; }
.sales-workspace { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }
.erp-panel { padding: 17px; }
.scan-row { display: grid; grid-template-columns: minmax(0, 1fr) 48px auto; gap: 8px; }
.camera-action svg { width: 24px; height: 24px; fill: currentColor; }
.stock-search-button { min-width: 112px; font-weight: 750; }
.camera-view { position: relative; margin-top: 10px; }
.camera-view[hidden] { display: none; }
.scanner-panel video { display: block; width: 100%; max-height: 300px; border-radius: 12px; background: #0c1720; object-fit: cover; }
.camera-close-button { position: absolute; z-index: 2; top: 9px; right: 9px; min-height: 36px; padding: 6px 11px; border: 1px solid rgba(255,255,255,.8); border-radius: 10px; background: rgba(126, 25, 25, .9); color: #fff; font-size: 12px; font-weight: 800; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.camera-close-button span { margin-right: 3px; font-size: 18px; line-height: 0; vertical-align: -1px; }
.manual-results { display: grid; gap: 7px; max-height: 240px; overflow: auto; margin-top: 9px; }
.manual-result { display: grid; justify-content: stretch; justify-items: start; min-height: 0; padding: 10px 12px; text-align: left; border-color: #e0e8ee; }
.manual-result strong { white-space: normal; }
.manual-result span { color: var(--muted); font-size: 12px; }
.stock-search-modal { width: min(680px, calc(100% - 24px)); max-height: min(78vh, 680px); padding: 18px; border: 0; border-radius: 18px; color: #172b3a; box-shadow: 0 24px 70px rgba(8, 32, 48, .3); }
.stock-search-modal::backdrop { background: rgba(9, 31, 46, .55); backdrop-filter: blur(3px); }
.stock-search-modal .modal-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 14px; }
.stock-search-modal .manual-results { max-height: calc(78vh - 130px); }
.cart-card { padding: 0; overflow: hidden; }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 18px; border-bottom: 1px solid var(--line); }
.cart-head div { display: grid; gap: 3px; }
.cart-head span { color: var(--muted); font-size: 12px; }
.cart-badge { padding: 5px 9px; border-radius: 999px; background: #e8eef3; color: var(--navy) !important; font-weight: 800; }
.cart-table-wrap { border: 0; border-radius: 0; box-shadow: none; }
.stock-cell { display: grid; gap: 3px; min-width: 230px; }
.stock-cell span { color: var(--muted); font-size: 12px; white-space: normal; }
.price-input { min-width: 130px; background: #fffdf6; border-color: #e9d89e; }
.price-input::placeholder { color: #ac8e35; }
.empty-state { display: grid; place-items: center; gap: 6px; padding: 34px; color: #8796a1; }
.empty-state span { font-size: 32px; }
.empty-state[hidden] { display: none; }
.cart-footer { display: flex; align-items: center; justify-content: flex-end; gap: 16px; min-height: 76px; padding: 14px 18px; border-top: 1px solid var(--line); background: #f8fafb; }
.cart-footer .operation-status { flex: 1; margin: 0; }
.complete-button { min-width: 210px; }
.complete-button:disabled { opacity: .45; cursor: not-allowed; }

.selected-customer { display: grid; gap: 4px; max-width: 680px; padding: 14px 16px; margin: 15px 0; border-radius: 12px; background: var(--teal-soft); }
.selected-customer span { color: var(--muted); font-size: 11px; }
.selected-customer code { color: #087773; }
.column-map { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 14px; margin-top: 18px; border-radius: 10px; background: #f4f7f9; }
.column-map strong { grid-column: 1 / -1; }

@media (max-width: 820px) {
    body.app-shell { padding-bottom: 0; }
    .topbar { height: 60px; padding: 0 12px; padding-top: env(safe-area-inset-top); }
    .brand { font-size: 18px; }
    .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
    .user-chip { display: none; }
    .app-content { padding: calc(78px + env(safe-area-inset-top)) 12px 20px; }
    h1 { font-size: 23px; }
    .screen-title, .page-head { margin-bottom: 14px; }
    .home-menu { grid-template-columns: 1fr; }
    .customer-strip { width: 100%; }
    .filter-bar { grid-template-columns: 1fr; }
    .list-toolbar { position: sticky; top: calc(60px + env(safe-area-inset-top)); z-index: 20; padding: 8px; border-radius: 12px; background: #f3f6f9ee; backdrop-filter: blur(8px); }
    .cari-name-balance { align-items: flex-start; flex-direction: column; gap: 7px; }
    .balance-list { justify-content: flex-start; }
    .column-map { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
    .login-content { padding: 12px; }
    .login-card { padding: 24px 20px; }
    .form-card { padding: 18px 15px; }
    .mobile-table { white-space: normal; }
    .mobile-table thead { display: none; }
    .mobile-table, .mobile-table tbody, .mobile-table tr, .mobile-table td { display: block; width: 100%; }
    .mobile-table tbody { display: grid; gap: 10px; padding: 9px; }
    .mobile-table tr { position: relative; padding: 12px; border: 1px solid #e1e9ef; border-radius: 13px; background: #fff; box-shadow: 0 3px 12px #173f5f0d; }
    .mobile-table td { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; text-align: right; }
    .mobile-table td::before { content: attr(data-label); color: #758793; font-size: 11px; font-weight: 700; text-transform: uppercase; text-align: left; }
    .cari-table td::before { display: none; }
    .mobile-table td.icon-column, .mobile-table td.check-column { position: absolute; z-index: 2; top: 10px; left: 10px; display: block; width: 38px; padding: 0; }
    .mobile-table td.icon-column::before, .mobile-table td.check-column::before, .mobile-table td.row-end::before { display: none; }
    .cari-table tr { padding-left: 58px; padding-bottom: 50px; }
    .cari-table td.row-end { position: absolute; left: 58px; right: 12px; bottom: 9px; display: block; }
    .sale-action { width: 100%; justify-content: space-between; }
    .cari-name-balance { width: 100%; text-align: left; }
    .cari-name { min-width: 0; }
    .stock-table tr { padding-left: 48px; }
    .stock-table td.stock-name-cell, .cart-table td.stock-cell { display: grid; justify-items: end; }
    .stock-table td.stock-name-cell::before, .cart-table td.stock-cell::before { justify-self: start; }
    .cart-table tbody { padding: 0; }
    .cart-table tr { border-radius: 0; border-width: 0 0 1px; box-shadow: none; padding: 12px; }
    .cart-table td.row-end { position: absolute; top: 9px; right: 9px; width: auto; }
    .stock-cell { min-width: 0; padding-right: 42px !important; text-align: left !important; align-items: start !important; }
    .stock-cell::before { display: none; }
    .price-input { width: 155px; min-width: 0; }
    .cart-footer { position: sticky; bottom: 0; z-index: 10; flex-direction: column; align-items: stretch; gap: 8px; }
    .complete-button { width: 100%; min-width: 0; min-height: 48px; }
    .scan-row { grid-template-columns: minmax(0, 1fr) 46px auto; }
    .scanner-panel { padding: 13px; }
    .home-hero { padding: 22px 18px; }
    .home-menu-card { min-height: 100px; padding: 16px; }
    .stock-search-button { min-width: 96px; padding-inline: 10px; }
    .page-count { display: none; }
}

.mobile-only { display: none; }
.cari-search-row, .sales-customer-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.cari-search-row .home-back, .sales-customer-row .home-back { flex: 0 0 auto; margin: 0; }
.cari-search-row .live-search-card { flex: 1; min-width: 0; margin: 0; }
.sales-customer-row .customer-strip { flex: 1; min-width: 0; margin: 0; }
.cart-footer-info { display: grid; flex: 1; gap: 5px; }
.invoice-total { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.invoice-total strong { color: var(--navy); font-size: 18px; font-variant-numeric: tabular-nums; }
.cart-metrics { display: flex; gap: 12px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.stock-page-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.stock-page-title-row .home-back { margin: 0; }
.stock-page-title-row .page-count { margin-left: auto; }
.stock-filter-bar { grid-template-columns: minmax(160px, .5fr) minmax(240px, 1fr) auto auto; }
.stock-filter-fields { display: contents; }
.stock-add-button { white-space: nowrap; }
.stock-create-title { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.stock-create-title .home-back { margin: 0; }
.quick-stock-scanner { width: 100%; max-width: 780px; min-width: 0; overflow: hidden; }
.quick-stock-scan-row { display: grid; grid-template-columns: minmax(0, 1fr) 62px auto; gap: 8px; }
.quick-stock-scanner .camera-view { width: 100%; max-width: 100%; overflow: hidden; border-radius: 12px; background: #0c1720; }
.quick-stock-scanner .camera-view video { display: block; width: 100%; max-width: 100%; height: auto; max-height: min(62dvh, 460px); aspect-ratio: 4 / 3; border-radius: 12px; background: #0c1720; object-fit: cover; }
.barcode-scan-guide { position: absolute; z-index: 1; inset: 50% auto auto 50%; width: min(82%, 520px); height: 32%; min-height: 82px; border: 2px solid rgba(255,255,255,.9); border-radius: 13px; box-shadow: 0 0 0 999px rgba(0,0,0,.12); pointer-events: none; transform: translate(-50%, -50%); }
.barcode-scan-guide::after { content: ""; position: absolute; top: 50%; right: 8px; left: 8px; height: 2px; background: #41e0d8; box-shadow: 0 0 8px #41e0d8; }
.barcode-scan-guide span { position: absolute; right: 0; bottom: -27px; left: 0; color: #fff; font-size: 11px; font-weight: 750; text-align: center; text-shadow: 0 1px 3px #000; }
.recent-stock-registrations { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.recent-stock-registrations span { max-width: 100%; overflow: hidden; padding: 4px 7px; border-radius: 8px; background: #e4f4ed; color: #246446; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.registered-barcode-notice { position: fixed; z-index: 1200; top: 50%; left: 50%; display: grid; width: min(390px, calc(100% - 30px)); gap: 16px; padding: 22px; border: 1px solid #86cba8; border-radius: 18px; background: #f2fbf6; color: #214c38; box-shadow: 0 22px 70px rgba(8, 32, 48, .36); text-align: center; transform: translate(-50%, -50%); }
.registered-barcode-notice[hidden] { display: none; }
.registered-barcode-notice div { display: grid; min-width: 0; gap: 6px; }
.registered-barcode-notice strong { color: #16724a; font-size: 24px; }
.registered-barcode-notice span { overflow: hidden; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.registered-barcode-notice small { color: #59796a; font-size: 11px; }
.registered-barcode-notice button { width: 100%; min-height: 50px; padding: 10px 15px; border-color: #168b5a; background: #168b5a; color: #fff; font-size: 16px; font-weight: 800; white-space: nowrap; }
.sale-scan-notice { border-color: #e4bd67; background: #fff9e9; color: #654b16; }
.sale-scan-notice strong { color: #a16708; }
.sale-scan-notice small { color: #806c41; }
.sale-scan-notice button { border-color: #bf7c12; background: #bf7c12; }
.quick-stock-modal { width: min(520px, calc(100% - 20px)); padding: 18px; border: 0; border-radius: 18px; color: #172b3a; box-shadow: 0 24px 70px rgba(8, 32, 48, .3); }
.quick-stock-modal::backdrop { background: rgba(9, 31, 46, .6); backdrop-filter: blur(3px); }
.quick-stock-modal .modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.register-barcode { display: block; margin-top: 4px; color: var(--teal); font-family: "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.quick-stock-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.quick-stock-fields .wide-field { grid-column: 1 / -1; }
.mikro-name-preview { display: block; min-height: 19px; margin-top: 5px; color: #277354; font-size: 12px; line-height: 1.35; }
.mikro-name-preview.is-resolved { color: #155d3d; font-size: 16px; font-weight: 800; line-height: 1.25; }
.quick-stock-error { min-height: 20px; margin: 8px 0 3px; }
.sale-confirm-modal { width: min(560px, calc(100% - 24px)); padding: 20px; border: 0; border-radius: 18px; color: #172b3a; box-shadow: 0 24px 70px rgba(8, 32, 48, .3); }
.sale-confirm-modal::backdrop { background: rgba(9, 31, 46, .58); backdrop-filter: blur(3px); }
.sale-confirm-modal .modal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.sale-confirm-modal p { margin: 8px 0; line-height: 1.45; }
.sale-confirm-modal .confirm-description { color: var(--muted); font-size: 13px; }
.confirm-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.confirm-summary > span { display: grid; gap: 4px; padding: 11px; border-radius: 11px; background: #f0f5f7; }
.confirm-summary small { color: var(--muted); font-size: 11px; }
.confirm-summary strong { color: var(--navy); font-size: 16px; font-variant-numeric: tabular-nums; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 620px) {
    body { font-size: 14px; }
    .home-menu { gap: 9px; }
    .home-menu-card { min-height: 82px; padding: 12px 14px; border-radius: 14px; }
    .home-menu-card strong { font-size: 15px; font-weight: 600; }
    .home-menu-card small { font-size: 12px; }
    .home-menu-icon { width: 44px; height: 44px; border-radius: 12px; font-size: 23px; }
    .home-back { min-height: 40px; padding: 7px 10px; font-size: 13px; }

    .cari-search-row { align-items: stretch; gap: 7px; margin-bottom: 0; }
    .cari-search-row .home-back, .cari-search-row .live-search-card { height: 40px; min-height: 40px; }
    .cari-search-row .live-search-card { padding: 0; border-radius: 11px; }
    .cari-search-row .live-search-card input { height: 40px; min-height: 40px; padding: 7px 10px; font-size: 14px; }
    .cari-search-status { min-height: 0; margin: 3px 0 5px; }
    .cari-search-status:not(:empty) { min-height: 16px; }
    .cari-table tbody { gap: 7px; padding: 6px; }
    .cari-table tr {
        display: grid !important;
        grid-template-columns: 36px auto minmax(0, 1fr) auto;
        grid-template-areas:
            "upload name name sale"
            "upload code balance sale";
        align-items: center;
        gap: 4px 8px;
        min-height: 68px;
        padding: 9px;
    }
    .cari-table td { width: auto; padding: 0; text-align: left; }
    .cari-table td.icon-column {
        position: static;
        grid-area: upload;
        display: flex;
        width: auto;
        align-self: center;
    }
    .cari-table .cari-name-cell { grid-area: name; min-width: 0; padding-right: 4px; }
    .cari-table .cari-code-cell { grid-area: code; color: var(--muted); font-size: 12px; }
    .cari-table .cari-code-cell strong { font-weight: 600; }
    .cari-table .cari-balance-cell { grid-area: balance; min-width: 0; }
    .cari-table td.row-end { position: static; grid-area: sale; display: block; align-self: start; width: auto; }
    .cari-name { display: block; min-width: 0; overflow: hidden; font-size: 14px; font-weight: 500; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
    .balance-list { flex-wrap: nowrap; justify-content: flex-start; overflow: hidden; }
    .balance-item { padding: 3px 6px; font-size: 11px; white-space: nowrap; }
    .balance-empty { font-size: 12px; }
    .import-icon { width: 32px; height: 32px; border-radius: 9px; font-size: 19px; }
    .sale-action { width: auto; min-height: 32px; gap: 5px; padding: 4px 7px 4px 9px; font-size: 12px; }
    .sale-action b { font-size: 17px; }

    .sales-customer-row { align-items: center; gap: 6px; margin-bottom: 6px; }
    .sales-customer-row .customer-strip { min-height: 38px; padding: 6px 9px; }
    .sales-customer-row .customer-strip > strong { font-size: 13px; font-weight: 500; }
    .sales-workspace { margin-bottom: 7px; }
    .scanner-panel { padding: 9px; }
    .scan-row { gap: 5px; }
    .scanner-panel .operation-status { min-height: 15px; margin-top: 3px; padding: 3px 6px; border-radius: 7px; background: #eef7f5; font-size: 11px; }
    .cart-head { min-height: 38px; padding: 7px 10px; }
    .cart-head > span { font-size: 12px; }
    .cart-table tbody { display: grid; gap: 4px; padding: 4px; background: #f3f6f9; }
    .cart-table tr {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas:
            "name name name"
            "action code price"
            "metrics metrics metrics";
        gap: 3px 7px;
        padding: 6px 8px;
        border: 1px solid #e1e9ef;
        border-radius: 10px;
        background: #fff;
        box-shadow: 0 2px 9px rgba(23, 63, 95, .05);
    }
    .cart-table td { width: auto; padding: 0; border: 0; }
    .cart-table td::before { display: none; }
    .cart-table td.stock-cell { display: contents; }
    .cart-table .stock-name { grid-area: name; overflow: hidden; color: #263f50; font-size: 13px; font-weight: 500; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
    .cart-table .stock-code { grid-area: code; align-self: center; color: var(--navy); font-size: 12px; font-weight: 650; }
    .cart-table .cart-price-cell { grid-area: price; }
    .cart-table .price-input { width: 112px; min-width: 0; min-height: 32px; height: 32px; padding: 4px 8px; text-align: right; }
    .cart-table .cart-metrics { grid-area: metrics; justify-content: space-between; padding: 0 1px; font-size: 11px; }
    .cart-table td.row-end { position: static; grid-area: action; display: flex; align-self: center; justify-content: flex-start; width: auto; padding: 0; }
    .cart-table .danger-icon { width: 28px; height: 28px; min-height: 28px; border-radius: 8px; font-size: 17px; }
    .cart-footer { padding: 8px 10px; }
    .cart-footer-info { gap: 3px; }
    .invoice-total { justify-content: space-between; }
    .invoice-total strong { font-size: 17px; }

    .stock-page-title-row { gap: 8px; margin-bottom: 8px; }
    .stock-page-title-row h1 { font-size: 20px; }
    .stock-filter-bar { grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; margin-bottom: 7px; }
    .stock-filter-bar input[name="search"] { grid-column: 1 / -1; grid-row: 1; }
    .stock-filter-bar input[name="cariKodu"] { grid-column: 1; grid-row: 2; }
    .stock-filter-bar .barcode-print-button { grid-column: 2; grid-row: 2; min-height: 39px; padding: 6px 9px; font-size: 12px; }
    .stock-filter-bar .stock-add-button { grid-column: 3; grid-row: 2; min-height: 39px; padding: 6px 9px; font-size: 12px; }
    .stock-filter-bar input { min-height: 39px; }
    .stock-create-title { gap: 8px; margin-bottom: 8px; }
    .stock-create-title h1 { font-size: 20px; }
    .quick-stock-scanner { width: 100%; max-width: 100%; padding: 9px; }
    .quick-stock-scan-row { grid-template-columns: minmax(0, 1fr) 60px; gap: 5px; }
    .quick-stock-scan-row input, .quick-stock-scan-row button { min-height: 40px; }
    .quick-stock-scan-row .primary { grid-column: 1 / -1; width: 100%; padding-inline: 9px; font-size: 12px; }
    .quick-stock-scanner .camera-view video { max-height: 52dvh; aspect-ratio: 3 / 4; }
    .barcode-scan-guide { width: 88%; height: 25%; min-height: 76px; }
    .registered-barcode-notice { width: calc(100% - 28px); padding: 20px 16px; }
    .quick-stock-modal { position: fixed; inset: auto; top: max(5px, env(safe-area-inset-top)); left: 50%; max-height: calc(100dvh - env(safe-area-inset-top) - 10px); margin: 0; padding: 12px 14px; overflow-y: auto; border-radius: 15px; transform: translateX(-50%); }
    .quick-stock-fields input { min-height: 41px; padding: 8px 9px; }
    .quick-stock-modal .modal-head { margin-bottom: 8px; }
    .list-toolbar { margin-bottom: 7px; padding: 6px 8px; }
    .list-toolbar .button { min-height: 36px; padding: 6px 9px; font-size: 12px; }
    .mobile-only { display: inline; }
    .stock-table tbody { gap: 7px; padding: 6px; }
    .stock-table tr {
        display: grid !important;
        grid-template-columns: 34px minmax(0, 1fr) auto auto;
        grid-template-areas:
            "check name name status"
            "check micro kg price"
            "check barcode barcode barcode";
        align-items: center;
        gap: 5px 8px;
        min-height: 86px;
        padding: 9px;
    }
    .stock-table td { width: auto; padding: 0; text-align: left; }
    .stock-table td::before { display: none; }
    .stock-table td.stock-check { position: static; grid-area: check; display: flex; width: auto; align-self: stretch; align-items: flex-start; padding-top: 2px; }
    .stock-table .stock-name-cell { grid-area: name; display: block; max-width: none; overflow: hidden; font-size: 13px; font-weight: 500; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
    .stock-table .stock-status { grid-area: status; justify-self: end; }
    .stock-table .stock-micro { grid-area: micro; color: var(--navy); font-size: 12px; }
    .stock-table .stock-kg { grid-area: kg; color: var(--muted); font-size: 12px; white-space: nowrap; }
    .stock-table .stock-price { grid-area: price; color: var(--muted); font-size: 12px; white-space: nowrap; }
    .stock-table .stock-barcode { grid-area: barcode; min-width: 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
    .stock-table .stock-barcode code { font-size: 11px; }
    .stock-table .stock-date, .stock-table .stock-cari, .stock-table .stock-party, .stock-table .stock-group { display: none; }
    .stock-table .badge { padding: 3px 6px; font-size: 10px; }
    .sale-confirm-modal { padding: 16px; border-radius: 15px; }
    .sale-confirm-modal h2 { font-size: 18px; }
    .confirm-summary { gap: 5px; margin: 12px 0; }
    .confirm-summary > span { padding: 8px; }
    .confirm-summary strong { font-size: 13px; }
    .confirm-actions { display: grid; grid-template-columns: 1fr 1fr; }
}
