:root {
  --app-width: 520px;
  --bg: #0d0f0e;
  --surface: #101311;
  --panel: #141816;
  --panel-soft: #1a201d;
  --line: #2d352f;
  --line-strong: #475147;
  --text: #eef3ee;
  --muted: #9aa59b;
  --soft-text: #717d74;
  --accent: #d4a24f;
  --accent-strong: #f0c36e;
  --accent-soft: #2b2417;
  --blue: #7aa7d8;
  --blue-soft: #172333;
  --danger: #d96b5b;
  --danger-soft: #341b17;
  --warn: #d4a24f;
  --warn-soft: #302616;
  --review: #b9abff;
  --review-soft: #2b2542;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.48);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

body.detail-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(121, 215, 162, 0.9);
  outline-offset: 2px;
}

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

.hidden {
  display: none !important;
}

.legacy-domain-banner {
  position: fixed;
  z-index: 90;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  width: min(calc(100% - 24px), 980px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(121, 215, 162, 0.42);
  border-radius: 8px;
  background: rgba(17, 25, 20, 0.97);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.44);
  backdrop-filter: blur(18px);
}

.legacy-domain-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.legacy-domain-copy strong {
  font-size: 14px;
  line-height: 1.2;
}

.legacy-domain-copy span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.legacy-domain-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.compact-button {
  min-height: 42px;
  padding: 0 14px;
  white-space: nowrap;
}

body.legacy-domain-visible .app-shell {
  padding-top: 92px;
}

.app-shell {
  position: relative;
  width: min(100%, var(--app-width));
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: clip;
}

.app-statusbar {
  position: sticky;
  top: 0;
  z-index: 35;
  min-height: 29px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  padding: 7px 16px 0;
  border-bottom: 1px solid rgba(45, 53, 47, 0.72);
  background: #111512;
  color: var(--text);
  font-size: 11px;
  font-weight: 850;
}

body.am-mode .app-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: linear-gradient(135deg, #090d0b 0%, #0d120f 46%, #101513 100%);
  box-shadow: none;
  overflow: visible;
}

body.am-mode {
  overflow-y: auto;
  background: #050806;
}

.workspace {
  min-height: calc(100dvh - 29px);
  padding: max(12px, env(safe-area-inset-top)) 12px calc(86px + env(safe-area-inset-bottom));
}

.auth-panel,
.store-panel,
.products-layout,
.supply-layout {
  min-height: calc(100dvh - 96px);
}

.auth-panel {
  position: relative;
  display: grid;
  align-items: center;
}

.auth-panel::before {
  content: "";
  position: absolute;
  inset: 0 -12px auto;
  height: 118px;
  border-bottom: 1px solid rgba(45, 53, 47, 0.72);
  background: #151a17;
  pointer-events: none;
}

.auth-card,
.store-card,
.products-table-card,
.detail-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.auth-card {
  position: relative;
  display: grid;
  gap: 14px;
  align-self: center;
  margin-top: 52px;
  padding: 18px;
}

.auth-badge {
  position: absolute;
  top: -42px;
  left: 0;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-brand img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

.app-brand strong,
.app-brand span {
  display: block;
}

.app-brand strong {
  font-size: 18px;
  letter-spacing: 0;
}

.app-brand span {
  color: var(--muted);
  font-size: 13px;
}

.auth-copy {
  display: grid;
  gap: 3px;
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.05;
  letter-spacing: 0;
}

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

.auth-form,
.store-card,
.detail-card,
.expiry-form,
.photo-form,
.am-account-form {
  display: grid;
  gap: 12px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(121, 215, 162, 0.16);
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button,
.link-button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 12px;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: #07100b;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button,
.icon-button {
  background: var(--panel);
  color: var(--text);
  border-color: var(--line);
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(255, 138, 125, 0.36);
}

.link-button {
  min-height: 32px;
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 4px 0;
}

.form-message {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 12px;
}

.screen-head,
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.screen-head {
  align-items: center;
  padding: 4px 0 14px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 18;
  align-items: flex-start;
  margin: calc(-1 * max(12px, env(safe-area-inset-top))) -12px 12px;
  padding: max(12px, env(safe-area-inset-top)) 12px 10px;
  background: rgba(13, 18, 15, 0.95);
  border-bottom: 1px solid rgba(61, 74, 64, 0.78);
  backdrop-filter: blur(16px);
}

.topbar-title {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.topbar-title h1 {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-line {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--danger);
}

.status-dot.online {
  background: var(--accent);
}

.topbar-actions {
  display: flex;
  gap: 5px;
  flex: 0 0 auto;
}

.scan-fab {
  position: fixed;
  right: max(16px, calc((100vw - var(--app-width)) / 2 + 16px));
  bottom: calc(82px + env(safe-area-inset-bottom));
  z-index: 36;
  width: 66px;
  height: 66px;
  min-height: 66px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(183, 240, 205, 0.42);
  border-radius: 50%;
  background: linear-gradient(160deg, var(--accent-strong), var(--accent));
  color: #07100b;
  padding: 0;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.52), 0 0 0 6px rgba(121, 215, 162, 0.1);
}

.scan-fab svg {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scan-fab:active {
  transform: translateY(1px) scale(0.98);
}

.icon-button {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
}

.icon-button svg,
.bulk-buttons svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button.active,
.icon-button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: rgba(121, 215, 162, 0.42);
}

.products-notice {
  position: sticky;
  top: 78px;
  z-index: 17;
  display: none;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 800;
}

.products-notice.visible {
  display: block;
}

.products-notice[data-kind="success"] {
  border-color: rgba(121, 215, 162, 0.42);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.products-notice[data-kind="error"] {
  border-color: rgba(255, 138, 125, 0.36);
  background: var(--danger-soft);
  color: var(--danger);
}

.store-grid {
  display: grid;
  gap: 8px;
}

.store-card {
  padding: 14px;
}

.store-searchline {
  min-height: 42px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101311;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.store-searchline b {
  min-width: 34px;
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--accent);
  font-size: 11px;
}

.store-search-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(212, 162, 79, 0.12);
}

.store-choice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(112px, 148px) auto;
  gap: 10px;
  align-items: center;
  min-height: 72px;
  padding: 10px;
}

.store-choice-main {
  min-width: 0;
}

.store-choice-main strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-choice-password {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.store-choice-password span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-choice-password input {
  min-height: 34px;
  padding: 0 8px;
}

.store-choice-open {
  min-height: 36px;
  padding: 0 10px;
}

.store-choice-message {
  grid-column: 1 / -1;
  min-height: 0;
  margin: 0;
}

.store-card strong {
  display: block;
  font-size: 16px;
}

.store-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.metric-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(72px, 1fr);
  gap: 6px;
  margin-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.metric-grid::-webkit-scrollbar,
.segmented::-webkit-scrollbar {
  display: none;
}

.metric-card {
  min-height: 46px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.metric-card strong {
  display: block;
  margin-top: 2px;
  font-size: 17px;
  line-height: 1;
}

.control-panel {
  display: grid;
  gap: 8px;
  margin: 0 0 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 27, 22, 0.96);
  backdrop-filter: blur(14px);
}

.search-box input {
  min-height: 48px;
}

.control-panel[aria-label="Экспорт товаров"] {
  grid-template-columns: 1fr 1fr;
}

.segmented {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0 0 2px;
  overflow-x: auto;
}

.segment {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  padding: 7px 12px;
  white-space: nowrap;
  font-weight: 850;
}

.segment.active {
  background: var(--accent-soft);
  border-color: rgba(121, 215, 162, 0.42);
  color: var(--accent-strong);
}

.bulk-actions {
  position: fixed;
  left: 50%;
  bottom: calc(66px + env(safe-area-inset-bottom));
  z-index: 34;
  display: none;
  width: min(calc(100% - 20px), calc(var(--app-width) - 20px));
  grid-template-columns: minmax(74px, auto) 1fr;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 27, 22, 0.96);
  backdrop-filter: blur(16px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
  transform: translateX(-50%);
}

.bulk-actions[data-visible="true"] {
  display: grid;
}

.bulk-actions[data-active="true"] {
  border-color: rgba(121, 215, 162, 0.42);
  background: rgba(24, 50, 37, 0.96);
}

.bulk-summary {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.bulk-summary strong,
.bulk-summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bulk-summary span {
  color: var(--muted);
  font-size: 12px;
}

.bulk-summary strong {
  font-size: 12px;
}

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

.bulk-buttons button {
  min-width: 0;
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
}

.content-grid {
  display: grid;
  gap: 12px;
}

.products-table-card {
  overflow: hidden;
}

.table-head {
  min-height: 40px;
  padding: 9px 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.products-table {
  display: grid;
  gap: 8px;
  padding: 8px;
}

.products-table[data-bulk-mode="false"] .bulk-check {
  display: none;
}

.products-table[data-bulk-mode="false"] .product-row {
  grid-template-columns: 58px minmax(0, 1fr) 70px;
}

.product-row {
  position: relative;
  display: grid;
  grid-template-columns: 26px 58px minmax(0, 1fr) 70px;
  gap: 7px;
  align-items: center;
  min-height: 94px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.product-row.active,
.product-row:hover {
  border-color: rgba(121, 215, 162, 0.34);
  background: #18211b;
}

.product-row.bulk-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.bulk-check {
  display: grid;
  place-items: center;
  min-height: 54px;
}

.bulk-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.check-box {
  width: 24px;
  height: 24px;
  border: 2px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel);
}

.bulk-check input:checked + .check-box {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 5px var(--panel);
}

.bulk-check input:disabled + .check-box {
  opacity: 0.45;
}

.product-thumb {
  width: 58px;
  height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  object-fit: contain;
  object-position: center;
}

.product-main,
.product-compact-meta {
  min-width: 0;
}

.product-main {
  display: grid;
  gap: 3px;
}

.product-name {
  display: -webkit-box;
  color: var(--text);
  font-weight: 850;
  font-size: 13px;
  line-height: 1.16;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-sub {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-compact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.product-compact-meta span {
  max-width: 100%;
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101311;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-compact-meta span:last-child {
  color: var(--text);
}

.term-card {
  align-self: stretch;
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 76px;
  border-radius: 8px;
  padding: 6px;
  text-align: center;
}

.term-card strong {
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0;
}

.term-card strong.term-card-word {
  font-size: 11px;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.term-card span {
  margin-top: 3px;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-ok {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

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

.status-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-review {
  background: var(--review-soft);
  color: var(--review);
}

.detail-panel,
.scanner-panel {
  position: fixed;
  inset: 0;
  z-index: 40;
  width: min(100%, var(--app-width));
  margin: 0 auto;
  background: rgba(0, 0, 0, 0.58);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.scanner-panel {
  z-index: 45;
}

.detail-panel.open,
.scanner-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.empty-detail {
  display: none;
}

.detail-card,
.scanner-card {
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: auto;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  padding: max(12px, env(safe-area-inset-top)) 12px calc(22px + env(safe-area-inset-bottom));
}

.scanner-card {
  display: grid;
  align-content: start;
  gap: 10px;
  background: var(--panel);
}

.scanner-camera {
  position: relative;
  overflow: hidden;
  min-height: 188px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050806;
}

.scanner-camera video {
  width: 100%;
  height: 100%;
  min-height: 188px;
  object-fit: cover;
  display: block;
}

.scanner-frame {
  position: absolute;
  inset: 28px 42px;
  border: 2px solid rgba(121, 215, 162, 0.82);
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.28);
}

.scanner-message {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.scanner-message[data-kind="success"] {
  color: var(--accent-strong);
}

.scanner-message[data-kind="error"] {
  color: var(--danger);
}

.scan-code-form {
  display: grid;
  gap: 8px;
}

.scan-code-actions {
  display: grid;
  grid-template-columns: 0.86fr 1fr;
  gap: 8px;
}

.scanner-result {
  display: grid;
  gap: 10px;
}

.am-row.editing {
  align-items: stretch;
}

.am-user-edit-form {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.am-store-editor {
  display: grid;
  gap: 10px;
}

.am-store-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.am-store-editor-head strong {
  font-size: 14px;
}

.am-store-editor-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.am-store-chip-list,
.am-store-pick-list {
  display: grid;
  gap: 6px;
}

.am-store-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.am-store-chip span {
  overflow-wrap: anywhere;
}

.am-store-pick {
  min-height: 42px;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 8px 10px;
  text-align: left;
}

.am-store-pick strong {
  color: var(--accent-strong);
}

.am-store-pick span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.empty-state.compact {
  padding: 12px;
  text-align: left;
}

.scanner-product {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.scanner-product img {
  width: 74px;
  height: 74px;
  border-radius: 7px;
  border: 1px solid var(--line);
  object-fit: contain;
  object-position: center;
  background: rgba(255, 255, 255, 0.03);
}

.am-ofd-auto-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.am-ofd-auto-status {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  font-weight: 900;
}

.am-ofd-auto-status.success {
  border-color: rgba(121, 215, 162, 0.62);
  color: #d9ffe7;
  background: rgba(50, 142, 88, 0.32);
}

.am-ofd-auto-status.warning {
  border-color: rgba(230, 190, 94, 0.72);
  color: #fff0c7;
  background: rgba(126, 89, 20, 0.36);
}

.am-ofd-auto-status.danger {
  border-color: rgba(255, 114, 114, 0.66);
  color: #ffe1e1;
  background: rgba(138, 36, 36, 0.34);
}

.am-ofd-check-panel {
  display: grid;
  gap: 5px;
  padding: 9px;
  border: 1px solid rgba(121, 215, 162, 0.28);
  border-radius: 8px;
  background: rgba(10, 18, 13, 0.54);
}

.am-ofd-check-panel strong {
  font-size: 13px;
}

.am-ofd-check-panel span {
  color: var(--muted);
  font-size: 12px;
}

.scanner-product div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.scanner-product strong,
.scanner-product span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.scanner-product strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.22;
}

.scanner-product span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.scan-expiry-form {
  display: grid;
  gap: 10px;
}

.detail-sheet-head {
  position: sticky;
  top: calc(-1 * max(12px, env(safe-area-inset-top)));
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: calc(-1 * max(12px, env(safe-area-inset-top))) -12px 12px;
  padding: max(12px, env(safe-area-inset-top)) 12px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(20, 27, 22, 0.96);
  backdrop-filter: blur(16px);
}

.sheet-close {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 8px 10px;
  font-weight: 850;
}

.detail-hero {
  display: grid;
  gap: 10px;
}

.detail-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  object-position: center;
  background: var(--panel-soft);
}

.detail-title {
  display: grid;
  gap: 6px;
}

.detail-title strong {
  font-size: 20px;
  line-height: 1.16;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.detail-fact {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.detail-fact span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.detail-fact strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.detail-actions [data-history] {
  grid-column: 1 / -1;
}

.expiry-form,
.photo-form {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.form-section-title {
  display: grid;
  gap: 2px;
}

.form-section-title span {
  color: var(--muted);
  font-size: 12px;
}

.expiry-fields,
.photo-fields {
  display: grid;
  gap: 8px;
}

.photo-fields input[type="file"] {
  min-width: 0;
  width: 100%;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
}

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

.history-item {
  padding: 9px;
  border-left: 3px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel-soft);
}

.history-item strong,
.history-item span {
  display: block;
}

.history-item span {
  color: var(--muted);
  font-size: 12px;
}

.loading-state,
.empty-state {
  padding: 26px 14px;
  color: var(--muted);
  text-align: center;
}

.empty-state.compact {
  padding: 10px;
  font-size: 12px;
}

.am-layout {
  display: grid;
  gap: 12px;
}

.am-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px;
}

.am-tab {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 8px 14px;
  font-weight: 850;
}

.am-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #07100b;
}

.am-filters .ghost-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.am-section,
.am-table-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.am-report-workspace-section {
  gap: 9px;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(20, 27, 22, 0.96), rgba(13, 18, 15, 0.96)),
    var(--panel);
}

.am-report-workspace-section .am-section-head {
  align-items: end;
}

.am-report-workspace-section .metric-grid {
  grid-auto-flow: row;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 7px;
  margin-bottom: 0;
  overflow: visible;
}

.am-report-workspace-section .metric-card {
  min-height: 44px;
  padding: 7px 9px;
  border-color: rgba(89, 107, 93, 0.7);
  background: linear-gradient(180deg, rgba(29, 38, 31, 0.9), rgba(18, 25, 21, 0.92));
}

.am-section h2,
.am-table-card h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.am-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.am-filters,
.am-upload-form,
.am-account-form {
  display: grid;
  gap: 8px;
}

@media (min-width: 860px) {
  body.am-mode .workspace {
    padding: 10px 8px 24px;
  }

  body.am-mode .rail {
    display: none;
  }

  .am-layout {
    gap: 16px;
  }

  .am-upload-form,
  .am-account-form,
  .am-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
  }

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

  .am-table {
    gap: 8px;
  }
}

@media (max-width: 720px) {
  .legacy-domain-banner {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .legacy-domain-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  body.legacy-domain-visible .app-shell {
    padding-top: 156px;
  }
}

@media (max-width: 859px) {
  .am-price-tags-workspace,
  .am-actions-workspace {
    grid-template-columns: 1fr;
  }

  .am-price-tag-summary-grid {
    grid-template-columns: 1fr;
  }

  .am-price-tag-batch-row {
    grid-template-columns: 1fr 1fr;
  }

  .am-report-summary,
  .am-category-chip-grid {
    grid-template-columns: 1fr 1fr;
  }

  .am-rule-row {
    grid-template-columns: 1fr;
  }

  .am-rule-actions {
    justify-content: start;
  }
}

@media (max-width: 520px) {
  .am-report-summary,
  .am-category-chip-grid {
    grid-template-columns: 1fr;
  }
}

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

.am-upload-form input[type="file"] {
  padding: 9px;
}

.am-import-form textarea {
  min-height: 140px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.35;
}

.am-actions-workspace {
  display: grid;
  grid-template-columns: minmax(360px, 520px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.am-rule-form,
.am-rule-list-panel {
  min-width: 0;
  border: 1px solid rgba(89, 107, 93, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(22, 31, 25, 0.96), rgba(15, 21, 17, 0.96)),
    var(--panel);
  padding: 12px;
}

.am-rule-form textarea {
  min-height: 150px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.35;
}

.am-rule-options {
  display: grid;
  gap: 10px;
  min-height: 80px;
  padding: 10px;
  border: 1px solid rgba(89, 107, 93, 0.72);
  border-radius: 8px;
  background: rgba(11, 17, 13, 0.72);
}

.am-rule-price-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(89, 107, 93, 0.72);
  border-radius: 8px;
  background: rgba(11, 17, 13, 0.72);
}

.am-rule-price-tags legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.am-rule-options-head {
  display: grid;
  gap: 3px;
}

.am-rule-options-head strong,
.am-rule-option-section h4 {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.am-rule-options-head span {
  color: var(--muted);
  font-size: 11px;
}

.am-rule-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.am-rule-target-chip {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid rgba(121, 215, 162, 0.2);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(13, 20, 16, 0.8);
  font-size: 11px;
  font-weight: 900;
}

.am-rule-target-chip.active {
  color: #102017;
  border-color: rgba(121, 215, 162, 0.86);
  background: linear-gradient(180deg, #9ce7ba, #72d59f);
  box-shadow: 0 8px 22px rgba(121, 215, 162, 0.16);
}

.am-rule-selected-panel {
  display: grid;
  gap: 8px;
  padding: 9px;
  border: 1px solid rgba(121, 215, 162, 0.24);
  border-radius: 8px;
  background: rgba(24, 50, 37, 0.28);
}

.am-rule-selected-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.am-rule-selected-head strong,
.am-rule-selected-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-rule-selected-head strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 950;
}

.am-rule-selected-head span {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 850;
}

.am-rule-selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
}

.am-rule-selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid rgba(121, 215, 162, 0.42);
  border-radius: 8px;
  color: var(--text);
  background: rgba(31, 59, 45, 0.82);
  font-size: 11px;
  font-weight: 850;
}

.am-rule-selected-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-rule-selected-chip b {
  color: var(--accent-strong);
  font-size: 13px;
  line-height: 1;
}

.am-rule-classification-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(100px, 160px);
  gap: 8px;
  align-items: end;
}

.am-rule-classification-controls label {
  display: grid;
  gap: 5px;
}

.am-rule-classification-controls span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.am-rule-classification-controls select {
  width: 100%;
}

.am-rule-option-search {
  display: grid;
  gap: 5px;
}

.am-rule-option-search span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.am-rule-option-search input {
  width: 100%;
}

.am-rule-option-section {
  display: grid;
  gap: 7px;
}

.am-rule-option-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 132px;
  overflow: auto;
}

.am-rule-option-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 260px;
  min-height: 30px;
  overflow: hidden;
  padding: 6px 9px;
  border: 1px solid rgba(121, 215, 162, 0.38);
  border-radius: 999px;
  color: var(--text);
  background: rgba(24, 50, 37, 0.42);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.am-rule-option-chip:hover {
  border-color: rgba(121, 215, 162, 0.72);
  background: rgba(35, 70, 52, 0.72);
}

.am-rule-option-chip.selected {
  color: #132118;
  border-color: rgba(183, 240, 205, 0.86);
  background: #b7f0cd;
  cursor: default;
  opacity: 1;
}

.am-rule-option-chip-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-rule-option-chip small {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 999px;
  color: #dcecdf;
  background: rgba(255, 255, 255, 0.1);
  font-size: 10px;
  line-height: 1;
}

.am-rule-option-chip.selected small {
  color: #23402f;
  background: rgba(19, 33, 24, 0.12);
}

.am-rule-option-limit {
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

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

.am-rule-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(19, 27, 22, 0.92);
}

.am-rule-row.active {
  border-color: rgba(121, 215, 162, 0.5);
}

.am-rule-row.inactive {
  opacity: 0.68;
}

.am-rule-main,
.am-rule-meta,
.am-rule-actions {
  min-width: 0;
}

.am-rule-main {
  display: grid;
  gap: 3px;
}

.am-rule-main strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-rule-main span,
.am-rule-meta span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-rule-meta {
  display: grid;
  gap: 3px;
}

.am-rule-actions {
  display: flex;
  gap: 6px;
  justify-content: end;
  flex-wrap: wrap;
}

.am-rule-actions .ghost-button,
.am-rule-actions .danger-button {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 11px;
}

.am-price-tags-workspace {
  display: grid;
  grid-template-columns: minmax(340px, 460px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.am-price-tag-form,
.am-price-tag-summary-panel {
  min-width: 0;
  border: 1px solid rgba(89, 107, 93, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(22, 31, 25, 0.96), rgba(15, 21, 17, 0.96)),
    var(--panel);
  padding: 12px;
}

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

.am-price-tag-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.am-price-tag-type-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(121, 215, 162, 0.28);
  border-radius: 8px;
  background: rgba(17, 27, 22, 0.94);
}

.am-price-tag-type-card span,
.am-price-tag-type-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-price-tag-type-card strong {
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.am-price-tag-batches {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.am-price-tag-batches h4 {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.am-price-tag-batch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, minmax(80px, auto));
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(19, 27, 22, 0.92);
}

.am-price-tag-batch-row div {
  min-width: 0;
}

.am-price-tag-batch-row strong,
.am-price-tag-batch-row span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-price-tag-batch-row strong {
  color: var(--text);
  font-size: 12px;
}

.am-price-tag-batch-row span {
  color: var(--muted);
  font-size: 11px;
}

.am-checkbox {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.am-checkbox input {
  width: 18px;
  min-height: 18px;
}

.am-report-grid {
  display: grid;
  grid-template-columns: minmax(880px, 1fr) minmax(320px, 380px);
  align-items: start;
  gap: 10px;
}

.am-report-grid.am-report-grid-premium {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.am-report-grid.am-report-grid-ugm-stable {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.am-table {
  display: grid;
  gap: 8px;
}

.am-report-main-card {
  min-width: 0;
}

.am-report-insights-card {
  position: sticky;
  top: 12px;
  max-height: calc(100dvh - 130px);
  overflow: auto;
  scrollbar-width: thin;
}

.am-report-grid-premium .am-report-insights-card {
  position: static;
  max-height: 210px;
}

.am-report-grid-ugm-stable .am-report-insights-card {
  position: static;
  max-height: none;
  overflow: visible;
}

.am-report-grid-premium .am-report-main-card,
.am-report-grid-premium .am-report-insights-card,
.am-report-grid-ugm-stable .am-report-main-card,
.am-report-grid-ugm-stable .am-report-insights-card {
  padding: 8px;
}

.am-report-grid-premium .am-report-main-card h3,
.am-report-grid-premium .am-report-insights-card h3,
.am-report-grid-ugm-stable .am-report-main-card h3,
.am-report-grid-ugm-stable .am-report-insights-card h3 {
  margin-bottom: 5px;
  font-size: 12px;
}

.am-report-grid-premium .am-report-body {
  gap: 5px;
}

.am-report-grid-ugm-stable .am-report-body {
  gap: 6px;
}

.am-report-body {
  display: grid;
  min-width: 0;
  gap: 8px;
}

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

.am-report-summary > div {
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid rgba(61, 74, 64, 0.7);
  border-radius: 8px;
  background: rgba(18, 25, 21, 0.86);
}

.am-report-summary span,
.am-report-cardlet h4 {
  display: block;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.am-report-summary strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-report-grid-premium .am-report-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.am-report-grid-ugm-stable .am-report-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.am-report-grid-premium .am-report-summary > div {
  padding: 5px 7px;
  border-radius: 6px;
}

.am-report-grid-ugm-stable .am-report-summary > div {
  padding: 5px 7px;
  border-radius: 6px;
}

.am-report-grid-premium .am-report-summary span {
  margin-bottom: 2px;
  font-size: 9px;
}

.am-report-grid-ugm-stable .am-report-summary span {
  margin-bottom: 2px;
  font-size: 9px;
}

.am-report-grid-premium .am-report-summary strong {
  font-size: 11px;
}

.am-report-grid-ugm-stable .am-report-summary strong {
  font-size: 11px;
}

.am-report-grid-ugm-stable .am-report-scroll {
  min-height: 360px;
  max-height: none;
}

.am-report-toolbar {
  display: flex;
  justify-content: flex-end;
  min-height: 28px;
}

.am-report-screenshot-button {
  min-height: 26px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 11px;
}

.am-column-settings {
  border: 1px solid rgba(89, 107, 93, 0.72);
  border-radius: 8px;
  background: rgba(12, 18, 14, 0.72);
}

.am-column-settings summary {
  min-height: 34px;
  padding: 9px 11px;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.am-column-settings .small {
  margin: 0;
  padding: 0 11px 8px;
}

.am-column-toggle-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 10px 10px;
}

.am-column-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid rgba(121, 215, 162, 0.32);
  border-radius: 999px;
  color: var(--text);
  background: rgba(24, 50, 37, 0.34);
  font-size: 11px;
  font-weight: 850;
}

.am-column-move {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  border: 1px solid rgba(121, 215, 162, 0.36);
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(7, 14, 10, 0.56);
  font-size: 12px;
  font-weight: 950;
}

.am-column-move:disabled {
  cursor: not-allowed;
  opacity: 0.32;
}

.am-column-toggle.locked {
  opacity: 0.72;
}

.am-column-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 10px 10px;
}

.am-column-settings-actions button {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 12px;
}

.am-report-scroll {
  overflow: auto;
  min-height: 520px;
  max-height: calc(100dvh - 260px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(246, 250, 246, 0.035);
  scrollbar-width: thin;
}

.am-report-screenshot-surface {
  position: fixed;
  left: -100000px;
  top: 0;
  z-index: -1;
  display: grid;
  width: max-content;
  max-width: none;
  gap: 6px;
  padding: 0;
  overflow: visible;
  color: var(--text);
  background: #0d0f0e;
}

.am-report-screenshot-surface .am-report-summary {
  width: 100%;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

.am-report-screenshot-surface .am-report-scroll {
  display: block !important;
  width: max-content;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

.am-report-screenshot-surface .am-report-table {
  min-width: 0;
}

.am-report-screenshot-surface .am-report-table .am-sticky-time,
.am-report-screenshot-surface .am-report-table .am-sticky-store {
  position: static;
}

.am-report-mobile-list {
  display: none;
}

.am-premium-board {
  min-width: 0;
  height: clamp(430px, calc(100dvh - 310px), 620px);
  display: grid;
  grid-template-rows: 30px minmax(0, 1fr);
  gap: 2px;
  overflow: hidden;
  border: 1px solid rgba(128, 143, 132, 0.22);
  border-radius: 8px;
  background: rgba(8, 12, 10, 0.6);
}

.am-premium-head,
.am-premium-row {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.am-premium-head > div {
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 2px 2px;
  border-bottom: 1px solid rgba(128, 143, 132, 0.22);
  border-right: 1px solid rgba(128, 143, 132, 0.14);
  color: rgba(221, 230, 220, 0.72);
  background: rgba(20, 27, 23, 0.96);
  font-size: 9px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  overflow: hidden;
}

.am-premium-head .am-premium-store-head {
  justify-items: start;
  padding-left: 6px;
  font-family: inherit;
  font-size: 9px;
}

.am-premium-rows {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(27, minmax(14px, 1fr)) 22px;
  gap: 2px;
  overflow: hidden;
}

.am-premium-row {
  min-height: 14px;
}

.am-premium-time,
.am-premium-store,
.am-premium-cell {
  min-width: 0;
  min-height: 0;
  display: grid;
  align-items: center;
  border-right: 1px solid rgba(128, 143, 132, 0.13);
  border-bottom: 1px solid rgba(128, 143, 132, 0.12);
  background: rgba(15, 20, 17, 0.96);
  overflow: hidden;
}

.am-premium-time {
  justify-items: center;
  color: rgba(221, 230, 220, 0.48);
  font: 800 9px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.am-premium-store {
  position: relative;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px;
  padding: 1px 4px 1px 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  white-space: nowrap;
}

.am-premium-store::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 2px;
  border-radius: 999px;
  background: rgba(121, 215, 162, 0.78);
}

.am-premium-store.bad::before {
  background: rgba(239, 139, 127, 0.86);
}

.am-premium-store b {
  color: var(--text);
  font: 900 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.am-premium-store span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-premium-cell {
  position: relative;
  justify-items: center;
  padding: 1px 2px;
  color: var(--text);
  font: 850 9px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: center;
}

.am-premium-cell::after,
.am-premium-drill-button::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 2px;
  height: 2px;
  border-radius: 999px;
  background: rgba(154, 165, 156, 0.25);
}

.am-premium-cell.good::after,
.am-premium-drill-button.good::after {
  background: rgba(121, 215, 162, 0.86);
}

.am-premium-cell.mid::after,
.am-premium-drill-button.mid::after {
  background: rgba(235, 193, 96, 0.9);
}

.am-premium-cell.bad::after,
.am-premium-drill-button.bad::after {
  background: rgba(239, 139, 127, 0.9);
}

.am-premium-cell.good {
  background: rgba(24, 50, 37, 0.18);
}

.am-premium-cell.mid {
  background: rgba(68, 51, 18, 0.16);
}

.am-premium-cell.bad {
  background: rgba(70, 25, 22, 0.18);
}

.am-premium-cell span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-premium-drill-button {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0 2px 2px;
  border: 0;
  border-radius: 0;
  color: var(--text);
  background: transparent;
  font: inherit;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-premium-drill-button:hover,
.am-premium-drill-button.active {
  color: #f8f3df;
  background: rgba(212, 170, 95, 0.22);
  box-shadow: inset 0 0 0 1px rgba(212, 170, 95, 0.45);
}

.am-premium-row.empty {
  opacity: 0.72;
}

.am-premium-row.total .am-premium-time,
.am-premium-row.total .am-premium-store,
.am-premium-row.total .am-premium-cell {
  color: var(--text);
  background: rgba(218, 226, 214, 0.08);
  font-weight: 950;
}

.am-report-mobile-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(121, 215, 162, 0.2);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(24, 40, 30, 0.94), rgba(15, 22, 18, 0.96));
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
}

.am-report-mobile-card.is-empty {
  opacity: 0.68;
}

.am-report-mobile-card header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.am-report-mobile-card header strong,
.am-report-mobile-card header span,
.am-report-mobile-card header em {
  display: block;
  min-width: 0;
}

.am-report-mobile-card header strong {
  color: var(--text);
  font-size: 17px;
  font-weight: 950;
}

.am-report-mobile-card header span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.am-report-mobile-card header em {
  color: #d6f2c0;
  font-size: 16px;
  font-style: normal;
  font-weight: 950;
  text-align: right;
  white-space: nowrap;
}

.am-mobile-report-kpis {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.am-mobile-report-categories-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.am-mobile-report-categories-head b {
  color: var(--accent-strong);
  font-size: 11px;
}

.am-mobile-report-kpis span,
.am-mobile-report-categories span {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 6px;
  border: 1px solid rgba(121, 215, 162, 0.18);
  border-radius: 8px;
  background: rgba(8, 14, 11, 0.44);
}

.am-mobile-report-kpis b,
.am-mobile-report-categories b {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-mobile-report-kpis small,
.am-mobile-report-categories small,
.am-mobile-report-time {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.am-mobile-report-time {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.am-mobile-report-categories {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  padding-bottom: 4px;
}

.am-mobile-report-categories > span {
  min-height: 0;
}

.am-report-table {
  width: max-content;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 10px;
  line-height: 1.1;
}

.am-report-table col.am-col-time {
  width: 44px;
}

.am-report-table col.am-col-store {
  width: 160px;
}

.am-report-table col.am-col-count {
  width: 42px;
}

.am-report-table col.am-col-short {
  width: 44px;
}

.am-report-table col.am-col-money {
  width: 78px;
}

.am-report-table col.am-col-rule {
  width: 38px;
}

.am-report-table col.am-col-default {
  width: 42px;
}

.am-report-table th,
.am-report-table td {
  padding: 3px 3px;
  border-right: 1px solid rgba(128, 143, 132, 0.34);
  border-bottom: 1px solid rgba(128, 143, 132, 0.34);
  text-align: center;
  white-space: nowrap;
  background: rgba(18, 24, 21, 0.98);
}

.am-report-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 70px;
  max-height: 70px;
  padding: 3px 2px;
  color: #162018;
  background: #b8d4ea;
  font-weight: 900;
  vertical-align: middle;
  white-space: normal;
}

.am-report-th-label {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-height: 1.15;
  max-height: 5.75em;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
}

.am-report-table tbody tr:nth-child(even) td {
  background: rgba(27, 34, 30, 0.98);
}

.am-report-table tbody tr.am-report-empty-row td {
  color: var(--soft-text);
}

.am-report-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  color: #172018;
  background: #d6e9bb;
  font-weight: 950;
}

.am-report-table .am-sticky-time,
.am-report-table .am-sticky-store {
  position: sticky;
  z-index: 4;
}

.am-report-table .am-sticky-time {
  left: 0;
  width: 44px;
  min-width: 44px;
}

.am-report-table .am-sticky-store {
  left: 44px;
  width: 160px;
  min-width: 160px;
  text-align: left;
  box-shadow: 1px 0 0 rgba(128, 143, 132, 0.5);
}

.am-report-table td.am-sticky-time,
.am-report-table td.am-sticky-store {
  background: rgba(18, 24, 21, 0.99);
}

.am-report-table tbody tr:nth-child(even) td.am-sticky-time,
.am-report-table tbody tr:nth-child(even) td.am-sticky-store {
  background: rgba(27, 34, 30, 0.99);
}

.am-report-table th.am-sticky-time,
.am-report-table th.am-sticky-store {
  background: #b8d4ea;
}

.am-report-table tfoot .am-sticky-time,
.am-report-table tfoot .am-sticky-store {
  background: #d6e9bb;
}

.am-report-table tfoot .am-rule-drill-button {
  color: #172018;
  border-color: rgba(23, 32, 24, 0.34);
  background: rgba(113, 138, 92, 0.22);
}

.am-report-table td.am-sticky-store strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-report-table td.am-sticky-store span {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
}

.am-report-table .am-heat-good {
  color: #142015;
  background: #96d58d !important;
  font-weight: 900;
}

.am-report-table .am-heat-mid {
  color: #251f0d;
  background: #f3d36c !important;
  font-weight: 900;
}

.am-report-table .am-heat-low {
  color: #2d1212;
  background: #ef8b7f !important;
  font-weight: 900;
}

.am-report-table .am-category-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-rule-drill-button,
.am-mobile-report-category-button {
  width: 100%;
  min-height: 18px;
  padding: 2px 3px;
  border: 1px solid rgba(121, 215, 162, 0.3);
  border-radius: 6px;
  color: var(--accent-strong);
  background: rgba(24, 50, 37, 0.5);
  font: inherit;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.am-rule-drill-button:hover,
.am-rule-drill-button.active,
.am-mobile-report-category-button:hover,
.am-mobile-report-category-button.active {
  color: #102017;
  border-color: rgba(121, 215, 162, 0.9);
  background: linear-gradient(180deg, #9ce7ba, #72d59f);
}

.am-mobile-report-category-action .am-mobile-report-category-button {
  margin-top: 2px;
  text-align: left;
}

.am-report-side {
  display: grid;
  gap: 10px;
}

.am-report-cardlet {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.am-report-cardlet + .am-report-cardlet {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.am-rule-drilldown {
  align-content: start;
}

.am-rule-drilldown-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.am-rule-drilldown-head h4 {
  margin-bottom: 2px;
}

.am-rule-drilldown-head strong,
.am-rule-drilldown-head span,
.am-rule-drilldown-head b,
.am-rule-drilldown-head small {
  display: block;
}

.am-rule-drilldown-head strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
}

.am-rule-drilldown-head span,
.am-rule-drilldown-head small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.am-rule-drilldown-head b {
  color: var(--accent-strong);
  font-size: 20px;
  font-weight: 950;
  text-align: right;
}

.am-rule-drilldown-kpis,
.am-rule-store-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.am-rule-drilldown-kpis span,
.am-rule-store-summary span {
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(121, 215, 162, 0.18);
  border-radius: 8px;
  background: rgba(8, 14, 11, 0.44);
}

.am-rule-drilldown-kpis b,
.am-rule-drilldown-kpis small,
.am-rule-store-summary strong,
.am-rule-store-summary small,
.am-rule-store-summary b {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-rule-drilldown-kpis b,
.am-rule-store-summary strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 950;
}

.am-rule-drilldown-kpis small,
.am-rule-store-summary small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.am-rule-store-summary b {
  margin-top: 2px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 900;
}

.am-rule-store-summary em {
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.am-rule-receipts {
  display: grid;
  gap: 8px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.am-rule-product-list {
  display: grid;
  gap: 5px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.am-rule-product-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 7px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid rgba(89, 107, 93, 0.64);
  border-left: 3px solid var(--accent-strong);
  border-radius: 8px;
  background: rgba(12, 19, 15, 0.72);
}

.am-rule-product-row strong,
.am-rule-product-row span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-rule-product-row strong {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 950;
}

.am-rule-product-row span,
.am-rule-product-row em,
.am-rule-product-row small {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.am-rule-product-row b {
  color: var(--text);
  font-size: 11px;
  font-weight: 950;
  white-space: nowrap;
}

.am-rule-receipt {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid rgba(89, 107, 93, 0.72);
  border-radius: 8px;
  background: rgba(12, 18, 14, 0.7);
}

.am-rule-receipt header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.am-rule-receipt header strong,
.am-rule-receipt header span,
.am-rule-receipt header b,
.am-rule-receipt header small {
  display: block;
  min-width: 0;
}

.am-rule-receipt header strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-rule-receipt header span,
.am-rule-receipt header small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.am-rule-receipt header b {
  color: #d6f2c0;
  font-size: 12px;
  font-weight: 950;
  text-align: right;
  white-space: nowrap;
}

.am-rule-receipt-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.am-rule-receipt-meta span {
  padding: 3px 6px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(246, 250, 246, 0.06);
  font-size: 10px;
  font-weight: 800;
}

.am-rule-receipt-items {
  display: grid;
  gap: 4px;
}

.am-rule-receipt-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 6px;
  align-items: center;
  padding: 5px 6px;
  border-left: 3px solid transparent;
  border-radius: 6px;
  background: rgba(246, 250, 246, 0.035);
}

.am-rule-receipt-item.match-matched,
.am-rule-receipt-item.match-primary,
.am-rule-receipt-item.match-secondary,
.am-rule-receipt-item.match-both {
  border-left-color: var(--accent-strong);
  background: rgba(121, 215, 162, 0.14);
}

.am-rule-receipt-item.match-secondary {
  border-left-color: #9cc7ff;
}

.am-rule-receipt-item.match-both {
  border-left-color: #f3d36c;
}

.am-rule-receipt-item strong,
.am-rule-receipt-item span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-rule-receipt-item strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
}

.am-rule-receipt-item span,
.am-rule-receipt-item em,
.am-rule-receipt-item small {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.am-rule-receipt-item b {
  color: var(--text);
  font-size: 11px;
  font-weight: 950;
  white-space: nowrap;
}

.am-rule-receipt-item small {
  padding: 2px 5px;
  border-radius: 999px;
  color: #102017;
  background: var(--accent-strong);
}

.am-category-chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.am-category-chip {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px;
  border: 1px dashed rgba(121, 215, 162, 0.38);
  border-radius: 8px;
  background: rgba(24, 50, 37, 0.36);
}

.am-category-chip.active {
  border-style: solid;
  border-color: rgba(121, 215, 162, 0.72);
  background: rgba(24, 50, 37, 0.62);
}

.am-category-chip strong,
.am-category-chip small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-category-chip strong {
  color: var(--text);
  font-size: 12px;
}

.am-category-chip small {
  color: var(--muted);
  font-size: 10px;
}

.am-diagnostic-list {
  display: grid;
  gap: 7px;
}

.am-diagnostic-list div {
  display: grid;
  gap: 2px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(61, 74, 64, 0.6);
}

.am-diagnostic-list div:last-child {
  border-bottom: 0;
}

.am-diagnostic-list strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-diagnostic-list span {
  color: var(--muted);
  font-size: 11px;
}

.am-products-compact .am-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 8px;
}

@media (max-width: 1280px) {
  .am-report-grid {
    grid-template-columns: 1fr;
  }

  .am-actions-workspace {
    grid-template-columns: 1fr;
  }

  .am-report-insights-card {
    position: static;
    max-height: none;
  }

  .am-report-scroll {
    max-height: 68vh;
  }
}

@media (max-width: 760px) {
  .am-rule-classification-controls {
    grid-template-columns: 1fr;
  }

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

  .am-column-settings summary {
    min-height: 40px;
  }

  .am-column-toggle-grid {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 12px;
  }

  .am-column-toggle {
    flex: 0 0 auto;
  }

  .am-report-mobile-list {
    display: grid;
    gap: 8px;
  }

  .am-report-scroll {
    display: none;
  }

  .am-premium-board {
    display: none;
  }

  .am-mobile-report-kpis,
  .am-mobile-report-categories {
    display: grid;
  }

  .am-rule-drilldown-kpis,
  .am-rule-store-summary {
    grid-template-columns: 1fr;
  }

  .am-rule-receipts {
    max-height: none;
    overflow: visible;
  }

  .am-rule-product-list {
    max-height: none;
    overflow: visible;
  }

  .am-rule-product-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .am-rule-product-row b,
  .am-rule-product-row small {
    justify-self: start;
  }

  .am-rule-receipt-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .am-rule-receipt-item em,
  .am-rule-receipt-item small {
    justify-self: start;
  }
}

@media (min-width: 1400px) {
  .am-report-table {
    font-size: 10px;
  }
}

.am-row,
.am-cash-row {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.am-row strong,
.am-cash-row strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.am-row span,
.am-cash-row span,
.am-result {
  color: var(--muted);
  font-size: 12px;
}

.am-source-period-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr)) auto;
  gap: 8px;
  align-items: end;
}

.am-source-period-controls label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.am-source-period-controls label span {
  font-size: 11px;
}

@media (max-width: 720px) {
  .am-source-period-controls {
    grid-template-columns: 1fr;
  }
}

.am-job-row {
  border-left: 3px solid rgba(122, 218, 160, 0.65);
}

.am-job-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 260px));
  gap: 10px;
  margin: 0 0 12px;
}

.am-job-filters label {
  display: grid;
  gap: 5px;
}

.am-job-filters span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.am-job-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.am-job-summary-card {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.am-job-summary-card span,
.am-job-summary-card small {
  color: var(--muted);
  font-size: 12px;
}

.am-job-summary-card strong {
  color: var(--text);
  font-size: 20px;
}

.am-job-type-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -2px 0 12px;
}

.am-job-type-summary span {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.am-job-status {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text) !important;
  background: rgba(255, 255, 255, 0.04);
}

.am-job-status-running,
.am-job-status-queued {
  border-color: rgba(122, 218, 160, 0.55);
  color: var(--accent) !important;
}

.am-job-status-failed,
.danger-text {
  color: #ff9c9c !important;
}

.am-job-events {
  display: grid;
  gap: 3px;
  padding-top: 2px;
}

.am-job-events small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.am-cash-row select {
  min-height: 40px;
}

@media (max-width: 760px) {
  .am-job-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.supply-layout {
  display: grid;
  gap: 12px;
}

.supply-upload-card,
.supply-section {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.supply-upload-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.supply-upload-form input[type="file"] {
  width: 100%;
  min-height: 48px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
}

.supply-upload-result {
  display: none;
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.supply-upload-result.visible {
  display: block;
}

.supply-upload-result[data-kind="success"] {
  color: var(--accent-strong);
}

.supply-upload-result[data-kind="error"] {
  color: var(--danger);
}

.supply-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.supply-section-head h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.15;
}

.supply-session-list,
.supply-job-list,
.supply-history-list {
  display: grid;
  gap: 8px;
}

.supply-session-card,
.supply-job-row,
.supply-history-row,
.supply-item-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.supply-session-card.active,
.supply-item-row.active {
  border-color: rgba(121, 215, 162, 0.56);
  background: var(--accent-soft);
}

.supply-session-main {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  display: grid;
  gap: 5px;
  padding: 10px;
  text-align: left;
}

.supply-session-main strong,
.supply-session-main span,
.supply-item-main strong,
.supply-item-main span,
.supply-job-row strong,
.supply-job-row span,
.supply-history-row strong,
.supply-history-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.supply-session-main strong,
.supply-item-main strong,
.supply-job-row strong,
.supply-history-row strong {
  white-space: nowrap;
}

.supply-session-main > span:not(.supply-progress),
.supply-item-main > span:last-child,
.supply-job-row span,
.supply-history-row span {
  color: var(--muted);
  font-size: 12px;
}

.supply-progress {
  overflow: hidden;
  height: 6px;
  border-radius: 999px;
  background: rgba(127, 138, 130, 0.24);
}

.supply-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.supply-session-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 0 10px 10px;
}

.supply-job-row,
.supply-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
}

.supply-job-row > div,
.supply-history-row > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.supply-job-row em {
  color: var(--danger);
  font-size: 11px;
  font-style: normal;
  overflow-wrap: anywhere;
}

.supply-controls {
  position: sticky;
  top: max(8px, env(safe-area-inset-top));
  z-index: 15;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.supply-controls .segmented {
  grid-column: 1 / -1;
}

.supply-scan-button {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.supply-scan-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.supply-table {
  display: grid;
  gap: 8px;
  padding: 8px;
}

.supply-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 44px;
  align-items: center;
  gap: 8px;
  min-height: 96px;
  padding: 8px;
  color: inherit;
  cursor: pointer;
}

.supply-item-row:hover {
  border-color: rgba(121, 215, 162, 0.36);
}

.supply-item-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.supply-item-main .status-pill {
  justify-self: start;
}

.supply-qty-box {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 72px;
  border-radius: 8px;
  background: rgba(13, 18, 15, 0.72);
  text-align: center;
}

.supply-qty-box strong {
  font-size: 18px;
  line-height: 1;
}

.supply-qty-box span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.supply-detail-title {
  display: grid;
  gap: 6px;
  padding: 4px 0 2px;
}

.supply-item-fields {
  grid-template-columns: 86px minmax(0, 1fr) minmax(0, 1fr);
}

.supply-checks {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.supply-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.supply-checks input {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.supply-checks span {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.supply-related {
  display: grid;
  gap: 7px;
  margin-top: 4px;
}

.supply-related > strong {
  font-size: 13px;
}

.supply-related button {
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 8px;
  text-align: left;
}

.supply-related span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supply-scanner-card {
  gap: 12px;
}

.supply-scanner-result {
  padding-top: 2px;
}

.supply-scanner-result > strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
}

.supply-scan-match {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 9px;
  text-align: left;
}

.supply-scan-match:hover {
  border-color: rgba(121, 215, 162, 0.48);
}

.supply-scan-match div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.supply-scan-match strong,
.supply-scan-match span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.supply-scan-match strong {
  white-space: nowrap;
}

.supply-scan-match span {
  color: var(--muted);
  font-size: 11px;
}

.supply-scan-match b {
  min-width: 56px;
  color: var(--accent-strong);
  font-size: 16px;
  text-align: right;
}

.supply-scan-quantity-form {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(121, 215, 162, 0.28);
  border-radius: 8px;
  background: rgba(121, 215, 162, 0.08);
}

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

.supply-scan-summary span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 14, 10, 0.42);
}

.supply-scan-summary b {
  color: var(--accent-strong);
  font-size: 18px;
  line-height: 1;
}

.supply-scan-summary small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supply-scan-quantity-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.supply-scan-quantity-form input {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  font-size: 18px;
  font-weight: 900;
}

@media (max-width: 620px) {
  .supply-scan-match {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .supply-scan-match .status-pill {
    grid-column: 1 / -1;
    justify-self: start;
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    text-align: center;
  }
}

@media (max-width: 460px) {
  .supply-upload-form {
    grid-template-columns: 1fr;
  }

  .supply-controls {
    grid-template-columns: 1fr;
  }

  .supply-scan-button {
    width: 100%;
  }

  .supply-item-row {
    grid-template-columns: minmax(0, 1fr) 64px 40px;
  }

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

  .supply-item-fields,
  .supply-checks {
    grid-template-columns: 1fr;
  }
}

.rail {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 0;
  z-index: 30;
  width: min(100%, var(--app-width));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  padding: 8px max(10px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-right));
  border-top: 1px solid rgba(61, 74, 64, 0.78);
  background: rgba(13, 18, 15, 0.94);
  backdrop-filter: blur(18px);
}

.rail-item {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 7px 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 850;
}

.rail-item.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: rgba(121, 215, 162, 0.42);
}

.rail-item.muted {
  opacity: 0.55;
}

@media (min-width: 720px) {
  .app-shell {
    min-height: calc(100dvh - 28px);
    margin-top: 14px;
    margin-bottom: 14px;
    border-radius: 18px;
  }

  .workspace {
    min-height: calc(100dvh - 28px);
  }

  .detail-panel,
  .scanner-panel {
    left: 50%;
    right: auto;
    transform: translate(-50%, 12px);
  }

  .detail-panel.open,
  .scanner-panel.open {
    transform: translate(-50%, 0);
  }

  .detail-card,
  .scanner-card {
    min-height: calc(100dvh - 28px);
    max-height: calc(100dvh - 28px);
    border-radius: 18px 18px 0 0;
  }

  .scan-fab {
    right: calc((100vw - var(--app-width)) / 2 + 18px);
  }
}

@media (max-width: 390px) {
  .workspace {
    padding-left: 10px;
    padding-right: 10px;
  }

  .topbar,
  .detail-sheet-head {
    margin-left: -10px;
    margin-right: -10px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .bulk-buttons,
  .detail-grid,
  .detail-actions {
    grid-template-columns: 1fr;
  }

  .product-row {
    grid-template-columns: 26px 58px minmax(0, 1fr) 54px;
  }

  .products-table[data-bulk-mode="false"] .product-row {
    grid-template-columns: 58px minmax(0, 1fr) 54px;
  }

  .product-thumb {
    width: 58px;
    height: 78px;
  }

  .term-card {
    min-height: 78px;
  }

  .term-card strong {
    font-size: 23px;
  }

  .term-card strong.term-card-word {
    font-size: 10px;
  }

  .product-compact-meta {
    grid-template-columns: 1fr;
    gap: 1px;
  }

  .scan-fab {
    right: 14px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    width: 62px;
    height: 62px;
    min-height: 62px;
  }
}

.topbar,
.screen-head,
.control-panel,
.bulk-actions,
.am-section,
.am-table-card,
.supply-section,
.products-table-card,
.detail-card,
.scanner-card,
.auth-card,
.store-card {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: none;
}

.topbar,
.screen-head {
  min-height: 64px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: #151a17;
}

.topbar h1,
.screen-head h1,
.am-section h2,
.am-table-card h3,
.supply-section-head h2 {
  letter-spacing: 0;
}

.eyebrow {
  color: var(--accent);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.primary-button,
.am-tab.active,
.segment.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #14100a;
}

.primary-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #14100a;
}

.ghost-button,
.secondary-button,
.icon-button,
.link-button,
.segment,
.am-tab {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--text);
}

.ghost-button:hover,
.secondary-button:hover,
.icon-button:hover,
.link-button:hover,
.segment:hover,
.am-tab:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.metric-card,
.am-report-summary > div,
.am-report-cardlet,
.supply-session-card,
.supply-job-row,
.supply-history-row,
.supply-item-row,
.product-row,
.am-report-mobile-card {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  box-shadow: none;
}

.metric-card {
  min-height: 52px;
  padding: 8px 10px;
}

.product-row {
  border-left: 3px solid transparent;
}

.product-row.active,
.product-row:hover,
.supply-session-card.active,
.supply-item-row.active {
  border-color: #9f814c;
  background: #202722;
}

.product-row.active,
.product-row:hover {
  border-left-color: var(--accent);
}

.term-card,
.product-thumb,
.supply-qty-box,
.am-mobile-report-kpis span,
.am-mobile-report-categories span,
.am-report-cardlet {
  border-color: var(--line);
  background: #101311;
}

.am-report-mobile-card {
  gap: 9px;
  background: #141816;
}

.am-report-mobile-card header strong {
  font-size: 16px;
}

.am-report-mobile-card header em {
  color: var(--accent-strong);
}

.am-mobile-report-kpis,
.am-mobile-report-categories {
  gap: 6px;
}

.am-mobile-report-category-button {
  border-color: var(--line);
  background: #101311;
}

.am-mobile-report-category-button:hover,
.am-mobile-report-category-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.am-report-scroll {
  border-color: var(--line);
  background: #101311;
}

.am-report-table th,
.am-report-table td {
  border-color: rgba(113, 125, 116, 0.36);
  background: #141816;
}

.am-report-table th {
  background: #1a201d;
  color: var(--muted);
}

.am-report-table tbody tr:nth-child(even) td {
  background: #111512;
}

.rail {
  height: calc(72px + env(safe-area-inset-bottom));
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #0b0d0c;
}

.rail-item {
  min-height: 54px;
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.rail-item.active {
  border-color: #8f784b;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.scan-fab {
  border-color: var(--accent);
  background: var(--accent);
  color: #14100a;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.36);
}

.products-notice.visible,
.supply-upload-result.visible {
  border-radius: 8px;
}

@media (min-width: 860px) {
  body.am-mode .app-shell {
    background: var(--surface);
  }

  body.am-mode .workspace {
    padding: 10px 8px 24px;
  }

  .am-report-workspace-section {
    background: var(--panel);
  }
}

@media (max-width: 859px) {
  .workspace {
    padding: max(10px, env(safe-area-inset-top)) 10px calc(84px + env(safe-area-inset-bottom));
  }

  .topbar,
  .screen-head {
    margin-left: -10px;
    margin-right: -10px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .am-tabs {
    margin-left: -10px;
    margin-right: -10px;
    padding: 0 10px 2px;
  }
}
