:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --text: #102033;
  --muted: #64748b;
  --line: #d9e2ec;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Segoe UI, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  background: #102033;
  color: #e5edf5;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
}
.brand { font-size: 22px; font-weight: 800; margin: 8px 8px 18px; }
nav { display: grid; gap: 6px; }
nav a, .userbox a {
  color: #d8e4f0;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 650;
}
nav a:hover, nav a.active { background: #1d4ed8; color: #fff; }
.main-nav {
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}
.nav-component {
  display: grid;
  gap: 4px;
}
.nav-parent,
.nav-child {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 7px;
}
.nav-parent em,
.nav-child em {
  min-width: 0;
  border-radius: 999px;
  padding: 2px 7px;
  background: #9cff66;
  color: #0b3514;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}
.nav-parent b {
  color: #e5edf5;
  font-size: 17px;
  line-height: 1;
}
.nav-children {
  display: grid;
  gap: 3px;
  margin: -1px 0 2px 12px;
  padding-left: 9px;
  border-left: 1px solid rgba(255,255,255,.16);
}
.nav-child {
  min-height: 30px;
  padding: 7px 10px;
  color: #a9b8ca;
  font-size: 12px;
  font-weight: 720;
}
.nav-child:hover,
.nav-child.active {
  background: rgba(37, 99, 235, .78);
  color: #fff;
}
.nav-component.is-open .nav-parent b {
  transform: rotate(45deg);
}
.userbox {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.14);
  padding: 14px 8px 0;
  display: grid;
  gap: 4px;
}
.userbox span { color: #a9b8ca; font-size: 13px; }
.content { margin-left: 248px; padding: 22px; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
h1 { margin: 0; font-size: 26px; }
h2 { margin: 0 0 12px; font-size: 18px; }
p { margin: 6px 0 0; color: var(--muted); }
.cards {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
}
.card { padding: 14px; }
.card span { display: block; color: var(--muted); font-size: 13px; }
.card strong { display: block; font-size: 24px; margin-top: 8px; }
.panel { padding: 14px; overflow: auto; }
.table-panel {
  max-height: calc(100vh - 145px);
  padding: 0;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table { min-width: 980px; }
.stock-table { min-width: 2200px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th {
  background: #f2f6fb;
  color: #27364a;
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]::after {
  content: "↕";
  color: #94a3b8;
  font-size: 11px;
  margin-left: 6px;
}
th.sort-asc::after { content: "↑"; color: var(--blue); }
th.sort-desc::after { content: "↓"; color: var(--blue); }
tbody tr:hover { background: #f8fbff; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.strong { font-weight: 800; color: #0f3f8a; }
td.nowrap, th.nowrap { white-space: nowrap; }
td.wide {
  min-width: 190px;
  max-width: 360px;
}
.stock-table td:nth-child(1),
.stock-table th:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 2;
  background: inherit;
}
.stock-table th:nth-child(1) {
  background: #f2f6fb;
  z-index: 3;
}
.action-col {
  min-width: 176px;
  white-space: nowrap;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-weight: 750;
  font-size: 12px;
  background: #e2e8f0;
  color: #334155;
  white-space: nowrap;
}
.badge.ok, .status-normal { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.danger { background: #fee2e2; color: #991b1b; }
.status-yuksek-risk { background: #fee2e2; color: #991b1b; }
.status-dususte { background: #fef3c7; color: #92400e; }
.status-artista { background: #dbeafe; color: #1e40af; }
.status-veri-az { background: #e2e8f0; color: #475569; }
.status-stock { background: #dcfce7; color: #166534; }
.status-invoice { background: #fef3c7; color: #92400e; }
.status-closed { background: #e0f2fe; color: #075985; }
.status-placement-ok { background: #dcfce7; color: #166534; }
.status-placement-none { background: #e2e8f0; color: #475569; }
.status-placement-missing { background: #fef3c7; color: #92400e; }
.status-placement-extra { background: #fee2e2; color: #991b1b; }
.capacity {
  width: 260px;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #dbe4ee;
}
.capacity span { display: block; height: 100%; background: var(--blue); }
.search, .inline-form { display: flex; gap: 8px; align-items: center; }
input {
  height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 0 10px;
  min-width: 120px;
}
.search input { width: 360px; }
.inline-form input { width: 90px; }
button, .button {
  height: 36px;
  border: 0;
  border-radius: 7px;
  background: var(--blue);
  color: white;
  font-weight: 750;
  padding: 0 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
button:hover, .button:hover { background: var(--blue-dark); }
.button-danger {
  background: var(--red) !important;
  color: #fff !important;
}
.small-button {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}
.inline-delete-form {
  display: inline-flex;
  margin: 0;
}
.button.secondary {
  background: #e2e8f0;
  color: #102033;
}
.button.secondary:hover { background: #cbd5e1; }
.small-link {
  color: var(--blue);
  font-weight: 750;
  text-decoration: none;
}
.doc-link {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}
.doc-link:hover, .small-link:hover { text-decoration: underline; }
td small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}
.file-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  margin-left: 5px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e40af;
  font-size: 11px;
  font-weight: 850;
}
.link-separator { color: var(--muted); margin: 0 5px; }
.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 22px;
}
.form-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
  max-width: 980px;
}
.form-panel label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-weight: 750;
}
.form-panel input,
.form-panel select,
.form-panel textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}
.form-panel textarea {
  min-height: 84px;
  resize: vertical;
}
.span-2 { grid-column: span 2; }
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.login-body {
  display: grid;
  place-items: center;
  background: #f3f6fb;
}
.login-card {
  width: min(420px, calc(100vw - 28px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  display: grid;
  gap: 12px;
  box-shadow: 0 16px 42px rgba(15, 23, 42, .1);
}
.login-logo { width: 128px; height: 128px; object-fit: contain; justify-self: center; }
.login-card h1 { text-align: center; font-size: 22px; }
.login-card p { text-align: center; margin-bottom: 8px; }
.login-card input, .login-card button { width: 100%; height: 42px; }
.alert { background: #fee2e2; color: #991b1b; padding: 10px; border-radius: 7px; }

/* Incident / damage operations */
.incident-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 320px;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}
.incident-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
  overflow: visible;
}
.incident-form label,
.signature-box label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-weight: 750;
  font-size: 13px;
}
.incident-form input,
.incident-form select,
.incident-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: color-mix(in srgb, var(--panel) 96%, var(--bg));
  color: var(--text);
  font: inherit;
}
.incident-form textarea {
  min-height: 88px;
  padding: 9px 10px;
  resize: vertical;
}
.signature-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 88%, var(--bg));
}
.signature-box canvas {
  width: 100%;
  height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  touch-action: none;
}
.incident-guide {
  display: grid;
  gap: 12px;
}
.incident-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 10px 0 12px;
}
.incident-kpi-row div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: color-mix(in srgb, var(--panel) 92%, var(--bg));
}
.incident-kpi-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.incident-kpi-row strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
}
.incident-table-panel {
  max-height: calc(100vh - 240px);
}
.incident-list-head {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}
.incident-table {
  min-width: 1240px;
}

/* Customer cockpit */
.customer-overview { grid-template-columns: repeat(6, minmax(130px, 1fr)); }
.card-status { font-size: 14px !important; }
.customer-detail-grid {
  display: grid;
  grid-template-columns: minmax(260px, .85fr) minmax(300px, 1fr) minmax(260px, .8fr);
  gap: 14px;
  margin-bottom: 14px;
}
.customer-insight,
.customer-chart {
  min-height: 178px;
}
.insight-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.insight-line span { color: var(--muted); font-weight: 750; }
.insight-line strong { text-align: right; }
.mini-bars {
  height: 118px;
  display: grid;
  grid-template-columns: repeat(8, minmax(24px, 1fr));
  gap: 8px;
  align-items: end;
}
.mini-bar {
  display: grid;
  gap: 6px;
  justify-items: center;
  align-items: end;
  height: 100%;
}
.bar-stack {
  width: 100%;
  height: 86px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 3px;
  border-radius: 7px;
  background: #edf2f7;
  padding: 4px;
}
.bar-stack i {
  display: block;
  width: 40%;
  min-height: 3px;
  border-radius: 5px 5px 2px 2px;
}
.bar-in { background: var(--green); }
.bar-out { background: var(--blue); }
.mini-bar small { color: var(--muted); font-size: 11px; }
.weekday-bars { display: grid; gap: 9px; }
.weekday-bars div {
  display: grid;
  grid-template-columns: 38px 32px 1fr;
  gap: 8px;
  align-items: center;
}
.weekday-bars span,
.weekday-bars strong { font-size: 12px; }
.weekday-bars i {
  height: 8px;
  border-radius: 999px;
  background: var(--blue);
}
.customer-sections { align-items: start; margin-bottom: 14px; }
.customer-panel { max-height: 460px; }
.customer-movements { max-height: 620px; }
.customer-quotes { max-height: 330px; margin-bottom: 14px; }
.movement-table { min-width: 1580px; }
.customer-portal-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.4fr) auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.customer-portal-panel input {
  width: 100%;
  min-width: 0;
  font-size: 12px;
}
.customer-portal-panel form { margin: 0; }
.portal-body {
  background: #eef3f8;
  color: var(--text);
}
.portal-shell {
  width: min(1460px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 22px 0;
}
.portal-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
}
.portal-head img {
  width: 150px;
  height: auto;
}
.portal-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}
.portal-panel {
  max-height: 560px;
  margin-bottom: 14px;
  overflow: auto;
  border-radius: 8px;
}
.portal-overview {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}
.portal-panel h2 {
  margin: 0;
  padding: 13px 14px 5px;
  background: var(--panel);
  border-bottom: 1px solid rgba(205, 217, 231, .55);
}
.portal-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  background: var(--panel);
  border-bottom: 1px solid rgba(205, 217, 231, .55);
}
.portal-panel-head h2 {
  padding-left: 0;
  border-bottom: 0;
}
.portal-export-button {
  min-height: 36px;
  padding: 8px 12px;
  white-space: nowrap;
}
.portal-panel .table-tools {
  top: 0;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.portal-stock-table,
.portal-movement-table {
  width: 100%;
  table-layout: fixed;
  min-width: 1400px;
}
.portal-stock-table th:nth-child(1), .portal-stock-table td:nth-child(1) { width: 94px; }
.portal-stock-table th:nth-child(2), .portal-stock-table td:nth-child(2) { width: 130px; }
.portal-stock-table th:nth-child(3), .portal-stock-table td:nth-child(3) { width: 180px; }
.portal-stock-table th:nth-child(4), .portal-stock-table td:nth-child(4) { width: 115px; }
.portal-stock-table th:nth-child(5), .portal-stock-table td:nth-child(5) { width: auto; }
.portal-stock-table th:nth-child(6), .portal-stock-table td:nth-child(6),
.portal-stock-table th:nth-child(7), .portal-stock-table td:nth-child(7),
.portal-stock-table th:nth-child(8), .portal-stock-table td:nth-child(8),
.portal-stock-table th:nth-child(9), .portal-stock-table td:nth-child(9) { width: 100px; }
.portal-stock-table th:nth-child(10), .portal-stock-table td:nth-child(10) { width: 135px; }
.portal-stock-table th:nth-child(11), .portal-stock-table td:nth-child(11) { width: 110px; }
.portal-movement-table {
  min-width: 1420px;
}
.portal-movement-table th:nth-child(1), .portal-movement-table td:nth-child(1) { width: 90px; }
.portal-movement-table th:nth-child(2), .portal-movement-table td:nth-child(2) { width: 110px; }
.portal-movement-table th:nth-child(3), .portal-movement-table td:nth-child(3) { width: 180px; }
.portal-movement-table th:nth-child(4), .portal-movement-table td:nth-child(4) { width: 180px; }
.portal-movement-table th:nth-child(5), .portal-movement-table td:nth-child(5) { width: 130px; }
.portal-movement-table th:nth-child(6), .portal-movement-table td:nth-child(6) { width: auto; }
.portal-movement-table th:nth-child(7), .portal-movement-table td:nth-child(7),
.portal-movement-table th:nth-child(8), .portal-movement-table td:nth-child(8) { width: 95px; }
.portal-movement-table th:nth-child(9), .portal-movement-table td:nth-child(9) { width: 170px; }
.portal-movement-table th:nth-child(10), .portal-movement-table td:nth-child(10) { width: 110px; }
.portal-stock-table td,
.portal-movement-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.portal-stock-table td.wide,
.portal-movement-table td.wide {
  white-space: normal;
  min-width: 0;
  max-width: none;
}
@media (max-width: 1100px) {
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-actions { justify-content: flex-start; width: 100%; }
  .customer-overview { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .customer-detail-grid { grid-template-columns: 1fr; }
  .customer-portal-panel { grid-template-columns: 1fr; }
  .portal-head { grid-template-columns: 1fr; }
  .portal-head img { width: 130px; }
  .portal-overview { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .portal-stock-table { min-width: 1320px; }
  .portal-movement-table { min-width: 1320px; }
  .incident-layout { grid-template-columns: 1fr; }
  .incident-form { grid-template-columns: 1fr; }
  .incident-form .span-2,
  .signature-box.span-2 { grid-column: span 1; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .sidebar { position: static; width: auto; }
  .content { margin-left: 0; }
  .page-head { align-items: stretch; flex-direction: column; }
}

/* Quote management */
.quote-overview { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.quote-table { min-width: 1180px; }
.quote-table-panel { max-height: calc(100vh - 215px); }
.quote-editor {
  display: grid;
  gap: 14px;
  padding-bottom: 72px;
}
.quote-section {
  padding: 16px;
  overflow: visible;
}
.quote-section h2 { margin-bottom: 10px; }
.quote-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}
.quote-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
}
.quote-grid label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-weight: 750;
  font-size: 13px;
}
.quote-grid input,
.quote-grid select,
.quote-grid textarea,
.quote-items-table input {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: color-mix(in srgb, var(--panel) 96%, var(--bg));
  color: var(--text);
}
.quote-grid textarea {
  min-height: 82px;
  padding: 9px 10px;
  resize: vertical;
}
.quote-grid .quote-terms { min-height: 180px; }
.quote-items-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.quote-items-table {
  min-width: 1040px;
  font-size: 12px;
}
.quote-items-table th {
  position: static;
  background: color-mix(in srgb, var(--blue) 10%, var(--panel));
}
.quote-items-table td { padding: 6px; }
.quote-items-table input {
  height: 32px;
  padding: 0 8px;
}
.quote-items-table td:nth-child(1) { min-width: 190px; }
.quote-items-table td:nth-child(2) { min-width: 180px; }
.quote-items-table td:nth-child(3) { min-width: 160px; }
.quote-items-table td:nth-child(8) { width: 120px; }
.quote-row-remove {
  height: 30px;
  padding: 0 10px;
}
.quote-save-bar {
  position: sticky;
  bottom: 0;
  z-index: 6;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, var(--bg));
  box-shadow: 0 -8px 24px rgba(15, 23, 42, .08);
}
@media (max-width: 1100px) {
  .quote-overview { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .quote-grid { grid-template-columns: 1fr; }
  .quote-section-head { flex-direction: column; }
}

/* Web panel polish */
html[data-theme="dark"] {
  --bg: #0f172a;
  --panel: #111c2f;
  --text: #e5edf5;
  --muted: #9fb0c6;
  --line: #26354a;
  --blue: #60a5fa;
  --blue-dark: #3b82f6;
  --green: #22c55e;
  --red: #f87171;
  --amber: #fbbf24;
}
html[data-theme="blue"] {
  --bg: #eaf3ff;
  --panel: #ffffff;
  --text: #10233f;
  --muted: #55708f;
  --line: #c8d9ee;
  --blue: #0f6ddf;
  --blue-dark: #0b54ad;
  --green: #0f9f6e;
  --red: #dc2626;
  --amber: #d97706;
}
html[data-theme="blue"] .sidebar { background: linear-gradient(180deg, #0b3d75, #10233f); }
html[data-theme="blue"] th { background: #e4f0ff; color: #10233f; }
html[data-theme="dark"] .sidebar { background: #07111f; }
html[data-theme="dark"] th { background: #162238; color: var(--text); }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #0f172a;
  color: var(--text);
  border-color: var(--line);
}
html[data-theme="dark"] tbody tr:hover { background: rgba(96, 165, 250, .12); }

.brand { display: grid; gap: 2px; }
.brand small { color: #94a3b8; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.nav-section {
  margin: 10px 8px 2px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.theme-toggle {
  height: 34px;
  background: rgba(255,255,255,.1);
  color: #e5edf5;
}
.theme-toggle:hover { background: rgba(255,255,255,.18); }
.theme-choices { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.tool-card { align-content: start; max-width: none; }
.upload-panel { max-width: none; margin-bottom: 14px; }
.settings-cards { grid-template-columns: repeat(4, minmax(150px, 1fr)); margin-top: 14px; }
.metric-list { display: grid; gap: 10px; margin-top: 10px; }
.metric-list div {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.metric-list div:last-child { border-bottom: 0; }
.metric-list span { color: var(--muted); font-size: 13px; font-weight: 750; }
.metric-list strong { font-size: 15px; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.users-grid { align-items: start; margin-bottom: 14px; }
.data-table input,
.data-table select {
  height: 32px;
  min-width: 115px;
}

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.compact-panel { max-height: 520px; }
.table-tools {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.table-tools input { width: min(360px, 45vw); }
.row-count { color: var(--muted); font-weight: 700; margin-right: auto; }
.density-toggle {
  height: 32px;
  background: #e2e8f0;
  color: #102033;
}
table.dense th, table.dense td { padding: 5px 8px; font-size: 12px; }

.dashboard-head { align-items: center; }
.dashboard-capacity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 320px;
}
.donut {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--blue) var(--value), #dbe4ee 0);
  position: relative;
  flex: 0 0 auto;
}
.donut::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: var(--panel);
}
.donut span { position: relative; z-index: 1; font-weight: 900; }
.chart-panel { min-height: 220px; }
.bar-chart {
  height: 150px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 10px;
  align-items: end;
  padding-top: 12px;
}
.bar-group { display: grid; gap: 6px; align-items: end; min-width: 0; }
.bar-group small { color: var(--muted); text-align: center; font-size: 11px; }
.bar-pair { height: 120px; display: flex; align-items: end; justify-content: center; gap: 4px; border-bottom: 1px solid var(--line); }
.bar { width: 12px; min-height: 2px; border-radius: 5px 5px 0 0; }
.bar.in, .dot.in { background: var(--blue); }
.bar.out, .dot.out { background: var(--amber); }
.legend { display: flex; gap: 8px; align-items: center; color: var(--muted); font-weight: 700; margin-top: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.status-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.status-split div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: color-mix(in srgb, var(--panel) 92%, var(--bg));
}
.status-split strong { display: block; font-size: 28px; }
.status-split span { color: var(--muted); font-weight: 700; }
.progress-line { margin-top: 14px; height: 12px; background: #dbe4ee; border-radius: 999px; overflow: hidden; }
.progress-line span { display: block; height: 100%; background: var(--green); }
.rank-list { display: grid; gap: 11px; }
.rank-row { display: grid; grid-template-columns: minmax(140px, 1fr) auto; gap: 8px 12px; align-items: center; }
.rank-row span { font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row strong { font-size: 13px; color: var(--muted); }
.rank-row i { grid-column: 1 / -1; height: 8px; background: linear-gradient(90deg, var(--blue), var(--green)); border-radius: 999px; }
.alert.success { background: #dcfce7; color: #166534; }
.json-box {
  overflow: auto;
  max-height: 440px;
  background: color-mix(in srgb, var(--panel) 82%, var(--bg));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  white-space: pre-wrap;
}
.preview-modal[hidden] { display: none; }
.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}
.preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .64);
}
.preview-dialog {
  position: relative;
  width: min(1100px, calc(100vw - 40px));
  height: min(780px, calc(100vh - 40px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 80px rgba(15, 23, 42, .35);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}
.preview-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.preview-dialog header div { display: flex; gap: 8px; }
.preview-dialog iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

/* 3D warehouse map */
.warehouse-page { display: grid; gap: 14px; }
.warehouse-head { margin-bottom: 0; }
.warehouse-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.warehouse-switch {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 88%, var(--bg));
}
.warehouse-switch .button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
}
.warehouse-switch .button.active {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 13%, var(--panel));
  color: var(--brand-strong);
}
.warehouse-switch small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.warehouse-metrics { grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); margin-bottom: 0; }
.warehouse-shell {
  display: grid;
  grid-template-columns: 300px minmax(420px, 1fr) 330px;
  gap: 14px;
  min-height: calc(100vh - 270px);
}
.warehouse-sidebar,
.warehouse-drawer {
  max-height: calc(100vh - 245px);
}
.warehouse-search {
  display: grid;
  gap: 6px;
  color: #334155;
  font-weight: 750;
  margin-bottom: 12px;
}
.warehouse-search input { width: 100%; }
.placement-panel {
  display: grid;
  gap: 9px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, var(--bg));
}
.placement-panel h2 { margin-bottom: 2px; }
.placement-panel label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.placement-panel input,
.placement-panel select {
  width: 100%;
  min-width: 0;
  height: 32px;
}
.placement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.placement-check {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 7px !important;
  color: var(--text) !important;
}
.placement-check input {
  width: auto;
  height: auto;
}
.placement-point {
  padding: 8px;
  border-radius: 7px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 800;
}
.placement-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.placement-actions button { padding: 0 8px; }
.mini-note.is-error { color: var(--red); font-weight: 800; }
.map-control-panel {
  display: grid;
  gap: 9px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--blue) 26%, var(--line));
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue-soft) 58%, var(--panel)), var(--panel));
}
.map-control-panel h2 { margin-bottom: 0; }
.map-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.map-control-grid button {
  min-width: 0;
  padding: 0 8px;
}
.map-issue-list {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
}
.map-issue-list .issue-row {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 88%, var(--bg));
  font-size: 11px;
  font-weight: 800;
}
.map-issue-list .issue-row.is-danger { border-left-color: var(--red); }
.map-issue-list .issue-row.is-ok { border-left-color: var(--green); }
.map-issue-list .issue-row small {
  color: var(--muted);
  font-weight: 750;
}
.warehouse-stage {
  padding: 0;
  position: relative;
  min-height: 620px;
  overflow: hidden;
}
.warehouse-canvas {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 40% 20%, rgba(37, 99, 235, .10), transparent 35%),
    radial-gradient(circle, rgba(100, 116, 139, .22) 1px, transparent 1.2px),
    #e8edf4;
  background-size: auto, 14px 14px, auto;
}
.warehouse-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.map-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
  z-index: 1;
}
.map-loader.is-error {
  color: #991b1b;
  padding: 18px;
  text-align: center;
}
.map-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  font-size: 12px;
  font-weight: 750;
}
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i {
  width: 12px;
  height: 12px;
  display: inline-block;
  border-radius: 3px;
  border: 1px solid rgba(15, 23, 42, .15);
}
.legend-empty { background: #d1d5db; }
.legend-storage { background: #93c5fd; }
.legend-loading { background: #fde047; }
.legend-safety { background: #16a34a; }
.legend-occupied { background: #2563eb; }
.legend-reserved { background: #f59e0b; }
.legend-blocked { background: #dc2626; }
.legend-selected { background: #f97316; }
.legend-multi { background: #14b8a6; }
.zone-list { display: grid; gap: 8px; margin-top: 10px; }
.zone-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  padding: 10px;
  background: color-mix(in srgb, var(--panel) 94%, var(--bg));
}
.zone-card strong { display: block; }
.zone-card span { color: var(--muted); font-size: 12px; }
.zone-card small {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}
.zone-card em {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}
.zone-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.zone-actions button {
  height: 30px;
  padding: 0 8px;
}
.zone-card form { display: grid; gap: 6px; margin-top: 8px; }
.zone-edit-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.zone-edit-form label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.zone-edit-form label:first-of-type { grid-column: 1 / -1; }
.zone-edit-form button { grid-column: 1 / -1; }
.zone-card input { height: 30px; min-width: 0; width: 100%; }
.zone-card button { height: 30px; padding: 0 10px; }
.mini-note { font-size: 12px; }
.pallet-detail { display: grid; gap: 10px; margin-top: 12px; }
.pallet-detail div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.pallet-detail span { color: var(--muted); font-weight: 750; }
.pallet-detail strong { overflow-wrap: anywhere; }
.recent-strip { overflow: hidden; }
.recent-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
}
.recent-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: color-mix(in srgb, var(--panel) 94%, var(--bg));
}
.recent-item strong { display: block; }
.recent-item span { color: var(--muted); font-size: 12px; }
.confirm-modal[hidden] { display: none; }
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
}
.confirm-dialog {
  position: relative;
  width: min(460px, calc(100vw - 40px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 80px rgba(15, 23, 42, .35);
  padding: 18px;
}
html[data-theme="dark"] .warehouse-canvas {
  background:
    radial-gradient(circle at 40% 20%, rgba(96, 165, 250, .14), transparent 35%),
    radial-gradient(circle, rgba(148, 163, 184, .20) 1px, transparent 1.2px),
    #0b1120;
  background-size: auto, 14px 14px, auto;
}

@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: 1fr; }
  .settings-cards { grid-template-columns: repeat(2, 1fr); }
  .warehouse-metrics { grid-template-columns: repeat(2, 1fr); }
  .warehouse-shell { grid-template-columns: 1fr; }
  .warehouse-sidebar, .warehouse-drawer { max-height: none; }
  .warehouse-stage { min-height: 520px; }
  .recent-list { grid-template-columns: 1fr; }
  .dashboard-capacity { min-width: 0; }
  .form-panel { grid-template-columns: 1fr; }
  .tenant-settings-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
}

@media (max-width: 640px) {
  .placement-actions { grid-template-columns: 1fr; }
}

/* Professional WMS theme refresh */
:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d7dfeb;
  --blue: #1f6feb;
  --blue-dark: #1757b8;
  --green: #0e9f6e;
  --red: #d92d20;
  --amber: #b7791f;
  --surface-soft: #f8fafc;
  --sidebar-bg: #ffffff;
  --sidebar-text: #202939;
  --sidebar-muted: #667085;
  --sidebar-active: #e8f1ff;
  --focus: rgba(31, 111, 235, .24);
  --shadow-soft: 0 10px 28px rgba(24, 39, 75, .07);
  --shadow-panel: 0 1px 2px rgba(24, 39, 75, .06), 0 12px 30px rgba(24, 39, 75, .06);
}

html[data-theme="blue"] {
  --bg: #f3f8ff;
  --panel: #ffffff;
  --text: #172033;
  --muted: #60728a;
  --line: #ccdaeb;
  --blue: #1769d1;
  --blue-dark: #1254a8;
  --green: #0d9488;
  --amber: #b45309;
  --surface-soft: #f6faff;
  --sidebar-bg: #ffffff;
  --sidebar-text: #1d2939;
  --sidebar-muted: #667085;
  --sidebar-active: #e6f0ff;
}

html[data-theme="dark"] {
  --bg: #101418;
  --panel: #171d24;
  --text: #edf2f7;
  --muted: #a7b2c1;
  --line: #2b3644;
  --blue: #6ba6ff;
  --blue-dark: #4e8ff0;
  --green: #34d399;
  --red: #fb7185;
  --amber: #fbbf24;
  --surface-soft: #111820;
  --sidebar-bg: #151b22;
  --sidebar-text: #edf2f7;
  --sidebar-muted: #a7b2c1;
  --sidebar-active: rgba(107, 166, 255, .16);
  --focus: rgba(107, 166, 255, .28);
}

body {
  font-family: "Segoe UI", Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at 12% -10%, rgba(31, 111, 235, .08), transparent 28%),
    linear-gradient(180deg, #fbfcfe 0%, var(--bg) 280px);
  color: var(--text);
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 14% -10%, rgba(107, 166, 255, .10), transparent 26%),
    linear-gradient(180deg, #111820 0%, var(--bg) 300px);
}

.mobile-nav-toggle {
  display: none;
  position: fixed;
  left: 14px;
  top: 14px;
  z-index: 60;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(15, 23, 42, .38);
}

.nav-backdrop[hidden] { display: none; }

.sidebar {
  width: 276px;
  padding: 18px 14px;
  background: var(--sidebar-bg) !important;
  color: var(--sidebar-text);
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 28px rgba(24, 39, 75, .05);
}

.content {
  margin-left: 276px;
  padding: 26px;
  max-width: 1920px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 6px 18px;
  padding: 8px;
  border-radius: 8px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(31, 111, 235, .22);
}

.brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-copy strong {
  font-size: 17px;
  line-height: 1.1;
}

.brand-copy small {
  color: var(--sidebar-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.main-nav {
  gap: 4px;
  overflow: auto;
  padding: 2px 2px 12px;
}

.main-nav a,
.userbox a {
  color: var(--sidebar-text);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  font-weight: 750;
}

.main-nav a:hover {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--text);
}

.main-nav a.active {
  background: var(--sidebar-active);
  border-color: color-mix(in srgb, var(--blue) 28%, var(--line));
  color: var(--blue-dark);
}

html[data-theme="dark"] .main-nav a.active { color: var(--blue); }

.nav-section {
  margin: 14px 10px 4px;
  color: var(--sidebar-muted);
  font-size: 10px;
}

.userbox {
  margin: auto 4px 0;
  padding: 14px 4px 0;
  border-top: 1px solid var(--line);
}

.userbox strong {
  color: var(--sidebar-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.userbox span {
  color: var(--sidebar-muted);
  font-weight: 750;
  text-transform: capitalize;
}

.theme-toggle {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

.theme-toggle:hover {
  background: var(--sidebar-active);
  color: var(--blue-dark);
}

.page-head {
  min-height: 54px;
  margin-bottom: 18px;
}

h1 {
  font-size: clamp(24px, 2vw, 32px);
  line-height: 1.15;
}

h2 {
  color: var(--text);
  font-size: 17px;
}

p { line-height: 1.45; }

.card,
.panel,
.form-panel,
.login-card {
  border-color: var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-panel);
}

.panel {
  background: color-mix(in srgb, var(--panel) 96%, var(--surface-soft));
}

.card {
  position: relative;
  overflow: hidden;
  min-height: 92px;
  padding: 15px;
}

.card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--blue), var(--green));
}

.card span {
  color: var(--muted);
  font-weight: 800;
}

.card strong {
  color: var(--text);
  font-size: 25px;
}

.table-panel {
  border-radius: 8px;
  max-height: calc(100vh - 150px);
}

.table-tools {
  background: color-mix(in srgb, var(--panel) 96%, var(--surface-soft));
  backdrop-filter: blur(10px);
}

table {
  color: var(--text);
}

th {
  background: color-mix(in srgb, var(--surface-soft) 76%, var(--panel)) !important;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 850;
}

td {
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-soft) 42%, transparent); }
tbody tr:hover { background: color-mix(in srgb, var(--blue) 8%, var(--panel)); }

.stock-table td:nth-child(1),
.stock-table th:nth-child(1) {
  background: color-mix(in srgb, var(--panel) 96%, var(--surface-soft));
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--focus);
}

button,
.button {
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(24, 39, 75, .12);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

button:hover,
.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(24, 39, 75, .12);
}

.button.secondary,
.density-toggle {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

.button.secondary:hover,
.density-toggle:hover {
  background: color-mix(in srgb, var(--blue) 9%, var(--panel));
}

.badge {
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}

.alert {
  border: 1px solid color-mix(in srgb, var(--red) 22%, transparent);
}

.dashboard-capacity,
.placement-panel,
.zone-card,
.recent-item,
.status-split div {
  background: color-mix(in srgb, var(--panel) 94%, var(--surface-soft));
  border-color: var(--line);
}

.donut {
  box-shadow: inset 0 0 0 1px var(--line), 0 10px 20px rgba(24, 39, 75, .08);
}

.rank-row i,
.progress-line span {
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.warehouse-stage {
  border: 1px solid var(--line);
}

.map-legend {
  box-shadow: var(--shadow-soft);
}

@media (max-width: 1100px) {
  .mobile-nav-toggle { display: inline-grid; }
  body.nav-open { overflow: hidden; }
  .sidebar {
    position: fixed;
    z-index: 55;
    width: min(316px, calc(100vw - 56px));
    transform: translateX(-105%);
    transition: transform .18s ease;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .content {
    margin-left: 0;
    padding: 72px 14px 18px;
  }
  .cards,
  .metric-grid,
  .customer-overview,
  .warehouse-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .search {
    width: 100%;
    flex-wrap: wrap;
  }
  .search input {
    width: 100%;
    flex: 1 1 240px;
  }
  .table-tools {
    align-items: stretch;
    flex-wrap: wrap;
  }
  .table-tools input {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .cards,
  .metric-grid,
  .customer-overview,
  .warehouse-metrics,
  .settings-cards {
    grid-template-columns: 1fr;
  }
  .page-actions,
  .warehouse-actions,
  .form-actions,
  .placement-actions {
    width: 100%;
    justify-content: stretch;
  }
  .page-actions > *,
  .warehouse-actions > *,
  .form-actions > *,
  .placement-actions > * {
    flex: 1 1 auto;
  }
  .card strong { font-size: 22px; }
  .warehouse-stage { min-height: 430px; }
}

/* Fix Antrepo brand assets */
.brand {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 6px;
  margin: 2px 4px 16px;
  padding: 6px 2px 12px;
  border-bottom: 1px solid var(--line);
}

.brand-logo {
  width: min(198px, 100%);
  height: auto;
  max-height: 64px;
  object-fit: contain;
  display: block;
}

.brand > small {
  color: var(--sidebar-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.login-logo {
  width: min(300px, 82vw);
  height: auto;
  max-height: 132px;
  object-fit: contain;
}

.login-card {
  gap: 14px;
}

/* Operations, alerts and quick filters */
.quick-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}

.quick-filter-bar a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 850;
  box-shadow: 0 1px 2px rgba(24, 39, 75, .05);
}

.quick-filter-bar a.active,
.quick-filter-bar a:hover {
  border-color: color-mix(in srgb, var(--blue) 38%, var(--line));
  background: color-mix(in srgb, var(--blue) 9%, var(--panel));
  color: var(--blue-dark);
}

.quick-filter-bar strong {
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
}

.operation-cards {
  grid-template-columns: repeat(7, minmax(130px, 1fr));
}

.operation-grid,
.operation-sections {
  margin-bottom: 14px;
}

.alert-list {
  display: grid;
  gap: 9px;
}

.alert-list-wide {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.alert-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
}

.alert-row strong { font-size: 14px; }
.alert-row span { font-size: 22px; font-weight: 900; }
.alert-row p { grid-column: 1 / -1; margin: 0; font-size: 12px; }
.severity-high { border-left-color: var(--red); }
.severity-medium { border-left-color: var(--amber); }
.severity-info { border-left-color: var(--blue); }

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

.mini-record-list a {
  display: grid;
  gap: 3px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, var(--surface-soft));
  color: var(--text);
  text-decoration: none;
}

.mini-record-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.placement-alerts {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, var(--bg));
}

.placement-alerts h2 { margin-bottom: 0; }

.capacity-summary {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--blue) 18%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--blue) 8%, var(--panel));
}

.capacity-summary strong {
  font-size: 24px;
  line-height: 1;
}

.capacity-summary span,
.capacity-summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.capacity-alert-row,
.capacity-zone-row {
  width: 100%;
  height: auto;
  display: grid;
  gap: 3px;
  padding: 9px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
}

.capacity-alert-row strong,
.capacity-zone-row span,
.capacity-zone-row strong,
.capacity-zone-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.capacity-alert-row small,
.capacity-zone-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.capacity-zone-list {
  display: grid;
  gap: 6px;
  margin-top: 2px;
}

.capacity-zone-row {
  grid-template-columns: 1fr auto;
  padding: 8px;
}

.capacity-zone-row small {
  grid-column: 1 / -1;
}

.capacity-alert-row.is-ok,
.capacity-zone-row.is-ok,
.zone-capacity.is-ok { border-left-color: var(--green); }

.capacity-alert-row.is-info,
.capacity-zone-row.is-info,
.zone-capacity.is-info { border-left-color: var(--blue); }

.capacity-alert-row.is-warning,
.capacity-zone-row.is-warning,
.zone-capacity.is-warning { border-left-color: var(--amber); }

.capacity-alert-row.is-danger,
.capacity-zone-row.is-danger,
.zone-capacity.is-danger { border-left-color: var(--red); }

.zone-capacity {
  display: block;
  padding-left: 7px;
  border-left: 3px solid var(--green);
  color: var(--muted);
}

.placement-alert-row {
  width: 100%;
  height: auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
}

.placement-alert-row strong,
.placement-alert-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.placement-alert-row span {
  font-size: 11px;
  font-weight: 900;
}

.placement-alert-row small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.placement-alert-row.status-placement-none { border-left-color: var(--muted); }
.placement-alert-row.status-placement-missing { border-left-color: var(--amber); }
.placement-alert-row.status-placement-extra { border-left-color: var(--red); }

.pallet-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.pallet-size-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 90%, var(--bg));
}

.pallet-size-editor h3 {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 13px;
}

.pallet-size-editor label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.pallet-size-editor input,
.pallet-size-editor select {
  width: 100%;
  min-width: 0;
  height: 31px;
}

.pallet-size-editor label:last-of-type,
.pallet-size-editor button {
  grid-column: 1 / -1;
}

.pallet-bulk-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 90%, var(--bg));
}

.pallet-bulk-editor h3,
.pallet-bulk-editor .mini-note,
.pallet-bulk-editor button {
  grid-column: 1 / -1;
}

.selection-tools {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 82%, var(--blue-soft));
}

.selection-tools .mini-note {
  grid-column: 1 / -1;
  margin: 0;
}

.selection-tools button {
  grid-column: auto;
  min-width: 0;
}

.pallet-bulk-editor h3 {
  margin: 0;
  font-size: 13px;
}

.pallet-bulk-editor label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.pallet-bulk-editor input,
.pallet-bulk-editor select {
  width: 100%;
  min-width: 0;
  height: 31px;
}

.pallet-actions button {
  min-width: 0;
  padding: 0 8px;
}

.pallet-actions [data-pallet-delete] {
  grid-column: 1 / -1;
}

.placement-recommendations {
  display: grid;
  gap: 7px;
}

.placement-recommendations:empty {
  display: none;
}

.placement-recommendations > strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.placement-recommendations button {
  height: auto;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--blue) 24%, var(--line));
  border-left: 4px solid var(--brand-teal);
  background: color-mix(in srgb, var(--blue) 7%, var(--panel));
  color: var(--text);
  text-align: left;
}

.placement-recommendations button:hover {
  background: color-mix(in srgb, var(--blue) 13%, var(--panel));
}

.placement-recommendations button.is-warning {
  border-left-color: var(--amber);
}

.placement-recommendations span {
  font-weight: 900;
}

.placement-recommendations small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

@media (max-width: 1100px) {
  .operation-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .alert-list-wide { grid-template-columns: 1fr; }
}

/* Operations cockpit polish */
:root {
  --brand-teal: #0796aa;
  --brand-orange: #ff8a3d;
  --brand-red: #ef3340;
  --surface-glass: rgba(255, 255, 255, .78);
  --shadow-strong: 0 18px 48px rgba(15, 23, 42, .10);
}

body {
  background:
    radial-gradient(circle at 22% 8%, rgba(7, 150, 170, .14), transparent 28%),
    radial-gradient(circle at 92% 0%, rgba(37, 99, 235, .10), transparent 24%),
    linear-gradient(180deg, #f6f9fd 0%, var(--bg) 46%, #eaf1f8 100%);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(7, 150, 170, .24), transparent 22%),
    #071827;
  border-right: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 18px 0 48px rgba(15, 23, 42, .12);
}

.main-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.main-nav a.active {
  background: linear-gradient(90deg, var(--brand-teal), var(--blue));
  box-shadow: 0 10px 24px rgba(37, 99, 235, .22);
}

.main-nav a.active::before {
  content: "";
  width: 4px;
  align-self: stretch;
  border-radius: 999px;
  background: var(--brand-orange);
}

.content {
  padding-top: 26px;
}

.page-head,
.dashboard-head {
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  border-radius: 12px;
  background: var(--surface-glass);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}

.dashboard-head {
  background:
    linear-gradient(135deg, rgba(7, 150, 170, .14), rgba(37, 99, 235, .08)),
    var(--surface-glass);
}

.card,
.panel {
  border-radius: 10px;
  border-color: color-mix(in srgb, var(--line) 82%, transparent);
  box-shadow: var(--shadow-soft);
}

.metric-grid .card,
.operation-cards .card,
.customer-overview .card {
  position: relative;
  overflow: hidden;
  min-height: 92px;
  border-left: 4px solid var(--brand-teal);
}

.metric-grid .card::after,
.operation-cards .card::after,
.customer-overview .card::after {
  content: "";
  position: absolute;
  right: -26px;
  top: -28px;
  width: 86px;
  height: 86px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-teal) 12%, transparent);
}

.metric-grid .card:nth-child(4),
.metric-grid .card:nth-child(5),
.operation-cards .card:nth-child(5),
.customer-overview .card:nth-child(4) {
  border-left-color: var(--brand-orange);
}

.card span {
  text-transform: uppercase;
  letter-spacing: .03em;
  font-size: 11px;
  font-weight: 850;
}

.card strong {
  color: #0b1f33;
  font-weight: 900;
}

.dashboard-capacity {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
}

.donut {
  background: conic-gradient(var(--brand-teal) var(--value), #dce6f1 0);
}

.chart-panel h2,
.panel h2 {
  color: #071827;
  font-weight: 900;
}

.rank-row {
  padding: 8px 0;
  border-bottom: 1px dashed color-mix(in srgb, var(--line) 78%, transparent);
}

.rank-row:last-child {
  border-bottom: 0;
}

.rank-row small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.rank-row i,
.progress-line span {
  background: linear-gradient(90deg, var(--brand-teal), var(--brand-orange));
}

th {
  background: color-mix(in srgb, #eef6fb 88%, var(--panel));
}

.stock-table {
  min-width: 2040px;
}

.operation-cards {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 22% 8%, rgba(7, 150, 170, .18), transparent 28%),
    radial-gradient(circle at 92% 0%, rgba(96, 165, 250, .12), transparent 24%),
    #08111d;
}

html[data-theme="dark"] .page-head,
html[data-theme="dark"] .dashboard-head {
  background: color-mix(in srgb, var(--panel) 90%, transparent);
}

html[data-theme="dark"] .card strong,
html[data-theme="dark"] .chart-panel h2,
html[data-theme="dark"] .panel h2 {
  color: var(--text);
}

@media (max-width: 1100px) {
  .operation-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .operation-cards {
    grid-template-columns: 1fr;
  }
}

/* Professional compact theme pass */
:root {
  --bg: #f3f6fa;
  --panel: #ffffff;
  --text: #0f1f33;
  --muted: #667085;
  --line: #d8e1ec;
  --blue: #1f6feb;
  --blue-dark: #1554b8;
  --brand-teal: #0796aa;
  --brand-orange: #ff8a3d;
  --surface-soft: #f6f9fc;
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-panel: 0 1px 2px rgba(15, 23, 42, .06);
}

html {
  font-size: 14px;
}

body {
  font-family: "Segoe UI Variable", "Segoe UI", Inter, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.35;
  background:
    linear-gradient(180deg, rgba(7, 150, 170, .055), transparent 260px),
    #f3f6fa;
}

html[data-theme="dark"] {
  --bg: #0e1723;
  --panel: #151f2b;
  --text: #edf2f7;
  --muted: #9aa8ba;
  --line: #263446;
  --surface-soft: #101a26;
  --shadow-soft: none;
  --shadow-panel: none;
}

html[data-theme="dark"] body {
  background: #0e1723;
}

.sidebar {
  width: 252px;
  padding: 12px 10px;
  background: #0b1726 !important;
  border-right: 1px solid rgba(255, 255, 255, .08);
  box-shadow: none;
}

.content {
  margin-left: 252px;
  padding: 18px 20px;
  max-width: none;
}

.brand {
  gap: 4px;
  margin: 0 2px 12px;
  padding: 8px 4px 10px;
  border-bottom-color: rgba(255, 255, 255, .10);
}

.brand-logo {
  width: min(170px, 100%);
  max-height: 46px;
}

.brand > small {
  color: #98a7ba;
  font-size: 9px;
  letter-spacing: .16em;
}

.main-nav {
  gap: 2px;
  padding-right: 2px;
}

.nav-section {
  margin: 11px 10px 3px;
  color: #7f8da1;
  font-size: 9px;
  letter-spacing: .13em;
}

.main-nav a,
.userbox a {
  min-height: 31px;
  padding: 7px 10px;
  border-radius: 7px;
  color: #d5dde8;
  font-size: 12px;
  font-weight: 720;
}

.main-nav a:hover {
  background: rgba(255, 255, 255, .055);
  border-color: rgba(255, 255, 255, .08);
  color: #fff;
}

.main-nav a.active {
  background: rgba(7, 150, 170, .18);
  border-color: rgba(7, 150, 170, .32);
  color: #fff;
  box-shadow: none;
}

.main-nav a.active::before {
  width: 3px;
  background: var(--brand-orange);
}

.userbox {
  margin: auto 2px 0;
  padding-top: 11px;
  border-top-color: rgba(255, 255, 255, .10);
}

.userbox strong {
  color: #fff;
  font-size: 12px;
}

.userbox span {
  color: #98a7ba;
  font-size: 11px;
}

.theme-toggle {
  min-height: 31px;
  border-color: rgba(255, 255, 255, .10);
  background: rgba(255, 255, 255, .06);
  color: #d5dde8;
}

.page-head,
.dashboard-head {
  min-height: 0;
  margin-bottom: 12px;
  padding: 11px 13px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .88);
  box-shadow: var(--shadow-soft);
  backdrop-filter: none;
}

html[data-theme="dark"] .page-head,
html[data-theme="dark"] .dashboard-head {
  background: var(--panel);
}

h1 {
  font-size: 21px;
  line-height: 1.18;
  letter-spacing: 0;
}

h2,
.chart-panel h2,
.panel h2 {
  margin-bottom: 9px;
  color: var(--text);
  font-size: 15px;
  font-weight: 820;
}

h3 {
  font-size: 13px;
}

p,
.mini-note {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
}

.cards,
.metric-grid,
.operation-cards,
.customer-overview,
.quote-overview {
  gap: 9px;
}

.cards {
  margin-bottom: 10px;
}

.card,
.panel,
.form-panel,
.quote-section,
.login-card {
  border-radius: 8px;
  border-color: var(--line);
  box-shadow: var(--shadow-panel);
}

.panel {
  padding: 11px;
  background: var(--panel);
}

.card {
  min-height: 70px;
  padding: 10px 11px;
}

.metric-grid .card,
.operation-cards .card,
.customer-overview .card {
  min-height: 72px;
  border-left-width: 3px;
}

.card::before {
  width: 2px;
}

.metric-grid .card::after,
.operation-cards .card::after,
.customer-overview .card::after {
  display: none;
}

.card span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .025em;
  line-height: 1.25;
}

.card strong {
  margin-top: 5px;
  color: var(--text);
  font-size: 20px;
  line-height: 1.15;
  font-weight: 850;
}

.card-status {
  font-size: 12px !important;
}

.dashboard-capacity {
  padding: 8px 10px;
  border-radius: 9px;
  box-shadow: none;
}

.donut {
  width: 64px;
  height: 64px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.donut::after {
  inset: 11px;
}

.donut span {
  font-size: 12px;
}

.chart-panel {
  min-height: 190px;
}

.bar-chart {
  min-height: 138px;
}

.status-split {
  gap: 8px;
}

.status-split div {
  padding: 10px;
  border-radius: 8px;
  box-shadow: none;
}

.status-split strong {
  font-size: 22px;
}

.rank-row {
  gap: 5px 10px;
  padding: 6px 0;
}

.rank-row span {
  font-size: 12px;
}

.rank-row strong,
.rank-row small {
  font-size: 11px;
}

.rank-row i,
.progress-line span {
  height: 6px;
  background: linear-gradient(90deg, var(--brand-teal), var(--blue));
}

.table-panel {
  max-height: calc(100vh - 132px);
  border-radius: 8px;
}

.table-tools {
  gap: 7px;
  min-height: 42px;
  padding: 7px 9px;
  background: color-mix(in srgb, var(--panel) 94%, var(--surface-soft));
  border-bottom: 1px solid var(--line);
  backdrop-filter: none;
}

.table-tools input {
  width: min(320px, 42vw);
  height: 31px;
  font-size: 12px;
}

.row-count {
  font-size: 12px;
}

table {
  font-size: 12px;
}

th,
td {
  padding: 6px 8px;
  line-height: 1.28;
}

th {
  height: 32px;
  font-size: 11px;
  letter-spacing: 0;
}

td small {
  font-size: 10px;
}

tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--surface-soft) 55%, transparent);
}

tbody tr:hover {
  background: color-mix(in srgb, var(--brand-teal) 7%, var(--panel));
}

table.dense th,
table.dense td {
  padding: 4px 7px;
  font-size: 11px;
}

.stock-table {
  min-width: 1960px;
}

.badge {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 760;
}

input,
select,
textarea {
  min-height: 32px;
  height: 32px;
  border-radius: 7px;
  font-size: 12px;
}

textarea {
  height: auto;
  min-height: 72px;
}

button,
.button,
.density-toggle {
  min-height: 32px;
  height: 32px;
  padding: 0 11px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 760;
  box-shadow: none;
}

button:hover,
.button:hover {
  transform: none;
  box-shadow: none;
}

.button.secondary,
.density-toggle {
  background: #edf2f7;
}

html[data-theme="dark"] .button.secondary,
html[data-theme="dark"] .density-toggle {
  background: #1f2d3d;
}

.search,
.inline-form,
.page-actions,
.warehouse-actions,
.form-actions {
  gap: 7px;
}

.search input {
  width: min(320px, 42vw);
}

.form-panel,
.quote-section,
.quote-editor {
  gap: 10px;
  padding: 13px;
}

.form-panel label,
.quote-grid label {
  gap: 5px;
  font-size: 11px;
  font-weight: 760;
}

.quote-section h2 {
  margin-bottom: 7px;
}

.quote-grid {
  gap: 10px;
}

.quick-filter-bar {
  gap: 6px;
  margin-bottom: 10px;
}

.quick-filter-bar a {
  min-height: 31px;
  padding: 5px 9px;
  font-size: 11px;
  box-shadow: none;
}

.alert-row {
  padding: 9px;
  border-left-width: 4px;
}

.alert-row strong {
  font-size: 13px;
}

.alert-row span {
  font-size: 18px;
}

.alert-row p {
  font-size: 11px;
}

.warehouse-page {
  gap: 10px;
}

.warehouse-shell {
  gap: 10px;
}

.warehouse-sidebar,
.warehouse-drawer {
  padding: 10px;
}

.warehouse-stage {
  border-radius: 8px;
}

.warehouse-metrics {
  gap: 8px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 44%, transparent);
  background-clip: padding-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 1100px) {
  .mobile-nav-toggle {
    width: 38px;
    height: 38px;
  }

  .sidebar {
    width: min(300px, calc(100vw - 56px));
  }

  .content {
    margin-left: 0;
    padding: 64px 14px 14px;
  }

  .page-head,
  .dashboard-head {
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 12px;
  }

  h1 {
    font-size: 19px;
  }

  .page-head,
  .dashboard-head {
    padding: 10px;
  }

  .cards,
  .metric-grid,
  .customer-overview,
  .quote-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .table-tools {
    align-items: stretch;
  }

  .table-tools input,
  .search input {
    width: 100%;
  }
}

/* Dashboard and stock workspace refinement */
.dashboard-page,
.stock-page {
  display: grid;
  gap: 10px;
}

.dashboard-head {
  display: flex;
  align-items: center;
}

.dashboard-head > div:first-child {
  min-width: 260px;
}

.dashboard-head p {
  max-width: 620px;
}

.dashboard-capacity {
  min-width: 292px;
  margin-left: auto;
}

.dashboard-capacity strong {
  display: block;
  margin-bottom: 1px;
  font-size: 13px;
}

.dashboard-capacity p {
  margin: 0;
  font-size: 12px;
}

.metric-grid {
  grid-template-columns: repeat(6, minmax(118px, 1fr));
}

.dashboard-customs-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-color: color-mix(in srgb, var(--blue) 22%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 8%, transparent), transparent 58%),
    var(--panel);
}

.dashboard-customs-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.dashboard-customs-head h2 {
  margin: 0;
  font-size: 17px;
}

.dashboard-customs-head p:last-child {
  margin: 3px 0 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-customs-stats {
  display: grid;
  grid-template-columns: repeat(7, minmax(92px, 1fr));
  gap: 7px;
}

.dashboard-customs-stats a {
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, var(--surface-soft));
  color: var(--text);
  text-decoration: none;
}

.dashboard-customs-stats a.is-danger { border-left-color: var(--red); }
.dashboard-customs-stats a.is-warning { border-left-color: var(--amber); }

.dashboard-customs-stats span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.dashboard-customs-stats strong {
  font-size: 20px;
  line-height: 1;
}

.dashboard-customs-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.customs-mini-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 96%, var(--surface-soft));
  color: var(--text);
  text-decoration: none;
}

.customs-mini-row strong,
.customs-mini-row small,
.customs-mini-row em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customs-mini-row strong {
  align-self: center;
  font-size: 12px;
}

.customs-mini-row small,
.customs-mini-row em {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.customs-mini-row em {
  color: color-mix(in srgb, var(--red) 68%, var(--muted));
}

.dashboard-task-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.dashboard-task-layout {
  display: grid;
  grid-template-columns: minmax(330px, .65fr) minmax(420px, 1fr);
  gap: 10px;
}

.task-stat-grid {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}

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

.dashboard-grid {
  grid-template-columns: minmax(320px, 1.08fr) minmax(230px, .72fr) minmax(300px, .95fr);
  gap: 10px;
  margin-bottom: 0;
}

.dashboard-lower-grid {
  grid-template-columns: minmax(340px, .95fr) minmax(460px, 1.05fr);
  gap: 10px;
}

.dashboard-page .chart-panel {
  min-height: 178px;
}

.dashboard-page .bar-chart {
  height: 126px;
  gap: 7px;
}

.dashboard-page .bar-pair {
  height: 98px;
}

.dashboard-page .bar {
  width: 9px;
}

.dashboard-page .legend {
  margin-top: 5px;
  font-size: 11px;
}

.dashboard-page .rank-list {
  gap: 7px;
}

.dashboard-grid .rank-list,
.dashboard-lower-grid .rank-list {
  max-height: 250px;
  overflow: auto;
  padding-right: 3px;
}

.dashboard-lower-grid .table-panel {
  max-height: 372px;
}

.authority-page {
  display: grid;
  gap: 10px;
}

.authority-head {
  align-items: center;
}

.authority-status-card {
  min-width: 250px;
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: var(--panel);
}

.authority-status-card.active {
  border-left-color: var(--green);
  background: color-mix(in srgb, var(--green) 8%, var(--panel));
}

.authority-status-card span,
.authority-status-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.authority-status-card strong {
  font-size: 22px;
  line-height: 1;
}

.authority-overview {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.authority-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(300px, .65fr);
  gap: 10px;
}

.authority-form,
.authority-current,
.authority-services {
  display: grid;
  gap: 10px;
}

.authority-facts {
  display: grid;
  gap: 8px;
}

.authority-facts article {
  display: grid;
  gap: 2px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, var(--surface-soft));
}

.authority-facts span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.authority-facts strong {
  font-size: 13px;
}

.authority-service-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 8px;
}

.authority-service-card {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
}

.authority-service-card span,
.authority-service-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.authority-service-card em {
  width: fit-content;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 11px;
  font-weight: 800;
}

.authority-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-left: 4px solid var(--amber);
}

.authority-inline.active {
  border-left-color: var(--green);
  background: color-mix(in srgb, var(--green) 7%, var(--panel));
}

.authority-inline div {
  display: grid;
  gap: 2px;
}

.authority-inline strong {
  font-size: 13px;
}

.authority-inline span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.authority-log-panel {
  max-height: 410px;
}

.authority-page-v2 {
  gap: 12px;
}

.authority-hero {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 8%, transparent), transparent 48%),
    var(--panel);
}

.authority-hero h1 {
  margin-bottom: 4px;
}

.authority-hero p {
  max-width: 780px;
}

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

.authority-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.authority-step span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--blue);
  font-weight: 900;
}

.authority-step.active span {
  background: var(--blue);
  color: #fff;
}

.authority-step strong {
  font-size: 13px;
}

.authority-step em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.authority-grid-v2 {
  grid-template-columns: minmax(520px, 1.2fr) minmax(320px, .8fr);
}

.authority-login-card {
  gap: 12px;
}

.authority-choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.choice-tile {
  position: relative;
  display: grid;
  gap: 4px;
  min-height: 94px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 90%, var(--surface-soft));
  cursor: pointer;
}

.choice-tile input {
  position: absolute;
  top: 10px;
  right: 10px;
  width: auto;
}

.choice-tile:has(input:checked) {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 42%, transparent);
  background: color-mix(in srgb, var(--blue) 7%, var(--panel));
}

.choice-tile strong {
  padding-right: 24px;
  font-size: 13px;
}

.choice-tile span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.authority-help-box,
.authority-empty-state,
.authority-active-banner,
.authority-mini-checklist {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.authority-help-box strong,
.authority-empty-state strong,
.authority-active-banner strong {
  font-size: 13px;
}

.authority-help-box span,
.authority-empty-state span,
.authority-active-banner span,
.authority-mini-checklist,
.authority-mini-checklist li {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.authority-active-banner {
  border-color: color-mix(in srgb, var(--green) 34%, var(--line));
  background: color-mix(in srgb, var(--green) 9%, var(--panel));
}

.authority-current-v2 {
  align-content: start;
}

.authority-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.authority-action-row form {
  margin: 0;
}

.authority-mini-checklist ul {
  margin: 2px 0 0 18px;
  padding: 0;
}

.ncts-guidance-panel {
  display: grid;
  gap: 10px;
}

.ncts-guidance-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 8px;
}

.ncts-guidance-grid article {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, var(--surface-soft));
}

.ncts-guidance-grid strong {
  font-size: 13px;
}

.ncts-guidance-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.declaration-verify-page {
  display: grid;
  gap: 12px;
}

.declaration-verify-head {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 8%, transparent), transparent 45%),
    var(--panel);
}

.declaration-verify-search {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(280px, .55fr);
  gap: 12px;
  align-items: end;
}

.declaration-verify-search form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  margin: 0;
}

.official-status {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: var(--surface-soft);
}

.official-status.active {
  border-left-color: var(--green);
  background: color-mix(in srgb, var(--green) 8%, var(--panel));
}

.official-status span,
.official-status em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}

.official-status strong {
  font-size: 15px;
}

.declaration-verify-summary {
  grid-template-columns: repeat(8, minmax(118px, 1fr));
}

.verify-check-panel {
  display: grid;
  gap: 10px;
}

.verify-check-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 8px;
}

.verify-check {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: var(--panel);
}

.verify-check.ok { border-left-color: var(--green); }
.verify-check.warning { border-left-color: var(--amber); }
.verify-check.danger { border-left-color: var(--red); }
.verify-check.info { border-left-color: var(--blue); }

.verify-check span,
.verify-check em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}

.verify-check strong {
  font-size: 13px;
}

.verify-table-panel {
  max-height: 430px;
}

.tasks-page {
  display: grid;
  gap: 10px;
}

.tasks-head {
  align-items: center;
}

.task-overview {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

.tasks-grid,
.operation-task-sections {
  display: grid;
  grid-template-columns: minmax(420px, .82fr) minmax(420px, 1fr);
  gap: 10px;
}

.task-form,
.task-urgent-panel {
  display: grid;
  gap: 10px;
}

.task-filter-panel {
  display: grid;
  gap: 8px;
}

.task-sync-result {
  padding: 0 2px;
}

.task-sync-settings {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, var(--surface-soft));
}

.task-sync-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.task-sync-settings-head div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.task-sync-settings-head strong {
  font-size: 13px;
}

.task-sync-settings-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.task-sync-settings-head button {
  min-height: 31px;
  padding: 6px 10px;
  white-space: nowrap;
}

.task-sync-toggles {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 7px 10px;
}

.task-sync-toggles label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.task-sync-toggles input {
  accent-color: var(--blue);
}

.task-sync-numbers {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.task-sync-numbers input {
  max-width: 150px;
}

.task-search {
  justify-content: flex-start;
}

.task-search input {
  width: min(520px, 48vw);
}

.task-mini-list {
  display: grid;
  gap: 7px;
}

.task-mini-list a {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 8px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, var(--surface-soft));
  color: var(--text);
  text-decoration: none;
}

.task-mini-list strong,
.task-mini-list small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-mini-list strong {
  align-self: center;
  font-size: 12px;
}

.task-mini-list small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.task-table-panel {
  max-height: calc(100vh - 315px);
}

.task-table td.wide small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 210px;
}

.task-actions form {
  margin: 0;
}

.task-actions button {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 11px;
}

.task-overdue-row td {
  background: color-mix(in srgb, var(--red) 5%, var(--panel));
}

.badge.muted {
  background: var(--surface-soft);
  color: var(--muted);
}

.customs-file-task-list,
.customs-file-task-form {
  margin-bottom: 12px;
}

.customs-file-task-form {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.regulations-page {
  display: grid;
  gap: 10px;
}

.regulations-head {
  align-items: center;
}

.regulations-head .page-actions form {
  margin: 0;
}

.regulations-overview {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.regulations-filter {
  display: grid;
  gap: 8px;
}

.regulations-search {
  justify-content: flex-start;
}

.regulations-search input {
  width: min(560px, 48vw);
}

.regulations-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(300px, .42fr);
  gap: 10px;
}

.regulations-feed,
.regulations-sources {
  display: grid;
  align-content: start;
  gap: 10px;
}

.regulation-list,
.regulation-source-list,
.regulation-mini-list {
  display: grid;
  gap: 8px;
}

.regulation-item,
.regulation-source-list a,
.regulation-mini-list a {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, var(--surface-soft));
  color: var(--text);
  text-decoration: none;
}

.regulation-item.is-pinned,
.regulation-source-list a {
  border-left-color: var(--green);
}

.regulation-item > div {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.regulation-item strong,
.regulation-item small,
.regulation-item p,
.regulation-source-list strong,
.regulation-source-list span,
.regulation-mini-list strong,
.regulation-mini-list small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.regulation-item strong,
.regulation-source-list strong,
.regulation-mini-list strong {
  font-size: 13px;
}

.regulation-item small,
.regulation-item p,
.regulation-source-list span,
.regulation-mini-list small {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.dashboard-regulation-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.regulation-mini-list {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.regulation-mini-list a {
  padding: 9px;
}

.regulation-mini-list strong,
.regulation-mini-list small {
  white-space: nowrap;
}

.customs-protocol-grid.one {
  grid-template-columns: 1fr;
}

.stock-head {
  align-items: center;
}

.stock-head p {
  max-width: 720px;
}

.stock-search {
  min-width: min(560px, 50vw);
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.stock-search input {
  width: min(420px, 38vw);
  flex: 1 1 280px;
}

.stock-filter-panel {
  display: grid;
  gap: 8px;
  padding: 9px 10px;
  overflow: visible;
}

.stock-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.stock-filter-head strong {
  font-size: 12px;
  font-weight: 850;
}

.stock-filter-head span {
  color: var(--muted);
  font-size: 11px;
}

.stock-filter-bar {
  margin: 0;
}

.stock-filter-bar a {
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-soft) 84%, var(--panel));
}

.stock-filter-bar a.active {
  color: #fff;
  border-color: var(--brand-teal);
  background: linear-gradient(90deg, var(--brand-teal), var(--blue));
}

.stock-filter-bar a.active strong {
  background: rgba(255, 255, 255, .18);
  color: #fff;
}

.stock-table-panel {
  max-height: calc(100vh - 198px);
}

.stock-table th,
.stock-table td {
  white-space: nowrap;
}

.stock-table td.wide {
  white-space: normal;
}

.stock-table th:nth-child(-n+4),
.stock-table td:nth-child(-n+4) {
  background-color: color-mix(in srgb, var(--panel) 96%, var(--surface-soft));
}

.stock-table tbody tr:hover td:nth-child(-n+4) {
  background-color: color-mix(in srgb, var(--brand-teal) 7%, var(--panel));
}

html[data-theme="dark"] .stock-table th:nth-child(-n+4),
html[data-theme="dark"] .stock-table td:nth-child(-n+4) {
  background-color: color-mix(in srgb, var(--panel) 90%, var(--surface-soft));
}

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

  .dashboard-customs-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

  .dashboard-task-layout,
  .dashboard-task-list,
  .tasks-grid,
  .operation-task-sections {
    grid-template-columns: 1fr;
  }

  .task-overview {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .task-sync-toggles,
  .task-sync-numbers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .regulations-layout,
  .regulation-mini-list {
    grid-template-columns: 1fr;
  }

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

  .authority-grid,
  .authority-service-grid {
    grid-template-columns: 1fr;
  }

  .authority-workflow,
  .authority-choice-row,
  .ncts-guidance-grid,
  .declaration-verify-search,
  .declaration-verify-search form,
  .verify-check-grid {
    grid-template-columns: 1fr;
  }

  .authority-overview,
  .declaration-verify-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .dashboard-lower-grid {
    grid-template-columns: 1fr;
  }

  .stock-head {
    align-items: stretch;
  }

  .stock-search {
    min-width: 0;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .dashboard-head {
    display: grid;
  }

  .dashboard-capacity {
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }

  .dashboard-customs-head {
    display: grid;
  }

  .dashboard-customs-stats,
  .dashboard-customs-list {
    grid-template-columns: 1fr;
  }

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

  .task-search input {
    width: 100%;
  }

  .task-sync-settings-head {
    align-items: stretch;
    flex-direction: column;
  }

  .task-sync-toggles,
  .task-sync-numbers {
    grid-template-columns: 1fr;
  }

  .task-sync-numbers input {
    max-width: none;
  }

  .regulations-search input {
    width: 100%;
  }

  .authority-head,
  .authority-inline {
    display: grid;
  }

  .authority-status-card {
    min-width: 0;
  }

  .stock-search {
    flex-wrap: wrap;
  }

  .stock-search input {
    width: 100%;
    flex-basis: 100%;
  }

  .stock-filter-head {
    display: grid;
    gap: 3px;
  }
}

/* 3D warehouse operations refinement */
.warehouse-page {
  gap: 9px;
}

.warehouse-head {
  align-items: center;
}

.warehouse-head p {
  max-width: 640px;
}

.warehouse-actions {
  max-width: 880px;
  justify-content: flex-end;
  gap: 6px;
}

.warehouse-actions > .button,
.warehouse-actions > button {
  min-height: 30px;
  height: 30px;
  padding-inline: 9px;
}

.warehouse-switch {
  gap: 4px;
  padding: 3px;
  border-radius: 8px;
}

.warehouse-switch .button {
  min-height: 28px;
  height: 28px;
  padding-inline: 9px;
}

.warehouse-switch small {
  font-size: 9px;
}

.warehouse-metrics {
  grid-template-columns: repeat(6, minmax(105px, 1fr));
  gap: 7px;
}

.warehouse-metrics .card {
  min-height: 56px;
  padding: 8px 9px;
}

.warehouse-metrics .card span {
  font-size: 9px;
  letter-spacing: .02em;
}

.warehouse-metrics .card strong {
  margin-top: 3px;
  font-size: 16px;
  white-space: nowrap;
}

.warehouse-shell {
  grid-template-columns: 312px minmax(520px, 1fr) 312px;
  gap: 10px;
  min-height: calc(100vh - 238px);
  align-items: start;
}

.warehouse-sidebar,
.warehouse-drawer {
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 118px);
  overflow: auto;
  scrollbar-gutter: stable;
}

.warehouse-sidebar > h2,
.warehouse-drawer > h2,
.placement-panel h2,
.map-control-panel h2,
.placement-alerts h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 850;
}

.warehouse-search {
  margin-bottom: 8px;
  font-size: 11px;
}

.warehouse-sidebar > .mini-note {
  margin: 8px 0;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--line) 74%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft) 80%, var(--panel));
}

.warehouse-sidebar .quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin: 8px 0 10px;
}

.warehouse-sidebar .quick-actions button {
  min-width: 0;
  padding-inline: 6px;
}

.map-control-panel,
.placement-alerts,
.placement-panel {
  margin: 10px 0;
  padding: 10px;
  border-radius: 8px;
}

.map-control-grid,
.placement-actions {
  gap: 6px;
}

.map-control-grid button,
.placement-actions button {
  min-height: 29px;
  height: auto;
  padding: 6px 7px;
  line-height: 1.2;
}

.placement-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.placement-grid label {
  font-size: 10px;
}

.placement-grid input {
  padding-inline: 6px;
}

.placement-point {
  padding: 7px 8px;
  font-size: 11px;
  font-weight: 760;
  background: color-mix(in srgb, var(--brand-teal) 10%, var(--panel));
  color: color-mix(in srgb, var(--brand-teal) 55%, var(--text));
}

.placement-recommendations button,
.capacity-alert-row,
.capacity-zone-row,
.placement-alert-row,
.map-issue-list .issue-row,
.zone-card {
  border-radius: 7px;
  box-shadow: none;
}

.capacity-summary {
  padding: 8px;
}

.capacity-summary strong {
  font-size: 18px;
}

.capacity-zone-list,
.map-issue-list,
.zone-list {
  max-height: 280px;
  overflow: auto;
  padding-right: 2px;
}

.placement-alert-row,
.capacity-alert-row,
.capacity-zone-row {
  padding: 7px 8px;
}

.zone-list {
  gap: 6px;
}

.zone-card {
  padding: 8px;
  border-left-width: 4px;
}

.zone-card strong {
  font-size: 12px;
}

.zone-card span,
.zone-card small,
.zone-card em {
  font-size: 10px;
}

.zone-actions {
  gap: 5px;
  margin-top: 6px;
}

.zone-edit-form {
  gap: 5px;
}

.zone-edit-form label {
  font-size: 10px;
}

.warehouse-config-card {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
  padding: 9px;
  border: 1px solid color-mix(in srgb, var(--brand-teal) 24%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--brand-teal) 7%, var(--panel));
}

.warehouse-config-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.warehouse-config-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 900;
}

.warehouse-config-head span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-align: right;
}

.warehouse-config-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.warehouse-config-form label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}

.warehouse-config-form label.wide,
.warehouse-config-form button,
.obstacle-edit-form button {
  grid-column: 1 / -1;
}

.warehouse-config-form input,
.warehouse-config-form select,
.zone-edit-form select,
.zone-card select {
  width: 100%;
  min-width: 0;
  height: 30px;
}

.warehouse-config-form input[type="color"],
.zone-edit-form input[type="color"] {
  padding: 2px;
}

.warehouse-config-notice {
  margin-bottom: 8px;
  padding: 8px 9px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 850;
}

.warehouse-config-notice.is-ok {
  border: 1px solid color-mix(in srgb, var(--green) 35%, var(--line));
  background: color-mix(in srgb, var(--green) 10%, var(--panel));
  color: color-mix(in srgb, var(--green) 72%, var(--text));
}

.warehouse-config-notice.is-error {
  border: 1px solid color-mix(in srgb, var(--red) 35%, var(--line));
  background: color-mix(in srgb, var(--red) 9%, var(--panel));
  color: color-mix(in srgb, var(--red) 78%, var(--text));
}

.obstacle-card {
  border-left-color: #64748b;
}

.warehouse-stage {
  min-height: calc(100vh - 238px);
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55);
}

.warehouse-canvas {
  background:
    linear-gradient(180deg, rgba(255,255,255,.42), rgba(226,232,240,.18)),
    radial-gradient(circle at 50% 12%, rgba(7, 150, 170, .09), transparent 38%),
    radial-gradient(circle, rgba(100, 116, 139, .18) 1px, transparent 1.1px),
    #e8edf4;
  background-size: auto, auto, 16px 16px, auto;
}

.map-legend {
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  gap: 6px 9px;
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .82);
  font-size: 10px;
  font-weight: 760;
  backdrop-filter: blur(8px);
}

html[data-theme="dark"] .map-legend {
  background: rgba(21, 31, 43, .82);
}

.map-legend i {
  width: 10px;
  height: 10px;
}

.pallet-detail {
  gap: 9px;
  margin-top: 9px;
}

.pallet-detail .pallet-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0;
  border: 0;
}

.pallet-detail .pallet-info-grid > div {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface-soft) 72%, var(--panel));
}

.pallet-detail .pallet-info-grid > div:nth-child(2),
.pallet-detail .pallet-info-grid > div:nth-child(4),
.pallet-detail .pallet-info-grid > div:nth-child(20) {
  grid-column: 1 / -1;
}

.pallet-detail span {
  font-size: 10px;
  font-weight: 800;
}

.pallet-detail strong {
  font-size: 12px;
  line-height: 1.25;
}

.pallet-size-editor,
.pallet-bulk-editor {
  gap: 6px;
  padding: 9px;
}

.pallet-actions {
  gap: 6px;
}

.pallet-actions button {
  min-height: 29px;
  height: auto;
  padding: 6px 7px;
  line-height: 1.2;
}

.recent-strip {
  padding: 10px;
}

.recent-strip h2 {
  margin-bottom: 8px;
}

.recent-list {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 7px;
}

.recent-item {
  padding: 8px;
}

@media (max-width: 1500px) {
  .warehouse-shell {
    grid-template-columns: 300px minmax(460px, 1fr);
  }

  .warehouse-drawer {
    position: static;
    grid-column: 1 / -1;
    max-height: none;
  }
}

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

  .warehouse-shell {
    grid-template-columns: 1fr;
  }

  .warehouse-sidebar,
  .warehouse-drawer {
    position: static;
    max-height: none;
  }

  .warehouse-stage {
    min-height: 520px;
  }
}

.warehouse-tabs {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin: -2px -2px 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft) 82%, var(--panel));
}

.warehouse-tabs button,
.placement-mode-bar button {
  min-width: 0;
  min-height: 29px;
  height: auto;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  line-height: 1.1;
  box-shadow: none;
}

.warehouse-tabs button:hover,
.placement-mode-bar button:hover {
  background: color-mix(in srgb, var(--brand-teal) 7%, var(--panel));
  color: var(--text);
}

.warehouse-tabs button.active,
.placement-mode-bar button.active {
  border-color: color-mix(in srgb, var(--brand-teal) 36%, var(--line));
  background: color-mix(in srgb, var(--brand-teal) 13%, var(--panel));
  color: color-mix(in srgb, var(--brand-teal) 56%, var(--text));
}

.warehouse-tab-panel {
  display: none;
}

.warehouse-tab-panel.active {
  display: grid;
  gap: 10px;
}

.placement-mode-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft) 78%, var(--panel));
}

.placement-panel[data-mode="auto"] .placement-grid label:nth-child(-n+2),
.placement-panel[data-mode="pick"] .placement-grid label:nth-child(-n+2) {
  opacity: .74;
}

.placement-panel[data-mode="manual"] .placement-grid {
  border: 1px dashed color-mix(in srgb, var(--brand-teal) 34%, var(--line));
  border-radius: 8px;
  padding: 7px;
  background: color-mix(in srgb, var(--brand-teal) 5%, var(--panel));
}

.placement-smart-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.placement-smart-summary > span,
.placement-smart-summary div {
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface-soft) 78%, var(--panel));
}

.placement-smart-summary div span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
}

.placement-smart-summary div strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
  font-size: 12px;
}

.placement-smart-summary.is-ok div:last-child {
  border-color: color-mix(in srgb, var(--green) 28%, var(--line));
  background: color-mix(in srgb, var(--green) 9%, var(--panel));
}

.placement-smart-summary.is-warning div:last-child {
  border-color: color-mix(in srgb, var(--amber) 34%, var(--line));
  background: color-mix(in srgb, var(--amber) 11%, var(--panel));
}

@media (max-width: 1180px) {
  .warehouse-tabs {
    position: static;
  }
}

/* Customer operations workspace */
.page-kicker {
  margin: 0 0 3px;
  color: var(--brand-teal);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.customers-page,
.customer-page {
  display: grid;
  gap: 10px;
}

.customers-head,
.customer-head {
  align-items: center;
}

.customers-head p:not(.page-kicker),
.customer-head p:not(.page-kicker) {
  max-width: 760px;
}

.customers-search {
  min-width: min(500px, 44vw);
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.customers-search input {
  width: min(360px, 34vw);
  flex: 1 1 260px;
}

.customer-overview {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.customer-overview .card {
  min-height: 66px;
  padding: 9px 10px;
}

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

.customer-detail-grid {
  grid-template-columns: minmax(260px, .86fr) minmax(320px, 1fr) minmax(250px, .78fr);
  gap: 10px;
  margin-bottom: 0;
}

.customer-insight,
.customer-chart {
  min-height: 154px;
}

.insight-line {
  padding: 7px 0;
}

.insight-line span,
.insight-line strong {
  font-size: 12px;
}

.customer-insight p {
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft) 78%, var(--panel));
}

.mini-bars {
  height: 104px;
  gap: 6px;
}

.bar-stack {
  height: 76px;
}

.weekday-bars {
  gap: 7px;
}

.customer-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft) 82%, var(--panel));
}

.customer-tabs button {
  min-width: 0;
  min-height: 31px;
  height: auto;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  box-shadow: none;
}

.customer-tabs button:hover {
  background: color-mix(in srgb, var(--brand-teal) 7%, var(--panel));
  color: var(--text);
}

.customer-tabs button.active {
  border-color: color-mix(in srgb, var(--brand-teal) 34%, var(--line));
  background: color-mix(in srgb, var(--brand-teal) 13%, var(--panel));
  color: color-mix(in srgb, var(--brand-teal) 58%, var(--text));
}

.customer-tab-panel {
  display: none;
}

.customer-tab-panel.active {
  display: block;
}

.customer-quotes,
.customer-panel,
.customer-movements {
  margin-bottom: 0;
}

.customer-panel {
  max-height: calc(100vh - 300px);
}

.customer-quotes {
  max-height: calc(100vh - 300px);
}

.customer-movements {
  max-height: calc(100vh - 300px);
}

.customers-table-panel {
  max-height: calc(100vh - 190px);
}

.customers-table-panel .data-table {
  min-width: 1180px;
}

.customer-sections {
  margin-bottom: 0;
}

.movement-table {
  min-width: 1500px;
}

@media (max-width: 1100px) {
  .customers-head,
  .customer-head {
    align-items: stretch;
  }

  .customers-search {
    min-width: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .customers-search input {
    width: 100%;
    flex-basis: 100%;
  }

  .customer-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .customer-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Quote workspace refinement */
.quotes-page,
.quote-page {
  display: grid;
  gap: 10px;
}

.quotes-head,
.quote-head {
  align-items: center;
  margin-bottom: 4px;
}

.quotes-head p:not(.page-kicker),
.quote-head p:not(.page-kicker) {
  max-width: 760px;
}

.quotes-search {
  min-width: min(560px, 46vw);
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.quotes-search input {
  width: min(380px, 34vw);
  flex: 1 1 260px;
}

.quote-overview {
  grid-template-columns: repeat(4, minmax(118px, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.quote-overview .card {
  min-height: 66px;
  padding: 9px 10px;
}

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

.quote-table-panel {
  max-height: calc(100vh - 205px);
}

.quote-row-actions {
  min-width: 230px;
}

.quote-row-actions .small-link {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}

.quote-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 310px);
  align-items: start;
  gap: 12px;
  padding: 0 0 22px;
}

.quote-main-column,
.quote-side-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.quote-side-panel {
  position: sticky;
  top: 12px;
  align-self: start;
}

.quote-section {
  position: relative;
  padding: 12px;
}

.quote-section-head {
  align-items: center;
  margin-bottom: 10px;
}

.quote-section-head h2 {
  margin: 2px 0 0;
}

.quote-section-head p {
  max-width: 760px;
  margin-top: 3px;
}

.section-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-teal, #0896a8) 12%, var(--panel));
  color: var(--brand-teal, #0896a8);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
}

.quote-info-grid {
  grid-template-columns: repeat(3, minmax(170px, 1fr));
}

.quote-text-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.quote-grid input,
.quote-grid select,
.quote-grid textarea,
.quote-items-table input {
  min-height: 34px;
  border-radius: 6px;
  font-size: 12px;
}

.quote-grid textarea {
  min-height: 78px;
}

.quote-grid .quote-terms {
  min-height: 260px;
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.42;
}

.quote-items-wrap {
  border-color: color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 8px;
  background: var(--panel);
}

.quote-items-table {
  min-width: 1060px;
}

.quote-items-table th {
  height: 34px;
  background: color-mix(in srgb, var(--brand-teal, #0896a8) 9%, var(--panel));
  color: #17324d;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .035em;
}

html[data-theme="dark"] .quote-items-table th {
  color: #dceaff;
}

.quote-items-table td {
  background: color-mix(in srgb, var(--panel) 96%, var(--surface-soft, #f7f9fc));
}

.quote-row-remove {
  min-width: 58px;
}

.quote-summary-card {
  overflow: hidden;
  border-color: color-mix(in srgb, var(--brand-teal, #0896a8) 28%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand-teal, #0896a8) 8%, var(--panel)), var(--panel) 44%),
    var(--panel);
}

.quote-summary-card h2 {
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.22;
}

.quote-summary-list {
  display: grid;
  gap: 6px;
  margin: 0;
}

.quote-summary-list div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 7px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.quote-summary-list div:last-child {
  border-bottom: 0;
}

.quote-summary-list dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.quote-summary-list dd {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.quote-output-actions {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.quote-output-actions .button,
.quote-save-bar .button,
.quote-save-bar button {
  width: 100%;
  justify-content: center;
}

.quote-muted-box {
  display: block;
  padding: 9px 10px;
  border: 1px dashed color-mix(in srgb, var(--line) 80%, var(--muted));
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.quote-check-card h2 {
  margin-bottom: 8px;
}

.quote-check-card ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 17px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.36;
}

.quote-side-panel .quote-save-bar {
  position: static;
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  padding: 10px;
  border-radius: 8px;
  box-shadow: var(--shadow-panel, 0 8px 22px rgba(15, 23, 42, .06));
}

@media (max-width: 1180px) {
  .quote-editor-layout {
    grid-template-columns: 1fr;
  }

  .quote-side-panel {
    position: static;
  }

  .quote-info-grid,
  .quote-text-grid {
    grid-template-columns: repeat(2, minmax(170px, 1fr));
  }
}

@media (max-width: 760px) {
  .quotes-head,
  .quote-head {
    align-items: stretch;
  }

  .quotes-search {
    min-width: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .quotes-search input {
    width: 100%;
    flex-basis: 100%;
  }

  .quote-overview,
  .quote-info-grid,
  .quote-text-grid {
    grid-template-columns: 1fr;
  }
}

/* Warehouse placement memory */
.dimension-suggestion {
  display: grid;
  gap: 4px;
  margin-top: -2px;
  padding: 8px 10px;
  border: 1px dashed color-mix(in srgb, var(--line) 82%, var(--brand-teal, #0896a8));
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 86%, var(--panel));
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.dimension-suggestion strong {
  color: var(--text);
  font-size: 12px;
}

.dimension-suggestion span {
  color: var(--muted);
}

.dimension-suggestion.has-suggestion {
  border-style: solid;
  border-color: color-mix(in srgb, var(--brand-teal, #0896a8) 42%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-teal, #0896a8) 9%, var(--panel)), var(--panel));
}

.dimension-suggestion.is-manual {
  border-color: color-mix(in srgb, var(--amber) 48%, var(--line));
  background: color-mix(in srgb, var(--amber) 9%, var(--panel));
}

.quality-report-panel {
  display: grid;
  gap: 9px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.quality-report-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.quality-report-head h2 {
  margin-bottom: 0;
}

.quality-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.quality-summary-grid article {
  display: grid;
  gap: 2px;
  min-height: 50px;
  padding: 8px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 82%, var(--panel));
}

.quality-summary-grid article.is-ok { border-left-color: var(--green); }
.quality-summary-grid article.is-warning { border-left-color: var(--amber); }
.quality-summary-grid article.is-danger { border-left-color: var(--red); }

.quality-summary-grid strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

.quality-summary-grid span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 820;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.quality-list {
  display: grid;
  gap: 7px;
  max-height: 360px;
  overflow: auto;
}

.quality-row {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 9px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.quality-row.is-ok { border-left-color: var(--green); }
.quality-row.is-info { border-left-color: var(--blue); }
.quality-row.is-warning { border-left-color: var(--amber); }
.quality-row.is-danger { border-left-color: var(--red); }

.quality-row strong,
.quality-row span,
.quality-row small,
.quality-row em {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.quality-row strong {
  font-size: 12px;
}

.quality-row span,
.quality-row small,
.quality-row em {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.32;
}

.quality-row em {
  color: color-mix(in srgb, var(--text) 74%, var(--muted));
  font-style: normal;
  font-weight: 760;
}

/* Customs query workspace */
.customs-page {
  display: grid;
  gap: 10px;
}

.customs-head {
  margin-bottom: 4px;
}

.customs-head p:not(.page-kicker) {
  max-width: 840px;
}

.customs-grid {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(360px, 1.2fr);
  gap: 10px;
}

.customs-card {
  display: grid;
  gap: 9px;
  overflow: visible;
}

.customs-card label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
}

.customs-card input,
.customs-authority-form input,
.customs-authority-form select {
  min-height: 34px;
}

.customs-auth-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr);
  gap: 8px;
}

.customs-auth-grid.three {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.customs-live-card {
  border-color: color-mix(in srgb, var(--brand-teal, #0896a8) 26%, var(--line));
}

.security-note {
  margin: 0;
  padding: 8px 10px;
  border: 1px dashed color-mix(in srgb, var(--amber) 42%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--amber) 7%, var(--panel));
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.customs-overview {
  grid-template-columns: repeat(4, minmax(118px, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.customs-overview .card {
  min-height: 66px;
  padding: 9px 10px;
}

.customs-overview .card strong {
  font-size: 17px;
}

.customs-result {
  display: grid;
  gap: 10px;
}

.customs-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.customs-summary-grid,
.customs-info-grid {
  display: grid;
  gap: 7px;
}

.customs-summary-grid {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}

.customs-info-grid {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.customs-summary-grid article,
.customs-info-grid article,
.integration-cards article {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 78%, var(--panel));
}

.customs-summary-grid span,
.customs-info-grid span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 860;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.customs-summary-grid strong,
.customs-info-grid strong {
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.customs-items {
  max-height: 320px;
}

.raw-json summary {
  cursor: pointer;
  color: var(--blue);
  font-size: 12px;
  font-weight: 820;
}

.customs-integrations {
  display: grid;
  gap: 10px;
}

.customs-service-center,
.customs-protocols {
  display: grid;
  gap: 10px;
}

.customs-section-head,
.customs-service-result {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.secure-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--brand-teal, #0896a8) 28%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-teal, #0896a8) 8%, var(--panel));
  color: var(--text);
  font-size: 11px;
  font-weight: 820;
  white-space: nowrap;
}

.customs-service-layout {
  display: grid;
  grid-template-columns: minmax(340px, .95fr) minmax(420px, 1.05fr);
  gap: 10px;
}

.service-list,
.customs-authority-form {
  display: grid;
  gap: 8px;
}

.service-card,
.customs-authority-form,
.customs-service-result aside,
.customs-protocol-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 78%, var(--panel));
}

.service-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  padding: 10px;
}

.service-card strong,
.customs-protocol-grid strong {
  color: var(--text);
  font-size: 13px;
}

.service-card span,
.service-card small,
.customs-protocol-grid span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.service-card em {
  align-self: start;
  justify-self: end;
  padding: 3px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--amber) 12%, var(--panel));
  color: color-mix(in srgb, var(--text) 78%, var(--amber));
  font-size: 10px;
  font-style: normal;
  font-weight: 820;
}

.service-card.active em {
  background: color-mix(in srgb, var(--brand-teal, #0896a8) 12%, var(--panel));
  color: color-mix(in srgb, var(--text) 75%, var(--brand-teal, #0896a8));
}

.service-card a {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}

.customs-authority-form {
  padding: 12px;
}

.customs-authority-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
}

.customs-service-result {
  border-left: 4px solid var(--blue);
}

.customs-service-result.success {
  border-left-color: var(--brand-teal, #0896a8);
}

.customs-service-result.warning {
  border-left-color: var(--amber);
}

.customs-service-result.error {
  border-left-color: #dc2626;
}

.customs-service-result p {
  margin: 4px 0 8px;
  color: var(--muted);
}

.customs-service-result aside {
  display: grid;
  min-width: 190px;
  gap: 3px;
  padding: 10px;
}

.customs-service-result aside span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 860;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.customs-service-result aside strong {
  color: var(--text);
  font-size: 18px;
}

.customs-service-result aside em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  overflow-wrap: anywhere;
}

.customs-next-steps {
  flex-basis: 100%;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.customs-protocol-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 8px;
}

.customs-protocol-grid article {
  display: grid;
  gap: 5px;
  padding: 10px;
}

/* MERSIS company verification */
.mersis-page {
  display: grid;
  gap: 10px;
}

.mersis-head p:not(.page-kicker) {
  max-width: 900px;
}

.mersis-grid {
  display: grid;
  grid-template-columns: minmax(280px, .85fr) minmax(380px, 1.15fr);
  gap: 10px;
}

.mersis-card,
.mersis-official,
.mersis-protocols {
  display: grid;
  gap: 10px;
}

.mersis-card label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
}

.mersis-card input {
  min-height: 34px;
}

.mersis-authority-card {
  border-color: color-mix(in srgb, var(--brand-teal, #0896a8) 24%, var(--line));
}

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

.mersis-link-grid article {
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 78%, var(--panel));
}

.mersis-link-grid strong {
  color: var(--text);
  font-size: 13px;
}

.mersis-link-grid span {
  min-height: 34px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

/* Customs file control center */
.customs-control-page {
  display: grid;
  gap: 10px;
}

.customs-control-head {
  align-items: center;
}

.customs-control-head p {
  max-width: 820px;
}

.customs-control-search {
  min-width: min(560px, 50vw);
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.customs-control-search input {
  width: min(420px, 38vw);
  flex: 1 1 280px;
}

.customs-control-summary {
  grid-template-columns: repeat(8, minmax(108px, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.customs-control-summary .card {
  min-height: 62px;
  padding: 9px 10px;
}

.customs-control-summary .card strong {
  font-size: 18px;
}

.customs-control-filter {
  margin-bottom: 0;
}

.customs-critical-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 8px;
}

.customs-critical-card {
  display: grid;
  gap: 8px;
  border-left: 4px solid var(--red);
}

.customs-critical-card > div {
  display: grid;
  gap: 4px;
}

.customs-critical-card strong {
  color: var(--text);
  font-size: 14px;
}

.customs-critical-card small,
.customs-critical-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.customs-critical-card nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.customs-control-table-panel {
  max-height: calc(100vh - 236px);
}

.customs-control-table {
  min-width: 1720px;
}

.issue-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 360px;
}

.issue-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 10px;
  font-weight: 780;
  white-space: nowrap;
}

.issue-pill.critical {
  background: #fee2e2;
  color: #991b1b;
}

.issue-pill.warning {
  background: #fef3c7;
  color: #92400e;
}

.issue-pill.ok {
  background: #dcfce7;
  color: #166534;
}

/* Customs file detail checklist */
.customs-file-page {
  display: grid;
  gap: 10px;
}

.customs-file-head {
  align-items: center;
}

.customs-file-head p {
  max-width: 860px;
}

.customs-file-summary {
  grid-template-columns: repeat(8, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.customs-file-summary .card {
  min-height: 62px;
  padding: 9px 10px;
}

.customs-file-summary .card strong {
  font-size: 17px;
}

.customs-file-layout {
  display: grid;
  grid-template-columns: minmax(540px, 1.2fr) minmax(310px, .8fr);
  gap: 10px;
}

.customs-checklist-form,
.customs-file-side {
  display: grid;
  gap: 10px;
}

.customs-checklist-form textarea {
  min-height: 92px;
  resize: vertical;
}

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

.check-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: start;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 78%, var(--panel));
  color: var(--text);
}

.check-item input {
  min-width: 18px;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 1px;
}

.check-item span {
  display: grid;
  gap: 3px;
}

.check-item strong {
  font-size: 12px;
}

.check-item small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
}

.customs-file-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 8px;
}

.customs-checklist-form label:not(.check-item) {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
}

.file-facts {
  display: grid;
  gap: 7px;
}

.file-facts div {
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 78%, var(--panel));
}

.file-facts span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 860;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.file-facts strong {
  color: var(--text);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.customs-file-sections .table-panel {
  max-height: 360px;
}

.success-alert {
  border-color: color-mix(in srgb, var(--green) 28%, transparent);
  background: color-mix(in srgb, var(--green) 9%, var(--panel));
  color: #166534;
}

.integration-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
}

.integration-cards strong {
  color: var(--text);
  font-size: 13px;
}

.integration-cards span,
.integration-cards em {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.integration-cards em {
  color: color-mix(in srgb, var(--text) 76%, var(--muted));
  font-style: normal;
  font-weight: 760;
}

/* Customer contact center */
.contacts-page {
  display: grid;
  gap: 10px;
}

.contacts-head p {
  max-width: 920px;
}

.contact-overview {
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.contact-overview .card {
  min-height: 66px;
  padding: 10px 12px;
}

.contact-overview .card strong {
  font-size: 20px;
}

.contacts-grid {
  display: grid;
  grid-template-columns: minmax(520px, .95fr) minmax(340px, .65fr);
  gap: 10px;
}

.contact-form,
.contact-urgent-panel {
  display: grid;
  gap: 10px;
}

.contact-form h2,
.contact-urgent-panel h2 {
  margin: 0;
}

.contact-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
}

.contact-form input,
.contact-form select,
.contact-form textarea {
  min-height: 34px;
}

.contact-form textarea {
  resize: vertical;
}

.contact-filter-panel {
  margin: 0;
}

.contact-table-panel {
  max-height: calc(100vh - 248px);
}

.contact-table {
  min-width: 1540px;
}

.contact-table td {
  vertical-align: top;
}

.contact-table .wide small,
.contact-note-cell small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.contact-note-cell strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-size: 12px;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 270px;
}

.contact-actions form {
  margin: 0;
}

.contact-actions button {
  min-height: 26px;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 10px;
  line-height: 1;
}

.contact-actions .danger {
  border-color: color-mix(in srgb, var(--red) 28%, var(--line));
  color: #991b1b;
}

.contact-focus-row {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
}

.dashboard-contact-panel {
  border-color: color-mix(in srgb, var(--accent-2, #0ea5a6) 24%, var(--line));
}

.inline-action-form {
  display: inline-flex;
  margin: 0;
}

.notification-settings-form h2 {
  margin: 0;
}

.tenant-settings-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.tenant-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}

.tenant-settings-grid label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-weight: 750;
}

.tenant-settings-grid input,
.tenant-settings-grid textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

.tenant-settings-grid textarea {
  min-height: 82px;
  resize: vertical;
}

.notification-log-panel {
  display: grid;
  gap: 10px;
}

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

.notification-log-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 78%, var(--panel));
}

.notification-log-row strong {
  color: var(--text);
  font-size: 12px;
}

.notification-log-row small,
.notification-log-row em {
  grid-column: 2;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.notification-log-row em {
  color: #991b1b;
  font-style: normal;
  overflow-wrap: anywhere;
}

/* Gmail mail center */
.mail-page {
  display: grid;
  gap: 10px;
}

.mail-head p {
  max-width: 900px;
}

.mail-overview {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.mail-connect-panel {
  display: grid;
  gap: 10px;
}

.mail-connect-panel code {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 86%, var(--panel));
  color: var(--text);
  overflow-wrap: anywhere;
}

.mail-filter-panel {
  margin: 0;
}

.mail-table-panel {
  max-height: calc(100vh - 250px);
}

.mail-table {
  min-width: 1280px;
}

.mail-table small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.mail-detail-grid {
  align-items: start;
}

.mail-body-panel,
.mail-side-panel {
  display: grid;
  gap: 10px;
}

.mail-ref-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.mail-body-panel pre {
  max-height: 560px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 76%, var(--panel));
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow: auto;
}

.mail-attachment-list,
.mail-task-form {
  display: grid;
  gap: 8px;
}

.mail-attachment-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 76%, var(--panel));
}

.mail-attachment-card strong {
  color: var(--text);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.mail-attachment-card small {
  color: var(--muted);
  font-size: 10px;
}

.mail-attachment-card label,
.mail-task-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
}

.mail-ops-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.mail-sidebar,
.mail-main-panel,
.mail-account-form {
  display: grid;
  gap: 10px;
}

.mail-account-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
}

.mail-folder-list {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.mail-folder-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 820;
}

.mail-folder-list a.active {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 9%, var(--panel));
}

.mail-main-head {
  display: flex;
  gap: 10px;
  align-items: start;
  justify-content: space-between;
}

.mail-main-head h2 {
  margin: 0;
}

.mail-list {
  display: grid;
  gap: 7px;
  max-height: calc(100vh - 250px);
  overflow: auto;
  padding-right: 4px;
}

.mail-list-row {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 74%, var(--panel));
  color: var(--text);
  text-decoration: none;
}

.mail-list-row:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 6%, var(--panel));
}

.mail-row-top,
.mail-row-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.mail-row-top strong {
  font-size: 12px;
}

.mail-row-top span,
.mail-list-row p {
  color: var(--muted);
  font-size: 11px;
}

.mail-list-row h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
}

.mail-list-row p {
  margin: 0;
  line-height: 1.4;
}

.mail-row-meta {
  justify-content: flex-start;
}

.mail-row-meta em {
  padding: 3px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  color: var(--accent);
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
}

.empty-mail-state {
  display: grid;
  gap: 5px;
  place-items: center;
  min-height: 260px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-mail-state h2,
.empty-mail-state p {
  margin: 0;
}

/* System health */
.system-health-page {
  display: grid;
  gap: 10px;
}

.health-overview {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.health-route-list,
.health-file-list,
.health-recommendations,
.health-error-list {
  display: grid;
  gap: 7px;
}

.deployment-check-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 8px;
}

.deployment-check-grid article {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 8px;
  align-items: center;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 78%, var(--panel));
}

.deployment-check-grid strong,
.deployment-check-grid small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deployment-check-grid strong {
  font-size: 12px;
}

.deployment-check-grid small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.health-route-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 78%, var(--panel));
  color: var(--text);
  text-decoration: none;
}

.health-route-row small,
.health-route-row em {
  color: var(--muted);
  font-size: 10px;
}

.health-route-row em {
  grid-column: 2 / -1;
  color: #991b1b;
  font-style: normal;
}

.health-count-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 8px;
}

.health-count-grid div,
.health-file-list div,
.health-recommendations p {
  margin: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 78%, var(--panel));
}

.health-count-grid span,
.health-file-list span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}

.health-count-grid strong,
.health-file-list strong {
  color: var(--text);
  font-size: 15px;
}

.health-error-list pre {
  max-height: 220px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 10px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow: auto;
}

.update-log {
  max-height: 260px;
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: #07172d;
  color: #e6f3f6;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow: auto;
  overflow-wrap: anywhere;
}

.module-map-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 8px;
}

.module-map-grid article {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 76%, var(--panel));
}

.module-map-grid strong {
  color: var(--text);
  font-size: 13px;
}

.module-map-grid small,
.module-map-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

/* Data quality */
.quality-page {
  display: grid;
  gap: 10px;
}

.quality-overview {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.quality-card-panel {
  padding: 10px;
}

.quality-issue-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 8px;
}

.quality-issue-grid.compact {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}

.quality-issue,
.quality-mini-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 8px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 78%, var(--panel));
  color: var(--text);
  text-decoration: none;
}

.quality-issue.danger,
.quality-mini-row.danger {
  border-color: color-mix(in srgb, #dc2626 30%, var(--line));
  background: color-mix(in srgb, #fee2e2 36%, var(--panel));
}

.quality-issue.warn,
.quality-mini-row.warn {
  border-color: color-mix(in srgb, #d97706 30%, var(--line));
  background: color-mix(in srgb, #fef3c7 42%, var(--panel));
}

.quality-issue strong,
.quality-mini-row strong,
.quality-issue small,
.quality-mini-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quality-issue strong,
.quality-mini-row strong {
  white-space: nowrap;
  font-size: 12px;
}

.quality-issue small,
.quality-mini-row small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.quality-mini-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 8px;
}

.quality-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quality-section {
  min-width: 0;
}

.quality-table td small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.task-bulk-action {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

@media (max-width: 1100px) {
  .customs-grid,
  .mersis-grid,
  .customs-file-layout,
  .customs-critical-grid,
  .customs-service-layout,
  .customs-summary-grid,
  .customs-info-grid,
  .mersis-link-grid,
  .customs-protocol-grid,
  .integration-cards,
  .contacts-grid,
  .mail-detail-grid,
  .mail-ops-layout {
    grid-template-columns: 1fr;
  }

  .customs-auth-grid,
  .customs-auth-grid.three,
  .customs-file-summary,
  .customs-file-meta,
  .customs-control-summary,
  .customs-overview,
  .contact-overview,
  .mail-overview,
  .health-overview,
  .health-count-grid,
  .deployment-check-grid,
  .module-map-grid,
  .quality-overview,
  .quality-issue-grid,
  .quality-issue-grid.compact,
  .quality-mini-list,
  .quality-section-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .checklist-grid {
    grid-template-columns: 1fr;
  }

  .customs-section-head,
  .customs-service-result {
    display: grid;
  }
}

@media (max-width: 700px) {
  .quality-overview,
  .quality-issue-grid,
  .quality-issue-grid.compact,
  .quality-mini-list,
  .quality-section-grid {
    grid-template-columns: 1fr;
  }

  .task-bulk-action {
    justify-content: stretch;
  }

  .task-bulk-action button {
    width: 100%;
  }
}

/* Sidebar hierarchy */
.main-nav {
  gap: 7px;
}

.main-nav .nav-component {
  gap: 4px;
}

.main-nav .nav-parent,
.main-nav .nav-child {
  position: relative;
  display: grid;
  min-width: 0;
  border-radius: 7px;
  text-decoration: none;
}

.main-nav .nav-parent {
  grid-template-columns: minmax(0, 1fr) auto auto;
  min-height: 36px;
  padding: 9px 10px 9px 12px;
  color: #f4f8fc;
  font-size: 12.5px;
  font-weight: 850;
}

.main-nav .nav-parent span,
.main-nav .nav-child span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-nav .nav-parent b {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, .08);
  color: #cfe0f2;
  font-size: 14px;
  line-height: 1;
}

.main-nav .nav-children {
  gap: 3px;
  margin: 1px 0 4px 14px;
  padding: 3px 0 3px 10px;
  border-left: 1px solid rgba(148, 163, 184, .28);
}

.main-nav .nav-child {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 28px;
  padding: 6px 8px 6px 12px;
  color: #9fb0c4;
  font-size: 11px;
  font-weight: 650;
}

.main-nav .nav-child:hover {
  background: rgba(255, 255, 255, .045);
  color: #eef6ff;
}

.main-nav .nav-parent.active,
.main-nav .nav-child.active {
  padding-left: 16px;
}

.main-nav .nav-parent.active::before,
.main-nav .nav-child.active::before {
  position: absolute;
  left: 6px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 999px;
  align-self: auto;
  background: var(--brand-orange);
}

.main-nav .nav-child.active {
  background: rgba(7, 150, 170, .12);
  border-color: rgba(7, 150, 170, .20);
  color: #ffffff;
  box-shadow: none;
}

input:target,
select:target,
textarea:target,
form:target {
  outline: 3px solid color-mix(in srgb, var(--brand-orange) 65%, transparent);
  outline-offset: 3px;
}

/* Login refresh */
body.login-body {
  min-height: 100vh;
  display: block;
  background:
    radial-gradient(circle at 18% 20%, rgba(8, 150, 168, .12), transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, #eef3f8 100%);
  color: #0b1220;
}

.login-shell {
  width: min(1100px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) 430px;
  gap: 26px;
  align-items: center;
  padding: 38px 0;
}

.login-showcase {
  min-height: 680px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(7, 150, 170, .18), transparent 42%),
    #050918;
  color: #ffffff;
  padding: 28px;
  box-shadow: 0 26px 70px rgba(15, 23, 42, .18);
}

.login-showcase-top,
.login-system-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.login-showcase-logo {
  width: min(300px, 48vw);
  height: 104px;
  border-radius: 0;
  object-fit: contain;
  background: transparent;
  border: 0;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .28));
}

.login-showcase-top > span {
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  background: rgba(255, 255, 255, .09);
  color: #7ff4df;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.login-showcase-main > p,
.login-card-head > p {
  margin: 0;
  color: #4ff2cf;
  font-size: 13px;
  font-weight: 950;
  text-transform: uppercase;
}

.login-showcase-main h1 {
  max-width: 620px;
  margin: 18px 0 0;
  font-size: 42px;
  line-height: 1.15;
  letter-spacing: 0;
}

.login-official-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.login-official-grid article {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 14px;
  background: rgba(255, 255, 255, .07);
  padding: 13px 14px;
}

.login-official-grid span {
  display: block;
  color: #9fb0c5;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-official-grid strong {
  display: block;
  margin-top: 7px;
  color: #ffffff;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 950;
}

.login-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.login-feature-grid article,
.login-system-strip {
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 16px;
  background: rgba(255, 255, 255, .09);
}

.login-feature-grid article {
  min-height: 106px;
  padding: 18px;
}

.login-feature-grid i {
  display: inline-grid;
  min-width: 34px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: rgba(79, 242, 207, .13);
  color: #7ff4df;
  font-style: normal;
  font-size: 12px;
  font-weight: 950;
}

.login-feature-grid span,
.login-system-strip span {
  display: block;
  margin-top: 16px;
  color: #cad5e4;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-feature-grid strong,
.login-system-strip strong {
  display: block;
  margin-top: 6px;
  color: #fff;
  font-size: 17px;
  font-weight: 950;
}

.login-feature-grid strong {
  overflow-wrap: anywhere;
}

.login-system-strip {
  padding: 16px 18px;
}

.login-system-strip span {
  margin-top: 0;
}

.login-system-strip b {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  background: rgba(79, 242, 207, .13);
  color: #7ff4df;
  font-size: 13px;
}

.login-panel-wrap {
  min-width: 0;
}

.login-mobile-brand {
  display: none;
}

.login-card {
  width: 100%;
  margin: 0;
  padding: 28px;
  border: 1px solid rgba(203, 213, 225, .92);
  border-radius: 18px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 18px 42px rgba(15, 23, 42, .08);
}

.login-card-head {
  margin-bottom: 24px;
}

.login-card-head > p {
  color: #64748b;
}

.login-card-head h2 {
  margin: 8px 0 0;
  color: #020617;
  font-size: 26px;
  font-weight: 950;
}

.login-card-head span {
  display: block;
  margin-top: 10px;
  color: #475569;
  font-size: 14px;
  line-height: 1.7;
}

.login-card label {
  display: block;
  margin-top: 18px;
  color: #1e293b;
  font-size: 13px;
  font-weight: 850;
}

.login-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 50px;
  margin-top: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  background: #ffffff;
  padding: 0 13px;
}

.login-input-wrap:focus-within {
  border-color: #0896a8;
  box-shadow: 0 0 0 4px rgba(8, 150, 168, .14);
}

.login-input-wrap svg,
.login-submit svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.login-input-wrap svg {
  color: #64748b;
}

.login-card input {
  width: 100%;
  min-width: 0;
  height: 46px;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0;
}

.login-submit {
  width: 100%;
  height: 52px;
  margin-top: 16px;
  border-radius: 16px;
  background: #050918;
  color: #ffffff;
  gap: 9px;
  font-size: 15px;
  font-weight: 950;
}

.login-submit:hover {
  background: #111827;
}

.login-status-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.login-status-row article {
  min-height: 66px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(203, 213, 225, .92);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.login-status-row span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.login-status-row strong {
  color: #020617;
  font-size: 14px;
  font-weight: 950;
}

/* User permissions */
.users-admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 16px;
}

.user-create-panel {
  align-items: start;
}

.permission-role-panel {
  max-height: none;
}

.user-permission-list {
  display: grid;
  gap: 14px;
}

.user-permission-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--shadow-panel, 0 8px 22px rgba(15, 23, 42, .05));
}

.user-permission-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.user-permission-card > header h2 {
  margin: 8px 0 0;
}

.user-permission-card > header p {
  margin-top: 4px;
}

.user-edit-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.user-edit-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.user-edit-grid input,
.user-edit-grid select {
  width: 100%;
}

.user-password-field {
  grid-column: span 1;
}

.permission-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 10px;
}

.permission-group {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft, #f7f9fc) 82%, var(--panel));
  padding: 10px;
}

.permission-check {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 30px;
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
}

.permission-check input {
  width: 17px;
  min-width: 17px;
  height: 17px;
  accent-color: var(--brand-teal, #0896a8);
}

.permission-check span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-parent {
  color: var(--text);
  font-size: 13px;
  font-weight: 920;
}

.permission-children {
  display: grid;
  gap: 3px;
  margin-top: 7px;
  padding-left: 18px;
  border-left: 2px solid color-mix(in srgb, var(--brand-teal, #0896a8) 25%, var(--line));
}

@media (max-width: 1100px) {
  .login-shell {
    grid-template-columns: 1fr;
    max-width: 560px;
  }

  .login-showcase {
    display: none;
  }

  .login-mobile-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    border: 1px solid rgba(203, 213, 225, .92);
    border-radius: 18px;
    background: #ffffff;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  }

  .login-mobile-brand p {
    margin: 0;
    color: #0896a8;
    font-size: 13px;
    font-weight: 950;
  }

  .login-mobile-brand h1 {
    margin-top: 4px;
    font-size: 24px;
  }

  .login-mobile-brand img {
    width: 148px;
    height: 54px;
    object-fit: contain;
  }

  .users-admin-layout,
  .permission-board {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 700px) {
  .login-shell {
    width: min(100vw - 22px, 520px);
    padding: 22px 0;
  }

  .login-card {
    padding: 20px;
  }

  .login-status-row {
    grid-template-columns: 1fr;
  }

  .login-showcase-main h1 {
    font-size: 34px;
  }

  .login-official-grid,
  .login-feature-grid {
    grid-template-columns: 1fr;
  }

  .user-permission-card > header {
    display: grid;
  }

  .user-permission-card > header button {
    width: 100%;
  }

  .user-edit-grid {
    grid-template-columns: 1fr;
  }
}

/* Readable section headers */
.table-panel > h2:first-child {
  margin: 0;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .18);
  background: linear-gradient(135deg, #0f766e, #0f6ddf);
  color: #ffffff;
  font-size: 14px;
  font-weight: 950;
}

.panel:not(.table-panel) > h2:first-child {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin: -2px 0 12px;
  padding: 7px 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(8, 150, 168, .15), rgba(15, 109, 223, .12));
  color: #0f4c81;
  font-size: 14px;
  font-weight: 950;
}

.customer-insight > h2:first-child {
  color: #7c2d12;
  background: linear-gradient(135deg, rgba(249, 115, 22, .16), rgba(245, 158, 11, .13));
}

.customer-chart > h2:first-child {
  color: #075985;
  background: linear-gradient(135deg, rgba(14, 165, 233, .15), rgba(8, 150, 168, .12));
}

.customer-quotes > h2:first-child {
  background: linear-gradient(135deg, #6d28d9, #2563eb);
}

.customer-panel > h2:first-child {
  background: linear-gradient(135deg, #0f766e, #16a34a);
}

.customer-movements > h2:first-child {
  background: linear-gradient(135deg, #ea580c, #dc2626);
}

.customer-tabs {
  border-color: rgba(15, 109, 223, .24);
  background: linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(236, 245, 255, .92));
  box-shadow: 0 10px 26px rgba(15, 23, 42, .07);
}

.customer-tabs button {
  position: relative;
  border-color: rgba(148, 163, 184, .28);
  background: #ffffff;
  color: #25364d;
}

.customer-tabs button::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 7px 0 0 7px;
  background: #94a3b8;
}

.customer-tabs button:nth-child(1)::before { background: #ea580c; }
.customer-tabs button:nth-child(2)::before { background: #0f766e; }
.customer-tabs button:nth-child(3)::before { background: #0f6ddf; }
.customer-tabs button:nth-child(4)::before { background: #7c3aed; }

.customer-tabs button:hover {
  border-color: rgba(15, 109, 223, .28);
  background: #f8fbff;
}

.customer-tabs button.active {
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(15, 23, 42, .10);
}

.customer-tabs button.active:nth-child(1) {
  background: linear-gradient(135deg, #ea580c, #dc2626);
}

.customer-tabs button.active:nth-child(2) {
  background: linear-gradient(135deg, #0f766e, #16a34a);
}

.customer-tabs button.active:nth-child(3) {
  background: linear-gradient(135deg, #0f6ddf, #0896a8);
}

.customer-tabs button.active:nth-child(4) {
  background: linear-gradient(135deg, #6d28d9, #2563eb);
}

.customer-tabs button.active::before {
  background: rgba(255, 255, 255, .85);
}

html[data-theme="dark"] .panel:not(.table-panel) > h2:first-child {
  color: #e2e8f0;
  background: linear-gradient(135deg, rgba(8, 150, 168, .26), rgba(15, 109, 223, .20));
}

html[data-theme="dark"] .customer-tabs {
  background: rgba(15, 23, 42, .88);
}

html[data-theme="dark"] .customer-tabs button {
  background: rgba(15, 23, 42, .72);
  color: #dbe7f5;
}

.stock-table {
  min-width: 2380px;
}

.portal-stock-table {
  min-width: 1400px;
}

.status-area-included {
  background: #dcfce7;
  color: #166534;
}

.status-area-included::before {
  content: "✓ ";
  font-weight: 950;
}

.status-area-excess {
  background: #fee2e2;
  color: #991b1b;
}

.status-area-standard {
  background: #e2e8f0;
  color: #475569;
}

.area-contract-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(15, 109, 223, .18);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(240, 249, 255, .92), rgba(236, 253, 245, .72));
}

.area-contract-head,
.quote-share-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.area-contract-head strong {
  color: #0f4c81;
  font-size: 14px;
}

.toggle-line {
  display: inline-flex !important;
  grid-column: auto !important;
  align-items: center;
  gap: 8px;
  min-height: auto !important;
  margin: 0;
  font-weight: 900;
}

.toggle-line input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.area-contract-grid {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  gap: 12px;
}

.area-contract-summary {
  display: grid;
  gap: 12px;
}

.area-contract-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.area-contract-title h2 {
  margin: 0;
  font-size: 16px;
}

.area-meter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 10px;
}

.area-meter-grid div {
  min-height: 86px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 10px;
  background: #ffffff;
}

.area-meter-grid span,
.area-meter-grid small {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.area-meter-grid strong {
  display: block;
  margin-top: 7px;
  color: #0f172a;
  font-size: 20px;
}

.area-status-cell {
  min-width: 190px;
}

.area-bulk-form {
  display: grid;
  gap: 10px;
}

.area-bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px;
  border: 1px solid rgba(15, 109, 223, .18);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(240, 249, 255, .92), rgba(236, 253, 245, .74));
}

.area-check-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #0f4c81;
  font-size: 13px;
  font-weight: 950;
}

.area-check-line input,
.select-cell input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #0f6ddf;
}

.select-cell {
  text-align: center;
}

.area-bulk-toolbar select {
  min-width: 170px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 850;
}

.area-bulk-toolbar button {
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: #0f6ddf;
  color: #fff;
  font-weight: 950;
  cursor: pointer;
}

.area-bulk-toolbar button.secondary {
  background: #0f766e;
}

.status-badge-stack {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.area-allocation-form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px;
}

.area-allocation-form select {
  min-width: 126px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
}

.area-allocation-form button,
.link-button {
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: #0f6ddf;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.area-allocation-form button {
  padding: 0 10px;
}

.area-allocation-form.compact select {
  min-width: 104px;
}

.area-status-cell small {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.quote-share-cell {
  min-width: 230px;
}

.share-url-input {
  width: 100%;
  max-width: 280px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(15, 109, 223, .22);
  border-radius: 8px;
  background: #f8fbff;
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
}

.quote-share-create {
  margin: 0;
}

.quote-share-create .button,
.quote-output-actions button {
  width: 100%;
}

.link-button {
  padding: 0;
  background: transparent;
  color: #dc2626;
}

html[data-theme="dark"] .area-contract-editor,
html[data-theme="dark"] .area-bulk-toolbar,
html[data-theme="dark"] .area-meter-grid div,
html[data-theme="dark"] .share-url-input {
  background: rgba(15, 23, 42, .72);
}

html[data-theme="dark"] .area-meter-grid strong {
  color: #f8fafc;
}

@media (max-width: 900px) {
  .area-contract-grid,
  .area-meter-grid {
    grid-template-columns: 1fr;
  }
}

/* Product catalog */
.products-page,
.product-detail-page {
  display: grid;
  gap: 12px;
}

.products-head,
.product-detail-head {
  align-items: center;
}

.products-search {
  min-width: min(520px, 44vw);
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.products-search input {
  width: min(390px, 34vw);
  flex: 1 1 260px;
}

.product-overview {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-bottom: 0;
}

.product-integration-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-left: 5px solid var(--brand-teal, #0896a8);
  background: linear-gradient(135deg, rgba(8, 150, 168, .10), rgba(255, 255, 255, .94));
}

.product-integration-panel div {
  display: grid;
  gap: 4px;
}

.product-integration-panel strong {
  color: #0f4c81;
  font-size: 15px;
}

.product-integration-panel span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.products-table-panel {
  max-height: calc(100vh - 280px);
}

.products-table {
  min-width: 1280px;
}

.products-table td small,
.product-arrivals-table td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.product-detail-grid {
  display: grid;
  grid-template-columns: minmax(360px, .95fr) minmax(280px, .55fr);
  gap: 12px;
  align-items: start;
}

.product-edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 12px;
  overflow: visible;
}

.product-edit-form h2,
.product-edit-form .span-2 {
  grid-column: 1 / -1;
}

.product-edit-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.product-edit-form input,
.product-edit-form textarea {
  width: 100%;
}

.product-source-panel {
  overflow: visible;
}

.product-arrivals-panel {
  max-height: 520px;
}

.product-arrivals-table {
  min-width: 1320px;
}

.product-pallets-panel {
  max-height: 360px;
}

.product-pallets-table {
  min-width: 1120px;
}

@media (max-width: 1100px) {
  .products-head,
  .product-detail-head {
    align-items: stretch;
  }

  .products-search {
    min-width: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .products-search input {
    width: 100%;
    flex-basis: 100%;
  }

  .product-integration-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .product-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .product-edit-form {
    grid-template-columns: 1fr;
  }
}

/* Navigation placeholders */
.placeholder-page {
  display: grid;
  gap: 10px;
}

.placeholder-overview {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.placeholder-overview .card strong {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.placeholder-grid {
  align-items: start;
}

.placeholder-panel {
  max-height: 440px;
}

.placeholder-table {
  min-width: 760px;
}

@media (max-width: 1100px) {
  .placeholder-overview,
  .placeholder-grid {
    grid-template-columns: 1fr;
  }
}

/* Licensing */
.license-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff7ed;
  color: #7c2d12;
}

.license-banner.is-danger {
  background: #fef2f2;
  color: #991b1b;
}

.license-banner a {
  color: inherit;
  font-weight: 900;
}

.license-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(320px, .8fr);
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.license-status-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-weight: 750;
}

.license-status-card.is-ok {
  border-color: #86efac;
}

.license-status-card.is-warn {
  border-color: #facc15;
}

.license-status-card.is-danger {
  border-color: #fca5a5;
}

.license-activation-panel textarea,
.license-code-list textarea,
.license-code-list input {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.license-code-list {
  display: grid;
  gap: 10px;
}

.license-enforcement-form,
.license-danger-form {
  margin-top: 12px;
}

.switch-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text);
  font-weight: 850;
}

.license-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 8px;
}

.license-feature {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft, #f8fafc);
}

.license-feature span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.license-feature strong {
  font-size: 18px;
}

.license-feature small {
  color: var(--muted);
  line-height: 1.35;
}

.license-feature.is-ok {
  border-color: #86efac;
}

.license-feature.is-danger {
  border-color: #fecaca;
  opacity: .76;
}

@media (max-width: 1100px) {
  .license-layout,
  .license-feature-grid {
    grid-template-columns: 1fr;
  }
}

/* Professional polish pass: stock, customer detail and archive tables */
.stock-table {
  min-width: 1960px;
  table-layout: fixed;
}

.stock-table th,
.stock-table td {
  padding: 7px 8px;
  font-size: 12px;
  line-height: 1.35;
}

.stock-table th:nth-child(1), .stock-table td:nth-child(1) { width: 112px; }
.stock-table th:nth-child(2), .stock-table td:nth-child(2) { width: 78px; }
.stock-table th:nth-child(3), .stock-table td:nth-child(3) { width: 104px; }
.stock-table th:nth-child(4), .stock-table td:nth-child(4) { width: 168px; }
.stock-table th:nth-child(5), .stock-table td:nth-child(5) { width: 220px; }
.stock-table th:nth-child(6), .stock-table td:nth-child(6) { width: 210px; }
.stock-table th:nth-child(7), .stock-table td:nth-child(7) { width: 126px; }
.stock-table th:nth-child(8), .stock-table td:nth-child(8) { width: 176px; }
.stock-table th:nth-child(9), .stock-table td:nth-child(9) { width: 220px; }
.stock-table th:nth-child(10), .stock-table td:nth-child(10) { width: 120px; }
.stock-table th:nth-child(11), .stock-table td:nth-child(11) { width: 230px; }

.stock-area-form {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
}

.area-status-cell small {
  margin-top: 2px;
  font-size: 10px;
}

.customer-page,
.customer-tab-panel,
.customer-tab-panel > .panel,
.customer-tab-panel .table-panel {
  min-width: 0;
  max-width: 100%;
}

.customer-tab-panel.active {
  overflow: hidden;
}

.customer-movements,
.customer-panel,
.customer-quotes {
  overflow: auto;
}

.customer-movements > h2:first-child,
.customer-tabs button.active:nth-child(1),
.customer-tabs button.active:nth-child(2),
.customer-tabs button.active:nth-child(3),
.customer-tabs button.active:nth-child(4) {
  background: linear-gradient(135deg, var(--brand-teal), var(--blue));
}

.customer-tabs button:nth-child(1)::before,
.customer-tabs button:nth-child(2)::before,
.customer-tabs button:nth-child(3)::before,
.customer-tabs button:nth-child(4)::before {
  background: var(--brand-teal);
}

.movement-table {
  min-width: 1320px;
  table-layout: fixed;
}

.movement-table th,
.movement-table td {
  padding: 7px 8px;
  font-size: 12px;
}

.movement-table th:nth-child(1), .movement-table td:nth-child(1) { width: 70px; }
.movement-table th:nth-child(2), .movement-table td:nth-child(2) { width: 100px; }
.movement-table th:nth-child(3), .movement-table td:nth-child(3) { width: 170px; }
.movement-table th:nth-child(4), .movement-table td:nth-child(4) { width: 180px; }
.movement-table th:nth-child(5), .movement-table td:nth-child(5) { width: 110px; }
.movement-table th:nth-child(6), .movement-table td:nth-child(6) { width: 280px; }
.movement-table th:nth-child(7), .movement-table td:nth-child(7) { width: 70px; }
.movement-table th:nth-child(8), .movement-table td:nth-child(8) { width: 95px; }
.movement-table th:nth-child(9), .movement-table td:nth-child(9) { width: 100px; }
.movement-table th:nth-child(10), .movement-table td:nth-child(10) { width: 115px; }
.movement-table th:nth-child(11), .movement-table td:nth-child(11) { width: 150px; }
.movement-table th:nth-child(12), .movement-table td:nth-child(12) { width: 120px; }

.attachments-table {
  min-width: 980px;
  table-layout: fixed;
}

.attachments-table th:nth-child(1), .attachments-table td:nth-child(1) { width: 110px; }
.attachments-table th:nth-child(2), .attachments-table td:nth-child(2) { width: auto; }
.attachments-table th:nth-child(3), .attachments-table td:nth-child(3) { width: 90px; }
.attachments-table th:nth-child(4), .attachments-table td:nth-child(4) { width: 160px; }
.attachments-table th:nth-child(5), .attachments-table td:nth-child(5) { width: 150px; }

.attachments-table td.wide {
  overflow-wrap: anywhere;
}

.attachment-actions {
  white-space: nowrap;
}

.attachment-actions .small-link,
.attachment-actions .inline-delete-form {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
}

.danger-link {
  border: 0;
  background: transparent;
  color: var(--red);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

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

/* Stability pass: wide stock table and collapsible sidebar */
.stock-table-panel {
  overflow: auto;
  max-width: 100%;
}

.stock-table-panel .table-tools {
  left: 0;
  width: 100%;
  min-width: min(760px, 100%);
  background: color-mix(in srgb, var(--panel) 96%, #eef7fb);
}

.stock-table {
  width: 3541px;
  min-width: 3541px;
  table-layout: fixed;
}

.stock-table th {
  top: 53px;
}

.stock-table th,
.stock-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-table td.wide {
  overflow-wrap: anywhere;
  word-break: normal;
}

.stock-table th:nth-child(1), .stock-table td:nth-child(1) { width: 104px; }
.stock-table th:nth-child(2), .stock-table td:nth-child(2) { width: 82px; }
.stock-table th:nth-child(3), .stock-table td:nth-child(3) { width: 106px; }
.stock-table th:nth-child(4), .stock-table td:nth-child(4) { width: 150px; }
.stock-table th:nth-child(5), .stock-table td:nth-child(5) { width: 190px; }
.stock-table th:nth-child(6), .stock-table td:nth-child(6) { width: 210px; }
.stock-table th:nth-child(7), .stock-table td:nth-child(7) { width: 128px; }
.stock-table th:nth-child(8), .stock-table td:nth-child(8) { width: 180px; }
.stock-table th:nth-child(9), .stock-table td:nth-child(9) { width: 230px; }
.stock-table th:nth-child(10), .stock-table td:nth-child(10) { width: 128px; }
.stock-table th:nth-child(11), .stock-table td:nth-child(11) { width: 230px; }
.stock-table th:nth-child(12), .stock-table td:nth-child(12) { width: 118px; }
.stock-table th:nth-child(13), .stock-table td:nth-child(13) { width: 118px; }
.stock-table th:nth-child(14), .stock-table td:nth-child(14) { width: 140px; }
.stock-table th:nth-child(15), .stock-table td:nth-child(15) { width: 132px; }
.stock-table th:nth-child(16), .stock-table td:nth-child(16) { width: 128px; }
.stock-table th:nth-child(17), .stock-table td:nth-child(17) { width: 135px; }
.stock-table th:nth-child(18), .stock-table td:nth-child(18) { width: 118px; }
.stock-table th:nth-child(19), .stock-table td:nth-child(19) { width: 118px; }
.stock-table th:nth-child(20), .stock-table td:nth-child(20) { width: 118px; }
.stock-table th:nth-child(21), .stock-table td:nth-child(21) { width: 118px; }
.stock-table th:nth-child(22), .stock-table td:nth-child(22) { width: 140px; }
.stock-table th:nth-child(23), .stock-table td:nth-child(23) { width: 140px; }
.stock-table th:nth-child(24), .stock-table td:nth-child(24) { width: 280px; }

.stock-table th:nth-child(-n+4),
.stock-table td:nth-child(-n+4) {
  position: sticky;
  background: color-mix(in srgb, var(--panel) 97%, #eef7fb);
}

.stock-table th:nth-child(-n+4) {
  z-index: 8;
}

.stock-table td:nth-child(-n+4) {
  z-index: 5;
}

.stock-table th:nth-child(1), .stock-table td:nth-child(1) { left: 0; }
.stock-table th:nth-child(2), .stock-table td:nth-child(2) { left: 104px; }
.stock-table th:nth-child(3), .stock-table td:nth-child(3) { left: 186px; }
.stock-table th:nth-child(4), .stock-table td:nth-child(4) {
  left: 292px;
  box-shadow: 8px 0 16px rgba(15, 23, 42, .06);
}

.stock-table tbody tr:hover td:nth-child(-n+4) {
  background: color-mix(in srgb, var(--brand-teal) 8%, var(--panel));
}

.area-status-cell {
  overflow: hidden;
}

.area-status-cell small {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-weight: 800;
}

.stock-area-display {
  display: grid;
  gap: 3px;
  justify-items: start;
  min-width: 0;
}

.area-edit-link {
  color: var(--brand-teal);
  font-size: 10.5px;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.area-edit-link:hover {
  color: var(--blue);
  text-decoration: underline;
}

.nav-parent-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 5px;
}

.nav-parent-wrap.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.nav-parent-wrap .nav-parent {
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
}

.nav-group-toggle {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 8px;
  background: rgba(255, 255, 255, .055);
  color: #cfe0f2;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  box-shadow: none;
}

.nav-group-toggle:hover {
  background: rgba(7, 150, 170, .22);
  color: #fff;
}

.nav-component.is-open .nav-group-toggle {
  transform: rotate(45deg);
  background: rgba(7, 150, 170, .24);
  color: #fff;
}

.nav-children[hidden] {
  display: none !important;
}

.main-nav .nav-child {
  font-size: 11.5px;
  font-weight: 680;
}

/* Stock table stability pass: prevent visual column drift on wide reports */
.stock-table-panel {
  position: relative;
  overflow: auto;
  scrollbar-gutter: stable both-edges;
}

.stock-table {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.stock-table th,
.stock-table td {
  box-sizing: border-box;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.stock-table td.wide,
.stock-table td:nth-child(11),
.stock-table td:nth-child(24) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.stock-table td:nth-child(5) small,
.stock-table .doc-link,
.stock-table .area-edit-link {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.stock-table td:nth-child(5) small {
  display: block;
  margin-top: 3px;
}

.stock-table th:nth-child(-n+4),
.stock-table td:nth-child(-n+4) {
  background-clip: padding-box;
  outline: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  outline-offset: -1px;
}

.stock-table th:nth-child(4),
.stock-table td:nth-child(4) {
  box-shadow: 10px 0 18px rgba(15, 23, 42, .08);
}

/* Customer detail tabs must not expand the whole page when a wide table opens */
.customer-page,
.customer-tab-panel,
.customer-tab-panel .customer-sections,
.customer-tab-panel .panel,
.customer-tab-panel .table-panel {
  min-width: 0;
  max-width: 100%;
}

.customer-page {
  overflow-x: hidden;
}

.customer-tabs {
  max-width: 100%;
  overflow-x: auto;
}

.customer-tabs button {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-tab-panel {
  overflow: hidden;
}

.customer-tab-panel.active {
  display: block;
}

.customer-tab-panel .table-panel {
  width: 100%;
  overflow: auto;
  scrollbar-gutter: stable;
}

.customer-panel .data-table,
.customer-quotes .data-table,
.customer-movements .movement-table {
  table-layout: fixed;
  max-width: none;
}

.customer-panel .data-table {
  min-width: 1280px;
}

.customer-quotes .data-table {
  min-width: 1240px;
}

.customer-movements .movement-table {
  width: 1320px;
  min-width: 1320px;
}

.customer-tab-panel .data-table th,
.customer-tab-panel .data-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
