:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-2: #eef2f1;
  --ink: #18201f;
  --muted: #6b7471;
  --line: #dce2df;
  --accent: #146c5f;
  --accent-2: #245b8f;
  --warn: #a35d10;
  --danger: #a83a32;
  --ok: #24724b;
  --shadow: 0 16px 34px rgba(30, 43, 40, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background: linear-gradient(135deg, #f6f7f8 0%, #e7eeec 100%);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-brand {
  padding: 0 0 8px;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #17211f;
  color: #f7faf9;
  padding: 20px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 22px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #d7eee9;
  color: #10332d;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #b8c8c4;
  font-size: 13px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: #dce7e4;
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.workspace {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 17px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  min-width: 60px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.user-badge {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.icon-btn,
.text-btn,
.primary-btn,
.secondary-btn,
.row-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.icon-btn {
  width: 40px;
  height: 40px;
  font-size: 18px;
}

.text-btn {
  min-height: 34px;
  padding: 0 12px;
}

.primary-btn {
  min-height: 42px;
  padding: 0 16px;
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.secondary-btn {
  min-height: 42px;
  padding: 0 16px;
  background: #ffffff;
  font-weight: 700;
}

.row-btn {
  min-height: 30px;
  padding: 0 9px;
  margin: 2px;
  white-space: nowrap;
}

.row-btn.ok {
  border-color: rgba(36, 114, 75, 0.3);
  color: var(--ok);
}

.row-btn.warn {
  border-color: rgba(163, 93, 16, 0.3);
  color: var(--warn);
}

.row-btn.danger {
  border-color: rgba(168, 58, 50, 0.3);
  color: var(--danger);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  min-height: 104px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}

.kpi strong {
  display: block;
  font-size: 30px;
  word-break: break-word;
}

.notification-panel {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid #e2c278;
  border-radius: 8px;
  background: #fff8e7;
}

.notification-list {
  display: grid;
  gap: 8px;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(163, 93, 16, 0.22);
  border-radius: 8px;
  background: #ffffff;
}

.notification-item p {
  margin: 4px 0;
  color: #394341;
  line-height: 1.45;
}

.notification-item small {
  color: var(--muted);
}

.workbench-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.mini-kpi {
  min-height: 74px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mini-kpi span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.mini-kpi strong {
  display: block;
  font-size: 24px;
}

.workbench-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 16px;
  align-items: start;
}

.workbench-lane {
  min-width: 0;
}

.lane-head {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.lane-count {
  min-width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #e7eeec;
  color: var(--ink);
  font-weight: 800;
}

.order-card-list {
  display: grid;
  gap: 10px;
}

.order-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 20px rgba(30, 43, 40, 0.06);
}

.order-card-head,
.order-card-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.order-card-head strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  word-break: break-word;
}

.order-card-product {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.order-card-product small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.order-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.order-facts span {
  min-height: 30px;
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--surface-2);
  color: #33413e;
  font-size: 12px;
}

.order-facts b {
  margin-right: 4px;
  font-size: 15px;
}

.order-details {
  display: grid;
  gap: 7px;
  margin: 0;
}

.order-details div {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 8px;
}

.order-details dt {
  color: var(--muted);
  font-size: 12px;
}

.order-details dd {
  min-width: 0;
  margin: 0;
  color: #26302e;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.order-card-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.empty-card {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.55);
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

.export-card {
  min-height: 108px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.export-card:hover {
  border-color: var(--accent-2);
}

.export-card strong {
  font-size: 18px;
}

.export-card span {
  color: var(--muted);
  font-size: 13px;
}

.primary-export {
  background: #17211f;
  color: #ffffff;
}

.primary-export span {
  color: #b8c8c4;
}

.split-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.panel,
.form-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.panel-head,
.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.form-band {
  margin-bottom: 18px;
  padding: 18px;
}

.form-band.attention {
  animation: formAttention 900ms ease;
}

@keyframes formAttention {
  0% {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(20, 108, 95, 0.18), var(--shadow);
  }
  100% {
    border-color: var(--line);
    box-shadow: var(--shadow);
  }
}

.form-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 16px;
}

.form-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}

.inbound-lines {
  display: grid;
  gap: 10px;
}

.line-head,
.inbound-item-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(110px, .7fr) minmax(130px, .8fr) auto;
  gap: 10px;
  align-items: end;
}

.line-head {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.inbound-items {
  display: grid;
  gap: 8px;
}

label {
  display: grid;
  gap: 6px;
  color: #394341;
  font-size: 13px;
  min-width: 0;
}

.wide {
  grid-column: span 2;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(36, 91, 143, 0.12);
}

input[readonly] {
  background: #f4f6f5;
  color: var(--muted);
}

.toolbar {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.quick-filter {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.quick-filter button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.quick-filter button.active {
  background: #17211f;
  color: #ffffff;
}

.search-box {
  width: min(430px, 100%);
}

.compact-filter {
  width: 150px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 0;
  color: var(--muted);
  font-size: 13px;
}

.pagination-bar button {
  min-width: 76px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.table-wrap.compact {
  max-height: 360px;
}

.mobile-data-list {
  display: none;
}

.mobile-data-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 20px rgba(30, 43, 40, 0.06);
}

.mobile-card-head,
.mobile-card-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mobile-card-head strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  word-break: break-word;
}

.mobile-card-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.mobile-card-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mobile-card-facts div,
.mobile-card-section {
  min-width: 0;
  padding: 8px;
  border-radius: 8px;
  background: var(--surface-2);
}

.mobile-card-facts span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.mobile-card-facts strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  word-break: break-word;
}

.mobile-card-summary {
  display: grid;
  gap: 7px;
  margin-top: 5px;
}

.mobile-card-summary small {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.mobile-card-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

table.finance-table {
  min-width: 1120px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  background: #f9fbfa;
  color: #4b5552;
  z-index: 1;
}

td strong {
  display: block;
  font-size: 13px;
}

td small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.money-input {
  min-width: 104px;
  text-align: right;
}

.note-input {
  min-width: 180px;
}

.profit-positive {
  color: var(--ok);
}

.profit-negative {
  color: var(--danger);
}

.profit-pending {
  color: var(--muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.file-link {
  color: var(--accent-2);
  font-weight: 700;
  text-decoration: none;
}

.file-link:hover {
  text-decoration: underline;
}

.muted-sep {
  color: var(--muted);
  margin: 0 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.badge.ok {
  color: var(--ok);
  background: #edf8f2;
  border-color: #c9e9d7;
}

.badge.warn {
  color: var(--warn);
  background: #fff5e8;
  border-color: #f1d4a9;
}

.badge.danger {
  color: var(--danger);
  background: #fff0ee;
  border-color: #efc8c4;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #17211f;
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(17, 25, 23, 0.42);
}

.modal-panel {
  width: min(940px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
}

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

.modal-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.inbound-detail-panel {
  width: min(1040px, 100%);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.detail-grid div,
.inline-form-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.detail-grid div {
  padding: 10px 12px;
}

.detail-grid small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.inline-form-band {
  padding: 14px;
  margin-bottom: 14px;
}

.inline-form-band .form-head {
  margin-bottom: 10px;
}

.inline-form-band h3 {
  margin: 0;
  font-size: 15px;
}

.detail-table-wrap {
  margin-bottom: 14px;
}

.scan-panel {
  width: min(760px, 100%);
}

.scan-layout {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.scan-input-label,
.scan-manual-label,
.scan-photo-label,
.scan-camera-panel,
.scan-camera-status,
.scan-code-list,
.scan-filter,
.scan-summary,
.scan-photo-preview,
.scan-layout .modal-actions {
  grid-column: 1 / -1;
}

.scan-input-label textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

.scan-manual-label input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 18px;
  letter-spacing: 0;
}

.scan-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.scan-filter {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.scan-filter button {
  flex: 1 1 0;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.scan-filter button.active {
  background: #17211f;
  color: #ffffff;
}

.mobile-scan-only {
  display: none !important;
}

.scan-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.scan-summary strong {
  font-size: 22px;
}

.scan-summary span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.primary-btn.ready {
  border-color: var(--ok);
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(36, 114, 75, 0.14);
}

.scan-camera-panel {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  max-height: min(320px, 36vh);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101918;
}

.scan-camera-panel video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scan-camera-frame {
  position: absolute;
  inset: 18%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.scan-camera-status {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.scan-code-list {
  max-height: min(320px, 34vh);
  overflow: auto;
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.scan-code-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  background: var(--surface-2);
}

.scan-photo-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.scan-photo-preview img {
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-2);
}

.scan-photo-preview div {
  min-width: 0;
  flex: 1 1 auto;
}

.scan-photo-preview strong,
.scan-photo-preview small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scan-photo-preview small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.scan-code-list span,
.scan-code-list small {
  min-width: 0;
  word-break: break-all;
}

.scan-code-list small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.scan-item-code {
  font-size: 12px;
  color: var(--ink);
}

.scan-item.scanned {
  background: #edf8f2;
  border: 1px solid #c9e9d7;
}

.scan-item.scanned .scan-item-code,
.scan-check {
  color: var(--ok);
}

.scan-check {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  vertical-align: -3px;
}

.scan-check svg {
  width: 18px;
  height: 18px;
}

.scan-check path {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: draw-check 360ms ease-out forwards;
}

@keyframes draw-check {
  to {
    stroke-dashoffset: 0;
  }
}

@media (max-width: 760px) {
  .mobile-scan-only:not([hidden]) {
    display: inline-flex !important;
  }

  .scan-camera-status.mobile-scan-only:not([hidden]) {
    display: block !important;
  }
}

.scan-pending {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.scan-done {
  flex: 0 0 auto;
  color: var(--ok);
  font-size: 12px;
  font-weight: 700;
}

.empty-scan {
  justify-content: center !important;
  color: var(--muted);
  background: transparent !important;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    align-content: start;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
  }

  .brand {
    padding-bottom: 12px;
  }

  .nav {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 2px;
    padding: 8px 4px;
  }

  .workspace {
    padding: 18px;
  }

  .topbar,
  .form-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .kpi-grid,
  .workbench-kpis,
  .workbench-grid,
  .split-layout,
  .export-grid,
  .detail-grid,
  .grid-form,
  .inbound-item-row {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: span 1;
  }
}

@media (max-width: 760px) {
  body {
    background: #ffffff;
  }

  .login-view {
    padding: 14px;
  }

  .login-card {
    padding: 20px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 12;
    height: auto;
    min-height: 0;
    padding: 8px 8px 7px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .sidebar .brand {
    display: none;
  }

  .nav {
    display: flex;
    gap: 6px;
    min-height: 0;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    min-width: 58px;
    min-height: 44px;
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .workspace {
    padding: 12px;
  }

  .topbar {
    gap: 10px;
    margin-bottom: 14px;
  }

  .topbar h1 {
    font-size: 22px;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .user-badge {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .workbench-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }

  .mini-kpi {
    min-height: 64px;
    padding: 10px;
  }

  .mini-kpi strong {
    font-size: 22px;
  }

  .lane-head {
    position: sticky;
    top: 53px;
    z-index: 6;
    margin: 0 -12px 10px;
    padding: 8px 12px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
  }

  .order-card {
    padding: 12px;
    box-shadow: none;
  }

  .order-card-head,
  .order-card-actions {
    align-items: flex-start;
  }

  .order-card-head {
    flex-direction: column;
  }

  .order-card-actions .row-btn,
  .mobile-card-actions .row-btn,
  .scan-actions button,
  .modal-actions button {
    flex: 1 1 120px;
    min-height: 44px;
    margin: 0;
  }

  .order-facts,
  .mobile-card-facts {
    grid-template-columns: 1fr;
  }

  .responsive-table {
    display: none;
  }

  .mobile-data-list {
    display: grid;
    gap: 10px;
  }

  .pagination-bar {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .pagination-bar button {
    flex: 1 1 110px;
  }

  .toolbar {
    padding: 10px;
  }

  .search-box,
  .compact-filter {
    width: 100%;
  }

  .quick-filter {
    width: 100%;
  }

  .quick-filter button {
    flex: 1 1 0;
    min-height: 42px;
    padding: 0 8px;
  }

  .modal {
    place-items: stretch;
    padding: 0;
    background: rgba(17, 25, 23, 0.55);
  }

  .modal-panel,
  .scan-panel,
  .inbound-detail-panel {
    width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    border: 0;
    padding: 12px;
  }

  .modal-head {
    position: sticky;
    top: -12px;
    z-index: 8;
    align-items: flex-start;
    margin: -12px -12px 12px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .modal-head h2 {
    font-size: 18px;
  }

  .modal-subtitle {
    font-size: 12px;
    line-height: 1.35;
  }

  .scan-layout {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .scan-input-label textarea {
    min-height: 76px;
  }

  .scan-manual-label input {
    min-height: 48px;
    font-size: 20px;
  }

  .scan-actions,
  .modal-actions {
    position: static;
    display: flex;
    flex-wrap: wrap;
  }

  .scan-filter button {
    min-height: 42px;
  }

  .scan-camera-panel {
    aspect-ratio: 4 / 3;
    max-height: none;
  }

  .scan-summary {
    align-items: center;
    justify-content: space-between;
  }

  .scan-code-list {
    max-height: 42dvh;
    padding: 6px;
  }

  .scan-code-list li {
    align-items: flex-start;
    padding: 9px;
  }

  .scan-code-list .row-btn {
    min-height: 36px;
    margin: 0;
  }

  .scan-photo-label input {
    min-height: 48px;
    padding: 10px;
  }

  .scan-photo-preview {
    align-items: flex-start;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
