﻿:root {
  color-scheme: light;
  --bg: #f5f6fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --field: #ffffff;
  --ink: #162033;
  --muted: #617083;
  --line: #d9e1ea;
  --brand: #171184;
  --brand-2: #07854f;
  --danger: #b42318;
  --ok: #197a45;
  --warn: #9a6700;
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111318;
  --panel: #1b1f27;
  --panel-soft: #242a34;
  --field: #151922;
  --ink: #f4f7fb;
  --muted: #aab4c2;
  --line: #343c49;
  --brand: #e2562a;
  --brand-2: #24a86a;
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, .button-link { border: 0; border-radius: 6px; background: var(--brand); color: #fff; cursor: pointer; font-weight: 700; min-height: 40px; padding: 0 14px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button.secondary, .button-link.secondary { background: #e7eef4; color: var(--ink); }
button.danger { background: var(--danger); }
button.success { background: var(--ok); }
button:disabled { cursor: not-allowed; opacity: .45; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; background: var(--field); color: var(--ink); min-height: 40px; padding: 9px 10px; }
.cell-input { min-width: 110px; }
td .cell-input { min-height: 34px; padding: 6px 8px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }

.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-box { width: min(430px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 28px; box-shadow: 0 18px 45px rgba(20, 40, 45, .10); }
.login-box h1, .page-title h1 { margin: 0; font-size: 26px; letter-spacing: 0; }
.login-box p, .page-title p { color: var(--muted); margin: 8px 0 0; }
.login-box h1, .login-box > p { text-align: center; }
.login-brand { display: grid; justify-items: center; margin-bottom: 18px; }
.error { background: #fff0ed; border: 1px solid #ffd3ca; border-radius: 6px; color: var(--danger); padding: 10px; }
.notice-backdrop {
  align-items: center;
  background: rgba(15, 23, 42, .42);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 200;
}
.notice-modal {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .28);
  color: #162033;
  display: grid;
  gap: 14px;
  max-width: 460px;
  padding: 22px;
  width: min(100%, 460px);
}
.notice-modal h2 { font-size: 22px; margin: 0; }
.notice-modal p { color: #334155; font-size: 16px; line-height: 1.45; margin: 0; white-space: pre-wrap; }
.notice-modal button { justify-self: end; min-width: 110px; }
.install-link { color: var(--brand); display: block; font-weight: 800; margin-top: 14px; text-align: center; text-decoration: none; }

.app-shell { min-height: 100vh; }
.topbar {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px 18px;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  grid-template-areas:
    "brand actions"
    "nav nav";
  min-height: 76px;
  padding: 10px 20px 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar > div:first-child { grid-area: brand; }
.brand-logo { align-items: center; display: flex; gap: 12px; min-width: 0; }
.brand-logo img { display: block; height: 44px; width: 92px; object-fit: contain; }
.brand-logo strong { color: var(--ink); display: block; font-size: 16px; font-weight: 900; line-height: 1.1; }
.brand-logo span { color: var(--muted); display: block; font-size: 12px; margin-top: 4px; }
.brand-logo small { color: var(--muted); display: block; font-size: 11px; font-weight: 800; margin-top: 3px; }
.brand-logo.large { display: grid; justify-items: center; text-align: center; }
.brand-logo.large img { height: auto; max-width: 220px; width: 100%; }
.brand-logo.mark-only div { display: none; }
.brand-logo.mark-only { justify-content: center; }

.topnav { display: flex; flex-wrap: wrap; gap: 8px; grid-area: nav; justify-content: flex-start; min-width: 0; }
.nav-button { background: var(--panel-soft); color: var(--ink); min-height: 38px; padding: 0 16px; }
.nav-button.active { background: var(--brand); color: #fff; }
.nav-dropdown { position: relative; }
.nav-dropdown-button { gap: 8px; }
.nav-dropdown-button span {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  height: 0;
  width: 0;
}
.nav-dropdown-menu {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(20, 40, 45, .16);
  display: none;
  gap: 6px;
  left: 0;
  min-width: 190px;
  padding: 8px;
  position: absolute;
  top: calc(100% + 8px);
  z-index: 40;
}
.nav-dropdown.open .nav-dropdown-menu { display: grid; }
.nav-menu-item {
  background: transparent;
  color: var(--ink);
  justify-content: flex-start;
  min-height: 34px;
  padding: 0 10px;
  width: 100%;
}
.nav-menu-item:hover,
.nav-menu-item.active {
  background: var(--panel-soft);
  color: var(--brand);
}
.mobile-menu-button { display: none; gap: 8px; justify-content: center; }
.mobile-menu-button span { background: currentColor; border-radius: 999px; display: block; height: 2px; width: 16px; }
.userbar { align-items: center; display: flex; gap: 10px; grid-area: actions; justify-content: flex-end; min-width: 0; position: relative; }
.profile-icon-button { border-radius: 999px; display: grid; height: 42px; min-height: 42px; padding: 0; place-items: center; position: relative; width: 42px; }
.profile-icon-button span { display: block; position: absolute; }
.profile-icon-head { background: currentColor; border-radius: 999px; height: 10px; top: 10px; width: 10px; }
.profile-icon-body { border: 3px solid currentColor; border-bottom: 0; border-radius: 999px 999px 0 0; height: 13px; top: 23px; width: 20px; }
.user-actions { align-items: end; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; min-width: 0; }
.language-select { gap: 3px; font-size: 11px; font-weight: 800; }
.language-select select { min-height: 28px; padding: 3px 8px; }
.profile-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 18px 45px rgba(20, 40, 45, .16); display: grid; gap: 10px; min-width: 280px; padding: 14px; position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; }
.profile-summary { border-bottom: 1px solid var(--line); display: grid; gap: 3px; padding-bottom: 10px; }
.profile-summary strong { color: var(--ink); font-size: 15px; }
.profile-summary small { color: var(--muted); font-size: 12px; font-weight: 800; }
.profile-mobile-settings { display: none; gap: 8px; grid-template-columns: 1fr auto; }
.profile-menu-item { justify-content: flex-start; width: 100%; }
.profile-password-form { border-top: 1px solid var(--line); padding-top: 10px; }
.theme-switch { align-items: center; background: var(--panel-soft); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); display: inline-flex; font-size: 12px; gap: 6px; justify-content: flex-start; min-height: 28px; padding: 3px 8px; }
.theme-switch span { background: var(--muted); border-radius: 999px; display: block; height: 14px; width: 14px; }
.theme-switch.active { background: #2a1712; border-color: #7c2d12; color: #fb923c; }
.theme-switch.active span { background: var(--brand); }
.maintenance-toggle,
.test-toggle {
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  gap: 6px;
  justify-content: flex-start;
  min-height: 28px;
  padding: 3px 8px;
}
.maintenance-toggle span,
.test-toggle span {
  background: var(--muted);
  border-radius: 999px;
  display: block;
  height: 14px;
  width: 14px;
}
.maintenance-toggle.active {
  background: #2b1111;
  border-color: #991b1b;
  color: #fecaca;
}
.maintenance-toggle.active span {
  background: #ef4444;
}
.test-toggle.active {
  background: #11231b;
  border-color: #15803d;
  color: #bbf7d0;
}
.test-toggle.active span {
  background: #22c55e;
}
.test-mode-banner {
  background: #dcfce7;
  border-bottom: 1px solid #86efac;
  color: #14532d;
  font-size: 13px;
  font-weight: 900;
  padding: 10px 22px;
  text-align: center;
}
.content { padding: 22px; display: grid; gap: 16px; }

:root[dir="rtl"] .topbar,
:root[dir="rtl"] .page-title,
:root[dir="rtl"] .panel-heading,
:root[dir="rtl"] .userbar {
  direction: rtl;
}

:root[dir="rtl"] th,
:root[dir="rtl"] td {
  text-align: right;
}

.page-title { align-items: end; display: flex; gap: 16px; justify-content: space-between; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: 0 10px 24px rgba(30, 45, 60, .06); }
.panel h2 { font-size: 18px; margin: 0 0 14px; }
.panel-heading { align-items: center; display: flex; justify-content: space-between; gap: 12px; }
.import-heading { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.form { display: grid; gap: 14px; margin-top: 10px; }
.customer-card-row { align-items: end; display: grid; gap: 12px; grid-template-columns: minmax(260px, 1fr) auto; }
.customer-card-actions { align-items: end; justify-content: flex-start; }
.grid { display: grid; gap: 14px; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wide { grid-column: 1 / -1; }
.stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.stat b { display: block; font-size: 32px; }
.stat span, .muted { color: var(--muted); }

.rate-box { align-items: end; display: grid; gap: 4px; justify-items: end; min-width: 210px; }
.rate-box strong { color: var(--brand-2); }
.rate-box small { color: var(--muted); }

.maintenance-shell .login-box {
  text-align: center;
}
.maintenance-message {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: #9a3412;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.45;
  padding: 16px;
}
.test-mode-login,
.mode-notice {
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 8px;
  color: #14532d;
  font-weight: 900;
  padding: 10px;
  text-align: center;
}
.test-mode-message {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  color: #166534;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
  padding: 10px;
}
:root[data-theme="dark"] .maintenance-message {
  background: rgba(154, 52, 18, .18);
  border-color: rgba(251, 146, 60, .4);
  color: #fdba74;
}
:root[data-theme="dark"] .test-mode-banner,
:root[data-theme="dark"] .test-mode-login,
:root[data-theme="dark"] .mode-notice,
:root[data-theme="dark"] .test-mode-message {
  background: rgba(20, 83, 45, .28);
  border-color: rgba(34, 197, 94, .42);
  color: #bbf7d0;
}

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 12px 10px; text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.selected-row td {
  background: rgba(245, 158, 11, .16);
  box-shadow: inset 0 1px 0 rgba(245, 158, 11, .45), inset 0 -1px 0 rgba(245, 158, 11, .45);
}
.selected-row td:first-child {
  box-shadow: inset 5px 0 0 var(--brand), inset 0 1px 0 rgba(245, 158, 11, .45), inset 0 -1px 0 rgba(245, 158, 11, .45);
}
:root[data-theme="dark"] .selected-row td {
  background: rgba(245, 158, 11, .22);
}
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ecommerce-cart-actions {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(220px, max-content) minmax(24px, 1fr) minmax(120px, max-content);
}
.ecommerce-cart-actions .ecommerce-return-button {
  grid-column: 3;
}
.empty { color: var(--muted); padding: 18px 0; }
.danger-text { color: var(--danger); font-weight: 800; }
.draft-stock-issue td { box-shadow: inset 0 2px 0 var(--danger), inset 0 -2px 0 var(--danger); }
.draft-stock-issue td:first-child { box-shadow: inset 2px 0 0 var(--danger), inset 0 2px 0 var(--danger), inset 0 -2px 0 var(--danger); }
.draft-stock-issue td:last-child { box-shadow: inset -2px 0 0 var(--danger), inset 0 2px 0 var(--danger), inset 0 -2px 0 var(--danger); }
.draft-item-issue { border: 1px solid var(--danger); border-radius: 6px; padding: 6px; }

.product-picker { display: grid; gap: 10px; max-height: 420px; overflow: auto; padding-right: 4px; }
.product-row { align-items: center; background: var(--panel-soft); border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) 100px; padding: 12px; }
.product-row strong { display: block; }
.product-row small { color: var(--muted); }
.stock-badge {
  border: 1px solid currentColor;
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  padding: 4px 8px;
}

.stock-badge.available {
  color: var(--ok);
}

.stock-badge.warning {
  color: #f59e0b;
}

.stock-badge.critical {
  color: var(--danger);
}

.status { border-radius: 999px; display: inline-block; font-size: 12px; font-weight: 800; padding: 5px 9px; }
.status.pending, .status.waiting { background: #fff6d7; color: var(--warn); }
.status.ready_to_ship { background: #eaf2ff; color: #1d4ed8; }
.status.approved, .status.completed { background: #e8f7ee; color: var(--ok); }
.status.rejected { background: #fff0ed; color: var(--danger); }
.status.hidden-product { background: #eef2f7; color: var(--muted); margin-left: 6px; vertical-align: middle; }
.import-row, .report-actions { align-items: end; display: flex; flex-wrap: wrap; gap: 12px; }
.report-actions label { min-width: 180px; }
.stock-report-stack { display: grid; gap: 16px; }
.stock-report-panel { padding: 0; overflow: hidden; }
.stock-report-panel .panel-heading { margin-bottom: 12px; }
.stock-report-summary { align-items: center; cursor: pointer; display: grid; gap: 12px; grid-template-columns: auto minmax(80px, 1fr) auto; list-style: none; min-height: 62px; padding: 16px 18px; }
.stock-report-summary::-webkit-details-marker { display: none; }
.stock-report-summary::before { color: var(--brand); content: "›"; font-size: 26px; font-weight: 900; line-height: 1; transform: rotate(0deg); transition: transform .18s ease; }
.stock-report-panel[open] .stock-report-summary::before { transform: rotate(90deg); }
.stock-report-summary h2 { margin: 0; }
.stock-report-body { border-top: 1px solid var(--line); padding: 16px 18px 18px; }
.history-panel { margin-top: 16px; }
.history-summary-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.history-filter-form { align-items: end; display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(160px, 1fr)); margin: 0 0 14px; }
.history-filter-actions { align-items: end; }
.history-limit-note { margin-top: 10px; }
.download-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.stock-report-group { display: grid; gap: 8px; margin-top: 16px; }
.stock-report-group:first-child { margin-top: 0; }
.stock-report-group h3 { color: var(--ink); font-size: 16px; margin: 0; }
.stock-report-table { min-width: 900px; table-layout: fixed; }
.stock-report-table .stock-code-col { width: 20%; }
.stock-report-table .stock-name-col { width: 35%; }
.stock-report-table .stock-price-col { width: 20%; }
.stock-report-table .stock-count-col { width: 12%; }
.stock-report-table .stock-status-col { width: 13%; }
.stock-report-table th,
.stock-report-table td { white-space: nowrap; }
.stock-report-table th:nth-child(3),
.stock-report-table td:nth-child(3),
.stock-report-table th:nth-child(4),
.stock-report-table td:nth-child(4) { text-align: right; }
.current-report-table { min-width: 1100px; }
.current-report-table th:nth-child(n+3):nth-child(-n+7),
.current-report-table td:nth-child(n+3):nth-child(-n+7) { text-align: right; }
.report-total-row td {
  background: rgba(220, 232, 223, .75);
  font-weight: 900;
}
:root[data-theme="dark"] .report-total-row td {
  background: rgba(36, 168, 106, .18);
}
.money-nowrap { display: inline-block; white-space: nowrap; }
.current-summary {
  align-items: start;
  display: grid;
  gap: 10px;
}
.current-summary > div {
  align-items: baseline;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(130px, max-content) minmax(0, 1fr);
}
.current-summary strong { white-space: nowrap; }
.current-summary span { min-width: 0; }
.money-positive { color: var(--ok); font-weight: 800; }
.money-negative { color: var(--danger); font-weight: 800; }
.money-neutral { color: var(--muted); font-weight: 800; }
.permission-grid { border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 14px; }
.permission-grid legend { color: var(--muted); font-weight: 800; padding: 0 6px; }
.permission-grid label { align-items: center; display: flex; color: var(--ink); font-weight: 600; }
.permission-grid input { min-height: auto; width: auto; }
.action-permission-grid { align-items: start; }
.permission-group { display: grid; gap: 8px; }
.permission-group strong { color: var(--ink); font-size: 13px; }

@media (max-width: 980px) {
  .topbar { align-items: stretch; display: grid; grid-template-areas: none; grid-template-columns: 1fr; }
  .topbar > div:first-child { grid-area: auto; }
  .topnav { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; }
  .userbar { justify-content: space-between; }
  .page-title { align-items: stretch; flex-direction: column; }
  .rate-box { justify-items: start; }
  .three, .two, .stats, .permission-grid { grid-template-columns: 1fr; }
  .product-row { grid-template-columns: 1fr; }
}

.split-order {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
}

.split-order h3 {
  font-size: 15px;
  margin: 0 0 10px;
}

.order-customer-section {
  display: grid;
  gap: 12px;
}

.cart-add {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 82px auto;
}

.cart-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.cart-box-header {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 10px;
}

.cart-box-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.cart-box-header button {
  min-height: 32px;
  padding: 0 10px;
}

.cart-box table {
  min-width: 0;
}

.cart-total {
  align-items: end;
  background: #fff8ed;
  border: 2px solid #f59e0b;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(245, 158, 11, .14);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: 10px;
  padding: 12px;
}

.cart-total-text {
  display: grid;
  gap: 4px;
}

.cart-total small {
  color: var(--muted);
}

.money-usd {
  color: var(--ok);
  font-weight: 900;
}

.money-try {
  color: #1d4ed8;
  font-weight: 900;
}

.cart-percent {
  min-width: 110px;
  width: 130px;
}

.cart-percent input {
  text-align: right;
}

.ecommerce-total-input {
  min-width: 180px;
  width: 220px;
}

@media (max-width: 980px) {
  .split-order,
  .cart-add {
    grid-template-columns: 1fr;
  }

  .cart-total {
    align-items: stretch;
    display: grid;
  }

  .cart-percent {
    width: 100%;
  }
}

@media (max-width: 720px) {
  body { font-size: 14px; }
  button, .button-link { min-height: 38px; padding: 0 10px; }
  .content { gap: 12px; padding: 12px; }
  .panel { border-radius: 6px; padding: 12px; }
  .panel-heading,
  .page-title,
  .cart-total,
  .customer-card-row,
  .report-actions,
  .import-row {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }
  .topbar { gap: 10px; grid-template-columns: minmax(0, 1fr) auto; padding: 10px 12px; }
  .topbar > div:first-child { grid-column: 1; grid-row: 1; }
  .brand-logo img { height: 38px; width: 76px; }
  .brand-logo strong { font-size: 14px; }
  .brand-logo span { font-size: 11px; }
  .topnav { gap: 6px; grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; margin: 0 -12px; overflow-x: auto; padding: 0 12px 4px; }
  .topbar.has-mobile-menu { grid-template-columns: minmax(0, 1fr) auto auto; }
  .topbar.has-mobile-menu > .topnav { grid-column: 1 / -1; grid-row: 2; }
  .topbar.has-mobile-menu > .userbar { grid-column: 3; grid-row: 1; }
  .topbar.has-mobile-menu .mobile-menu-button { align-self: center; display: inline-flex; grid-column: 2; grid-row: 1; min-height: 34px; }
  .topbar.has-mobile-menu .topnav { display: none; margin: 0; overflow: visible; padding: 0; }
  .topbar.has-mobile-menu.mobile-menu-open .topnav { display: grid; grid-template-columns: 1fr; }
  .topbar.has-mobile-menu .nav-button { justify-content: flex-start; width: 100%; }
  .topbar.has-mobile-menu .nav-dropdown { width: 100%; }
  .topbar.has-mobile-menu .nav-dropdown-menu { box-shadow: none; margin-top: 6px; min-width: 0; position: static; width: 100%; }
  .nav-button { flex: 0 0 auto; font-size: 13px; min-height: 34px; padding: 0 10px; }
  .userbar { align-items: center; display: flex; grid-column: 2; grid-row: 1; justify-content: flex-end; }
  .user-actions { display: none; }
  .profile-icon-button { height: 36px; min-height: 36px; width: 36px; }
  .profile-icon-head { height: 9px; top: 8px; width: 9px; }
  .profile-icon-body { height: 12px; top: 20px; width: 18px; }
  .profile-panel { left: 0; min-width: 0; right: 0; }
  .profile-mobile-settings { align-items: end; display: grid; }
  .grid.three,
  .grid.two,
  .customer-card-row { grid-template-columns: 1fr; }
  .order-cart-section { order: -1; }
  .order-cart-section .order-customer-section {
    border-top: 1px solid var(--line);
    margin-top: 12px;
    padding-top: 12px;
  }
  .product-row { gap: 10px; padding: 10px; }
  .product-picker { max-height: none; overflow: visible; padding-right: 0; }
  .mobile-product-hint { background: var(--panel-soft); border: 1px dashed var(--line); border-radius: 8px; padding: 14px; }
  .stock-report-summary { grid-template-columns: auto 1fr; }
  .stock-report-summary .download-actions { grid-column: 1 / -1; justify-content: stretch; }
  .history-summary-actions { grid-column: 1 / -1; justify-content: stretch; }
  .history-summary-actions button, .history-summary-actions a { flex: 1; }
  .history-filter-form { grid-template-columns: 1fr; }
  .stock-report-summary .button-link { flex: 1; }

  .table-wrap { overflow: visible; }
  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap th,
  .table-wrap td {
    display: block;
    width: 100%;
  }
  .table-wrap thead { display: none; }
  .table-wrap tbody { display: grid; gap: 10px; }
  .table-wrap tr {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(30, 45, 60, .05);
    overflow: hidden;
  }
  .table-wrap td {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(96px, 36%) minmax(0, 1fr);
    padding: 9px 10px;
    text-align: left !important;
    white-space: normal !important;
  }
  .table-wrap td:last-child { border-bottom: 0; }
  .table-wrap td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 11px;
    font-weight: 900;
    line-height: 1.2;
    text-transform: uppercase;
  }
  .table-wrap td[colspan] {
    display: block;
  }
  .table-wrap td[colspan]::before {
    content: "";
    display: none;
  }
  .row-actions { display: grid; grid-template-columns: 1fr; }
  .row-actions button,
  .row-actions .button-link { width: 100%; }
  .cart-box-header {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }
  .cart-box-header button {
    width: 100%;
  }
  .ecommerce-cart-actions {
    display: grid;
    gap: 18px;
    grid-template-columns: 1fr;
  }
  .ecommerce-cart-actions .ecommerce-return-button {
    grid-column: auto;
    margin-top: 4px;
  }
  .cart-box table { min-width: 0; }
  .cart-box td input { min-width: 0; }
  .stock-report-table { min-width: 0; }
}

/* Sipariş sepet düzeni düzeltmeleri */
.product-picker {
  overflow-x: hidden;
}

.product-row {
  grid-template-columns: minmax(0, 1fr) 230px;
}

.cart-add {
  grid-template-columns: 76px minmax(130px, 1fr);
}

.cart-add button {
  white-space: nowrap;
  width: 100%;
}

.split-order > div:nth-child(2),
.order-cart-section {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.split-order > div:nth-child(2) h3,
.order-cart-section h3 {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.product-filter-row { display: grid; gap: 10px; grid-template-columns: minmax(160px, 220px) minmax(0, 1fr); margin-bottom: 10px; }
.split-return {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr);
}

.split-return > div {
  display: grid;
  gap: 14px;
  align-content: start;
}

.return-cart { border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.return-cart table { min-width: 820px; }
.return-cart input { max-width: 110px; }

.return-detail-panel {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 14px;
}

.return-detail-head {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding-bottom: 12px;
}

.return-detail-head h3,
.return-detail-section h4 {
  font-size: 15px;
  margin: 0;
}

.return-detail-head small,
.return-history-item small {
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

.return-detail-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.return-detail-grid div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 5px;
  padding: 10px;
}

.return-detail-grid strong {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.return-detail-grid span {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.return-detail-section {
  display: grid;
  gap: 10px;
}

.return-history-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.empty.compact {
  padding: 8px 0;
}

.accountant-search-panel label {
  max-width: 460px;
}

.accountant-dashboard {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
}

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

.accountant-queue {
  min-height: 190px;
}

.accountant-queue .panel-heading h2 {
  font-size: 16px;
  margin: 0;
}

.accountant-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.accountant-list-item {
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px;
}

.accountant-list-item span {
  overflow-wrap: anywhere;
}

.accountant-package-results {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.accountant-package-results .active-result {
  background: var(--brand-2);
  color: #fff;
}

.invoice-history-search {
  overflow: visible;
}

.invoice-history-combobox {
  max-width: 760px;
}

.invoice-history-dropdown {
  margin-top: 10px;
}

.invoice-history-picker {
  display: grid;
  gap: 6px;
  max-width: 100%;
}

.invoice-history-limit {
  display: block;
  margin-top: 8px;
}

.invoice-history-dropdown > .empty {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.18);
  padding: 12px;
}

.load-more-row {
  display: flex;
  justify-content: center;
  padding-top: 14px;
}

.accountant-package-card {
  display: grid;
  gap: 14px;
}

.production-layout {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .9fr) minmax(320px, .9fr);
}

.production-frame {
  display: grid;
  gap: 14px;
}

.production-frame .panel-heading h2 {
  margin: 0;
}

.production-frame h3 {
  border-top: 1px solid var(--line);
  font-size: 15px;
  margin: 4px 0 0;
  padding-top: 14px;
}

.production-potential {
  border: 1px solid currentColor;
  border-radius: 999px;
  display: inline-block;
  font-weight: 900;
  padding: 5px 10px;
}

.production-potential.ok {
  color: var(--ok);
}

.production-potential.empty {
  color: var(--danger);
}

.production-transfer {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr;
  min-width: 180px;
}

.production-transfer input {
  min-height: 34px;
}

.recipe-editor {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.recipe-editor .panel-heading h2 {
  font-size: 16px;
  margin: 0;
}

.recipe-add {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1fr) 100px auto;
}

.recipe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 220px;
}

.embedded-product-entry {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
}

.embedded-product-entry h3 {
  font-size: 16px;
  margin: 0;
}

.install-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.install-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(20, 40, 45, .10);
  display: grid;
  gap: 16px;
  max-width: 620px;
  padding: 28px;
  width: min(100%, 620px);
}

.install-panel img {
  height: 84px;
  object-fit: contain;
  width: 180px;
}

.install-panel h1,
.install-panel h2,
.install-panel p {
  margin: 0;
}

.install-panel h1 {
  font-size: 26px;
}

.install-panel h2 {
  font-size: 16px;
}

.install-panel p {
  color: var(--muted);
  line-height: 1.45;
}

.install-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.install-help {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding-top: 16px;
}

:root[data-theme="dark"] .login-box,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .stat,
:root[data-theme="dark"] .topbar {
  box-shadow: 0 12px 28px rgba(0, 0, 0, .28);
}

:root[data-theme="dark"] button.secondary,
:root[data-theme="dark"] .button-link.secondary {
  background: #2f3745;
  color: var(--ink);
}

:root[data-theme="dark"] .cart-total {
  background: #2b1b0d;
  border-color: #f97316;
  box-shadow: 0 8px 18px rgba(249, 115, 22, .18);
}

:root[data-theme="dark"] .money-try {
  color: #60a5fa;
}

:root[data-theme="dark"] .status.pending,
:root[data-theme="dark"] .status.waiting {
  background: #3a260b;
  color: #f59e0b;
}

:root[data-theme="dark"] .status.ready_to_ship {
  background: #3a1f12;
  color: #fb923c;
}

:root[data-theme="dark"] .status.approved,
:root[data-theme="dark"] .status.completed {
  background: #0f2f20;
  color: #22c55e;
}

:root[data-theme="dark"] .status.rejected,
:root[data-theme="dark"] .error {
  background: #3a1212;
  color: #f87171;
}

:root[data-theme="dark"] .notice-modal {
  background: #1b1f27;
  border-color: #343c49;
  color: #f4f7fb;
}

:root[data-theme="dark"] .notice-modal p {
  color: #d4dbe6;
}

:root[data-theme="dark"] .status.hidden-product {
  background: #2f3745;
  color: var(--muted);
}


@media (max-width: 980px) {
  .profile-panel { left: 0; right: auto; }
  .customer-card-row { grid-template-columns: 1fr; }
  .product-filter-row { grid-template-columns: 1fr; }
  .split-return { grid-template-columns: 1fr; }
  .accountant-dashboard,
  .accountant-queues,
  .production-layout,
  .recipe-add,
  .accountant-list-item { grid-template-columns: 1fr; }
  .return-cart table { min-width: 560px; }
  .return-detail-head { display: grid; }
  .return-detail-grid { grid-template-columns: 1fr; }
}
