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

@font-face {
  font-family: 'Hanken Grotesk';
  src: url('../fonts/hanken-grotesk-latin.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f5f5f8;
  --panel: #ffffff;
  --panel-2: #f9f9fb;
  --line: #e3e3ea;
  --line-strong: #888a99;
  --text: #1e2233;
  --muted: #565a6c;
  --accent: #5146d6;
  --accent-hover: #4339bd;
  --accent-ink: #ffffff;
  --accent-soft: #eeecfb;
  --accent-text: #4338b8;
  --good-soft: #e4f2ea;
  --good-text: #1f6440;
  --warn-soft: #fdf0d5;
  --warn-text: #7d4300;
  --warn-fill: #c77700;
  --bad-soft: #fbe9e9;
  --bad-text: #b0262a;
  --bad-fill: #d1434a;
  --info-soft: #e8eef8;
  --info-text: #23497f;
  --chip-muted-soft: #eeeff3;
  --chip-muted-text: #4a4e5e;
  --side-bg: #ffffff;
  --side-text: #3d4152;
  --side-strong: #1e2233;
  --side-hover: #f2f2f6;
  --side-active: #eeecfb;
  --side-line: #e3e3ea;
  --focus: #5146d6;
  --shadow-float: 0 12px 32px rgba(30, 34, 51, 0.16), 0 2px 6px rgba(30, 34, 51, 0.08);
  --r-panel: 8px;
  --r-ctrl: 6px;
  --side-w: 232px;
  --top-h: 64px;
  color-scheme: light;
}

[data-theme='dark'] {
  --bg: #13141c;
  --panel: #1b1d29;
  --panel-2: #212433;
  --line: #2d3042;
  --line-strong: #747891;
  --text: #e8e8f0;
  --muted: #a9acbf;
  --accent: #a9a3f0;
  --accent-hover: #c0bbf5;
  --accent-ink: #15123a;
  --accent-soft: #2a2752;
  --accent-text: #b9b4f5;
  --good-soft: #17372a;
  --good-text: #86d6aa;
  --warn-soft: #3b2d12;
  --warn-text: #f4bb57;
  --warn-fill: #e3a33a;
  --bad-soft: #3d1c20;
  --bad-text: #ff9a9a;
  --bad-fill: #ef6a70;
  --info-soft: #1c2a47;
  --info-text: #a5c2f2;
  --chip-muted-soft: #272a3a;
  --chip-muted-text: #c1c3d2;
  --side-bg: #171923;
  --side-text: #b9bbcc;
  --side-strong: #ffffff;
  --side-hover: #212433;
  --side-active: #2a2752;
  --side-line: #262938;
  --focus: #b9b4f5;
  --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: 'Hanken Grotesk', 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;
  border: 1px solid var(--line);
}

.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);
}



.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 {
  color: var(--accent-text);
  font-weight: 700;
}

.nav-link.is-active .ic {
  color: var(--accent-text);
}

.sidebar {
  border-right: 1px solid var(--side-line);
}

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

.nav-count {
  min-width: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  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: var(--bad-text);
  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;
}

/* 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;
  }
}

/* HireFlow components */
.page-wide {
  max-width: 1680px;
}

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

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

.btn-quiet {
  border-color: var(--line);
  color: var(--muted);
}

.btn-quiet:hover {
  color: var(--bad-text);
  border-color: var(--bad-text);
  background: var(--bad-soft);
}

.avatar {
  flex: none;
  display: inline-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-lg {
  width: 56px;
  height: 56px;
  font-size: 1.125rem;
}

.cell-person,
.person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.cell-person > div,
.person > div {
  min-width: 0;
}

.cell-person {
  min-width: 200px;
}

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

.person + .facts {
  margin-top: 16px;
}

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

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

.hours-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.hours-list dd {
  margin: 0;
  text-align: right;
}

.timeline li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.field-aside {
  margin-top: -8px;
  color: var(--muted);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 0.875rem;
}

input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 0.75rem;
  color: var(--muted);
}

.lg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Column chart */
.cols {
  margin: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
}

.cols-axis {
  height: var(--h);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cols-plot {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  border-bottom: 1px solid var(--line-strong);
  background-image: linear-gradient(var(--line) 1px, transparent 1px);
  background-size: 100% calc(var(--h) / 2);
}

.cols-plot li {
  position: relative;
  height: var(--h);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.col {
  position: relative;
  display: block;
  width: min(100%, 28px);
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
  opacity: 0.55;
  outline-offset: 2px;
}

.cols-plot li.is-hl .col,
.col:hover,
.col:focus-visible {
  opacity: 1;
}

.col-tip {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.6875rem;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.col:hover .col-tip,
.col:focus-visible .col-tip,
.cols-plot li.is-hl .col-tip {
  opacity: 1;
}

.col-label {
  position: absolute;
  top: calc(100% + 4px);
  font-size: 0.6875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.cols {
  padding-bottom: 22px;
}

/* Front desk board */
.fd-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.fd-col {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: 12px;
  min-width: 0;
}

.fd-col header {
  margin-bottom: 10px;
}

.fd-col h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9375rem;
}

.fd-count {
  min-width: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.75rem;
  text-align: center;
  line-height: 22px;
}

.fd-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.fd-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--st-edge);
  border-radius: 6px;
  padding: 10px 12px;
  display: grid;
  gap: 2px;
  font-size: 0.875rem;
}

.fd-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.fd-time {
  font-weight: 750;
  white-space: nowrap;
}

.fd-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.fd-empty {
  padding: 8px 2px;
}

.lg i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--u-bg);
  border: 2px solid var(--u-edge);
}

.lg-now i {
  width: 3px;
  height: 14px;
  border: 0;
  background: var(--gold);
}

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

.image-wide {
  width: 128px;
  height: 90px;
}

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

.note-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.note-form .field {
  flex: 1;
}

.mr-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  display: grid;
  gap: 2px;
  font-size: 0.875rem;
}

.mr-card.pri-urgent {
  border-color: var(--bad-fill);
}

.fd-board-4 {
  grid-template-columns: repeat(4, minmax(220px, 1fr));
}

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

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

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

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

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

/* Stage colors, shared by the board, bars and tracks */
.st-applied { --sg: #9a9db0; }
.st-screening { --sg: #6f8fd0; }
.st-shortlisted { --sg: #5a7ac2; }
.st-interview { --sg: #7a6fe0; }
.st-assessment { --sg: #5146d6; }
.st-offer { --sg: #c48a1e; }
.st-hired { --sg: #2f8a57; }
.st-rejected { --sg: #c4474d; }

/* Kanban board, the signature screen */
.kb-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin-bottom: 14px;
}

.kb-bar .search-field {
  flex: 1 1 260px;
  max-width: 420px;
}

.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(252px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: start;
  scroll-snap-type: x proximity;
}

.kb-col {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-top: 3px solid var(--sg);
  border-radius: var(--r-panel);
  padding: 10px;
  min-height: 220px;
  scroll-snap-align: start;
}

.kb-col.is-over {
  background: var(--accent-soft);
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
}

.kb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 10px;
}

.kb-head h2 {
  font-size: 0.9375rem;
}

.kb-count {
  min-width: 26px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  line-height: 22px;
}

.kb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  min-height: 60px;
}

.kb-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 10px 8px 12px;
  display: grid;
  gap: 8px;
  cursor: grab;
}

.kb-card[draggable='false'] {
  cursor: default;
}

.kb-card:hover {
  border-color: var(--line-strong);
}

.kb-card.is-dragging {
  opacity: 0.5;
}

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

.kb-who {
  min-width: 0;
  flex: 1;
}

.kb-who .strong-link {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kb-score {
  flex: none;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 750;
  font-size: 0.8125rem;
  line-height: 24px;
  font-variant-numeric: tabular-nums;
}

.kb-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  background: var(--chip-muted-soft);
  color: var(--chip-muted-text);
  font-size: 0.75rem;
  font-weight: 600;
}

.tag-strong {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.kb-next {
  margin: 0;
  line-height: 1.35;
}

.kb-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border-top: 1px dashed var(--line);
  padding-top: 6px;
}

.kb-actions {
  display: flex;
  gap: 2px;
}

.kb-actions .icon-btn {
  width: 34px;
  height: 34px;
}

.kb-empty {
  padding: 18px 6px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 6px;
}

/* Funnel */
.funnel {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.funnel li {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 40px 44px;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
}

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

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

.fn-num {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fn-rate {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.fbar {
  display: flex;
  height: 8px;
  width: 140px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--chip-muted-soft);
  gap: 1px;
}

.fseg {
  display: block;
  background: var(--sg);
}

.cell-pipe {
  display: grid;
  gap: 4px;
}

.stage-counts {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
}

.stage-counts li {
  border-top: 3px solid var(--sg);
  background: var(--panel-2);
  border-radius: 4px;
  padding: 8px;
  display: grid;
}

.sc-num {
  font-size: 1.25rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

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

.kpi-sm {
  font-size: 1.125rem !important;
}

.prose {
  white-space: pre-line;
}

/* Candidate profile: summary left, activity right */
.profile {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.profile-side,
.profile-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.app-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.app-list > li {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.app-list > li:first-child {
  border-top: 0;
  padding-top: 0;
}

.app-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.stage-track {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.stage-track li {
  position: relative;
  padding-top: 10px;
  font-size: 0.6875rem;
  color: var(--muted);
  text-align: center;
}

.stage-track li::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 5px;
  border-radius: 3px;
  background: var(--chip-muted-soft);
}

.stage-track li.is-done::before {
  background: var(--accent);
  opacity: 0.55;
}

.stage-track li.is-now::before {
  background: var(--accent);
}

.stage-track li.is-now {
  color: var(--accent-text);
  font-weight: 700;
}

.app-actions select {
  width: auto;
}

.eval-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.eval-list > li {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  display: grid;
  gap: 8px;
  font-size: 0.875rem;
}

.eval-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eval-avg {
  margin-left: auto;
  font-weight: 750;
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
}

.scores {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 4px 16px;
}

.scores div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8125rem;
}

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

.scores dd {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.score-bar {
  width: 60px;
  height: 6px;
  border-radius: 3px;
  background: var(--chip-muted-soft);
  overflow: hidden;
}

.score-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.act-line li {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.act-what {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.feed li {
  grid-template-columns: 14px minmax(0, 1fr) auto;
}

.feed-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--sg);
}

.needs-list li {
  grid-template-columns: 96px minmax(0, 1fr) 0 auto;
}

/* Scorecard form */
.scorecard {
  display: grid;
  gap: 8px;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.score-label {
  font-size: 0.875rem;
  font-weight: 600;
}

.score-opts {
  display: inline-flex;
}

.score-opts label {
  position: relative;
}

.score-opts input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.score-opts span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--panel);
}

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

.score-opts label:first-child span {
  border-radius: 6px 0 0 6px;
}

.score-opts label:last-child span {
  border-radius: 0 6px 6px 0;
}

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

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

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

/* Interview week */
.cal-panel {
  padding: 0;
}

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

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  overflow-x: auto;
}

.cal-wday {
  border-left: 1px solid var(--line);
  min-width: 0;
  min-height: 150px;
}

.cal-wday:first-child {
  border-left: 0;
}

.cal-wday.is-today .cal-wday-head {
  box-shadow: inset 0 -3px 0 var(--accent);
}

.cal-wday-head {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
}

.cal-wlist {
  list-style: none;
  margin: 0;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.cal-wappt {
  display: block;
  padding: 6px 8px;
  border-radius: 5px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.8125rem;
  text-decoration: none;
  line-height: 1.35;
}

.cal-wappt:hover {
  color: var(--accent-text);
  filter: brightness(0.97);
}

.cal-wappt.iv-completed {
  border-left-color: #2f8a57;
  background: var(--good-soft);
  color: var(--good-text);
}

.cal-wappt.iv-no_show {
  border-left-color: var(--bad-fill);
  background: var(--bad-soft);
  color: var(--bad-text);
}

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

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

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

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

@media (max-width: 1180px) {
  .dash-grid > .panel-focus,
  .dash-grid > .panel-focus + .panel,
  .dash-grid > .panel:nth-child(3),
  .dash-grid > .panel:nth-child(4) {
    grid-column: span 12;
  }

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

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

  .stage-counts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .kanban {
    grid-auto-columns: minmax(82%, 1fr);
  }

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

  .funnel li {
    grid-template-columns: 80px minmax(0, 1fr) 32px 40px;
    gap: 6px;
  }

  .needs-list li {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .needs-list li > .chip {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  .needs-list li > span:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
  }

  .needs-list li > .btn {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .stage-track li span {
    display: none;
  }

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

  .cal-week {
    grid-template-columns: 1fr;
  }

  .cal-wday {
    border-left: 0;
    border-top: 1px solid var(--line);
    min-height: 0;
  }

  .cal-wday-head {
    flex-direction: row;
    gap: 8px;
    align-items: baseline;
  }

  .score-opts span {
    width: 44px;
    height: 44px;
  }

  .kb-bar .search-field {
    max-width: none;
  }

  .row > .filter {
    flex: 1 1 100%;
  }
}

/* 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;
  }
}
