/* public/css/style.css */
/* ============================================================
   红砖厂出入库系统 —— 工业蓝主题
   设计原则：极简、大气、信息密度适中、适合工厂现场平板/触摸屏操作
   ============================================================ */

:root {
  --brand-900: #0a2647;   /* 深蓝：顶部导航、侧边栏背景 */
  --brand-700: #144272;   /* 主蓝：按钮、强调色 */
  --brand-500: #205295;   /* 中蓝：hover态 */
  --brand-100: #e8f1fb;   /* 极浅蓝：选中态背景 */
  --accent: #2c9c5c;      /* 成功/入库绿 */
  --danger: #c0392b;      /* 危险/出库红/警告 */
  --warning: #e08e0b;     /* 警示黄 */
  --bg: #f4f7fb;
  --card-bg: #ffffff;
  --border: #dce4ee;
  --text-900: #1a2332;
  --text-500: #5c6b7f;
  --radius: 8px;
  --query-col-1: 72px;
  --query-col-2: 112px;
  --shadow: 0 1px 3px rgba(10, 38, 71, 0.08), 0 1px 2px rgba(10, 38, 71, 0.06);
}

.sales-query-table-wrap { overflow:auto; max-width:100%; }
.sales-query-table { min-width:2200px; border-collapse:separate; border-spacing:0; }
.sales-query-table thead th { position:sticky; top:0; z-index:3; background:var(--brand-900); }
.sales-query-table .sticky-col-1 { position:sticky; left:0; z-index:2; background:var(--card-bg); min-width:var(--query-col-1); }
.sales-query-table .sticky-col-2 { position:sticky; left:var(--query-col-1); z-index:2; background:var(--card-bg); min-width:var(--query-col-2); }
.sales-query-table .sticky-col-3 { position:sticky; left:calc(var(--query-col-1) + var(--query-col-2)); z-index:2; background:var(--card-bg); min-width:150px; }
.sales-query-table thead .sticky-col-1,
.sales-query-table thead .sticky-col-2,
.sales-query-table thead .sticky-col-3 { z-index:4; background:var(--brand-900); }
.sales-query-range > div { display:flex; align-items:center; gap:6px; }
.sales-query-range input { min-width:0; }
.sales-query-filters { padding:0; }
.sales-query-filters > summary { cursor:pointer; padding:14px 16px; font-weight:700; }
.sales-query-filters[open] > summary { border-bottom:1px solid var(--border); }
.sales-query-filters form { padding:12px 16px 16px; }
.checkbox-field { display:flex !important; align-items:center; gap:6px; min-height:38px; }
.checkbox-field input { width:auto !important; }
.link-button { border:0; padding:0; color:var(--brand-700); background:transparent; text-decoration:underline; font:inherit; }
.pagination-jump { display:inline-flex; align-items:center; gap:5px; }
.pagination-jump input { width:64px; padding:5px; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text-900);
  font-size: 14px;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-900) 0%, var(--brand-500) 100%);
}

.login-box {
  background: var(--card-bg);
  width: 380px;
  padding: 40px 36px;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.login-box h1 {
  font-size: 20px;
  margin: 0 0 4px;
  color: var(--brand-900);
}

.login-box .subtitle {
  color: var(--text-500);
  font-size: 12.5px;
  margin-bottom: 28px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-500);
  margin-bottom: 6px;
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: #fbfcfe;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  background: #fff;
}

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: none;
  font-size: 14px;
  font-weight: 500;
  transition: all .15s;
}

.btn-primary {
  background: var(--brand-700);
  color: #fff;
  width: 100%;
}
.btn-primary:hover { background: var(--brand-500); }

.btn-outline {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-900);
}
.btn-outline:hover { border-color: var(--brand-500); color: var(--brand-700); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }

.error-msg {
  background: #fdecea;
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.error-msg.show { display: block; }

.hint-msg {
  background: #fff8e6;
  color: #8a6100;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  margin-top: 12px;
}

.print-dialog-mask {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 24, 45, .56);
}

.print-dialog {
  width: min(460px, 100%);
  padding: 22px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .25);
}

.print-dialog h3 { margin: 0 0 8px; }
.print-dialog p { margin: 0 0 16px; color: var(--text-secondary); line-height: 1.6; }
.print-dialog label { display: block; margin-top: 12px; font-weight: 600; }
.print-dialog select,
.print-dialog textarea { width: 100%; margin-top: 6px; font-weight: 400; }
.print-dialog-error { min-height: 22px; padding-top: 6px; color: var(--danger); }
.print-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }

/* ---------- 应用主框架 ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--brand-900);
  color: #cdd9ea;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar .logo {
  padding: 20px 18px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar .logo small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: #8fa4c2;
  margin-top: 3px;
}

.nav-item {
  padding: 12px 18px;
  font-size: 13.5px;
  cursor: pointer;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active {
  background: rgba(255,255,255,0.1);
  border-left-color: var(--accent);
  color: #fff;
}
.nav-item.disabled {
  opacity: .4;
  cursor: not-allowed;
}
.nav-section-title {
  padding: 16px 18px 6px;
  font-size: 11px;
  color: #6f84a3;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.topbar .page-title { font-size: 16px; font-weight: 600; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-500);
}
.user-chip .role-tag {
  background: var(--brand-100);
  color: var(--brand-700);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11.5px;
}

.content {
  flex: 1;
  padding: 24px;
  overflow: auto;
}

.workspace-tabs {
  min-height: 42px;
  display: flex;
  align-items: end;
  gap: 4px;
  padding: 6px 14px 0;
  overflow-x: auto;
  background: #f2f6fb;
  border-bottom: 1px solid var(--border);
}
.workspace-tab {
  appearance: none;
  min-width: 126px;
  max-width: 240px;
  height: 35px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  background: transparent;
  color: var(--text-500);
  cursor: pointer;
  white-space: nowrap;
}
.workspace-tab:hover { background: #e7eef7; color: var(--text-800); }
.workspace-tab.active {
  background: #fff;
  border-color: var(--border);
  color: var(--brand-700);
  font-weight: 600;
}
.workspace-tab-title { overflow: hidden; text-overflow: ellipsis; }
.workspace-tab-dirty { color: #e39b22; font-size: 10px; }
.workspace-tab-close {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 17px;
  line-height: 1;
}
.workspace-tab-close:hover { background: #dce5ef; color: var(--danger); }
.workspace-panels {
  flex: 1;
  min-height: 0;
  position: relative;
}
.workspace-panel {
  position: absolute;
  inset: 0;
  min-width: 0;
}
.workspace-panel[hidden] { display: none; }
.workspace-content { height: 100%; box-sizing: border-box; }
.draft-inbox-button span {
  display: inline-flex;
  min-width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  margin-left: 3px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--brand-100);
  color: var(--brand-700);
  font-weight: 700;
}
.draft-inbox-modal { width: min(620px, calc(100vw - 32px)); }
.draft-inbox-list { display: grid; gap: 10px; margin-top: 14px; }
.draft-inbox-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.draft-inbox-item strong,
.draft-inbox-item small { display: block; }
.draft-inbox-item small { margin-top: 4px; color: var(--text-500); }
.admin-reset-button { white-space: nowrap; }
.admin-reset-modal { width: min(680px, calc(100vw - 32px)); }
.admin-reset-warning {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid #efb7ae;
  border-left: 5px solid var(--danger);
  border-radius: var(--radius);
  background: #fff1ef;
  color: #7f271d;
  line-height: 1.6;
}
.admin-reset-warning strong { font-size: 14px; }
.admin-reset-preserved {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #f7f9fc;
  color: var(--text-500);
  font-size: 12.5px;
  line-height: 1.6;
}
.admin-reset-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.admin-reset-count {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fbfcfe;
}
.admin-reset-count span,
.admin-reset-count strong { display: block; }
.admin-reset-count span { color: var(--text-500); font-size: 12px; }
.admin-reset-count strong { margin-top: 5px; color: var(--danger); font-size: 21px; }
.admin-reset-confirmation-field code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #fff1ef;
  color: var(--danger);
  font-family: inherit;
  font-weight: 700;
}
.admin-reset-actions { display: flex; gap: 10px; }
.admin-reset-actions .btn { flex: 1; }
.admin-reset-actions .btn:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 14.5px;
  font-weight: 600;
  margin: 0 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--text-500);
  font-weight: 500;
  background: #fafcff;
}
tr:hover td { background: #fafcff; }

.badge {
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
}
.badge-active { background: #e6f6ec; color: var(--accent); }
.badge-disabled { background: #fdecea; color: var(--danger); }
.badge-warning { background:#fff3d6; color:#946100; }

.modal-mask {
  position: fixed; inset: 0;
  background: rgba(10,38,71,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-mask.show { display: flex; }
.modal-box {
  background: #fff;
  width: 420px;
  max-width: 90vw;
  max-height: 85vh;
  overflow: auto;
  border-radius: 10px;
  padding: 24px;
}
.modal-box h3 { margin: 0 0 18px; font-size: 15px; }

.perm-group { margin-bottom: 14px; }
.perm-group-title { font-size: 12.5px; color: var(--text-500); margin-bottom: 6px; font-weight: 600; }
.perm-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }

.empty-state {
  text-align: center;
  color: var(--text-500);
  padding: 40px 0;
  font-size: 13px;
}

.toast {
  position: fixed;
  top: 20px; right: 20px;
  background: var(--brand-900);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 200;
  opacity: 0;
  transform: translateY(-8px);
  transition: all .2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

/* ---------- 业务页面通用组件 ---------- */
.page-actions { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:16px; }
.page-lead { color:var(--text-500); font-size:13px; }
.action-group { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.btn-auto { width:auto; }
.form-grid { display:grid; gap:14px; }
.form-grid.three { grid-template-columns:repeat(3, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns:repeat(4, minmax(0, 1fr)); }
.form-grid.five { grid-template-columns:repeat(5, minmax(0, 1fr)); }
.stats-grid { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:20px; }
.print-settings-grid { display:grid; grid-template-columns:1fr; gap:20px; }
.print-setting-group { display:grid; grid-template-columns:minmax(0, 1.45fr) minmax(320px, .75fr); gap:20px; align-items:start; }
.print-setting-group .card { margin-bottom:0; }
.print-setting-card { border-top:4px solid var(--brand-500); }
.workstation-profile-card { border-top:4px solid var(--accent); background:#fbfffd; }
.print-setting-card .field { margin-bottom:8px; }
.workstation-profile-card .field { margin-bottom:8px; }
.print-setting-actions { margin-top:14px; flex-wrap:wrap; }
.layout-coordinate-table input { min-width:84px; width:100%; padding:7px 8px; }
.layout-coordinate-table th:first-child,
.layout-coordinate-table td:first-child { white-space:nowrap; }
.workstation-profile-grid { margin-top:14px; }
.weighbridge-grid { display:grid; grid-template-columns:minmax(360px, .9fr) minmax(520px, 1.35fr); gap:20px; align-items:start; }
.weighbridge-grid .card { margin-bottom:0; }
.live-dot { display:inline-block; width:8px; height:8px; background:var(--accent); border-radius:50%; margin-right:6px; box-shadow:0 0 0 3px rgba(44,156,92,.14); }
.pool-count { display:inline-flex; align-items:center; justify-content:center; min-width:28px; padding:3px 9px; border-radius:20px; background:var(--brand-100); color:var(--brand-700); font-weight:700; }
.weight-preview { margin:4px 0 16px; padding:14px 16px; border:1px solid var(--border); border-radius:var(--radius); background:#f8fbff; display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.weight-preview span { color:var(--text-500); font-size:12px; }
.weight-preview strong { display:block; margin-top:4px; color:var(--brand-900); font-size:19px; }
.weigh-ticket-title { border-top:4px solid var(--brand-500); }
.form-hint { color:var(--text-500); font-size:12.5px; line-height:1.65; }
.inline-form { border-left:4px solid var(--brand-500); }
.inline-form .field { margin-bottom:8px; }
.field input[readonly] { background:#eef3f8; color:var(--brand-900); font-weight:700; cursor:not-allowed; }
.field input:disabled, .field select:disabled { background:#eef3f8; color:var(--text-500); cursor:not-allowed; opacity:1; }
.readonly-code-hint { display:block; margin-top:5px; color:var(--text-500); font-size:11.5px; }
.tag { display:inline-block; padding:3px 8px; margin:2px 5px 2px 0; background:var(--brand-100); color:var(--brand-700); border-radius:4px; font-size:11.5px; }
.tag-edit { margin-left:6px; padding:0; border:0; border-bottom:1px solid currentColor; background:transparent; color:inherit; font-size:11.5px; }
.table-wrap { overflow:auto; }
.number-cell { text-align:right; white-space:nowrap; }
.muted { color:var(--text-500); }
.block { display:block; margin-top:3px; }
.summary-grid { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:16px; margin-bottom:18px; }
.inventory-summary-grid { grid-template-columns:repeat(4, minmax(0, 1fr)); }
.summary-card { background:#fff; border-radius:var(--radius); box-shadow:var(--shadow); padding:18px 20px; display:grid; grid-template-columns:1fr auto; align-items:end; gap:3px 12px; }
.summary-card span { color:var(--text-500); font-size:12.5px; grid-column:1 / -1; }
.summary-card strong { color:var(--brand-900); font-size:25px; line-height:1.1; }
.summary-card small { color:var(--text-500); }
.inventory-product-list { display:grid; gap:14px; margin-bottom:20px; }
.inventory-product-card { overflow:hidden; border:1px solid var(--border); border-radius:var(--radius); background:#fff; box-shadow:var(--shadow); }
.inventory-product-toggle { width:100%; border:0; padding:17px 20px; display:flex; align-items:center; justify-content:space-between; gap:20px; background:#fff; color:var(--text-800); text-align:left; cursor:pointer; }
.inventory-product-toggle:hover { background:#f8fbff; }
.inventory-product-toggle::after { content:"展开"; flex:0 0 auto; padding:4px 9px; border-radius:14px; background:var(--brand-100); color:var(--brand-700); font-size:11.5px; }
.inventory-product-toggle[aria-expanded="true"]::after { content:"收起"; }
.inventory-product-name { display:grid; gap:4px; min-width:0; }
.inventory-product-name strong { color:var(--brand-900); font-size:16px; overflow-wrap:anywhere; }
.inventory-product-name small, .inventory-product-total small, .inventory-spec-heading small { color:var(--text-500); }
.inventory-product-total { display:flex; align-items:baseline; gap:4px; white-space:nowrap; }
.inventory-product-total b { color:var(--brand-900); font-size:24px; }
.inventory-product-details { display:none; padding:0 18px 18px; border-top:1px solid var(--border); background:#fbfcfe; }
.inventory-product-details.is-open { display:grid; gap:12px; }
.inventory-spec { margin-top:14px; padding:14px; border:1px solid var(--border); border-radius:var(--radius); background:#fff; }
.inventory-spec-heading { display:flex; align-items:center; justify-content:space-between; gap:18px; padding-bottom:10px; border-bottom:1px dashed var(--border); }
.inventory-spec-heading > div:first-child { display:grid; gap:3px; }
.inventory-spec-totals { display:flex; gap:16px; flex-wrap:wrap; justify-content:flex-end; color:var(--text-500); }
.inventory-spec-totals b { color:var(--brand-900); }
.inventory-warehouse-list { display:grid; gap:7px; padding-top:10px; }
.inventory-warehouse-row { display:grid; grid-template-columns:minmax(180px,1fr) auto minmax(150px,auto); gap:14px; align-items:center; padding:8px 10px; border-radius:6px; background:#f7f9fc; }
.inventory-warehouse-row small { color:var(--text-500); text-align:right; }
.qty-in { color:var(--accent); font-weight:600; }
.qty-out { color:var(--danger); font-weight:600; }
.audit-hint { margin:0 0 14px; }
.check-card { display:flex; align-items:center; gap:8px; min-height:40px; padding:9px 12px; border:1px solid var(--border); border-radius:var(--radius); background:#fbfcfe; color:var(--text-500); }
.check-card input { width:16px; height:16px; }
.customer-title { border-top:3px solid var(--brand-500); }
.customer-title h2 { margin:3px 0 5px; color:var(--brand-900); }
.customer-title p { margin:0; color:var(--text-500); }
.eyebrow { font-size:11px; font-weight:700; letter-spacing:.08em; color:var(--brand-500); }
.value-line { grid-column:1 / -1; color:var(--text-500); font-size:12px; padding-top:6px; border-top:1px solid var(--border); margin-top:6px; }
.customer-balances { grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); }
.customer-tree { display:grid; gap:12px; }
.customer-tree-branch { position:relative; }
.customer-unit-row { display:grid; grid-template-columns:minmax(190px,.75fr) minmax(260px,1.6fr) auto; align-items:center; gap:14px; padding:13px 14px; border:1px solid var(--border); border-radius:var(--radius); background:#fbfcfe; }
.customer-unit-main { display:grid; grid-template-columns:auto 1fr; align-items:center; gap:5px 8px; min-width:0; }
.customer-unit-main small { grid-column:1 / -1; color:var(--text-500); overflow-wrap:anywhere; }
.customer-unit-quotas { min-width:0; }
.customer-unit-actions { display:flex; justify-content:flex-end; gap:6px; flex-wrap:wrap; }
.customer-tree-children { display:grid; gap:8px; margin:8px 0 0 26px; padding-left:18px; border-left:2px solid var(--brand-100); }
.customer-tree-branch.level-3 .customer-unit-row { background:#fff; }
.quota-inherited { background:#f1f3f6; color:var(--text-500); }
.quota-blocked { background:#fdecea; color:var(--danger); }
.quota-set { background:#e6f6ec; color:#237545; }
.row-actions { white-space:nowrap; }
.row-actions .btn { margin:2px 3px 2px 0; }
.risk-row td { background:#fffbf0; }
.sales-batch-review-bar { position:sticky; top:10px; z-index:12; display:flex; align-items:center; justify-content:space-between; gap:16px; margin:0 0 14px; padding:12px 14px; border:1px solid #c7dbef; border-left:4px solid var(--brand-500); border-radius:var(--radius); background:#f7fbff; box-shadow:var(--shadow); }
.sales-batch-review-summary { display:flex; align-items:center; gap:18px; flex-wrap:wrap; color:var(--text-500); }
.sales-batch-review-summary strong { color:var(--brand-900); }
.sales-review-select { width:52px; text-align:center; }
.sales-review-select input { width:17px; height:17px; cursor:pointer; }
.batch-review-failed td { background:#fff0ed !important; box-shadow:inset 0 1px 0 #efb7ae, inset 0 -1px 0 #efb7ae; }
.section-label { margin:4px 0 12px; padding-bottom:7px; border-bottom:1px solid var(--border); color:var(--brand-700); font-weight:600; font-size:12.5px; }
.account-hint { padding:10px 12px; margin:2px 0 16px; border-radius:var(--radius); background:var(--brand-100); color:var(--brand-900); }
.account-hint.danger { background:#fff1ef; color:var(--danger); border:1px solid #f4c4bd; }
.risk-confirm { margin:10px 0; padding:12px; background:#fff8e6; border:1px solid #f2d58b; border-radius:var(--radius); color:#7a5300; }
.risk-confirm input { width:16px; height:16px; vertical-align:middle; }
.field-lock-note { margin:0 0 16px; padding:11px 13px; border:1px solid #efcc7b; border-radius:var(--radius); background:#fff8e6; color:#7a5300; font-size:12.5px; line-height:1.55; }
.field-lock-note.compact { display:inline-block; margin:6px 0 0; padding:6px 9px; }
.correction-reason { margin-top:16px; padding-top:14px; border-top:1px dashed var(--border); }
.change-number { display:inline-flex; align-items:center; padding:4px 9px; border-radius:14px; background:#e6f6ec; color:#237545; font-weight:700; }
.version-conflict-panel { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin:12px 0 16px; padding:12px 14px; border:1px solid #efb7ae; border-left:4px solid var(--danger); border-radius:var(--radius); background:#fff0ed; color:var(--danger); }
.version-conflict-panel[hidden] { display:none; }
.version-conflict-panel span { flex:1 1 280px; color:#8d3d32; }
.correction-actions { margin-top:16px; flex-wrap:wrap; }
.correction-line-editor { min-width:0; margin-bottom:16px; overflow-x:auto; }
.correction-line-row { min-width:760px; display:grid; grid-template-columns:minmax(180px,1.2fr) minmax(220px,1.3fr) minmax(110px,.55fr) minmax(120px,.55fr) auto; align-items:end; gap:12px; margin-bottom:10px; padding:12px; border:1px solid var(--border); border-left:4px solid var(--brand-500); border-radius:var(--radius); background:#fbfcfe; }
.correction-line-row .field { margin:0; }
.correction-line-row output { min-height:40px; display:flex; align-items:center; padding:9px 12px; border:1px solid var(--border); border-radius:var(--radius); background:#fff; font-weight:700; white-space:nowrap; }
.purchase-correction-summary, .correction-live-values { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:10px; margin:0 0 16px; }
.purchase-correction-summary > div, .correction-live-values > div { display:grid; gap:5px; padding:11px 12px; border:1px solid var(--border); border-radius:var(--radius); background:#f7fbff; }
.purchase-correction-summary span, .correction-live-values span { color:var(--text-500); font-size:12px; }
.purchase-correction-summary strong, .correction-live-values output { color:var(--brand-900); font-weight:700; }
.check-card.compact { display:inline-flex; margin:0 12px 0 0; }
.submit-large { min-width:180px; padding:12px 22px; }
.sales-lines-heading { display:flex; align-items:center; justify-content:space-between; }
.sales-lines { display:grid; gap:12px; margin-bottom:18px; }
.sales-line-row { border:1px solid var(--border); border-left:4px solid var(--brand-500); border-radius:var(--radius); background:#fbfcfe; padding:14px; }
.sales-line-title { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.sales-line-grid { display:grid; grid-template-columns:repeat(7,minmax(130px,1fr)); gap:12px; }
.sales-line-grid .field { margin-bottom:4px; }
.sales-line-overdraft-price { display:none; }
.sales-line-piece-count, .sales-line-amount { display:block; min-height:38px; padding:9px 12px; border:1px solid var(--border); border-radius:var(--radius); background:#f7f9fc; color:var(--brand-900); font-variant-numeric:tabular-nums; font-weight:700; }
.sales-line-summary { padding-top:8px; border-top:1px dashed var(--border); font-size:12.5px; line-height:1.55; }
.fleet-grid { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:20px; margin-bottom:20px; }
.fleet-picker-anchor { position:relative; }
.fleet-picker-results { position:absolute; z-index:30; top:100%; left:0; right:0; margin-top:4px; max-height:230px; overflow:auto; border:1px solid var(--border); border-radius:var(--radius); background:#fff; box-shadow:var(--shadow); }
.fleet-picker-choice { display:block; width:100%; padding:10px 12px; border:0; border-bottom:1px solid var(--border); background:#fff; color:var(--text-800); text-align:left; cursor:pointer; }
.fleet-picker-choice:hover, .fleet-picker-choice[aria-selected="true"] { background:var(--brand-100); }

@media (max-width: 1050px) {
  .form-grid.four, .form-grid.five { grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .print-setting-group { grid-template-columns:1fr; }
  .weighbridge-grid { grid-template-columns:1fr; }
  .fleet-grid { grid-template-columns:1fr; }
  .sales-line-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .customer-unit-row { grid-template-columns:1fr; }
  .customer-unit-actions { justify-content:flex-start; }
  .inventory-summary-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .sidebar { width:190px; }
  .content { padding:16px; }
  .form-grid.three, .form-grid.four, .form-grid.five, .summary-grid, .stats-grid { grid-template-columns:1fr; }
  .sales-line-grid { grid-template-columns:1fr; }
  .page-actions { align-items:flex-start; flex-direction:column; }
  .sales-batch-review-bar { position:static; align-items:flex-start; flex-direction:column; }
  .inventory-product-toggle, .inventory-spec-heading { align-items:flex-start; flex-direction:column; }
  .inventory-product-total { white-space:normal; }
  .inventory-spec-totals { justify-content:flex-start; }
  .inventory-warehouse-row { grid-template-columns:1fr; gap:4px; }
  .inventory-warehouse-row small { text-align:left; }
  .admin-reset-counts { grid-template-columns:1fr; }
  .version-conflict-panel { align-items:flex-start; flex-direction:column; }
}
