:root {
  --brand: #c01820;
  --brand-dark: #98141a;
  --brand-soft: #fff1f2;
  --bg: #f7f7f8;
  --card: #ffffff;
  --border: #e7e7ea;
  --border-strong: #d7d7dc;
  --text: #262a31;
  --muted: #747984;
  --muted-light: #9aa0aa;
  --table-head: #f4f5f7;
  --shadow: 0 10px 30px rgba(15, 23, 42, .06);
  --ok: #137333;
  --warning: #b45f06;
  --info: #2764ad;
  --danger: #c01820;
  --topbar-height: 64px;
  --sidebar-width: 232px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.brand:hover {
  color: var(--text);
  text-decoration: none;
}

.brand:hover .brand-title {
  color: var(--brand);
}

.brand-logo {
  display: block;
  height: 42px;
  width: auto;
  max-width: 96px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand-title {
  color: var(--text);
  transition: color .15s ease;
}

.brand .ver {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.user-name { color: var(--text); font-weight: 600; }

.role-pill {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
}

.inline { display: inline; }

.link-btn {
  border: none;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  font: inherit;
  padding: 4px 0;
}

.sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  z-index: 10;
  width: var(--sidebar-width);
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 18px 16px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-nav a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
}

.side-nav a:hover,
.side-nav a.active {
  background: var(--brand-soft);
  color: var(--brand);
}

.side-nav a.placeholder {
  color: var(--muted);
}

.container {
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 24px;
}

.app-main {
  width: auto;
  max-width: none;
  margin: var(--topbar-height) 0 0 var(--sidebar-width);
  padding: 32px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

h1, h2, h3 { color: var(--text); }
h1 { margin: 0; font-size: 28px; line-height: 1.25; }
h2 { margin: 0; font-size: 18px; line-height: 1.35; }
h3 { margin: 0 0 12px; font-size: 16px; }

.page-desc,
.card-head p,
.section-head p,
.hint,
.cell-muted {
  color: var(--muted);
}

.page-desc { margin: 8px 0 0; max-width: 660px; }
.section-head.compact {
  align-items: center;
  margin-top: 18px;
  margin-bottom: 0;
}
.section-head.compact h4 {
  margin: 0;
  font-size: 15px;
}
.page-actions, .actions, .detail-actions, .form-actions, .filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
  border-color: var(--brand);
  color: var(--brand);
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn.primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.btn.small {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12px;
}

.btn.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn.danger:hover {
  background: #fdebec;
}

.btn:disabled {
  cursor: not-allowed;
  color: var(--muted-light);
  background: #f5f5f6;
  border-color: var(--border);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.metric-card,
.content-card,
.filter-card,
.form-section,
.card,
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 20px;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.metric-card strong {
  color: var(--brand);
  font-size: 30px;
  line-height: 1.1;
}

.content-card,
.filter-card,
.form-section,
.card,
.stat-card {
  padding: 20px;
  margin-bottom: 18px;
}

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

.card-head p,
.section-head p {
  margin: 4px 0 0;
}

.filter-grid,
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.filter-actions {
  align-self: end;
}

label,
.field-label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 8px 11px;
  outline: none;
}

textarea { resize: vertical; }

textarea[readonly] {
  background: #fafafa;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(192, 24, 32, .1);
}

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

.source-picker {
  position: relative;
}

.source-picker-control {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
}

.source-picker-control:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(192, 24, 32, .1);
}

.source-picker-control input {
  min-height: 38px;
  border: 0;
  box-shadow: none;
}

.source-picker-control input:focus {
  border-color: transparent;
  box-shadow: none;
}

.source-picker-toggle {
  width: 40px;
  border: 0;
  border-left: 1px solid var(--border);
  background: #fafafa;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.source-picker-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 32px rgba(15, 23, 42, .12);
  padding: 6px;
}

/* 来源选项：浅边白底圆角标签，覆盖浏览器默认按钮外观 */
.source-picker-option {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 8px 8px 0;
  padding: 5px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

/* 悬停态：主题红描边 + 淡红底 */
.source-picker-option:hover,
.source-picker-option:focus {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
  outline: none;
}

/* 选中态：主题红实底白字 */
.source-picker-option.is-selected {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.source-picker-option span,
.source-picker-empty {
  color: var(--muted);
  font-size: 12px;
}

.source-picker-option.is-selected span {
  color: #ffd9dc;
}

.source-picker-empty {
  padding: 10px;
}

.quick-entry {
  border-color: #ffd6da;
  box-shadow: 0 12px 32px rgba(192, 24, 32, .08);
}

.advanced-settlement summary {
  cursor: pointer;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.advanced-settlement .hint {
  margin: 10px 0 16px;
}

.advanced-grid {
  margin-top: 6px;
}

.amount-composition {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafafa;
}

.nested-grid {
  margin-top: 8px;
}

.quick-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.dispatch-copy textarea {
  width: 100%;
  margin-top: 10px;
  font-family: "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  line-height: 1.65;
}

.record-forms {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 18px;
}

.compact-record-form {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafafa;
}

.record-table td { min-width: 96px; }

.dispatch-board {
  display: grid;
  gap: 20px;
}

.dispatch-board-table {
  min-width: 1500px;
}

.dispatch-board-table td {
  vertical-align: top;
}

.board-address {
  min-width: 220px;
  max-width: 320px;
  white-space: normal;
}

.board-tags,
.board-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.board-tags {
  margin-top: 8px;
}

.info-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #fff7e6;
  color: var(--warning);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.info-tag.ok {
  background: #e8f5ee;
  color: var(--ok);
}

.full { grid-column: 1 / -1; }
.wide { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 8px; }

/* 订单工作台筛选：主筛选常驻，高级筛选折叠 */
.workbench-filter .filter-primary {
  align-items: end;
}
.workbench-filter .filter-actions {
  display: flex;
  gap: 10px;
  align-self: end;
}
.more-filters {
  margin-top: 14px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}
.more-filters > summary {
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  list-style: none;
  user-select: none;
}
.more-filters > summary::before {
  content: "▸ ";
  color: var(--muted);
}
.more-filters[open] > summary::before {
  content: "▾ ";
}
.more-filters .filter-advanced {
  margin-top: 14px;
}

/* 返回上一页导航条 */
.page-back {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.checkline {
  flex-direction: row;
  align-items: center;
  align-self: end;
  min-height: 40px;
  gap: 8px;
  color: var(--text);
}

.checkline input {
  width: 16px;
  height: 16px;
  min-height: 16px;
}

.inline-check {
  justify-content: flex-start;
  width: fit-content;
}

.check-grid,
.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.check-card,
.chk {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.check-card input,
.chk input {
  width: 15px;
  height: 15px;
  min-height: 15px;
}

.form-actions {
  position: sticky;
  bottom: 0;
  padding: 16px 0 4px;
  background: linear-gradient(180deg, rgba(247,247,248,0), var(--bg) 35%);
}

.is-hidden { display: none; }

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table.grid {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
}

table.grid th,
table.grid td {
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

table.grid th {
  background: var(--table-head);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

table.grid tbody tr:hover td {
  background: #fffafa;
}

table.grid tbody tr:last-child td {
  border-bottom: 0;
}

.orders-table td { min-width: 96px; }
.orders-table {
  table-layout: fixed;
  min-width: 1180px;
}
.orders-table th,
.orders-table td {
  overflow: hidden;
}
.orders-table .actions-col { width: 170px; }
.clip-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.strong-link { color: var(--brand); font-weight: 700; }
.cell-muted { margin-top: 3px; font-size: 12px; font-weight: 400; }
.mono { font-family: "Consolas", "Courier New", monospace; }

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

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
}
.numeric-pager {
  flex-wrap: wrap;
}
.pager-summary {
  margin-right: auto;
}
.page-link,
.page-ellipsis {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}
.page-link:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.page-link.is-current {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.page-ellipsis {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef0f4;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.s-待派单 { background: #fff3e0; color: var(--warning); }
.badge.s-已派单,
.badge.s-未采样 { background: #eaf2ff; color: var(--info); }
.badge.s-已采样 { background: #e8f5ee; color: var(--ok); }
.badge.s-已取消 { background: #fdebec; color: var(--danger); }
.badge.s-已作废 { background: #eceff3; color: #596170; }
.badge.s-report { background: #f4f5f7; color: var(--text); }

.alert {
  background: #fff7e6;
  border: 1px solid #f3d38a;
  color: #7a4b00;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
}

.alert.ok {
  background: #e8f5ee;
  border-color: #a7d8ba;
  color: var(--ok);
}

.hint { margin: -4px 0 16px; }

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

.kv > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kv span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.kv b { font-weight: 700; }
.kv .full { grid-column: 1 / -1; }

.detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.detail-head h2 { font-size: 24px; }
.detail-actions { margin-left: auto; }
.action-reason-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.action-reason-form input {
  width: 160px;
  min-height: 34px;
}

.point-photo-table td:last-child { min-width: 280px; }
.sampling-feedback-table td:nth-child(2) { min-width: 220px; }
.photo-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.photo-drop {
  width: 96px;
  height: 72px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  overflow: hidden;
  padding: 0;
}
.photo-drop.is-active,
.photo-drop:focus {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.photo-drop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sampling-feedback-table img.thumb {
  width: 96px;
  height: 72px;
  max-width: 96px;
  max-height: 72px;
  object-fit: cover;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.photo-drop span {
  display: block;
  padding: 10px;
  font-size: 12px;
  line-height: 1.35;
}
.photo-form,
.photo-delete-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.photo-form input[type="file"] {
  max-width: 180px;
  min-height: 34px;
}
.photo-delete-form input {
  width: 120px;
  min-height: 34px;
}
.photo-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

/* 批量上传现场采样照片 */
.batch-upload {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: #fbfbfc;
}
.batch-upload h4 {
  margin: 0 0 4px;
  font-size: 15px;
}
.batch-photo-form {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.batch-photo-form {
  flex-direction: column;
  align-items: stretch;
}
.batch-photo-form input[type="file"] {
  max-width: 340px;
  min-height: 34px;
}
.hint.inline {
  margin: 0;
}
.batch-paste-zone {
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: #fff;
  padding: 16px;
  min-height: 84px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.batch-paste-zone.is-active,
.batch-paste-zone:focus {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.batch-paste-zone .paste-hint {
  font-weight: 700;
  color: var(--text);
}
.batch-paste-zone .paste-sub {
  font-size: 12px;
  color: var(--muted);
}
.batch-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.batch-thumb {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.batch-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.batch-file-pick {
  font-size: 13px;
  color: var(--muted);
}

/* 转账截图：点击后 Ctrl+V 粘贴或选择文件 */
.proof-paste-zone {
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: #fff;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.proof-paste-zone.is-active,
.proof-paste-zone:focus {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.proof-paste-zone .paste-hint {
  font-size: 13px;
  color: var(--muted);
}
.proof-paste-zone input[type="file"] {
  max-width: 320px;
  min-height: 34px;
}
.proof-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.proof-preview .proof-name {
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
}
.proof-thumb {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* 现场采样照片网格 */
.sampling-photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}
.sampling-photo {
  margin: 0;
  width: 160px;
}
.sampling-photo img {
  width: 160px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}
.sampling-photo figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

/* 财务结算：本期切换与超期标识 */
.period-switch {
  display: inline-flex;
  gap: 6px;
  margin-right: 10px;
  flex-wrap: wrap;
}
.badge.badge-overdue {
  background: #fdecec;
  color: var(--brand);
  border: 1px solid #f3b9b9;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card {
  text-align: center;
  text-decoration: none;
}
.stat-card:hover {
  border-color: var(--brand);
  color: var(--text);
}
.stat-card span {
  display: block;
  color: var(--muted);
  font-weight: 600;
}
.stat-card strong {
  display: block;
  margin-top: 6px;
  color: var(--brand);
  font-size: 28px;
}
.workbench-stats {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.workbench-table { min-width: 1380px; }
.stat-num { font-size: 32px; font-weight: 700; color: var(--brand); }
.stat-label { color: var(--muted); margin-top: 6px; }

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, #fff1f2, transparent 34%), var(--bg);
}

.login-card {
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 34px 30px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0;
  text-align: center;
  font-size: 22px;
}

.login-card .sub {
  margin: -6px 0 6px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

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

@media (max-width: 820px) {
  :root { --sidebar-width: 0px; }
  .topbar {
    position: static;
    height: auto;
    padding: 14px 18px;
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
  }
  .brand {
    max-width: 100%;
    flex-wrap: wrap;
  }
  .brand-logo {
    height: 38px;
    max-width: 88px;
  }
  .sidebar {
    position: static;
    width: auto;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .side-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .side-nav a { min-width: max-content; }
  .app-main {
    margin: 0;
    padding: 22px 16px;
  }
  .page-header,
  .card-head,
  .section-head {
    flex-direction: column;
  }
  .page-actions,
  .filter-actions,
  .form-actions {
    justify-content: flex-start;
  }
  .metric-grid,
  .filter-grid,
  .form-grid,
  .kv,
  .cards {
    grid-template-columns: 1fr;
  }
  .wide { grid-column: 1 / -1; }
}
