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

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--app-font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--app-fg);
  background:
    radial-gradient(circle at 18% -10%, rgba(var(--app-info-rgb), 0.08), transparent 28rem),
    linear-gradient(180deg, rgba(var(--app-accent-rgb), 0.045), transparent 210px),
    var(--app-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body.has-sidebar-open {
  overflow: hidden;
}

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

button {
  color: inherit;
}

button,
select {
  cursor: pointer;
}

svg {
  display: block;
  width: 1rem;
  height: 1rem;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.svg-sprite {
  display: none;
}

body:not(.is-authenticated) .app-shell {
  display: none;
}

body.is-authenticated .login-screen {
  display: none;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: clamp(18px, 4vw, 48px);
  background:
    linear-gradient(120deg, rgba(var(--app-accent-rgb), 0.08), transparent 38%),
    radial-gradient(circle at 78% 18%, rgba(var(--app-success-rgb), 0.08), transparent 26rem),
    var(--app-bg);
}

.login-frame {
  display: grid;
  width: min(430px, 100%);
  overflow: hidden;
  background: color-mix(in srgb, var(--app-surface) 96%, var(--app-bg));
  border: 1px solid var(--app-border);
  border-radius: 14px;
  box-shadow: 0 26px 70px rgba(13, 15, 12, 0.16);
}

.login-card {
  display: grid;
  padding: clamp(26px, 5vw, 38px);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--app-fg-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  color: var(--app-fg);
  background: color-mix(in srgb, var(--app-surface) 96%, var(--app-bg));
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  outline: 0;
  transition: border-color 130ms ease, box-shadow 130ms ease, background 130ms ease;
}

.login-form input:focus {
  border-color: var(--app-accent);
  box-shadow: 0 0 0 3px var(--app-focus-ring);
}

.login-submit {
  min-height: 46px;
  margin-top: 4px;
}

.login-error {
  display: none;
  margin: 0;
  padding: 9px 11px;
  color: var(--app-danger);
  background: rgba(var(--app-danger-rgb), 0.09);
  border: 1px solid rgba(var(--app-danger-rgb), 0.22);
  border-radius: var(--app-radius);
}

.login-error.is-visible {
  display: block;
}

.login-form.is-shaking {
  animation: login-shake 180ms ease;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--app-sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 18px 14px;
  color: var(--app-sidebar-fg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 220px),
    var(--app-sidebar-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-scrim {
  display: none;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 0 8px 16px;
}

.brand__mark {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  font-weight: 800;
  color: var(--app-accent-foreground);
  letter-spacing: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 42%),
    var(--app-accent);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-inset);
}

.brand__copy {
  min-width: 0;
}

.brand__copy strong,
.brand__copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand__copy strong {
  font-size: 15px;
}

.brand__copy span {
  margin-top: 1px;
  font-size: 12px;
  color: var(--app-sidebar-muted);
}

.nav-block {
  display: grid;
  gap: 4px;
  padding-top: 8px;
}

.nav-group {
  display: grid;
  gap: 2px;
  padding: 4px 0;
}

.nav-item--group {
  position: relative;
}

.nav-item--group .menu-arrow {
  width: 16px;
  height: 16px;
  margin-left: auto;
  color: currentColor;
  transition: transform 160ms ease;
}

.nav-group.is-open > .nav-item--group {
  color: var(--app-sidebar-fg);
  background: rgba(255, 255, 255, 0.07);
}

.nav-group.is-open > .nav-item--group .menu-arrow {
  transform: rotate(180deg);
}

.nav-group__label {
  display: flex;
  align-items: center;
  min-height: 32px;
  gap: 10px;
  padding: 7px 10px;
  color: var(--app-sidebar-fg);
  font-size: 12px;
  font-weight: 800;
}

.nav-group__label svg {
  width: 18px;
  height: 18px;
  color: var(--app-sidebar-muted);
}

.nav-submenu {
  display: grid;
  gap: 2px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: max-height 180ms ease, opacity 150ms ease, visibility 0ms linear 180ms;
}

.nav-group.is-open .nav-submenu {
  max-height: 180px;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0ms;
}

.nav-subitem {
  min-height: 32px;
  padding: 6px 10px 6px 38px;
  color: var(--app-sidebar-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--app-radius);
}

.nav-subitem:hover {
  color: var(--app-sidebar-fg);
  background: rgba(255, 255, 255, 0.07);
}

.nav-subitem.is-active {
  color: var(--app-sidebar-active-fg);
  font-weight: 800;
  background: var(--app-sidebar-active);
}

.nav-block--bottom {
  padding-top: 18px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-profile {
  position: relative;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user-menu {
  position: relative;
}

.sidebar-user-menu > summary {
  list-style: none;
}

.sidebar-user-menu > summary::-webkit-details-marker {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  gap: 10px;
  padding: 9px 10px;
  color: var(--app-sidebar-muted);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--app-radius);
}

.nav-item svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.nav-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item:hover {
  color: var(--app-sidebar-fg);
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.is-active {
  color: var(--app-sidebar-active-fg);
  background: var(--app-sidebar-active);
}

.app-main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  min-height: var(--app-topbar-height);
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: var(--app-topbar-bg);
  border-bottom: 1px solid var(--app-border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(18px) saturate(1.2);
}

.topbar__left,
.topbar__right {
  display: flex;
  align-items: center;
  min-width: 0;
}

.topbar__left {
  gap: 12px;
}

.topbar__right {
  gap: 10px;
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--app-accent);
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 17px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.25;
}

.workspace {
  display: grid;
  gap: 16px;
  max-width: 1560px;
  padding: 18px 22px 32px;
  margin: 0 auto;
}

.workspace:focus {
  outline: none;
}

.search-box {
  display: flex;
  width: min(340px, 28vw);
  min-width: 220px;
  height: var(--app-control-height);
  gap: 8px;
  align-items: center;
  padding: 0 12px;
  color: var(--app-fg-muted);
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-sm);
}

.search-box input {
  width: 100%;
  min-width: 0;
  color: var(--app-fg);
  background: transparent;
  border: 0;
  outline: 0;
}

.search-box input::placeholder {
  color: var(--app-fg-soft);
}

.select-wrap,
.field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.select-wrap span,
.field span,
.field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--app-fg-muted);
}

.select-wrap select,
.field input,
.field select {
  width: 100%;
  min-height: var(--app-control-height);
  padding: 0 10px;
  color: var(--app-fg);
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  outline: 0;
}

.select-wrap select:focus,
.field input:focus,
.field select:focus,
.search-box:focus-within {
  border-color: var(--app-accent);
  box-shadow: 0 0 0 3px var(--app-focus-ring);
}

.select-wrap--compact {
  width: 174px;
}

.select-wrap--compact span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.theme-switch {
  display: inline-flex;
  height: var(--app-control-height);
  padding: 3px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-sm);
}

.theme-switch button,
.icon-button,
.tool-button {
  display: inline-grid;
  place-items: center;
  border-radius: var(--app-radius);
}

.theme-switch button {
  width: 30px;
  color: var(--app-fg-muted);
  background: transparent;
  border: 0;
}

.theme-switch button.is-active {
  color: var(--app-accent-foreground);
  background: var(--app-accent);
}

.theme-switch--menu {
  width: 100%;
  box-shadow: none;
}

.theme-switch--menu button {
  flex: 1 1 0;
}

.icon-button {
  position: relative;
  width: var(--app-control-height);
  height: var(--app-control-height);
  color: var(--app-fg-muted);
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  box-shadow: var(--app-shadow-sm);
}

.icon-button:hover,
.tool-button:hover,
.action-button:hover {
  border-color: var(--app-border-strong);
}

.notify-dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 7px;
  height: 7px;
  background: var(--app-danger);
  border: 2px solid var(--app-surface);
  border-radius: 999px;
}

.topbar-placeholder {
  width: var(--app-control-height);
  height: var(--app-control-height);
}

.profile-button {
  display: flex;
  height: var(--app-control-height);
  gap: 8px;
  align-items: center;
  padding: 4px 9px 4px 5px;
  color: var(--app-fg);
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-sm);
}

.profile-button--sidebar {
  width: 100%;
  height: auto;
  min-height: 48px;
  justify-content: flex-start;
  padding: 7px 9px 7px 6px;
  color: var(--app-sidebar-fg);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.profile-button--sidebar:hover,
.profile-button--sidebar:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.profile-button__chevron {
  width: 16px;
  height: 16px;
  margin-left: auto;
  color: var(--app-sidebar-muted);
  transition: transform 160ms ease;
}

.sidebar-user-menu[open] .profile-button__chevron {
  transform: rotate(180deg);
}

.avatar {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--app-accent-foreground);
  background: var(--app-accent);
  border-radius: 6px;
}

.avatar--lg {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.profile-button__copy {
  display: grid;
  min-width: 0;
  text-align: left;
}

.profile-button__copy strong,
.profile-button__copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-button__copy strong {
  max-width: 132px;
  font-size: 12px;
}

.profile-button__copy small {
  color: var(--app-fg-muted);
}

.profile-button--sidebar .profile-button__copy small {
  color: var(--app-sidebar-muted);
}

.user-dropdown {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  display: grid;
  width: min(260px, calc(100vw - 32px));
  gap: 4px;
  padding: 8px;
  color: var(--app-fg);
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-md);
}

.user-dropdown__header {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 6px 9px;
  border-bottom: 1px solid var(--app-border);
}

.user-dropdown__header div {
  display: grid;
  min-width: 0;
}

.user-dropdown__header strong,
.user-dropdown__header small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown__header small {
  color: var(--app-fg-muted);
}

.user-dropdown__theme {
  display: grid;
  gap: 8px;
  padding: 9px 6px 10px;
  border-bottom: 1px solid var(--app-border);
}

.user-dropdown__theme > span {
  color: var(--app-fg-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.user-dropdown__item {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 7px 8px;
  color: var(--app-fg);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--app-radius);
}

.user-dropdown__item:hover,
.user-dropdown__item:focus-visible {
  background: var(--app-surface-muted);
  outline: none;
}

.user-dropdown__item--danger {
  color: var(--app-danger);
}

.user-dropdown__item--danger:hover,
.user-dropdown__item--danger:focus-visible {
  background: rgba(var(--app-danger-rgb), 0.12);
}

.user-dropdown__icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  font-size: 10px;
  font-weight: 900;
  color: var(--app-fg);
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: 8px;
}

.only-mobile {
  display: none;
}

.page-header,
.panel,
.metric-card,
.timeline-item,
.product-hero,
.stock-card {
  background: color-mix(in srgb, var(--app-surface) 94%, var(--app-bg));
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-sm);
}

.page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
}

.page-header p {
  max-width: 780px;
  margin-bottom: 0;
  color: var(--app-fg-muted);
}

.page-actions,
.button-row,
.detail-actions,
.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.action-button,
.tool-button {
  display: inline-flex;
  min-height: var(--app-control-height);
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  font-weight: 700;
  color: var(--app-fg);
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  text-decoration: none;
}

.action-button--primary {
  color: var(--app-accent-foreground);
  background: var(--app-accent);
  border-color: var(--app-accent);
}

.action-button--danger {
  color: #fff;
  background: var(--app-danger);
  border-color: var(--app-danger);
}

.button,
.link-button {
  display: inline-flex;
  min-height: var(--app-control-height);
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  font-weight: 800;
  color: var(--app-fg);
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  text-decoration: none;
  transition: transform 130ms ease, box-shadow 130ms ease, border-color 130ms ease, background 130ms ease;
}

.button svg,
.link-button svg {
  width: 17px;
  height: 17px;
}

.button--primary {
  color: var(--app-accent-foreground);
  background: linear-gradient(180deg, color-mix(in srgb, var(--app-accent) 92%, #fff), var(--app-accent));
  border-color: var(--app-accent);
  box-shadow: 0 8px 18px rgba(var(--app-accent-rgb), 0.22);
}

.button--secondary {
  color: var(--app-fg);
  background: var(--app-surface-muted);
}

.button--success {
  color: #ffffff;
  background: linear-gradient(180deg, #378f6b, #1f6f55);
  border-color: #1f6f55;
  box-shadow: 0 8px 18px rgba(31, 111, 85, 0.22);
}

.button--warning {
  color: #ffffff;
  background: linear-gradient(180deg, #b2742d, #935720);
  border-color: #935720;
  box-shadow: 0 8px 18px rgba(147, 87, 32, 0.22);
}

.link-button {
  min-height: 30px;
  padding: 0;
  color: var(--app-accent);
  background: transparent;
  border-color: transparent;
}

.link-button:hover {
  color: var(--app-fg);
}

.button:hover,
.tool-button:hover,
.icon-button:hover,
.profile-button:hover {
  transform: translateY(-1px);
}

.button:disabled,
.button:disabled:hover {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

.grid--two {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
}

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

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 14px;
}

.metric-card span {
  font-size: 12px;
  font-weight: 800;
  color: var(--app-fg-muted);
}

.metric-card strong {
  font-size: 26px;
  line-height: 1.1;
}

.metric-card p {
  margin-bottom: 0;
  color: var(--app-fg-muted);
}

.metric-card__label,
.table-meta,
.muted,
.kicker {
  color: var(--app-fg-muted);
}

.metric-card__label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
}

.metric-card__value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0;
}

.metric-card__note {
  margin-bottom: 0;
  font-size: 12px;
  color: var(--app-fg-muted);
}

.delta {
  display: inline-flex;
  width: max-content;
  align-items: center;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 800;
  color: var(--tone-fg, var(--app-fg));
  background: var(--tone-bg, var(--app-surface-muted));
  border-radius: 999px;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel__header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--app-border);
}

.panel__header h2,
.panel__header p {
  margin-bottom: 0;
}

.panel__body {
  padding: 14px;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 14px;
  margin: 0 12px 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.65), transparent),
    color-mix(in srgb, var(--app-surface-muted) 82%, var(--app-surface));
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

:root[data-theme="dark"] .filter-bar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    color-mix(in srgb, var(--app-surface) 88%, #060704);
}

:root[data-theme="dark"] .filter-field input,
:root[data-theme="dark"] .filter-field select {
  color: #1b1f1b;
  color-scheme: light;
  background: #f5f2eb;
  border-color: #cfd6c9;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 1px 0 rgba(0, 0, 0, 0.12);
}

:root[data-theme="dark"] .filter-field input::placeholder {
  color: #7f877c;
}

:root[data-theme="dark"] .filter-field input:focus,
:root[data-theme="dark"] .filter-field select:focus {
  border-color: var(--app-accent);
  box-shadow: 0 0 0 3px var(--app-focus-ring), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .filter-bar {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
      color-mix(in srgb, var(--app-surface) 88%, #060704);
  }

  :root[data-theme="system"] .filter-field input,
  :root[data-theme="system"] .filter-field select {
    color: #1b1f1b;
    color-scheme: light;
    background: #f5f2eb;
    border-color: #cfd6c9;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 1px 0 rgba(0, 0, 0, 0.12);
  }

  :root[data-theme="system"] .filter-field input::placeholder {
    color: #7f877c;
  }

  :root[data-theme="system"] .filter-field input:focus,
  :root[data-theme="system"] .filter-field select:focus {
    border-color: var(--app-accent);
    box-shadow: 0 0 0 3px var(--app-focus-ring), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  }
}

.filter-bar--four {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.filter-bar--five {
  grid-template-columns: repeat(5, minmax(140px, 1fr));
}

.filter-bar--six {
  grid-template-columns: repeat(6, minmax(140px, 1fr));
}

.filter-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.filter-field span {
  font-size: 11px;
  font-weight: 800;
  color: var(--app-fg-muted);
}

.filter-field input,
.filter-field select {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  color: var(--app-fg);
  background: color-mix(in srgb, var(--app-surface) 94%, var(--app-bg));
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  outline: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 130ms ease, box-shadow 130ms ease, background 130ms ease;
}

.filter-field input:focus,
.filter-field select:focus {
  border-color: var(--app-accent);
  box-shadow: 0 0 0 3px var(--app-focus-ring), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.date-range-filter {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr);
  grid-column: span 2;
  gap: 12px;
  min-width: 0;
}

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

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

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
}

.list-toolbar__left,
.list-toolbar__right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 16px;
  color: var(--app-fg-muted);
  background: var(--app-surface);
  border-top: 1px solid var(--app-border);
}

.pager__buttons {
  display: flex;
  gap: 6px;
}

.pager select {
  min-height: 30px;
  color: var(--app-fg);
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.data-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

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

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 11px;
  color: var(--app-fg-muted);
  letter-spacing: 0;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--app-surface) 92%, var(--app-surface-muted));
}

.data-table tbody tr:hover {
  background: rgba(var(--app-accent-rgb), 0.05);
}

.data-table td:nth-child(3) {
  white-space: nowrap;
}

.data-table td strong {
  display: block;
}

.data-table td small {
  display: block;
  margin-top: 2px;
  color: var(--app-fg-muted);
}

.data-table code {
  font-family: var(--app-font-mono);
  font-size: 12px;
  color: var(--app-fg);
}

.column-options {
  width: 1%;
  text-align: right !important;
  white-space: nowrap;
}

.column-options .tool-button {
  margin-left: 4px;
}

.empty-cell {
  padding: 26px 12px !important;
  color: var(--app-fg-muted);
  text-align: center !important;
}

.numeric {
  font-family: var(--app-font-mono);
  text-align: right !important;
  white-space: nowrap;
}

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

.tool-button {
  width: 32px;
  min-height: 32px;
  padding: 0;
}

.tool-button--soft {
  color: var(--app-accent);
  background: rgba(var(--app-accent-rgb), 0.1);
}

.tool-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.status-pill {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  color: var(--tone-fg, var(--app-fg));
  white-space: nowrap;
  background: transparent;
  border: 1px solid var(--tone-border, currentColor);
  border-radius: 999px;
}

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

.status-pill--success {
  --tone-fg: var(--app-success);
  --tone-border: rgba(var(--app-success-rgb), 0.56);
}

.status-pill--warning {
  --tone-fg: var(--app-warning);
  --tone-border: rgba(var(--app-warning-rgb), 0.58);
}

.status-pill--danger {
  --tone-fg: var(--app-danger);
  --tone-border: rgba(var(--app-danger-rgb), 0.56);
}

.status-pill--neutral {
  --tone-fg: var(--app-fg-muted);
  --tone-border: var(--app-border);
}

.badge {
  --tone-fg: var(--app-fg);
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  color: var(--tone-fg);
  white-space: nowrap;
  background: transparent;
  border: 1px solid var(--tone-border, currentColor);
  border-radius: 999px;
}

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

.tone-success {
  --tone-fg: var(--app-success);
  --tone-border: rgba(var(--app-success-rgb), 0.56);
}

.tone-warning {
  --tone-fg: var(--app-warning);
  --tone-border: rgba(var(--app-warning-rgb), 0.58);
}

.tone-danger {
  --tone-fg: var(--app-danger);
  --tone-border: rgba(var(--app-danger-rgb), 0.56);
}

.tone-info {
  --tone-fg: var(--app-info);
  --tone-border: rgba(var(--app-info-rgb), 0.56);
}

.tone-accent {
  --tone-fg: var(--app-accent);
  --tone-border: rgba(var(--app-accent-rgb), 0.56);
}

.empty-state {
  padding: 34px 14px;
  color: var(--app-fg-muted);
  text-align: center;
}

.product-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  min-height: 280px;
  overflow: hidden;
}

.dashboard-workload {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 12px;
}

.dashboard-workload .data-table {
  min-width: 700px;
}

.panel > .history-list {
  padding: 16px;
}

.dashboard-workload .data-table td:first-child strong {
  white-space: nowrap;
}

.product-hero__media {
  min-height: 100%;
  background: var(--app-surface-muted);
}

.product-hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-hero__copy {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 24px;
}

.product-hero__copy p {
  margin-bottom: 0;
  color: var(--app-fg-muted);
}

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

.hero-stat {
  padding: 10px;
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.hero-stat strong,
.hero-stat span {
  display: block;
}

.hero-stat strong {
  font-family: var(--app-font-mono);
  font-size: 16px;
}

.hero-stat span {
  font-size: 11px;
  color: var(--app-fg-muted);
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  gap: 5px;
  padding: 11px;
}

.timeline-item strong {
  font-size: 13px;
}

.timeline-item p {
  margin-bottom: 0;
  color: var(--app-fg-muted);
}

.timeline-item small {
  color: var(--app-fg-soft);
}

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

.progress-item {
  display: grid;
  gap: 7px;
}

.progress-item__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  background: var(--app-surface-muted);
  border-radius: 999px;
}

.progress-bar {
  display: block;
  height: 100%;
  background: var(--bar-color, var(--app-accent));
  border-radius: inherit;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  overflow-x: auto;
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.tab-button {
  min-height: 32px;
  padding: 0 11px;
  font-weight: 800;
  color: var(--app-fg-muted);
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.tab-button.is-active {
  color: var(--app-accent-foreground);
  background: var(--app-accent);
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
  gap: 16px;
}

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

.detail-layout--dispatch {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  align-items: start;
}

.detail-main {
  display: contents;
}

.detail-layout--dispatch .detail-main {
  display: grid;
  min-width: 0;
  gap: 16px;
}

.detail-sidebar {
  display: grid;
  min-width: 0;
  gap: 16px;
  align-content: start;
}

.detail-main > .panel:first-child {
  grid-column: 1;
  grid-row: 1;
}

.detail-sidebar {
  grid-column: 2;
  grid-row: 1;
}

.detail-layout--dispatch .detail-sidebar {
  grid-column: auto;
  grid-row: auto;
}

.detail-layout--dispatch .detail-main > .panel:first-child,
.detail-layout--dispatch .detail-main > .panel--table,
.detail-layout--dispatch .detail-main > .totals-panel {
  grid-column: auto;
  grid-row: auto;
}

.detail-main > .panel--table,
.detail-main > .totals-panel {
  grid-column: 1 / -1;
}

.detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 16px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-sm);
}

.detail-header p {
  margin-bottom: 0;
  color: var(--app-fg-muted);
}

.section-title {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--app-border);
}

.section-title h2,
.section-title p {
  margin-bottom: 0;
}

.section-title p {
  color: var(--app-fg-muted);
}

.section-title--compact {
  padding: 12px 12px 10px;
}

.section-title--compact h2 {
  font-size: 15px;
}

.invoice-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 16px;
  border-bottom: 1px solid var(--app-border);
}

.invoice-head h2 {
  margin-bottom: 4px;
  font-size: 22px;
}

.invoice-summary {
  display: grid;
  gap: 4px;
  min-width: 220px;
  padding: 12px;
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.status-grid {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.status-card {
  min-width: 180px;
  padding: 10px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.status-card span {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--app-fg-muted);
}

.status-card strong {
  font-size: 13px;
}

.invoice-summary div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

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

.info-grid article {
  min-width: 0;
  padding: 12px;
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.info-grid article > span {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--app-fg-muted);
  text-transform: uppercase;
}

.info-grid article strong {
  display: block;
  overflow-wrap: anywhere;
}

.info-grid article p {
  margin: 4px 0 0;
  color: var(--app-fg-muted);
}

.info-box {
  padding: 12px;
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.info-box dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.info-box div {
  display: grid;
  gap: 2px;
}

.info-box dt {
  font-size: 11px;
  font-weight: 800;
  color: var(--app-fg-muted);
}

.info-box dd {
  margin: 0;
}

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

.inline-title h3 {
  margin-bottom: 0;
}

.totals-box {
  display: grid;
  gap: 8px;
}

.totals-panel {
  display: grid;
  width: min(340px, 100%);
  justify-self: end;
  gap: 0;
  align-items: start;
  padding: 4px 14px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-sm);
}

.totals-panel article {
  display: flex;
  gap: 18px;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--app-border);
  border-radius: 0;
}

.totals-panel article:last-child {
  border-bottom: 0;
}

.totals-panel span {
  font-size: 11px;
  font-weight: 800;
  color: var(--app-fg-muted);
  text-transform: uppercase;
}

.totals-panel strong {
  font-family: var(--app-font-mono);
  font-size: 15px;
  text-align: right;
  white-space: nowrap;
}

.totals-panel__discount strong {
  color: var(--app-accent);
}

.totals-panel--invoice article:last-child strong {
  font-size: 17px;
}

.totals-panel--invoice article:last-child {
  color: var(--app-fg);
  font-weight: 800;
}

.quote-side-card {
  overflow: hidden;
}

.quote-side-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.quote-side-item {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 11px;
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.quote-side-item--document {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.quote-side-item__actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.quote-side-item__actions .tool-button {
  width: 34px;
  height: 34px;
}

.quote-side-item span,
.quote-side-item small,
.empty-note {
  color: var(--app-fg-muted);
}

.quote-side-item span {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.quote-side-item strong {
  display: block;
  margin-bottom: 3px;
  overflow-wrap: anywhere;
}

.quote-side-item p,
.quote-side-item small,
.empty-note {
  margin: 0;
  font-size: 12px;
}

.quote-side-item small {
  display: block;
  margin-top: 4px;
}

.detail-actions-bar {
  grid-column: 1 / -1;
}

.totals-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.totals-line--grand {
  padding-top: 10px;
  margin-top: 4px;
  font-size: 18px;
  font-weight: 800;
  border-top: 1px solid var(--app-border);
}

.sticky-actions {
  position: static;
  z-index: 5;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
  padding: 14px 16px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-sm);
}

.sticky-actions--right {
  justify-content: flex-end;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(13, 15, 12, 0.54);
  animation: modal-backdrop-in 160ms ease-out;
  backdrop-filter: blur(4px);
}

.modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(920px, 96vw);
  max-height: min(92vh, 900px);
  overflow: hidden;
  color: var(--app-fg);
  background: color-mix(in srgb, var(--app-surface) 96%, var(--app-bg));
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-md);
  transform-origin: 50% 18%;
  animation: modal-aladin-in 220ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.modal--sm {
  width: min(520px, 96vw);
}

.modal--lg {
  width: min(1080px, 96vw);
}

.modal--xl {
  width: min(1200px, 96vw);
}

.modal--lightbox {
  width: min(1180px, 96vw);
  max-height: min(94vh, 920px);
}

.modal__header,
.modal__footer {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
}

.modal__footer {
  justify-content: flex-end;
  border-top: 1px solid var(--app-border);
  border-bottom: 0;
}

.modal__header h2 {
  margin-bottom: 2px;
}

.modal__body {
  display: grid;
  gap: 16px;
  min-height: 0;
  padding: 18px 20px;
  overflow: auto;
  background: color-mix(in srgb, var(--app-surface) 98%, var(--app-bg));
}

.lightbox-shell {
  display: grid;
  min-height: 0;
}

.lightbox-document {
  display: grid;
  justify-items: center;
  padding: 18px;
  background: color-mix(in srgb, var(--app-sidebar-bg) 10%, var(--app-surface-muted));
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.pdf-page {
  display: grid;
  width: min(820px, 100%);
  gap: 18px;
  min-height: 760px;
  padding: 38px;
  color: #1e211f;
  background: #fffdf9;
  border: 1px solid #e2ddd3;
  border-radius: 6px;
  box-shadow: 0 18px 44px rgba(13, 15, 12, 0.18);
}

.pdf-page__header,
.pdf-page__meta,
.pdf-page__totals {
  display: grid;
  gap: 12px;
}

.pdf-page__header {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 2px solid #d9d2c4;
}

.pdf-page__header span,
.pdf-page__meta span,
.pdf-page__totals span {
  color: #626961;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.pdf-page__header strong {
  display: block;
  margin-top: 4px;
  font-size: 30px;
  line-height: 1.1;
}

.pdf-page__header p {
  margin: 5px 0 0;
  color: #626961;
}

.pdf-page__stamp {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.pdf-page__stamp > span {
  color: var(--app-accent);
  font-size: 18px;
}

.pdf-page__meta {
  grid-template-columns: 150px minmax(0, 1fr) 160px;
}

.pdf-page__meta article,
.pdf-page__totals article {
  display: grid;
  gap: 4px;
}

.pdf-page__meta strong,
.pdf-page__meta small {
  overflow-wrap: anywhere;
}

.pdf-page__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pdf-page__table th,
.pdf-page__table td {
  padding: 11px 10px;
  text-align: left;
  border-bottom: 1px solid #e5dfd4;
}

.pdf-page__table th {
  color: #626961;
  font-size: 11px;
  text-transform: uppercase;
}

.pdf-page__table td:last-child,
.pdf-page__table th:last-child {
  text-align: right;
}

.pdf-page__totals {
  width: min(300px, 100%);
  justify-self: end;
  margin-top: auto;
  padding-top: 14px;
  border-top: 2px solid #d9d2c4;
}

.pdf-page__totals article {
  grid-template-columns: 1fr auto;
  align-items: baseline;
}

.pdf-page__totals article:last-child strong {
  color: var(--app-accent);
  font-size: 22px;
}

.lightbox-image {
  display: grid;
  gap: 14px;
}

.lightbox-image img {
  display: block;
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-sm);
}

.lightbox-image__meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.lightbox-image__meta article {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.lightbox-image__meta span {
  color: var(--app-fg-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.dispatch-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dispatch-summary article {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.dispatch-summary span,
.dispatch-summary small {
  color: var(--app-fg-muted);
}

.dispatch-summary span {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

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

.dispatch-table input {
  width: 104px;
  min-height: 34px;
  padding: 0 10px;
  color: var(--app-fg);
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  outline: 0;
}

.dispatch-table input:focus {
  border-color: var(--app-accent);
  box-shadow: 0 0 0 3px var(--app-focus-ring);
}

.dispatch-table input:disabled {
  color: var(--app-fg-muted);
  background: var(--app-surface-muted);
}

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

.panel > .document-link-grid,
.panel > .evidence-list,
.panel > .empty-note {
  margin: 0;
  padding: 14px;
}

.detail-layout--dispatch .detail-sidebar .section-title {
  display: grid;
  gap: 3px;
  justify-content: stretch;
}

.detail-layout--dispatch .detail-sidebar .section-title p {
  max-width: none;
  font-size: 12px;
}

.detail-layout--dispatch .detail-sidebar .document-link-grid {
  grid-template-columns: 1fr;
}

.document-link-grid article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  padding: 12px;
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.document-link-grid span {
  color: var(--app-fg-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.document-link-grid strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-link-grid .tool-button {
  grid-row: 1 / span 2;
  grid-column: 2;
}

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

.dispatch-form-grid input[type="file"] {
  min-height: 40px;
  padding-top: 9px;
}

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

.evidence-list article {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.evidence-list strong,
.evidence-list span {
  display: block;
}

.evidence-list strong {
  overflow-wrap: anywhere;
}

.evidence-list span {
  margin-top: 2px;
  color: var(--app-fg-muted);
  font-size: 12px;
}

.dte-dialog {
  display: grid;
  gap: 14px;
}

.dte-card {
  overflow: hidden;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-sm);
}

.dte-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--app-surface-muted) 70%, var(--app-surface));
  border-bottom: 1px dashed var(--app-border);
}

.dte-card__header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 900;
}

.dte-card__header span {
  font-size: 12px;
  font-weight: 700;
  color: var(--app-fg-muted);
}

.dte-card__body {
  padding: 14px;
}

.dte-emisor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 16px;
  align-items: start;
}

.dte-sello {
  display: grid;
  gap: 5px;
  min-height: 136px;
  place-items: center;
  padding: 14px;
  color: #b22d22;
  text-align: center;
  border: 3px solid #c43a2f;
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 246, 244, 0.72)),
    var(--app-surface);
}

.dte-sello-tipo {
  font-size: 16px;
  font-weight: 950;
  line-height: 1.12;
  text-transform: uppercase;
}

.dte-sello-rut,
.dte-sello-folio {
  font-family: var(--app-font-mono);
  font-size: 13px;
  font-weight: 850;
}

.dte-sello-folio span {
  display: inline-block;
  min-width: 46px;
  color: var(--app-fg);
}

.dte-sello-nota {
  max-width: 210px;
  font-size: 11px;
  color: color-mix(in srgb, #b22d22 70%, var(--app-fg-muted));
}

.dte-label,
.dte-field-label,
.dte-static-field span,
.dte-reference-grid span {
  font-size: 11px;
  font-weight: 850;
  color: var(--app-fg-muted);
  text-transform: uppercase;
}

.dte-emisor-datos {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--app-fg);
}

.dte-fields-grid,
.dte-note-grid,
.dte-transport-grid,
.dte-receptor-grid,
.dte-reference-grid {
  display: grid;
  gap: 12px;
}

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

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

.dte-receptor-grid {
  grid-template-columns: minmax(170px, 0.25fr) minmax(0, 0.55fr) minmax(0, 0.7fr);
  align-items: stretch;
}

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

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

.dte-reference-grid > div,
.dte-static-field,
.dte-field,
.dte-receptor-stack {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--app-surface-muted) 72%, var(--app-surface));
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.dte-field-value,
.dte-static-field strong,
.dte-reference-grid strong {
  font-weight: 850;
  color: var(--app-fg);
}

.dte-control {
  display: grid;
  gap: 6px;
  min-width: 0;
  font-size: 11px;
  font-weight: 850;
  color: var(--app-fg-muted);
  text-transform: uppercase;
}

.dte-control input,
.dte-control select,
.dte-control textarea {
  width: 100%;
  min-height: 39px;
  padding: 0 11px;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  color: var(--app-fg);
  text-transform: none;
  background: color-mix(in srgb, var(--app-surface) 94%, var(--app-bg));
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  outline: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
  transition: border-color 130ms ease, box-shadow 130ms ease, background 130ms ease;
}

.dte-control textarea {
  min-height: 72px;
  padding: 10px 11px;
  resize: vertical;
}

.dte-control input:focus,
.dte-control select:focus,
.dte-control textarea:focus {
  border-color: var(--app-accent);
  box-shadow: 0 0 0 3px var(--app-focus-ring), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.dte-control--rut {
  align-self: stretch;
}

.dte-span-2 {
  grid-column: span 2;
}

.dte-span-3 {
  grid-column: span 3;
}

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

.dte-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

.dte-table th,
.dte-table td {
  padding: 10px 12px;
  vertical-align: top;
  border-bottom: 1px solid var(--app-border);
}

.dte-table thead th {
  font-size: 11px;
  font-weight: 900;
  color: var(--app-fg-muted);
  text-transform: uppercase;
  background: color-mix(in srgb, var(--app-surface-muted) 86%, var(--app-surface));
}

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

.dte-table code {
  font-family: var(--app-font-mono);
  font-size: 12px;
  font-weight: 850;
  color: var(--app-fg);
}

.text-center {
  text-align: center;
}

.text-end {
  text-align: right;
}

.dte-linea-stack {
  display: grid;
  gap: 5px;
}

.dte-linea-main {
  font-weight: 760;
  color: var(--app-fg);
}

.dte-descripcion-toggle {
  width: max-content;
  padding: 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--app-accent);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.dte-qty-input {
  width: 76px;
  min-height: 34px;
  padding: 0 8px;
  color: var(--app-fg);
  text-align: right;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.dte-muted {
  margin-top: 4px;
  font-size: 11px;
  color: var(--app-fg-muted);
}

.dte-card--totals {
  width: min(360px, 100%);
  justify-self: end;
}

.dte-totales-table {
  width: 100%;
  border-collapse: collapse;
}

.dte-totales-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--app-border);
}

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

.dte-totales-table td:last-child {
  font-family: var(--app-font-mono);
  font-size: 15px;
  font-weight: 850;
  text-align: right;
}

.dte-total-row td {
  padding-top: 11px;
  font-weight: 950;
  color: var(--app-fg);
}

.dte-total-row td:last-child {
  font-size: 18px;
}

.dte-hint {
  display: grid;
  gap: 7px;
  padding: 12px;
  margin-bottom: 14px;
  color: #6b491d;
  background: #fff7df;
  border: 1px solid #ead394;
  border-radius: var(--app-radius);
}

.dte-hint p,
.dte-hint ul {
  margin: 0;
}

.dte-hint ul {
  padding-left: 18px;
}

.dte-info-alert {
  margin: 12px 14px 0;
  padding: 10px 12px;
  color: #6b491d;
  background: #fff7df;
  border: 1px solid #ead394;
  border-radius: var(--app-radius);
}

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

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

.form-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
  font-size: 11px;
  font-weight: 800;
  color: var(--app-fg-muted);
}

.form-field-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--app-control-height);
  gap: 8px;
  align-items: end;
}

.form-field-with-action .tool-button {
  width: var(--app-control-height);
  height: var(--app-control-height);
}

.form-grid input,
.form-grid select,
.form-grid textarea,
.field textarea {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  color: var(--app-fg);
  background: color-mix(in srgb, var(--app-surface) 94%, var(--app-bg));
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  outline: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
  transition: border-color 130ms ease, box-shadow 130ms ease, background 130ms ease;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.field textarea:focus {
  border-color: var(--app-accent);
  box-shadow: 0 0 0 3px var(--app-focus-ring), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.form-grid textarea,
.field textarea {
  min-height: 82px;
  padding: 10px;
  resize: vertical;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

.panel > .form-grid {
  padding: 18px;
}

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

.history-item {
  display: grid;
  grid-template-columns: minmax(220px, 0.25fr) minmax(0, 1fr);
  gap: 18px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--app-surface-muted) 72%, var(--app-surface));
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.history-item__time {
  font-family: var(--app-font-mono);
  font-size: 12px;
  color: var(--app-fg-muted);
  white-space: nowrap;
}

.history-item p {
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

@keyframes modal-backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modal-aladin-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  60% {
    opacity: 1;
    transform: translateY(-2px) scale(1.01);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes login-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-5px);
  }
  70% {
    transform: translateX(5px);
  }
}

.flatpickr-calendar {
  color: var(--app-fg);
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-md);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover {
  color: var(--app-accent-foreground);
  background: var(--app-accent);
  border-color: var(--app-accent);
}

.flatpickr-day.today {
  border-color: var(--app-accent);
}

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

.stock-card {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.stock-card strong {
  font-size: 18px;
  line-height: 1.1;
}

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

.swatch {
  min-height: 86px;
  padding: 10px;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.swatch__color {
  height: 30px;
  margin-bottom: 10px;
  background: var(--swatch-color);
  border: 1px solid var(--app-border);
  border-radius: 6px;
}

.swatch code,
.code {
  font-family: var(--app-font-mono);
  font-size: 12px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  color: var(--app-fg);
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: 999px;
}

.mobile-only-row {
  display: none;
}

@media (max-width: 1180px) {
  .topbar {
    align-items: flex-start;
  }

  .topbar__right {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .search-box {
    order: 4;
    width: 100%;
    min-width: min(100%, 320px);
  }

  .grid--metrics,
  .metric-grid,
  .stock-grid,
  .dashboard-workload,
  .status-grid,
  .dispatch-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .totals-panel {
    grid-template-columns: 1fr;
  }

  .grid--two,
  .settings-grid,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .detail-main > .panel:first-child,
  .detail-main > .panel--table,
  .detail-main > .totals-panel,
  .detail-sidebar {
    grid-column: 1;
    grid-row: auto;
  }

  .filter-bar,
  .filter-bar--five,
  .filter-bar--six {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  .dte-fields-grid,
  .dte-fields-grid--guide,
  .dte-reference-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dte-receptor-grid,
  .dte-transport-grid,
  .dte-note-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pdf-page__meta,
  .lightbox-image__meta,
  .document-link-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 880px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 310px);
    transform: translateX(-104%);
    transition: transform 160ms ease;
  }

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

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 19;
    display: none;
    background: rgba(0, 0, 0, 0.42);
  }

  .sidebar-scrim.is-open {
    display: block;
  }

  .only-mobile {
    display: inline-grid;
  }

  .topbar {
    min-height: auto;
    padding: 12px;
  }

  .topbar__right {
    gap: 8px;
  }

  .topbar .profile-button__copy {
    display: none;
  }

  .select-wrap--compact {
    width: 150px;
  }

  .workspace {
    padding: 14px 12px 24px;
  }

  .page-header {
    grid-template-columns: 1fr;
  }

  .filter-bar,
  .filter-bar--four,
  .filter-bar--five,
  .filter-bar--six,
  .form-grid,
  .form-grid--three {
    grid-template-columns: 1fr 1fr;
  }

  .detail-header,
  .product-hero,
  .info-grid,
  .totals-panel,
  .metric-grid,
  .dashboard-workload,
  .status-grid,
  .dte-emisor-grid {
    grid-template-columns: 1fr;
  }

  .status-grid {
    justify-content: flex-start;
  }

  .status-card {
    width: 100%;
  }

  .span-2,
  .span-3,
  .dte-span-2,
  .dte-span-3 {
    grid-column: auto;
  }

  .product-hero__media {
    min-height: 220px;
  }

  .pdf-page {
    min-height: auto;
    padding: 22px;
  }

  .pdf-page__header {
    grid-template-columns: 1fr;
  }

  .pdf-page__stamp {
    justify-items: start;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 13px;
  }

  .login-screen {
    padding: 12px;
  }

  .login-frame {
    width: 100%;
  }

  .login-card {
    padding: 20px;
  }

  .topbar {
    display: grid;
  }

  .topbar__right {
    justify-content: stretch;
  }

  .search-box,
  .select-wrap--compact,
  .theme-switch {
    width: 100%;
  }

  .theme-switch button {
    flex: 1;
  }

  .grid--metrics,
  .metric-grid,
  .grid--three,
  .stock-grid,
  .dashboard-workload,
  .status-grid,
  .hero-stat-row,
  .dispatch-summary,
  .document-link-grid,
  .filter-bar,
  .filter-bar--four,
  .filter-bar--five,
  .filter-bar--six,
  .form-grid,
  .form-grid--three,
  .totals-panel,
  .swatches {
    grid-template-columns: 1fr;
  }

  .history-item {
    grid-template-columns: 1fr;
  }

  .dte-fields-grid,
  .dte-fields-grid--guide,
  .dte-reference-grid,
  .dte-receptor-grid,
  .dte-transport-grid,
  .dte-note-grid {
    grid-template-columns: 1fr;
  }

  .dte-card--totals {
    width: 100%;
  }

  .invoice-head {
    grid-template-columns: 1fr;
  }

  .invoice-summary {
    min-width: 0;
  }

  .sticky-actions {
    position: static;
    justify-content: stretch;
  }

  .sticky-actions .button,
  .sticky-actions .action-button {
    flex: 1;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .pdf-page {
    padding: 16px;
  }

  .pdf-page__table {
    font-size: 12px;
  }
}
