/* StockPilot stylesheet. Theme colors live in the custom properties below. */

@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('../fonts/plus-jakarta-sans-latin.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f6f7f5;
  --panel: #ffffff;
  --panel-2: #f9faf8;
  --line: #e1e5e0;
  --line-strong: #8d968c;
  --text: #14213d;
  --muted: #535e70;
  --accent: #0e7c5a;
  --accent-hover: #0b6649;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1ea;
  --accent-text: #0a6347;
  --good-soft: #e2f1ea;
  --good-text: #0a6347;
  --warn-soft: #fdf0d5;
  --warn-text: #7d4300;
  --warn-fill: #c77700;
  --bad-soft: #fcebe9;
  --bad-text: #b42318;
  --bad-fill: #d03b2c;
  --info-soft: #e7eff9;
  --info-text: #1d4a85;
  --chip-muted-soft: #edf0f2;
  --chip-muted-text: #474f5c;
  --side-bg: #14213d;
  --side-text: #c9d1e3;
  --side-strong: #ffffff;
  --side-hover: #1f2d4f;
  --side-active: #22355e;
  --side-line: #2a3a60;
  --focus: #0e7c5a;
  --shadow-float: 0 12px 32px rgba(20, 33, 61, 0.16), 0 2px 6px rgba(20, 33, 61, 0.08);
  --r-panel: 8px;
  --r-ctrl: 6px;
  --side-w: 248px;
  --top-h: 64px;
  color-scheme: light;
}

[data-theme='dark'] {
  --bg: #0f1729;
  --panel: #16203a;
  --panel-2: #1a2543;
  --line: #27335a;
  --line-strong: #6f7da3;
  --text: #e6eaf2;
  --muted: #a6b0c5;
  --accent: #34c38f;
  --accent-hover: #4fd3a2;
  --accent-ink: #062016;
  --accent-soft: #123b31;
  --accent-text: #5edaa9;
  --good-soft: #123b31;
  --good-text: #6be0b1;
  --warn-soft: #3b2d12;
  --warn-text: #f4bb57;
  --warn-fill: #e3a33a;
  --bad-soft: #3d1c22;
  --bad-text: #ff958b;
  --bad-fill: #f0675a;
  --info-soft: #182d4f;
  --info-text: #9cc2f5;
  --chip-muted-soft: #222d4c;
  --chip-muted-text: #bcc4d6;
  --side-bg: #0b1222;
  --side-text: #b4bdd2;
  --side-strong: #ffffff;
  --side-hover: #16203a;
  --side-active: #1c2a4b;
  --side-line: #1f2a47;
  --focus: #5edaa9;
  --shadow-float: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: 'tnum' 0;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.625rem;
  font-weight: 750;
}

h2 {
  font-size: 1.0625rem;
  font-weight: 700;
}

h3 {
  font-size: 0.9375rem;
  font-weight: 700;
}

p {
  margin: 0;
}

a {
  color: var(--accent-text);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--text);
}

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

a[href],
button:not(:disabled),
summary,
select,
label[for],
label:has(> input[type='radio']),
label:has(> input[type='checkbox']),
.file-btn,
[role='tab'] {
  cursor: pointer;
}

button:disabled,
.btn[aria-disabled='true'] {
  cursor: not-allowed;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--panel);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--r-ctrl);
  box-shadow: var(--shadow-float);
}

.skip:focus {
  top: 12px;
}

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

.small {
  font-size: 0.8125rem;
}

.block {
  display: block;
}

.mono {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  font-size: 0.8125rem;
}

.num,
.qty,
.kpi dd,
.feed-change,
.bar-value,
.facts dd {
  font-variant-numeric: tabular-nums;
}

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

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

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

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

.ic {
  flex: none;
}

/* Shell */
.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--side-w);
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--side-bg);
  color: var(--side-text);
  transition: width 0.18s ease;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--top-h);
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--side-line);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  color: var(--side-strong);
  text-decoration: none;
  border-radius: var(--r-ctrl);
}

.brand-link:hover {
  color: var(--side-strong);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

.brand-mark-lg {
  width: 72px;
  height: 72px;
  font-size: 1.5rem;
  border-radius: 12px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  object-fit: cover;
  background: #fff;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.brand-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--side-text);
}

.sidebar .icon-btn {
  color: var(--side-text);
}

.sidebar .icon-btn:hover {
  background: var(--side-hover);
  color: var(--side-strong);
}

.sidebar :focus-visible {
  outline-color: #7be3b9;
}

.icon-btn.drawer-close,
.icon-btn.menu-btn {
  display: none;
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--r-ctrl);
  color: var(--side-text);
  text-decoration: none;
  font-weight: 550;
}

.nav-link:hover {
  background: var(--side-hover);
  color: var(--side-strong);
}

.nav-link.is-active {
  background: var(--side-active);
  color: var(--side-strong);
}

.nav-link.is-active .ic {
  color: #5edaa9;
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-count {
  min-width: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #2f4372;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}

.sidebar-foot {
  padding: 12px 10px 16px;
  border-top: 1px solid var(--side-line);
  display: grid;
  gap: 8px;
}

.demo-note .nav-label {
  white-space: normal;
}

.demo-note {
  font-size: 0.75rem;
  padding: 0 12px;
  color: var(--side-text);
}

.storage-warn {
  display: flex;
  gap: 6px;
  font-size: 0.75rem;
  color: #ffc9a8;
  padding: 0 12px;
}

.sidebar .reset-btn {
  justify-content: flex-start;
  text-align: left;
  color: var(--side-text);
  border-color: var(--side-line);
  width: 100%;
}

.sidebar .reset-btn:hover {
  background: var(--side-hover);
  color: var(--side-strong);
  border-color: var(--side-line);
}

body.is-collapsed .sidebar {
  width: 72px;
}

body.is-collapsed .brand {
  flex-direction: column;
  justify-content: center;
  height: auto;
  padding: 12px 0;
  gap: 6px;
}

body.is-collapsed .brand-link {
  flex: none;
}

body.is-collapsed .brand-text,
body.is-collapsed .nav-label,
body.is-collapsed .demo-note {
  display: none;
}

body.is-collapsed .nav-link {
  justify-content: center;
  padding: 0;
  position: relative;
}

body.is-collapsed .nav-count {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 18px;
  line-height: 16px;
  font-size: 0.6875rem;
  padding: 0 4px;
}

body.is-collapsed .reset-btn {
  justify-content: center;
  padding: 0;
}

body.is-collapsed .collapse-btn .ic {
  transform: scaleX(-1);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--top-h);
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.global-search {
  position: relative;
  flex: 1;
  max-width: 520px;
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.pop-wrap {
  position: relative;
}

.dot-count {
  position: absolute;
  top: 4px;
  right: 3px;
  min-width: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--bad-fill);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.avatar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 10px 4px 4px;
  border: 0;
  border-radius: var(--r-ctrl);
  background: none;
}

.avatar-btn:hover {
  background: var(--panel-2);
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.75rem;
  font-weight: 750;
}

.avatar-name {
  font-weight: 600;
  font-size: 0.875rem;
}

main {
  flex: 1;
  outline: none;
}

.page {
  padding: 24px 24px 48px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-head h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-head h1:focus {
  outline: none;
}

.page-head p {
  margin-top: 4px;
}

.crumbs {
  display: flex;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctrl);
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}

.btn:hover {
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--text);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-ink);
}

.btn-danger {
  background: var(--bad-text);
  border-color: var(--bad-text);
  color: #fff;
}

[data-theme='dark'] .btn-danger {
  color: #2a0d0a;
}

.btn-danger:hover {
  background: var(--bad-fill);
  border-color: var(--bad-fill);
  color: #fff;
}

[data-theme='dark'] .btn-danger:hover {
  color: #2a0d0a;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  border-color: var(--line);
}

.btn-sm {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.8125rem;
}

.btn-block {
  width: 100%;
  margin-top: 16px;
}

.icon-danger-text:hover {
  color: var(--bad-text);
  border-color: var(--bad-text);
}

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--r-ctrl);
  background: transparent;
  color: var(--muted);
}

.icon-btn:hover {
  background: var(--panel-2);
  color: var(--text);
}

.icon-btn:active {
  background: var(--line);
}

.icon-btn:disabled {
  opacity: 0.4;
  background: transparent;
}

.icon-danger:hover {
  color: var(--bad-text);
  background: var(--bad-soft);
}

.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: inherit;
}

.link:hover {
  color: var(--text);
}

.strong-link {
  color: var(--text);
  font-weight: 650;
  text-decoration: none;
}

.strong-link:hover {
  color: var(--accent-text);
  text-decoration: underline;
}

.kbd {
  font: inherit;
  font-size: 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0 6px;
  color: var(--muted);
}

/* Chips */
.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
  white-space: nowrap;
}

.chip-good {
  background: var(--good-soft);
  color: var(--good-text);
}

.chip-warn {
  background: var(--warn-soft);
  color: var(--warn-text);
}

.chip-bad {
  background: var(--bad-soft);
  color: var(--bad-text);
}

.chip-info {
  background: var(--info-soft);
  color: var(--info-text);
}

.chip-muted {
  background: var(--chip-muted-soft);
  color: var(--chip-muted-text);
}

h1 .chip {
  font-size: 0.8125rem;
  height: 26px;
  letter-spacing: 0;
}

/* Stock gauge */
.gauge {
  display: inline-block;
  width: 72px;
  flex: none;
  vertical-align: middle;
}

.gauge-wide {
  width: 100%;
  margin: 12px 0 8px;
}

.gauge-track {
  position: relative;
  display: block;
  height: 6px;
  border-radius: 3px;
  background: var(--chip-muted-soft);
}

.gauge-wide .gauge-track {
  height: 10px;
  border-radius: 5px;
}

.gauge-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: var(--accent);
}

.gauge-low .gauge-fill {
  background: var(--warn-fill);
}

.gauge-out .gauge-fill {
  background: var(--bad-fill);
}

.gauge-min {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  background: var(--text);
  border-radius: 1px;
}

/* Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: 20px;
  min-width: 0;
}

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

.panel-head p {
  margin-top: 2px;
}

.panel-head .link {
  font-size: 0.8125rem;
  white-space: nowrap;
}

.panel-title {
  margin-bottom: 14px;
}

.panel-table {
  padding: 0;
}

.panel-table > .panel-head {
  padding: 18px 20px 0;
}

.panel-table .table-wrap + .pager,
.panel-table > .report-body {
  padding: 0 20px 16px;
}

.panel-table > .report-body {
  padding-top: 0;
}

/* KPIs */
.kpis {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 12px;
  margin: 0 0 16px;
}

.kpi {
  margin: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: 16px 18px;
}

.kpi dt {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

.kpi dd {
  margin: 4px 0 2px;
  font-size: 1.5rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.kpi-lead dd {
  font-size: 2rem;
}

.kpi-alert.has-alert dd {
  color: var(--bad-text);
}

/* Dashboard */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.dash-grid > .panel {
  grid-column: span 6;
}

.dash-grid > .panel-focus {
  grid-column: span 7;
  grid-row: span 2;
}

.dash-grid > .panel-focus + .panel,
.dash-grid > .panel-focus + .panel + .panel {
  grid-column: span 5;
}

.dash-grid > .panel:nth-child(4) {
  grid-column: span 12;
}

.dash-grid > .panel:nth-child(5),
.dash-grid > .panel:nth-child(6) {
  grid-column: span 6;
}

.panel-focus {
  border-color: var(--line-strong);
}

.reorder-group + .reorder-group {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.reorder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.reorder-head h3 a {
  color: var(--text);
  text-decoration: none;
}

.reorder-head h3 a:hover {
  text-decoration: underline;
}

.reorder-list,
.feed,
.mini-list,
.plain-list,
.alert-list,
.timeline,
.bars {
  list-style: none;
  margin: 0;
  padding: 0;
}

.reorder-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1.6fr) minmax(120px, 1fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.reorder-row + .reorder-row {
  border-top: 1px dashed var(--line);
}

.reorder-main,
.reorder-state {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.reorder-state {
  align-items: flex-start;
  font-size: 0.8125rem;
}

.reorder-stock {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8125rem;
}

.on-order {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.thumb {
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 6px;
  overflow: hidden;
  background: var(--chip-muted-soft);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-empty {
  color: var(--chip-muted-text);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.feed li {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.feed li:first-child {
  border-top: 0;
}

.feed li > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 0.875rem;
}

.feed li > div .muted {
  font-size: 0.8125rem;
}

.feed-change {
  font-weight: 700;
  text-align: right;
}

.feed-change.is-in {
  color: var(--good-text);
}

.feed-change.is-out {
  color: var(--bad-text);
}

.mini-list li {
  display: grid;
  grid-template-columns: minmax(80px, auto) minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
}

.mini-list li:first-child {
  border-top: 0;
}

.mini-list .muted {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-host {
  position: relative;
  min-height: 220px;
}

.chart {
  display: block;
  overflow: visible;
}

.chart .grid {
  stroke: var(--line);
  stroke-width: 1;
}

.chart .axis {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart .line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
}

.chart .area {
  fill: var(--accent);
  opacity: 0.1;
}

.chart .end,
.chart .cross-dot {
  fill: var(--accent);
  stroke: var(--panel);
  stroke-width: 2;
}

.chart .cross-line {
  stroke: var(--line-strong);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.chart .hit {
  fill: transparent;
  cursor: crosshair;
}

.chart .hit:focus-visible {
  outline: none;
  stroke: var(--focus);
  stroke-width: 2;
}

.tip {
  position: absolute;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  white-space: nowrap;
  box-shadow: var(--shadow-float);
}

.tip strong {
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.bars li {
  display: grid;
  grid-template-columns: minmax(90px, 120px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  font-size: 0.875rem;
}

.bar-track {
  height: 10px;
  border-radius: 0 4px 4px 0;
  background: var(--chip-muted-soft);
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}

.bar-value {
  font-weight: 650;
  min-width: 84px;
  text-align: right;
}

.bars li:hover .bar-fill {
  background: var(--accent-hover);
}

/* Empty, loading and error states */
.empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}

.empty strong {
  color: var(--text);
}

.empty-good {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  background: var(--good-soft);
  color: var(--good-text);
  border-radius: var(--r-ctrl);
}

.empty-good strong {
  color: inherit;
}

.state {
  max-width: 520px;
  margin: 64px auto;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
}

.state h1 {
  color: var(--text);
  font-size: 1.375rem;
}

.state-loading .ic {
  color: var(--accent);
}

.state-error .ic {
  color: var(--bad-text);
}

.callout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-ctrl);
  background: var(--chip-muted-soft);
  color: var(--chip-muted-text);
  margin-bottom: 16px;
  font-size: 0.875rem;
}

.callout-good {
  background: var(--good-soft);
  color: var(--good-text);
}

.callout-info {
  background: var(--info-soft);
  color: var(--info-text);
}

.callout-bad {
  background: var(--bad-soft);
  color: var(--bad-text);
}

.summary-line {
  margin: 0 0 12px;
  font-size: 0.875rem;
  color: var(--muted);
}

.report-body .summary-line {
  margin: 0 0 16px;
}

/* Toolbars and tables */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 260px;
}

.search-field .ic {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
}

.search-field input[type='search'] {
  width: 100%;
  padding-left: 40px;
}

.search-global .kbd {
  position: absolute;
  right: 10px;
}

.search-global input[type='search'] {
  padding-right: 36px;
  background: var(--panel-2);
}

.filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
}

.filter label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

input[type='text'],
input[type='search'],
input[type='number'],
input[type='email'],
input[type='tel'],
input[type='date'],
input:not([type]),
select,
textarea {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctrl);
  background: var(--panel);
  color: var(--text);
  width: 100%;
}

textarea {
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--text);
}

input[aria-invalid='true'],
select[aria-invalid='true'] {
  border-color: var(--bad-text);
  box-shadow: 0 0 0 1px var(--bad-text);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--panel-2);
}

.table th:first-child,
.table td:first-child {
  padding-left: 20px;
}

.table th:last-child,
.table td:last-child {
  padding-right: 20px;
}

.table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tbody tr:hover td {
  background: var(--panel-2);
}

.table .num {
  text-align: right;
  white-space: nowrap;
}

.table tfoot td,
.table tfoot th {
  font-weight: 650;
  border-bottom: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.875rem;
}

.table-compact td {
  padding: 9px 12px;
}

.sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: none;
  padding: 2px 0;
  font: inherit;
  color: inherit;
  font-weight: 650;
}

.sort:hover {
  color: var(--text);
}

th.num .sort {
  flex-direction: row-reverse;
}

.sort-mark {
  display: inline-block;
  width: 10px;
  color: var(--accent-text);
}

.sort-mobile {
  display: none;
}

.cell-product {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.cell-product > div {
  display: flex;
  flex-direction: column;
}

.cell-stock {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 190px;
}

.cell-actions {
  width: 1%;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
}

.move-type {
  font-weight: 600;
  white-space: nowrap;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.pager > span:first-child {
  margin-right: auto;
}

/* Detail pages */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.detail-wide {
  grid-column: 1 / -1;
}

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

.product-title {
  display: flex;
  gap: 16px;
  align-items: center;
}

.product-title > div {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.stock-big {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.stock-big strong {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.facts div {
  min-width: 0;
}

.facts dt {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.facts dd {
  margin: 2px 0 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.facts-stack {
  grid-template-columns: 1fr;
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.note {
  margin-top: 16px;
  padding: 12px;
  background: var(--panel-2);
  border-radius: var(--r-ctrl);
  font-size: 0.875rem;
}

.timeline li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--muted);
}

.timeline li:first-child {
  border-top: 0;
}

.plain-list {
  margin-top: 12px;
  display: grid;
  gap: 6px;
  font-size: 0.875rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  overflow-x: auto;
}

.tabs [role='tab'] {
  border: 0;
  background: none;
  padding: 10px 14px;
  min-height: 44px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}

.tabs [role='tab']:hover {
  color: var(--text);
}

.tabs [role='tab'][aria-selected='true'] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.report-sub {
  margin: 24px 0 8px;
}

.report-body .table th:first-child,
.report-body .table td:first-child {
  padding-left: 12px;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-wide {
  grid-column: 1 / -1;
}

.field > label,
.field > .label,
.field > legend {
  font-size: 0.8125rem;
  font-weight: 650;
  padding: 0;
}

.req {
  color: var(--bad-text);
}

.hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.static {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-weight: 650;
}

.field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--bad-text);
  font-weight: 600;
}

.form-error {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: var(--r-ctrl);
  background: var(--bad-soft);
  color: var(--bad-text);
  font-weight: 600;
  font-size: 0.875rem;
}

.form-error[hidden] {
  display: none;
}

.form-panel + .form-panel,
.settings + .form-panel,
.settings .form-panel + .form-panel {
  margin-top: 16px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.seg {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0;
}

.seg legend {
  width: 100%;
  margin-bottom: 6px;
}

.seg label {
  position: relative;
  flex: 1 1 auto;
}

.seg input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.seg span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  font-weight: 600;
  font-size: 0.875rem;
  background: var(--panel);
}

.seg label + label span {
  border-left: 0;
}

.seg label:first-of-type span {
  border-radius: var(--r-ctrl) 0 0 var(--r-ctrl);
}

.seg label:last-of-type span {
  border-radius: 0 var(--r-ctrl) var(--r-ctrl) 0;
}

.seg label:hover span {
  background: var(--panel-2);
}

.seg input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.seg input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.preview,
.margin-note {
  font-size: 0.875rem;
  color: var(--muted);
  min-height: 1.5em;
}

.preview strong {
  color: var(--text);
}

.image-pick {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.image-preview {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--chip-muted-soft);
  display: grid;
  place-items: center;
  color: var(--muted);
  flex: none;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-btn:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.wrap {
  flex-wrap: wrap;
}

#set-data + p {
  margin-bottom: 14px;
}

.lines .table th:first-child,
.lines .table td:first-child {
  padding-left: 0;
}

.lines .table th:last-child,
.lines .table td:last-child {
  padding-right: 0;
}

.lines .table th {
  background: transparent;
}

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

.table-lines td:first-child {
  min-width: 240px;
}

.table-lines input {
  width: 110px;
  text-align: right;
}

.table-lines [data-line-total] {
  padding-top: 20px;
  font-weight: 650;
}

.table-lines [data-avail] {
  margin-top: 4px;
}

.lines-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.lines-total {
  font-size: 0.9375rem;
}

.lines-total strong {
  font-size: 1.125rem;
  margin-left: 8px;
  font-variant-numeric: tabular-nums;
}

/* Dialogs, popovers, toasts */
.dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-float);
}

.dialog-wide {
  width: min(760px, calc(100vw - 24px));
}

.dialog::backdrop {
  background: rgba(10, 18, 34, 0.55);
}

.dialog-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 34px);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px 22px;
  border-bottom: 1px solid var(--line);
}

.dialog-body {
  padding: 20px 22px;
  overflow-y: auto;
}

.dialog-body > p + .form-grid {
  margin-top: 16px;
}

.dialog .form-error {
  margin: 0 22px 12px;
}

.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

@media (prefers-reduced-motion: no-preference) {
  .dialog[open] {
    animation: dlg 0.16s ease-out;
  }

  @keyframes dlg {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
  }
}

.popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 340px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-float);
  z-index: 40;
}

.popover-menu {
  width: 240px;
}

.pop-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.pop-head .muted {
  font-size: 0.8125rem;
}

.pop-empty {
  padding: 16px;
  font-size: 0.875rem;
  color: var(--muted);
}

.alert-list a {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 16px;
  color: var(--text);
  text-decoration: none;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
}

.alert-list li:first-child a {
  border-top: 0;
}

.alert-list a:hover {
  background: var(--panel-2);
}

.alert-list a > span:last-child {
  display: flex;
  flex-direction: column;
}

.alert-list .muted {
  font-size: 0.8125rem;
}

.menu {
  list-style: none;
  margin: 0;
  padding: 6px;
}

.menu a,
.menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-ctrl);
  background: none;
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 550;
  text-align: left;
}

.menu a:hover,
.menu button:hover {
  background: var(--panel-2);
}

.gs-list {
  left: 0;
  right: auto;
  width: 100%;
  list-style: none;
  margin: 0;
  padding: 6px;
}

.gs-list a {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 0 10px;
  padding: 8px 10px;
  border-radius: var(--r-ctrl);
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
}

.gs-list a .muted {
  grid-column: 2;
  font-size: 0.8125rem;
}

.gs-list [aria-selected='true'] a,
.gs-list a:hover {
  background: var(--accent-soft);
}

.gs-kind {
  grid-row: span 2;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--muted);
  padding-top: 2px;
}

.gs-label {
  font-weight: 650;
}

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 8px;
  z-index: 60;
  width: min(380px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 10px 14px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.875rem;
  font-weight: 550;
  box-shadow: var(--shadow-float);
}

.toast span {
  flex: 1;
}

.toast .icon-btn {
  color: inherit;
  width: 32px;
  height: 32px;
}

.toast .icon-btn:hover {
  background: rgba(127, 127, 127, 0.25);
  color: inherit;
}

.toast-good > .ic {
  color: #6be0b1;
}

[data-theme='dark'] .toast-good > .ic {
  color: #0a6347;
}

.toast-bad {
  background: var(--bad-text);
  color: #fff;
}

[data-theme='dark'] .toast-bad {
  color: #2a0d0a;
}

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 34, 0.55);
  z-index: 29;
}

.noscript {
  padding: 24px;
}

.print-host {
  display: none;
}

/* Responsive */
@media (max-width: 1180px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-grid > .panel,
  .dash-grid > .panel-focus,
  .dash-grid > .panel-focus + .panel,
  .dash-grid > .panel-focus + .panel + .panel,
  .dash-grid > .panel:nth-child(5),
  .dash-grid > .panel:nth-child(6) {
    grid-column: span 12;
    grid-row: auto;
  }
}

@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(300px, 86vw);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0.2s;
    box-shadow: var(--shadow-float);
  }

  body.is-collapsed .sidebar {
    width: min(300px, 86vw);
  }

  body.is-collapsed .brand-text,
  body.is-collapsed .nav-label,
  body.is-collapsed .demo-note {
    display: initial;
  }

  body.is-collapsed .brand {
    flex-direction: row;
    height: var(--top-h);
    padding: 0 12px 0 16px;
  }

  body.is-collapsed .nav-link {
    justify-content: flex-start;
    padding: 0 12px;
  }

  body.is-collapsed .nav-count {
    position: static;
  }

  body.is-collapsed .reset-btn {
    justify-content: flex-start;
    padding: 0 14px;
  }

  body.drawer-open .sidebar {
    transform: none;
    visibility: visible;
  }

  .icon-btn.collapse-btn {
    display: none;
  }

  .icon-btn.drawer-close,
  .icon-btn.menu-btn {
    display: inline-grid;
  }

  .topbar {
    padding: 0 12px;
    gap: 6px;
  }

  .avatar-name,
  .search-global .kbd {
    display: none;
  }

  .avatar-btn {
    padding: 4px;
  }

  .page {
    padding: 20px 16px 40px;
  }

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

@media (max-width: 720px) {
  h1 {
    font-size: 1.375rem;
  }

  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .page-head > .row,
  .page-head > .btn {
    width: 100%;
  }

  .page-head > .row .btn,
  .page-head > .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }

  .product-title {
    align-items: flex-start;
  }

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

  .kpi .muted.small {
    font-size: 0.75rem;
  }

  .kpi-lead {
    grid-column: 1 / -1;
  }

  .kpi {
    padding: 12px 14px;
  }

  .kpi dd {
    font-size: 1.25rem;
  }

  .kpi-lead dd {
    font-size: 1.625rem;
  }

  .panel {
    padding: 16px;
  }

  .panel-table {
    padding: 0;
  }

  .reorder-row {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 6px 12px;
  }

  .reorder-stock,
  .reorder-state {
    grid-column: 2;
  }

  .reorder-state {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .mini-list li {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 12px;
  }

  .mini-list li > .muted {
    grid-column: 1;
    grid-row: 2;
  }

  .mini-list li > .num {
    grid-row: 1;
    grid-column: 2;
    text-align: right;
  }

  .mini-list li > .chip,
  .mini-list li > .gauge,
  .mini-list li > span:last-child:not(.num) {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }

  .mini-list li > .gauge {
    grid-row: 2;
    grid-column: 1;
    justify-self: start;
  }

  .bars li {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
  }

  .bar-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .bar-value {
    grid-row: 1;
    grid-column: 2;
  }

  .toolbar {
    padding: 12px 16px;
  }

  .filter {
    flex: 1 1 140px;
    min-width: 0;
  }

  .search-field {
    flex-basis: 100%;
  }

  /* Tables become stacked cards; sorting moves to the select above them. */
  .table:not(.table-lines) thead {
    display: none;
  }

  .sort-mobile {
    display: flex;
    padding: 12px 16px 4px;
  }

  .report-body .sort-mobile {
    padding: 0 0 8px;
  }

  .table:not(.table-lines),
  .table:not(.table-lines) tbody,
  .table:not(.table-lines) tr,
  .table:not(.table-lines) td {
    display: block;
    width: 100%;
  }

  .table:not(.table-lines) tbody tr {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
  }

  .table:not(.table-lines) tbody tr:hover td {
    background: transparent;
  }

  .table:not(.table-lines) td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 4px 0 !important;
    border: 0;
    text-align: right;
  }

  .table:not(.table-lines) td[data-label]::before {
    content: attr(data-label);
    font-size: 0.75rem;
    font-weight: 650;
    color: var(--muted);
    text-align: left;
    flex: none;
  }

  .table:not(.table-lines) td:first-child {
    display: block;
    text-align: left;
    padding-bottom: 6px !important;
  }

  .table:not(.table-lines) td:first-child::before {
    display: none;
  }

  .table:not(.table-lines) td.cell-actions {
    width: 100%;
    justify-content: flex-end;
    border-top: 1px dashed var(--line);
    margin-top: 6px;
    padding-top: 6px !important;
  }

  .table:not(.table-lines) td .empty {
    width: 100%;
  }

  .table:not(.table-lines) tfoot {
    display: block;
  }

  .table:not(.table-lines) tfoot tr {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
  }

  .table:not(.table-lines) tfoot td,
  .table:not(.table-lines) tfoot th {
    display: block;
    width: auto;
    padding: 0 !important;
  }

  .table:not(.table-lines) tfoot td:empty {
    display: none;
  }

  .report-body .table:not(.table-lines) tbody tr {
    padding-left: 0;
    padding-right: 0;
  }

  .cell-product,
  .cell-stock {
    min-width: 0;
  }

  .cell-stock {
    justify-content: flex-end;
  }

  .table-lines thead {
    display: none;
  }

  .table-lines,
  .table-lines tbody,
  .table-lines tr {
    display: block;
  }

  .table-lines tr {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .table-lines td {
    display: block;
    padding: 0 !important;
    border: 0;
    text-align: left;
  }

  .table-lines td:first-child {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .table-lines td.num {
    text-align: left;
  }

  .table-lines td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem;
    font-weight: 650;
    color: var(--muted);
    margin-bottom: 4px;
  }

  .table-lines td:first-child::before {
    display: none;
  }

  .table-lines input {
    width: 100%;
  }

  .table-lines [data-line-total] {
    grid-column: 1 / 3;
    padding-top: 0;
    text-align: left;
  }

  .table-lines .cell-actions {
    grid-column: 3;
    grid-row: 3;
    width: auto;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .form-actions .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }

  .dialog-foot .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }

  .popover {
    position: fixed;
    left: 8px;
    right: 8px;
    top: calc(var(--top-h) + 4px);
    width: auto;
  }

  .gs-list {
    left: 8px;
    right: 8px;
    width: auto;
  }

  .seg span {
    padding: 0 8px;
    font-size: 0.8125rem;
  }

  .toasts {
    right: 16px;
    bottom: 16px;
  }
}

@media (max-width: 720px), (pointer: coarse) {
  .btn,
  .btn-sm,
  input[type='text'],
  input[type='search'],
  input[type='number'],
  input[type='email'],
  input[type='tel'],
  input[type='date'],
  select {
    min-height: 44px;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
  }

  .link {
    padding: 10px 0;
  }
}

@media (max-width: 380px) {
  .top-actions {
    gap: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* Print: only the document placed in #print-host is printed. */
@media print {
  @page {
    margin: 16mm;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .shell,
  .toasts,
  .skip,
  dialog {
    display: none !important;
  }

  .print-host {
    display: block;
  }

  .doc h1 {
    font-size: 18pt;
  }

  .doc h2 {
    font-size: 10pt;
    text-transform: none;
    color: #444;
    margin-bottom: 4px;
  }

  .doc-head {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid #000;
    margin-bottom: 16px;
  }

  .doc-head dl {
    margin: 0;
    display: grid;
    gap: 2px;
    text-align: right;
  }

  .doc-head dl div {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
  }

  .doc-head dt {
    color: #444;
  }

  .doc-head dd {
    margin: 0;
    font-weight: 700;
  }

  .doc-parties {
    display: flex;
    gap: 48px;
    margin-bottom: 16px;
  }

  .doc table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
  }

  .doc th,
  .doc td {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid #bbb;
    background: none !important;
    color: #000 !important;
  }

  .doc thead {
    position: static !important;
    width: auto !important;
    height: auto !important;
    clip: auto !important;
  }

  .doc tr,
  .doc td,
  .doc tbody,
  .doc table {
    display: revert !important;
  }

  .doc td::before {
    display: none !important;
  }

  .doc .num {
    text-align: right;
  }

  .doc tfoot td {
    font-weight: 700;
    border-bottom: 0;
  }

  .doc a {
    color: #000;
    text-decoration: none;
  }

  .doc .chip {
    padding: 0;
    background: none;
    color: #000;
  }

  .doc .muted,
  .doc .summary-line {
    color: #333;
  }

  .doc-notes,
  .doc-foot {
    margin-top: 12px;
    font-size: 9pt;
    color: #444;
  }
}
