:root {
  --brand-yellow: #fec304;
  --brand-yellow-hover: #e8b300;
  --brand-dark: #2b2a29;
  --ink-950: #10151f;
  --ink-900: #151b26;
  --ink-850: #1b2330;
  --ink-800: #242d3b;
  --ink-700: #354052;
  --ink-600: #4a586c;
  --ink-500: #657287;
  --ink-400: #8893a4;
  --ink-300: #b3bbc7;
  --ink-200: #d7dce3;
  --ink-150: #e4e7ec;
  --ink-100: #edf0f3;
  --ink-075: #f3f5f7;
  --ink-050: #f8f9fb;
  --white: #ffffff;
  --red-700: #b31323;
  --red-600: #ce1528;
  --red-500: #e01d32;
  --red-100: #fee8eb;
  --red-050: #fff5f6;
  --green-700: #117052;
  --green-600: #16805f;
  --green-100: #dbf4e9;
  --green-050: #effaf5;
  --amber-700: #9a5b08;
  --amber-600: #b66d0b;
  --amber-100: #ffedc7;
  --amber-050: #fff8e8;
  --blue-700: #245ba8;
  --blue-100: #deebff;
  --blue-050: #f0f6ff;
  --sidebar-width: 268px;
  --topbar-height: 76px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-soft: 0 1px 2px rgb(16 21 31 / 4%), 0 8px 26px rgb(16 21 31 / 5%);
  --shadow-float: 0 18px 48px rgb(16 21 31 / 18%);
  --ease: 180ms cubic-bezier(0.2, 0.7, 0.2, 1);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  color: var(--ink-900);
  background: var(--ink-050);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--ink-050);
  color: var(--ink-900);
  font-size: 1rem;
  line-height: 1.5;
}

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

button {
  color: inherit;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--brand-yellow);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.eyebrow {
  display: block;
  color: var(--ink-500);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-transform: uppercase;
}

.app-root,
.application-view {
  min-height: 100vh;
  min-height: 100dvh;
}

/* Login */

.login-view {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: env(safe-area-inset-top);
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--brand-dark);
  color: var(--white);
}

.login-view::before {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgb(255 255 255 / 2%) 1px, transparent 1px),
    linear-gradient(rgb(255 255 255 / 2%) 1px, transparent 1px);
  background-size: 48px 48px;
  content: "";
  mask-image: linear-gradient(to right, #000, transparent 70%);
  pointer-events: none;
}

.login-view::after {
  position: absolute;
  top: -28%;
  left: 25%;
  width: 48vw;
  height: 48vw;
  border: 1px solid rgb(255 255 255 / 5%);
  border-radius: 50%;
  box-shadow:
    0 0 0 8vw rgb(255 255 255 / 1.2%),
    0 0 0 16vw rgb(255 255 255 / 0.8%);
  content: "";
  pointer-events: none;
}

.brand-logo {
  display: block;
  max-width: 100%;
  height: auto;
}

.brand-logo--login {
  width: min(360px, 100%);
}

.login-product-name {
  color: var(--ink-600);
  font-size: 0.78rem;
  font-weight: 680;
  letter-spacing: 0.03em;
}

.login-stage {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.15fr) minmax(430px, 0.85fr);
}

.login-intro {
  display: flex;
  max-width: 760px;
  flex-direction: column;
  justify-content: center;
  padding: 64px 7vw 64px 8vw;
}

.login-intro-mark {
  width: 82px;
  height: 82px;
  margin-bottom: 34px;
  object-fit: contain;
}

.login-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: rgb(255 255 255 / 58%);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-kicker::before {
  width: 26px;
  height: 2px;
  background: var(--brand-yellow);
  content: "";
}

.login-intro h1 {
  max-width: 650px;
  margin: 24px 0 22px;
  font-size: clamp(2.5rem, 4.5vw, 5rem);
  font-weight: 690;
  letter-spacing: -0.055em;
  line-height: 0.99;
}

.login-intro > p {
  max-width: 560px;
  margin: 0;
  color: rgb(255 255 255 / 60%);
  font-size: 1.05rem;
  line-height: 1.7;
}

.login-visual {
  position: relative;
  display: flex;
  max-width: 600px;
  align-items: flex-end;
  margin-top: 54px;
}

.visual-card {
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 16px;
  background: rgb(255 255 255 / 6%);
  backdrop-filter: blur(12px);
  box-shadow: 0 24px 60px rgb(0 0 0 / 20%);
}

.visual-card--primary {
  width: min(400px, 72%);
  padding: 24px;
}

.visual-card-label {
  display: block;
  margin-bottom: 2px;
  color: rgb(255 255 255 / 44%);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.visual-card--primary > strong {
  font-size: 1.9rem;
  letter-spacing: -0.03em;
}

.visual-rule {
  height: 1px;
  margin: 18px 0 8px;
  background: rgb(255 255 255 / 10%);
}

.visual-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  color: rgb(255 255 255 / 60%);
  font-size: 0.82rem;
}

.visual-row b {
  color: var(--white);
  font-variant-numeric: tabular-nums;
}

.visual-card--small {
  position: absolute;
  right: 0;
  bottom: -18px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  color: rgb(255 255 255 / 76%);
  font-size: 0.78rem;
  font-weight: 650;
}

.visual-card--small .icon {
  color: #53d3a2;
}

.visual-pulse {
  position: absolute;
  right: 33px;
  bottom: 30px;
  display: grid;
  width: 12px;
  height: 12px;
  place-items: center;
}

.visual-pulse span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #53d3a2;
  box-shadow: 0 0 0 6px rgb(83 211 162 / 10%);
}

.login-panel {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 52px 7vw;
  border-left: 1px solid var(--ink-200);
  background: var(--ink-050);
}

.login-panel-brand {
  display: grid;
  width: 100%;
  max-width: 420px;
  justify-items: start;
  gap: 8px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 38px;
  border: 1px solid var(--ink-150);
  border-radius: 20px;
  background: var(--white);
  box-shadow: 0 20px 55px rgb(16 21 31 / 12%);
  color: var(--ink-900);
}

.login-card-head {
  margin-bottom: 28px;
}

.login-card-head h2 {
  margin: 8px 0 6px;
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.login-card-head p {
  margin: 0;
  color: var(--ink-500);
  font-size: 0.92rem;
}

.login-footnote {
  max-width: 420px;
  margin: 18px auto 0;
  color: var(--ink-500);
  font-size: 0.76rem;
  text-align: center;
}

/* Forms and buttons */

.field {
  display: grid;
  gap: 7px;
}

.field + .field {
  margin-top: 18px;
}

.login-remember {
  margin: 18px 0 4px;
}

.login-remember:has(input:disabled) {
  opacity: 0.55;
}

.account-sections,
.account-section {
  display: grid;
  gap: 20px;
}

.account-section + .account-section {
  padding-top: 24px;
  border-top: 1px solid var(--ink-150);
}

.account-section h3 {
  margin: 0;
}

.user-management-list {
  display: grid;
  gap: 12px;
}

.managed-user {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-md);
  background: var(--ink-050);
}

.managed-user-copy,
.managed-user-actions,
.managed-user-reset {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.managed-user-copy {
  display: grid;
}

.managed-user-copy span {
  color: var(--ink-500);
  font-size: 0.85rem;
}

.managed-user-reset input {
  min-width: 190px;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
}

.negative-result {
  color: var(--red-700);
}

.field label {
  color: var(--ink-700);
  font-size: 0.82rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--white);
  color: var(--ink-900);
  font-size: 0.93rem;
  line-height: 1.4;
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}

.field textarea {
  min-height: 90px;
  resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--ink-300);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand-dark);
  box-shadow: 0 0 0 3px rgb(254 195 4 / 40%);
}

.field input[readonly] {
  background: var(--ink-075);
  color: var(--ink-600);
}

.field-help {
  margin: 0;
  color: var(--ink-500);
  font-size: 0.76rem;
  line-height: 1.45;
}

.field-label-row {
  display: flex;
  min-height: 24px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.field-label-row .text-button {
  color: var(--brand-dark);
  font-size: 0.75rem;
}

.shipment-lines {
  display: grid;
  gap: 9px;
}

.shipment-line {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(115px, 0.55fr) 36px;
  align-items: start;
  gap: 9px;
}

.shipment-action-field {
  display: grid;
  gap: 3px;
}

.shipment-line-help {
  color: var(--ink-500);
  font-size: 0.68rem;
}

.shipment-line input {
  margin: 0;
}

.shipment-line-remove {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-400);
  cursor: pointer;
}

.shipment-line-remove:hover:not(:disabled) {
  background: var(--red-050);
  color: var(--red-600);
}

.shipment-line-remove:disabled {
  opacity: 0.25;
  cursor: default;
}

.shipment-line-remove .icon {
  width: 16px;
  height: 16px;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 78px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--ink-500);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transform: translateY(-50%);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 720;
  line-height: 1;
  cursor: pointer;
  transition: transform var(--ease), background var(--ease), border-color var(--ease), box-shadow var(--ease);
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.button--primary {
  border-color: var(--brand-yellow);
  background: var(--brand-yellow);
  box-shadow: 0 7px 18px rgb(254 195 4 / 18%);
  color: var(--brand-dark);
}

.button--primary:hover:not(:disabled) {
  border-color: var(--brand-yellow-hover);
  background: var(--brand-yellow-hover);
  box-shadow: 0 9px 22px rgb(254 195 4 / 24%);
}

.button--secondary {
  border-color: var(--ink-200);
  background: var(--white);
  color: var(--ink-700);
}

.button--secondary:hover:not(:disabled) {
  border-color: var(--ink-300);
  background: var(--ink-050);
}

.button--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-600);
}

.button--ghost:hover:not(:disabled) {
  background: var(--ink-100);
}

.button--wide {
  width: 100%;
  min-height: 48px;
  margin-top: 24px;
}

.button--wide .icon {
  margin-left: auto;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--ink-500);
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
}

.text-button:hover {
  color: var(--ink-900);
}

.text-button .icon {
  width: 16px;
  height: 16px;
}

.login-settings-button {
  margin: 22px auto 0;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}

.icon-button:hover {
  background: var(--ink-100);
}

.form-message {
  margin-top: 16px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.5;
}

.form-message--error {
  border: 1px solid #f6c9cf;
  background: var(--red-050);
  color: var(--red-700);
}

.form-message--success {
  border: 1px solid #bce4d4;
  background: var(--green-050);
  color: var(--green-700);
}

/* Application shell */

.application-view {
  background: var(--ink-050);
}

.sidebar {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 23px 17px 18px;
  background: var(--ink-900);
  color: var(--white);
}

.sidebar-head {
  display: flex;
  min-height: 47px;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-symbol {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  object-fit: contain;
}

.app-brand > div:last-child {
  display: grid;
  line-height: 1.2;
}

.app-brand span {
  color: rgb(255 255 255 / 44%);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.app-brand strong {
  margin-top: 2px;
  font-size: 0.96rem;
  font-weight: 680;
}

.main-nav {
  display: grid;
  gap: 5px;
  margin-top: 42px;
}

.nav-item {
  position: relative;
  display: flex;
  min-height: 47px;
  align-items: center;
  gap: 13px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgb(255 255 255 / 55%);
  font-size: 0.88rem;
  font-weight: 620;
  text-align: left;
  cursor: pointer;
  transition: color var(--ease), background var(--ease);
}

.nav-item .icon {
  width: 19px;
  height: 19px;
}

.nav-item:hover {
  background: rgb(255 255 255 / 5%);
  color: rgb(255 255 255 / 84%);
}

.nav-item.is-active {
  background: rgb(255 255 255 / 8%);
  color: var(--white);
}

.nav-item.is-active::before {
  position: absolute;
  left: 0;
  width: 3px;
  height: 21px;
  border-radius: 0 3px 3px 0;
  background: var(--brand-yellow);
  content: "";
}

.sidebar-bottom {
  margin-top: auto;
}

.connection-state {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px 15px;
  color: rgb(255 255 255 / 42%);
  font-size: 0.72rem;
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber-600);
  box-shadow: 0 0 0 4px rgb(182 109 11 / 12%);
}

.connection-state.is-online .connection-dot {
  background: #50c99b;
  box-shadow: 0 0 0 4px rgb(80 201 155 / 12%);
}

.connection-state.is-offline .connection-dot {
  background: #f15a6c;
  box-shadow: 0 0 0 4px rgb(241 90 108 / 12%);
}

.user-card {
  position: relative;
  display: grid;
  min-height: 66px;
  grid-template-columns: 38px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgb(255 255 255 / 7%);
  border-radius: 12px;
  background: rgb(255 255 255 / 4%);
}

.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: rgb(255 255 255 / 9%);
  color: rgb(255 255 255 / 86%);
  font-size: 0.75rem;
  font-weight: 780;
}

.user-card-copy {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}

.user-card-copy strong,
.user-card-copy span {
  overflow-wrap: anywhere;
}

.user-card-copy strong {
  color: rgb(255 255 255 / 88%);
  font-size: 0.78rem;
}

.user-card-copy span {
  margin-top: 2px;
  color: rgb(255 255 255 / 38%);
  font-size: 0.68rem;
}

.user-card > .icon-button {
  width: 30px;
  height: 30px;
  color: rgb(255 255 255 / 40%);
}

.user-card > .icon-button:hover {
  background: rgb(255 255 255 / 7%);
  color: var(--white);
}

.user-card > .icon-button .icon {
  width: 15px;
  height: 15px;
}

.user-menu {
  position: absolute;
  z-index: 30;
  right: 0;
  bottom: calc(100% + 8px);
  width: 190px;
  overflow: hidden;
  padding: 5px;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  background: var(--white);
  box-shadow: var(--shadow-float);
  color: var(--ink-800);
}

.user-menu button {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
}

.user-menu button:hover {
  background: var(--ink-075);
}

.user-menu .icon {
  width: 16px;
  height: 16px;
}

.sidebar-close,
.mobile-menu-button {
  display: none;
}

.workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  z-index: 15;
  top: 0;
  display: flex;
  height: var(--topbar-height);
  align-items: center;
  gap: 10px;
  padding: 0 clamp(20px, 3vw, 44px);
  border-bottom: 1px solid var(--ink-150);
  background: rgb(248 249 251 / 90%);
  backdrop-filter: blur(16px);
}

.global-search {
  position: relative;
  width: min(620px, calc(100% - 100px));
  margin-right: auto;
}

.global-search input {
  width: 100%;
  height: 44px;
  padding: 0 54px 0 44px;
  border: 1px solid var(--ink-150);
  border-radius: 11px;
  outline: none;
  background: var(--white);
  color: var(--ink-900);
  font-size: 0.87rem;
  box-shadow: 0 1px 2px rgb(16 21 31 / 3%);
  transition: border-color var(--ease), box-shadow var(--ease);
}

.global-search input::placeholder {
  color: var(--ink-400);
}

.global-search input:focus {
  border-color: var(--ink-400);
  box-shadow: 0 0 0 3px rgb(36 91 168 / 9%);
}

.search-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 15px;
  width: 18px;
  height: 18px;
  color: var(--ink-400);
  pointer-events: none;
  transform: translateY(-50%);
}

.global-search kbd {
  position: absolute;
  top: 50%;
  right: 12px;
  display: grid;
  width: 26px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--ink-200);
  border-bottom-color: var(--ink-300);
  border-radius: 6px;
  background: var(--ink-050);
  color: var(--ink-400);
  font-family: inherit;
  font-size: 0.7rem;
  transform: translateY(-50%);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  max-height: min(460px, calc(100vh - 130px));
  overflow-y: auto;
  padding: 7px;
  border: 1px solid var(--ink-200);
  border-radius: 12px;
  background: var(--white);
  box-shadow: var(--shadow-float);
}

.search-results-section + .search-results-section {
  margin-top: 5px;
  padding-top: 6px;
  border-top: 1px solid var(--ink-100);
}

.search-results-label {
  display: block;
  padding: 7px 10px 5px;
  color: var(--ink-400);
  font-size: 0.67rem;
  font-weight: 760;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.search-result {
  display: grid;
  width: 100%;
  min-height: 56px;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.search-result:hover,
.search-result.is-active {
  background: var(--ink-075);
}

.search-result-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink-100);
  color: var(--ink-600);
}

.search-result-icon .icon {
  width: 16px;
  height: 16px;
}

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

.search-result-copy strong,
.search-result-copy span {
  overflow-wrap: anywhere;
}

.search-result-copy strong {
  font-size: 0.8rem;
}

.search-result-copy span {
  color: var(--ink-500);
  font-size: 0.74rem;
}

.search-result-meta {
  color: var(--ink-500);
  font-size: 0.73rem;
  font-variant-numeric: tabular-nums;
}

.search-state {
  padding: 22px 16px;
  color: var(--ink-500);
  font-size: 0.82rem;
  text-align: center;
}

.topbar-action {
  border: 1px solid transparent;
  color: var(--ink-500);
}

.topbar-action:hover {
  border-color: var(--ink-150);
  background: var(--white);
  color: var(--ink-800);
}

.main-content {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 36px clamp(20px, 3vw, 44px) 56px;
}

/* Shared page components */

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

.page-head-copy {
  min-width: 0;
}

.page-head h1 {
  margin: 4px 0 0;
  color: var(--ink-950);
  font-size: clamp(1.65rem, 2.5vw, 2.15rem);
  font-weight: 720;
  letter-spacing: -0.045em;
  line-height: 1.2;
}

.page-head p {
  margin: 8px 0 0;
  color: var(--ink-500);
  font-size: 0.9rem;
}

.page-head-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.customer-notice {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 22px;
  padding: 11px 14px;
  border: 1px solid #cfdcf0;
  border-radius: 10px;
  background: var(--blue-050);
  color: var(--blue-700);
  font-size: 0.8rem;
}

.customer-notice .icon {
  width: 17px;
  height: 17px;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
  gap: 22px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-soft);
}

.panel-head {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--ink-100);
}

.panel-head-copy {
  min-width: 0;
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  color: var(--ink-900);
  font-size: 0.98rem;
  font-weight: 740;
  letter-spacing: -0.015em;
}

.panel-head p {
  margin: 3px 0 0;
  color: var(--ink-500);
  font-size: 0.75rem;
}

.panel-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border: 0;
  background: transparent;
  color: var(--ink-500);
  font-size: 0.76rem;
  font-weight: 680;
  white-space: nowrap;
  cursor: pointer;
}

.panel-link:hover {
  color: var(--brand-dark);
}

.panel-link .icon {
  width: 14px;
  height: 14px;
}

.panel-body {
  padding: 20px;
}

.panel-body--flush {
  padding: 0;
}

.internal-envelope-notice {
  margin-bottom: 22px;
}

.internal-envelope-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.internal-envelope-card {
  min-width: 0;
  padding: 22px;
  border: 1px solid #ead48e;
  border-radius: var(--radius-md);
  background: #fffdf5;
  box-shadow: var(--shadow-soft);
}

.internal-envelope-card-head {
  display: flex;
  align-items: center;
  gap: 13px;
}

.internal-envelope-card-head h2 {
  margin: 0;
  color: var(--ink-900);
  font-size: 1rem;
}

.internal-envelope-card-head p {
  margin: 4px 0 0;
  color: var(--ink-500);
  font-size: 0.76rem;
}

.internal-envelope-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 11px;
  background: var(--brand-yellow);
  color: var(--brand-dark);
}

.internal-envelope-icon .icon {
  width: 21px;
  height: 21px;
}

.internal-envelope-quantity {
  display: block;
  margin: 24px 0 18px;
  color: var(--ink-950);
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1;
}

.internal-envelope-quantity small {
  color: var(--ink-500);
  font-size: 0.82rem;
}

.internal-envelope-form {
  display: grid;
  grid-template-columns: minmax(110px, 0.45fr) minmax(180px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.internal-envelope-form .button {
  min-height: 43px;
}

.internal-envelope-journal {
  margin-top: 0;
}

@media (max-width: 1100px) {
  .internal-envelope-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .internal-envelope-grid {
    grid-template-columns: 1fr;
  }
}

.component-groups {
  display: grid;
  gap: 24px;
  padding: 20px;
}

.component-group {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-md);
  background: var(--white);
}

.component-group--envelope {
  border-color: #ead48e;
  background: #fffdf5;
}

.component-group-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--ink-100);
}

.component-group-head h3 {
  margin: 3px 0 0;
  font-size: 1rem;
}

.component-group-head > strong {
  color: var(--ink-700);
  font-size: 0.82rem;
}

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

.kpi-card {
  position: relative;
  min-height: 142px;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-soft);
}

.kpi-card::after {
  position: absolute;
  right: -30px;
  bottom: -42px;
  width: 98px;
  height: 98px;
  border: 18px solid var(--ink-075);
  border-radius: 50%;
  content: "";
}

.kpi-card--dark {
  border-color: var(--ink-900);
  background: var(--ink-900);
  color: var(--white);
}

.kpi-card--dark::after {
  border-color: rgb(255 255 255 / 4%);
}

.kpi-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kpi-label {
  color: var(--ink-500);
  font-size: 0.76rem;
  font-weight: 680;
}

.kpi-card--dark .kpi-label {
  color: rgb(255 255 255 / 50%);
}

.kpi-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink-075);
  color: var(--ink-500);
}

.kpi-icon .icon {
  width: 16px;
  height: 16px;
}

.kpi-card--dark .kpi-icon {
  background: rgb(255 255 255 / 8%);
  color: rgb(255 255 255 / 65%);
}

.kpi-value {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 15px;
  color: var(--ink-950);
  font-size: 1.8rem;
  font-weight: 730;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.045em;
  line-height: 1;
}

.kpi-card--dark .kpi-value {
  color: var(--white);
}

.kpi-note {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 10px;
  color: var(--ink-400);
  font-size: 0.7rem;
}

.status-pill,
.type-pill,
.stock-pill,
.version-pill {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 720;
  line-height: 1;
  white-space: nowrap;
}

.status-pill::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-pill--active,
.stock-pill--ok,
.type-pill--in {
  background: var(--green-100);
  color: var(--green-700);
}

.status-pill--inactive,
.stock-pill--unknown {
  background: var(--ink-100);
  color: var(--ink-600);
}

.stock-pill--low,
.type-pill--out {
  background: var(--amber-100);
  color: var(--amber-700);
}

.stock-pill--empty {
  background: var(--red-100);
  color: var(--red-700);
}

.type-pill--adjustment {
  background: var(--blue-100);
  color: var(--blue-700);
}

.type-pill--initial {
  background: var(--ink-100);
  color: var(--ink-700);
}

.version-pill {
  background: var(--ink-100);
  color: var(--ink-600);
}

.version-pill--active {
  background: var(--green-100);
  color: var(--green-700);
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.data-table th {
  padding: 11px 16px;
  border-bottom: 1px solid var(--ink-150);
  background: var(--ink-050);
  color: var(--ink-500);
  font-size: 0.68rem;
  font-weight: 760;
  letter-spacing: 0.055em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ink-100);
  color: var(--ink-700);
  font-size: 0.8rem;
  vertical-align: middle;
}

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

.data-table tbody tr {
  transition: background var(--ease);
}

.data-table tbody tr[data-action-id],
.data-table tbody tr[data-article-id] {
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: var(--ink-050);
}

.data-table .numeric {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.table-primary {
  display: grid;
  gap: 2px;
  min-width: 170px;
}

.table-primary strong {
  color: var(--ink-900);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.table-primary span {
  color: var(--ink-500);
  font-size: 0.73rem;
  overflow-wrap: anywhere;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.action-code {
  color: var(--ink-900);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
  font-weight: 740;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.empty-state,
.error-state {
  display: flex;
  min-height: 250px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 24px;
  text-align: center;
}

.empty-state-icon,
.error-state-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 13px;
  background: var(--ink-075);
  color: var(--ink-400);
}

.error-state-icon {
  background: var(--red-050);
  color: var(--red-600);
}

.empty-state h3,
.error-state h3 {
  margin: 16px 0 5px;
  font-size: 0.98rem;
}

.empty-state p,
.error-state p {
  max-width: 440px;
  margin: 0;
  color: var(--ink-500);
  font-size: 0.82rem;
}

.empty-state .button,
.error-state .button {
  margin-top: 18px;
}

.inline-empty {
  padding: 28px 20px;
  color: var(--ink-500);
  font-size: 0.8rem;
  text-align: center;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.filter-search {
  position: relative;
  width: min(500px, 100%);
}

.filter-search .icon {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 17px;
  height: 17px;
  color: var(--ink-400);
  pointer-events: none;
  transform: translateY(-50%);
}

.filter-search input {
  width: 100%;
  height: 42px;
  padding: 0 13px 0 40px;
  border: 1px solid var(--ink-200);
  border-radius: 9px;
  outline: none;
  background: var(--white);
  color: var(--ink-900);
  font-size: 0.85rem;
}

.filter-search input:focus {
  border-color: var(--blue-700);
  box-shadow: 0 0 0 3px rgb(36 91 168 / 9%);
}

.count-label {
  margin-left: auto;
  color: var(--ink-400);
  font-size: 0.75rem;
  white-space: nowrap;
}

/* Dashboard */

.quick-actions {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.quick-action {
  display: grid;
  min-height: 70px;
  grid-template-columns: 38px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--ink-100);
  border-radius: 10px;
  background: var(--white);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease), transform var(--ease);
}

.quick-action:hover {
  border-color: var(--ink-200);
  background: var(--ink-050);
  transform: translateY(-1px);
}

.quick-action-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 9px;
  background: var(--ink-075);
  color: var(--ink-600);
}

.quick-action-icon--brand {
  background: rgb(254 195 4 / 18%);
  color: var(--brand-dark);
}

.import-status {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--ink-100);
  color: var(--ink-700);
  font-size: 0.7rem;
  font-weight: 720;
  white-space: nowrap;
}

.import-status--auto_booked,
.import-status--reviewed,
.import-status--booked {
  background: var(--green-100);
  color: var(--green-700);
}

.import-status--clarification,
.import-status--duplicate,
.import-status--not_bookable {
  background: var(--amber-100);
  color: var(--amber-700);
}

.import-status--error {
  background: var(--red-100);
  color: var(--red-700);
}

.import-hash {
  display: inline-block;
  max-width: 15rem;
  overflow-wrap: anywhere;
}

.scanner-panel {
  margin-bottom: 18px;
}

.scanner-pairing {
  display: grid;
  gap: 8px;
  margin: 0 20px 18px;
  padding: 16px;
  border: 1px solid rgb(254 195 4 / 65%);
  border-radius: 10px;
  background: rgb(254 195 4 / 10%);
  color: var(--ink-800);
}

.scanner-pairing code {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  font-weight: 750;
  user-select: all;
}

.scanner-pairing span {
  color: var(--ink-600);
  font-size: 0.75rem;
}

.scanner-status-grid {
  display: grid;
  gap: 12px;
  padding: 0 20px 20px;
}

.scanner-status-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--ink-100);
  border-radius: 10px;
  background: var(--ink-050);
}

.scanner-status-title,
.scanner-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.scanner-status-card dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.scanner-status-card dl div {
  display: grid;
  gap: 3px;
}

.scanner-status-card dt {
  color: var(--ink-500);
  font-size: 0.69rem;
  font-weight: 720;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.scanner-status-card dd {
  margin: 0;
  color: var(--ink-800);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.text-button--danger {
  color: var(--red-700);
}

@media (max-width: 760px) {
  .scanner-status-card dl {
    grid-template-columns: 1fr;
  }
}

.error-text {
  color: var(--red-700) !important;
}

tr[data-import-document-id] {
  cursor: pointer;
}

tr[data-import-document-id]:focus-visible {
  outline: 3px solid rgb(254 195 4 / 55%);
  outline-offset: -3px;
}

.import-detail-panel {
  overflow: hidden;
}

.import-review-state {
  border-radius: 999px;
  background: rgb(254 195 4 / 16%);
  color: var(--brand-dark);
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 750;
}

.import-review-form,
.import-preview,
.import-booking-result,
.import-audit {
  margin: 0 20px 20px;
}

.import-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.import-source-data {
  display: grid;
  grid-template-columns: minmax(7rem, 0.5fr) minmax(12rem, 2fr) minmax(10rem, 1fr);
  gap: 12px;
  margin: 18px 0;
  padding: 14px;
  border-radius: 10px;
  background: var(--ink-050);
}

.import-source-data div,
.import-position-head,
.import-review-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.import-source-data dt,
.import-raw-text span {
  color: var(--ink-500);
  font-size: 0.68rem;
  font-weight: 720;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.import-source-data dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.import-position-list {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.import-position {
  padding: 16px;
  border: 1px solid var(--ink-100);
  border-radius: 10px;
  background: var(--white);
}

.import-position-head span {
  color: var(--ink-500);
  font-size: 0.75rem;
}

.import-raw-text {
  display: grid;
  gap: 4px;
  margin: 12px 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.import-position-fields {
  display: grid;
  grid-template-columns: minmax(18rem, 2fr) minmax(6rem, 0.5fr) minmax(7rem, 0.6fr);
  gap: 12px;
  align-items: end;
}

.import-position-fields .check-field {
  grid-column: 1 / -1;
}

.import-preview,
.import-booking-result {
  padding: 18px;
  border: 1px solid rgb(254 195 4 / 58%);
  border-radius: 10px;
  background: rgb(254 195 4 / 8%);
}

.import-preview .button {
  margin-top: 16px;
}

.import-booking-result {
  border-color: var(--green-300);
  background: var(--green-050);
}

.import-audit summary {
  cursor: pointer;
  font-weight: 720;
}

.import-audit li {
  margin: 10px 0;
}

.import-audit li span {
  display: block;
  color: var(--ink-500);
  font-size: 0.75rem;
}

@media (max-width: 900px) {
  .import-meta-grid,
  .import-source-data,
  .import-position-fields {
    grid-template-columns: 1fr;
  }
}

.quick-action-icon--green {
  background: var(--green-050);
  color: var(--green-600);
}

.quick-action-copy {
  display: grid;
  gap: 2px;
}

.quick-action-copy strong {
  color: var(--ink-900);
  font-size: 0.8rem;
}

.quick-action-copy span {
  color: var(--ink-500);
  font-size: 0.71rem;
}

.quick-action > .icon {
  width: 15px;
  height: 15px;
  color: var(--ink-400);
}

.activity-list {
  display: grid;
}

.activity-item {
  display: grid;
  min-height: 68px;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--ink-100);
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  background: var(--ink-075);
  color: var(--ink-500);
}

.activity-icon--in {
  background: var(--green-050);
  color: var(--green-600);
}

.activity-icon--out {
  background: var(--amber-050);
  color: var(--amber-700);
}

.activity-icon--adjustment {
  background: var(--blue-050);
  color: var(--blue-700);
}

.activity-icon .icon {
  width: 16px;
  height: 16px;
}

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

.activity-copy strong {
  color: var(--ink-800);
  font-size: 0.79rem;
  overflow-wrap: anywhere;
}

.activity-copy span {
  color: var(--ink-500);
  font-size: 0.7rem;
}

.activity-quantity {
  color: var(--ink-800);
  font-size: 0.8rem;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.activity-quantity.is-positive {
  color: var(--green-700);
}

.activity-quantity.is-negative {
  color: var(--red-700);
}

/* Action detail and BOM */

.breadcrumb-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--ink-500);
  font-size: 0.77rem;
  font-weight: 650;
  cursor: pointer;
}

.breadcrumb-button:hover {
  color: var(--ink-900);
}

.breadcrumb-button .icon {
  width: 15px;
  height: 15px;
}

.action-detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  margin-bottom: 22px;
  padding: 24px;
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-soft);
}

.action-detail-title {
  display: flex;
  align-items: flex-start;
  gap: 15px;
}

.action-detail-icon {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  background: var(--ink-900);
  color: var(--white);
}

.action-detail-copy h1 {
  margin: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 1.65rem;
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.action-detail-copy p {
  margin: 5px 0 0;
  color: var(--ink-500);
  font-size: 0.88rem;
}

.identifier-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.identifier-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid var(--ink-150);
  border-radius: 7px;
  background: var(--ink-050);
  color: var(--ink-600);
  font-size: 0.69rem;
  font-weight: 650;
}

.identifier-chip b {
  color: var(--ink-800);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.action-detail-actions {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--ink-100);
}

.summary-item {
  padding: 17px 20px;
  border-right: 1px solid var(--ink-100);
}

.summary-item:last-child {
  border-right: 0;
}

.summary-item span {
  display: block;
  color: var(--ink-500);
  font-size: 0.69rem;
  font-weight: 680;
}

.summary-item strong {
  display: block;
  margin-top: 4px;
  color: var(--ink-900);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.bom-list {
  display: grid;
}

.bom-row {
  --tree-indent: 0px;
  display: grid;
  min-height: 70px;
  grid-template-columns: minmax(270px, 1.7fr) minmax(80px, 0.45fr) minmax(140px, 0.75fr) minmax(118px, 0.6fr) minmax(180px, 0.9fr) 38px;
  align-items: center;
  gap: 12px;
  padding: 11px 16px 11px calc(16px + var(--tree-indent));
  border-bottom: 1px solid var(--ink-100);
}

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

.bom-row--header {
  min-height: 39px;
  padding-top: 8px;
  padding-bottom: 8px;
  background: var(--ink-050);
  color: var(--ink-500);
  font-size: 0.67rem;
  font-weight: 760;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.bom-row--group {
  background: #fcfcfd;
}

.bom-component {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.bom-row[data-depth]:not([data-depth="0"]) .bom-component::before {
  position: absolute;
  top: -24px;
  bottom: 50%;
  left: -17px;
  width: 12px;
  border-bottom: 1px solid var(--ink-200);
  border-left: 1px solid var(--ink-200);
  border-radius: 0 0 0 6px;
  content: "";
}

.bom-component-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink-075);
  color: var(--ink-500);
}

.bom-component-icon .icon {
  width: 15px;
  height: 15px;
}

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

.bom-component-copy strong {
  color: var(--ink-900);
  font-size: 0.79rem;
  overflow-wrap: anywhere;
}

.bom-component-copy span {
  color: var(--ink-500);
  font-size: 0.7rem;
  overflow-wrap: anywhere;
}

.factor-value,
.stock-value {
  color: var(--ink-800);
  font-size: 0.82rem;
  font-weight: 710;
  font-variant-numeric: tabular-nums;
}

.stock-value {
  font-size: 0.88rem;
}

.article-state {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.article-state strong {
  color: var(--ink-800);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.73rem;
  overflow-wrap: anywhere;
}

.article-state span {
  color: var(--ink-500);
  font-size: 0.68rem;
}

.used-in {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px;
}

.used-in-chip {
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid var(--ink-150);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink-600);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.65rem;
  overflow-wrap: anywhere;
}

.bom-action-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-400);
  cursor: pointer;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.bom-action-button:hover {
  background: var(--ink-100);
  color: var(--ink-800);
}

.bom-action-button .icon {
  width: 15px;
  height: 15px;
}

.version-tabs {
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--ink-100);
}

.version-tab {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--ink-150);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink-600);
  font-size: 0.74rem;
  font-weight: 680;
  white-space: nowrap;
  cursor: pointer;
}

.version-tab:hover {
  border-color: var(--ink-300);
}

.version-tab.is-active {
  border-color: var(--ink-900);
  background: var(--ink-900);
  color: var(--white);
}

.version-tab .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-600);
}

.detail-side-stack {
  display: grid;
  align-content: start;
  gap: 18px;
}

.meta-list {
  display: grid;
}

.meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ink-100);
}

.meta-row:first-child {
  padding-top: 0;
}

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

.meta-row span {
  color: var(--ink-500);
  font-size: 0.76rem;
}

.meta-row strong {
  color: var(--ink-800);
  font-size: 0.78rem;
  font-weight: 680;
  text-align: right;
}

/* Dialogs */

.dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 28px 90px rgb(16 21 31 / 28%);
  color: var(--ink-900);
}

.dialog--small {
  width: min(540px, calc(100vw - 32px));
}

.dialog--pdf {
  width: min(1200px, calc(100vw - 32px));
  height: min(900px, calc(100vh - 32px));
}

.dialog::backdrop {
  background: rgb(10 14 21 / 55%);
  backdrop-filter: blur(3px);
}

.dialog[open] {
  animation: dialog-in 160ms ease-out;
}

.dialog--scrollable[open] {
  display: flex;
  flex-direction: column;
}

.dialog--scrollable > .dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
}

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

.dialog-head {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--ink-100);
}

.dialog-head h2 {
  margin: 5px 0 0;
  font-size: 1.3rem;
  letter-spacing: -0.03em;
}

.dialog-body {
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
}

.dialog-actions {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 9px;
  padding: 15px 24px;
  border-top: 1px solid var(--ink-100);
  background: var(--ink-050);
}

.pdf-viewer-body {
  height: calc(100% - 78px);
  min-height: 420px;
  background: var(--ink-100);
}

.pdf-viewer-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--white);
}

.abb-identifier-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 24px;
}

.abb-identifier-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
}

.abb-identifier-add {
  padding-top: 20px;
  border-top: 1px solid var(--ink-100);
}

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

.field-grid .field + .field {
  margin-top: 0;
}

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

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px 13px;
  border: 1px solid var(--ink-150);
  border-radius: 9px;
  font-size: 0.79rem;
}

.notice p {
  margin: 0;
}

.notice .icon {
  width: 17px;
  height: 17px;
  margin-top: 1px;
}

.notice--info {
  border-color: #ccdcf3;
  background: var(--blue-050);
  color: var(--blue-700);
}

.notice--warning {
  border-color: #f2d9a4;
  background: var(--amber-050);
  color: var(--amber-700);
}

/* Toasts and loading */

.toast-region {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  display: grid;
  width: min(380px, calc(100vw - 40px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: grid;
  min-height: 62px;
  grid-template-columns: 30px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--ink-200);
  border-radius: 11px;
  background: var(--white);
  box-shadow: var(--shadow-float);
  color: var(--ink-800);
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.toast-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: var(--green-050);
  color: var(--green-700);
}

.toast--error .toast-icon {
  background: var(--red-050);
  color: var(--red-700);
}

.toast-icon .icon {
  width: 16px;
  height: 16px;
}

.toast-copy {
  display: grid;
  gap: 2px;
}

.toast-copy strong {
  font-size: 0.8rem;
}

.toast-copy span {
  color: var(--ink-500);
  font-size: 0.72rem;
}

.toast-close {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-400);
  cursor: pointer;
}

.toast-close:hover {
  background: var(--ink-100);
}

.toast-close .icon {
  width: 14px;
  height: 14px;
}

.page-loading {
  display: grid;
  gap: 22px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: var(--ink-100);
}

.skeleton::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 68%), transparent);
  content: "";
  transform: translateX(-100%);
  animation: shimmer 1.35s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.skeleton--title {
  width: 290px;
  height: 42px;
}

.skeleton--card {
  min-height: 142px;
}

.skeleton--panel {
  height: 360px;
}

.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive */

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

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

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

  .bom-row {
    grid-template-columns: minmax(245px, 1.6fr) 70px minmax(130px, 0.8fr) minmax(108px, 0.65fr) minmax(150px, 0.8fr) 34px;
  }
}

@media (max-width: 960px) {
  .login-stage {
    grid-template-columns: 1fr;
  }

  .login-intro {
    min-height: 96px;
    max-width: none;
    align-items: center;
    padding: 16px 24px;
  }

  .login-intro-mark {
    width: 64px;
    height: 64px;
    margin: 0;
  }

  .login-intro .login-kicker,
  .login-intro h1,
  .login-intro > p,
  .login-visual {
    display: none;
  }

  .login-panel {
    min-height: calc(100vh - 96px);
    padding: 34px 28px 42px;
    border-left: 0;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--ease);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 19;
    inset: 0;
    background: rgb(10 14 21 / 45%);
    backdrop-filter: blur(2px);
  }

  .sidebar-close,
  .mobile-menu-button {
    display: inline-grid;
  }

  .sidebar-close {
    color: rgb(255 255 255 / 60%);
  }

  .sidebar-close:hover {
    background: rgb(255 255 255 / 7%);
    color: var(--white);
  }

  .workspace {
    margin-left: 0;
  }

  .mobile-menu-button {
    color: var(--ink-600);
  }

  .global-search {
    width: auto;
    flex: 1 1 auto;
  }

  .bom-list {
    min-width: 920px;
  }

  .panel:has(.bom-list) {
    overflow-x: auto;
  }
}

@media (max-width: 700px) {
  :root {
    --topbar-height: 66px;
  }

  .brand-logo--login {
    width: min(300px, 100%);
  }

  .login-panel {
    padding: 28px 18px 36px;
  }

  .login-card {
    padding: 28px 22px;
  }

  .topbar {
    height: calc(var(--topbar-height) + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    padding-right: max(14px, env(safe-area-inset-right));
    padding-left: max(14px, env(safe-area-inset-left));
  }

  .sidebar {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .global-search kbd,
  .topbar-action:last-child {
    display: none;
  }

  .global-search input {
    padding-right: 12px;
  }

  .main-content {
    padding: 26px max(14px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 22px;
  }

  .page-head-actions {
    width: 100%;
  }

  .page-head-actions .button {
    flex: 1 1 auto;
  }

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

  .kpi-card {
    min-height: 126px;
  }

  .filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .count-label {
    margin-left: 0;
  }

  .action-detail-hero {
    grid-template-columns: 1fr;
    padding: 19px;
  }

  .action-detail-actions {
    width: 100%;
  }

  .action-detail-actions .button {
    flex: 1 1 auto;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .summary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-right: 0;
    border-bottom: 1px solid var(--ink-100);
  }

  .summary-item:last-child {
    border-bottom: 0;
  }

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

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

  .field--wide {
    grid-column: auto;
  }

  .shipment-line {
    grid-template-columns: minmax(0, 1fr) 94px 34px;
  }

  .dialog-actions {
    flex-wrap: wrap;
  }

  .dialog-actions .button {
    flex: 1 1 auto;
  }

  .abb-identifier-row {
    grid-template-columns: 1fr;
  }

  .toast-region {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
