:root {
  --ink: #f9f3f7;
  --muted: #beb1ba;
  --line: rgba(255, 255, 255, 0.11);
  --paper: #120b12;
  --panel: #1c131b;
  --panel-soft: #251822;
  --panel-raised: #2d1b29;
  --plum: #5a1d47;
  --coral: #f08a70;
  --teal: #55c1ba;
  --mint: rgba(85, 193, 186, 0.18);
  --gold: #d49b3f;
  --danger: #ff8585;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.35);
  --font-ui: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.42;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(85, 193, 186, 0.12), transparent 32vw),
    var(--paper);
}

.login-shell {
  width: min(420px, calc(100vw - 32px));
}

.login-panel {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin: 6px 0 22px;
  font-size: 30px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form .button {
  width: 100%;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 82px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100vh;
  padding: 22px;
  color: #fff;
  background:
    linear-gradient(180deg, #421332 0%, #2b0f24 100%);
  transition: padding 180ms ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-toggle,
.back-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.sidebar-toggle {
  margin-left: auto;
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(145deg, var(--plum), #813361);
  font-weight: 900;
}

.brand strong,
.brand small,
.side-metrics small,
.side-metrics strong {
  display: block;
}

.brand small,
.side-metrics small {
  color: rgba(255, 255, 255, 0.7);
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-sub {
  display: grid;
  gap: 6px;
}

.nav-section {
  margin: 12px 0 2px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-item {
  min-height: 38px;
  padding: 9px 11px;
  border: 0;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.82);
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.nav-child {
  padding-left: 22px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.sidebar-collapsed .sidebar {
  align-items: center;
  padding: 20px 12px;
}

.sidebar-collapsed .brand {
  display: grid;
  justify-items: center;
}

.sidebar-collapsed .brand div,
.sidebar-collapsed .nav-section,
.sidebar-collapsed .side-metrics {
  display: none;
}

.sidebar-collapsed .nav {
  width: 100%;
}

.sidebar-collapsed .nav-item {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 0;
  font-size: 0;
  text-align: center;
}

.sidebar-collapsed .nav-item::before {
  content: attr(data-short);
  font-size: 15px;
  font-weight: 900;
}

.sidebar-collapsed .nav-child {
  padding-left: 0;
}

.side-metrics {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.side-metrics div {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.side-metrics strong {
  margin-top: 4px;
  font-size: 24px;
}

.workspace {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 11, 18, 0.84);
  backdrop-filter: blur(10px);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mobile-back {
  display: none;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 750;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.home-layout,
.module-layout {
  display: grid;
  gap: 18px;
  padding: 28px 30px 38px;
}

.command-logo {
  display: none;
}

.command-mark {
  display: grid;
  place-items: center;
  width: 128px;
  height: 128px;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(145deg, var(--panel-raised), var(--plum));
  font-size: 28px;
  font-weight: 900;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

.command-logo p {
  margin: 18px 0 0;
  color: #a8b2c1;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.module-page-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}

.module-page-head .back-button {
  display: none;
}

.module-page-head h2 {
  font-size: 32px;
}

.module-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.module-hero h2 {
  font-size: 24px;
}

.module-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  gap: 8px;
  min-width: min(420px, 100%);
}

.module-stats div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.module-stats small,
.module-stats strong {
  display: block;
}

.module-stats small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.module-stats strong {
  margin-top: 3px;
  font-size: 20px;
}

.catalog-summary {
  min-width: 0;
}

.catalog-summary strong {
  overflow-wrap: anywhere;
}

.module-grid,
.module-list {
  display: grid;
  gap: 16px;
}

.module-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-list {
  max-width: 760px;
}

.module-card {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 18px;
  min-height: 132px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)),
    var(--panel);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

.module-card:hover,
.module-card.active {
  border-color: rgba(46, 116, 115, 0.45);
  transform: translateY(-1px);
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.36);
}

.module-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.32);
}

.finance-icon {
  background: linear-gradient(145deg, #28716f, var(--teal));
}

.merchandise-icon,
.receipt-icon {
  background: linear-gradient(145deg, var(--gold), var(--coral));
}

.billing-icon,
.product-icon {
  background: linear-gradient(145deg, var(--plum), #7d3b66);
}

.movement-icon {
  background: linear-gradient(145deg, #32446f, var(--teal));
}

.module-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.module-copy strong {
  font-size: 23px;
  line-height: 1.15;
}

.module-copy small {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.module-arrow {
  color: rgba(255, 255, 255, 0.38);
  font-size: 42px;
  font-weight: 400;
  line-height: 1;
}

.prep-panel {
  max-width: 760px;
}

.status-row,
.action-bar,
.panel-head,
.catalog-editor {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pill,
.badge,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--mint);
  color: #bff6ee;
  font-size: 12px;
  font-weight: 800;
}

.badge.muted,
.pill.muted {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.button, .sale-cancellation-actions button {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--panel-soft);
  font-weight: 900;
}

.button:hover, .sale-cancellation-actions button:hover {
  border-color: rgba(240, 138, 112, 0.42);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.button.primary {
  border-color: var(--plum);
  color: #fff;
  background: var(--plum);
}

.button.wide {
  width: 100%;
}

.button.compact {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.button.danger {
  border-color: rgba(255, 133, 133, 0.35);
  color: var(--danger);
}

.button.danger:hover {
  border-color: var(--danger);
}

.sync-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.sync-status strong {
  color: var(--ink);
  font-size: 13px;
  text-align: right;
}

.stock-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  padding: 24px 30px 34px;
}

.receipt-layout {
  display: grid;
  gap: 16px;
  padding: 24px 30px 34px;
}

.product-layout {
  display: grid;
  gap: 16px;
  padding: 24px 30px 34px;
}

.receipt-workbench {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.receipt-search-band {
  grid-template-columns: minmax(420px, 1fr) auto auto;
  margin-bottom: 0;
}

.receipt-product-panel,
.receipt-entry-panel {
  min-width: 0;
}

.catalog-layout {
  display: grid;
  gap: 16px;
  padding: 24px 30px 34px;
}

.movements-layout {
  display: grid;
  gap: 16px;
  padding: 24px 30px 34px;
}

.catalog-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 220px auto;
  align-items: end;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.date-range-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 220px)) auto;
  align-items: end;
  gap: 12px;
  margin: 12px 0;
}

.work-column,
.panel-column {
  min-width: 0;
}

.scan-band,
.panel,
.action-bar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.scan-band {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
}

.scan-input {
  min-height: 48px;
  font-size: 20px;
  font-weight: 800;
}

.scan-result {
  min-width: 150px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

#productView .form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#productView .span-2 {
  grid-column: 1 / -1;
}

.span-2 {
  grid-column: span 2;
}

.span-4 {
  grid-column: span 4;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: #140d13;
}

input::placeholder,
textarea::placeholder {
  color: rgba(190, 177, 186, 0.66);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(237, 125, 100, 0.24);
  border-color: var(--coral);
}

.section-title {
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--coral);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.inline-tool {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.inline-check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.inline-check input {
  width: auto;
}

.expiry-field {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

.expiry-field input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.action-bar {
  justify-content: flex-end;
  margin-top: 16px;
  padding: 12px;
}

.photo-uploader {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.photo-uploader label {
  flex: 1 1 320px;
}

.photo-actions,
.photo-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.photo-card,
.photo-preview {
  display: grid;
  gap: 8px;
  min-height: 100px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  overflow: hidden;
}

.photo-card img,
.photo-preview img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.photo-card strong,
.photo-card span {
  display: block;
}

.photo-card strong {
  color: var(--ink);
  font-size: 12px;
}

.photo-card .icon-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--panel);
  font-weight: 900;
}

.photo-card .icon-button:hover {
  border-color: var(--teal);
}

.panel-column {
  display: grid;
  align-content: start;
  gap: 14px;
}

.panel {
  padding: 14px;
}

.panel-copy {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.catalog-results,
.event-list,
.movement-list,
.order-list,
.sync-run-list,
.receipt-results,
.receipt-list,
.chips {
  display: grid;
  gap: 8px;
}

.receipt-list {
  max-height: 310px;
  overflow: auto;
}

.catalog-results {
  grid-template-columns: 1fr;
}

.movement-list {
  grid-template-columns: 1fr;
}

.event-list {
  grid-template-columns: 1fr;
}

.order-list {
  grid-template-columns: 1fr;
}

.sync-run-list {
  grid-template-columns: 1fr;
}

.replenishment-list {
  display: grid;
  gap: 10px;
}

.abc-list {
  display: grid;
  gap: 10px;
}

.purchase-plan-list,
.purchase-review-list {
  display: grid;
  gap: 10px;
}

.cycle-count-list {
  display: grid;
  gap: 10px;
}

.profit-alert-list,
.profit-product-list,
.profit-sale-list,
.expense-list {
  display: grid;
  gap: 10px;
}

.sync-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.sync-kpis div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.sync-kpis small,
.sync-kpis strong {
  display: block;
}

.sync-kpis small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.sync-kpis strong {
  margin-top: 4px;
  font-size: 24px;
}

.replenishment-card {
  display: grid;
  grid-template-columns: 116px minmax(240px, 1fr) minmax(430px, 1.6fr) 150px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: var(--panel);
}

.replenishment-card.status-review {
  border-left-color: var(--coral);
}

.replenishment-card.status-buy_now {
  border-left-color: #f59f00;
}

.replenishment-card.status-buy_soon {
  border-left-color: var(--gold);
}

.replenishment-card.status-slow {
  border-left-color: var(--teal);
}

.replenishment-card em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.replenishment-numbers {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.replenishment-numbers span,
.replenishment-money {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.replenishment-numbers small,
.replenishment-numbers strong,
.replenishment-money span,
.replenishment-money strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.replenishment-numbers small,
.replenishment-money span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.replenishment-numbers strong,
.replenishment-money strong {
  margin-top: 3px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.replenishment-money {
  display: grid;
  gap: 4px;
}

.abc-card {
  display: grid;
  grid-template-columns: 116px minmax(220px, 1fr) 150px minmax(420px, 1.6fr) 140px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: var(--panel);
}

.abc-card.signal-protect {
  border-left-color: #f59f00;
}

.abc-card.signal-capital_locked {
  border-left-color: var(--coral);
}

.abc-card.signal-grow {
  border-left-color: var(--gold);
}

.abc-card.signal-watch {
  border-left-color: var(--teal);
}

.abc-card em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.abc-classes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.abc-classes span {
  display: grid;
  place-items: center;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.abc-classes small,
.abc-classes strong {
  display: block;
}

.abc-classes small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.abc-classes strong {
  color: var(--ink);
  font-size: 24px;
  font-weight: 950;
}

.abc-numbers {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.purchase-group-card,
.purchase-review-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: var(--panel);
}

.purchase-group-card.missing-supplier {
  border-left-color: var(--coral);
}

.purchase-group-head {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px;
  gap: 12px;
  align-items: center;
}

.purchase-items {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.purchase-item-row {
  display: grid;
  grid-template-columns: 82px minmax(220px, 1fr) repeat(4, minmax(88px, 0.45fr)) 130px;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.purchase-item-row span {
  min-width: 0;
}

.purchase-item-row span small,
.purchase-item-row span strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-item-row span small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.purchase-item-row span strong {
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.purchase-review-card {
  grid-template-columns: 100px minmax(220px, 1fr) minmax(240px, 1.4fr);
  align-items: center;
  border-left-color: var(--coral);
}

.cycle-count-card {
  display: grid;
  grid-template-columns: 92px minmax(240px, 1fr) 90px 90px 100px 150px;
  gap: 12px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--coral);
  border-radius: 8px;
  background: var(--panel);
}

.cycle-count-card.matched {
  border-left-color: var(--teal);
}

.cycle-count-card span small,
.cycle-count-card span strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cycle-count-card span small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.cycle-count-card span strong {
  margin-top: 3px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.profit-alert-card,
.profit-product-card,
.profit-sale-card {
  display: grid;
  gap: 12px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.profit-alert-card {
  grid-template-columns: 120px minmax(220px, 1fr);
  border-left: 4px solid var(--coral);
}

.profit-product-card {
  grid-template-columns: minmax(260px, 1fr) 90px repeat(4, minmax(110px, 0.55fr));
}

.profit-sale-card {
  grid-template-columns: minmax(260px, 1fr) repeat(4, minmax(110px, 0.55fr));
}

.profit-product-card span,
.profit-sale-card span {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.profit-product-card span small,
.profit-product-card span strong,
.profit-sale-card span small,
.profit-sale-card span strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profit-product-card span small,
.profit-sale-card span small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.profit-product-card span strong,
.profit-sale-card span strong {
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.expense-form {
  display: grid;
  gap: 14px;
}

.expense-card {
  display: grid;
  grid-template-columns: 110px minmax(260px, 1fr) 130px auto;
  gap: 12px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.expense-card time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.movement-card {
  display: grid;
  grid-template-columns: 92px minmax(220px, 1fr) 86px 120px 150px;
  gap: 12px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.movement-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  color: #bff6ee;
  background: var(--mint);
  font-size: 12px;
  font-weight: 900;
}

.movement-out .movement-type {
  color: #ffd2cb;
  background: rgba(240, 138, 112, 0.16);
}

.movement-main {
  min-width: 0;
}

.movement-main strong,
.movement-main small {
  display: block;
}

.movement-main strong,
.movement-cost,
.movement-qty {
  color: var(--ink);
  font-weight: 900;
}

.movement-main small,
.movement-card time {
  color: var(--muted);
  font-size: 12px;
}

.movement-main strong,
.movement-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.movement-qty {
  color: var(--teal);
  text-align: right;
}

.movement-out .movement-qty {
  color: var(--coral);
}

.movement-cost,
.movement-card time {
  text-align: right;
}

.event-card {
  display: grid;
  grid-template-columns: 96px minmax(220px, 1fr) 150px;
  gap: 12px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.sync-run-card {
  display: grid;
  grid-template-columns: 96px minmax(220px, 1fr) 150px;
  gap: 12px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.event-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  color: #bff6ee;
  background: var(--mint);
  font-size: 12px;
  font-weight: 900;
}

.event-card time,
.order-summary time,
.sync-run-card time {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.order-card {
  display: grid;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.sales-tabs { display: flex; gap: 24px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.sales-tabs button { flex-shrink: 0; }
.sale-cancellation { border-left: 3px solid var(--coral); padding-left: 14px; margin: 18px 0; overflow-wrap: anywhere; }
.sale-cancellation-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.sale-cancellation-actions button { white-space: normal; }
.sales-tabs button { background: none; color: var(--muted); border: 0; border-bottom: 3px solid transparent; padding: 12px 0; font: inherit; cursor: pointer; }
.sales-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--coral); }
.sales-tabs button:focus-visible, .sale-disclosure summary:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.sales-disclosure-list { border-top: 1px solid var(--line); }
.sale-disclosure { border-bottom: 1px solid var(--line); background: var(--panel); }
.sale-disclosure summary { display: grid; grid-template-columns: 130px 160px minmax(0, 1fr) 112px 16px; align-items: center; gap: 16px; padding: 18px 16px; cursor: pointer; list-style: none; }
.sale-disclosure summary::-webkit-details-marker { display: none; }
.sale-disclosure summary:hover { background: var(--panel-soft); }
.sale-customer, .sale-number { overflow-wrap: anywhere; }
.sale-date { color: var(--muted); font-size: 13px; }
.sale-sync-badge { color: #d3cdd1; background: #393438; padding: 5px 9px; border-radius: 4px; font-size: 12px; text-align: center; }
.sale-sync-badge.is-new { color: #a7f0bc; background: #183e29; }
.sale-chevron { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.sale-disclosure[open] .sale-chevron { transform: rotate(225deg); }
.sale-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 32px; padding: 8px 20px 24px; }
.sale-detail h3 { font-size: 15px; margin: 12px 0; }
.sale-products ul { list-style: none; padding: 0; margin: 0; }
.sale-products li { display: grid; gap: 4px; padding: 10px 0; overflow-wrap: anywhere; }
.sale-products li > span + span { font-size: 12px; color: var(--muted); }
.sale-finances dl { margin: 0; font-size: 13px; }
.sale-finances dl > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(110px, .9fr); gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.sale-finances dt { color: var(--muted); }
.sale-finances dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.sale-warning { color: var(--danger); }
.sale-finances .sale-net-profit { border-bottom: 0; border-top: 2px solid var(--line); padding-top: 16px; margin-top: 4px; font-size: 15px; font-weight: 700; }
.sale-net-profit dt { color: var(--ink); }
.sale-net-profit dd { color: var(--teal); }
.sale-net-profit.is-negative dd { color: var(--danger); }
.sale-finance-note { font-size: 12px; color: var(--muted); margin: 12px 0 0; }
#salesSyncView [hidden] { display: none; }
@media (max-width: 900px) {
  .sale-disclosure summary { grid-template-columns: minmax(0, 1fr) 110px 12px; gap: 8px 12px; padding: 16px 12px; }
  .sale-number { grid-column: 1; grid-row: 1; }
  .sale-date { grid-column: 1; grid-row: 2; }
  .sale-customer { grid-column: 1 / 3; grid-row: 3; }
  .sale-sync-badge { grid-column: 2; grid-row: 1; }
  .sale-chevron { grid-column: 3; grid-row: 1; }
  .sale-detail { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 4px 12px 20px; }
}

.order-summary {
  display: grid;
  grid-template-columns: 112px minmax(220px, 1fr) 120px 150px;
  gap: 12px;
  align-items: center;
}

.order-lines {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.order-lines li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.55fr);
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.order-lines span,
.order-lines strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-lines strong {
  color: var(--ink);
  text-align: right;
}

.order-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.receipt-results {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.receipt-results:empty {
  display: none;
}

.product-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.catalog-card {
  grid-template-columns: 56px minmax(260px, 1.8fr) minmax(150px, 0.8fr) minmax(130px, 0.7fr) 82px auto;
  min-height: 74px;
}

.product-thumb,
.selected-product-image {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  object-fit: cover;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.catalog-card .product-thumb {
  width: 56px;
  height: 56px;
  font-size: 10px;
}

.catalog-card-main {
  min-width: 0;
}

.catalog-card-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-field {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.catalog-field small,
.catalog-stock small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.catalog-field span {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-stock {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 62px;
}

.catalog-stock strong {
  font-size: 20px;
  line-height: 1;
}

.receipt-result-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  min-height: 96px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.receipt-result-card:hover {
  border-color: var(--teal);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
}

.receipt-result-card strong,
.receipt-result-card small,
.receipt-result-card em,
.selected-product-card strong,
.selected-product-card span {
  display: block;
}

.receipt-result-card small,
.selected-product-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.receipt-result-card em {
  margin-top: 7px;
  color: var(--teal);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.selected-product-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.selected-product-image {
  width: 88px;
  height: 88px;
}

.compact-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}

.compact-facts div {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.compact-facts dt,
.compact-facts dd {
  margin: 0;
}

.compact-facts dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.compact-facts dd {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 900;
}

#receiptSelected .compact-facts dd {
  overflow-wrap: anywhere;
}

.receipt-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.inline-actions {
  box-shadow: none;
}

.product-card:hover {
  border-color: var(--teal);
}

.product-card strong,
.product-card span,
.product-card em,
.receipt-item strong,
.receipt-item span {
  display: block;
}

.product-card span,
.receipt-item span,
.muted-text,
.empty-line {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.product-card em {
  margin-top: 6px;
  color: var(--teal);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.product-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 142px;
}

.catalog-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.receipt-item,
.empty-line {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(145deg, var(--plum), #311024);
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

@media (max-width: 1080px) {
  .stock-layout,
  .receipt-workbench,
  .receipt-search-band,
  .catalog-toolbar,
  .date-range-toolbar {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .sidebar {
    padding: 18px;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }

  .module-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .catalog-card {
    grid-template-columns: 56px minmax(180px, 1fr) minmax(120px, 0.8fr) minmax(110px, 0.7fr);
  }

  .catalog-stock {
    justify-items: start;
  }

  .catalog-card .product-actions {
    grid-column: 2 / -1;
    justify-content: flex-start;
  }

  #productView .form-grid,
  .receipt-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body {
    background: var(--paper);
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  body[data-view="home"] .topbar,
  body[data-view="merchandise"] .topbar {
    display: none;
  }

  .topbar,
  .action-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    gap: 14px;
    padding-top: 18px;
    padding-bottom: 18px;
    background: var(--paper);
    backdrop-filter: none;
  }

  .topbar-title {
    gap: 12px;
  }

  .mobile-back:not(.hidden) {
    display: grid;
  }

  h1 {
    font-size: 28px;
  }

  .scan-band,
  .form-grid,
  .receipt-form,
  .catalog-editor {
    grid-template-columns: 1fr;
  }

  #productView .form-grid {
    grid-template-columns: 1fr;
  }

  .module-stats {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .catalog-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .catalog-summary > div:last-child {
    grid-column: 1 / -1;
  }

  .desktop-hero {
    display: none;
  }

  .command-logo {
    display: grid;
    justify-items: center;
    padding: 34px 0 26px;
    text-align: center;
  }

  .module-page-head {
    margin: 0 0 10px;
  }

  .module-page-head .back-button {
    display: grid;
  }

  .module-page-head h2 {
    font-size: 32px;
  }

  .module-grid,
  .module-list {
    grid-template-columns: 1fr;
    gap: 18px;
    max-width: none;
  }

  .module-card {
    grid-template-columns: 62px minmax(0, 1fr) 20px;
    gap: 16px;
    min-height: 112px;
    padding: 18px 22px;
    border: 0;
    border-radius: 8px;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.34);
  }

  .module-icon {
    width: 58px;
    height: 58px;
    border-radius: 8px;
    font-size: 22px;
  }

  .module-copy strong {
    font-size: 24px;
  }

  .module-copy small {
    font-size: 16px;
  }

  .module-arrow {
    font-size: 38px;
  }

  .photo-uploader {
    align-items: stretch;
    flex-direction: column;
  }

  .product-card {
    grid-template-columns: 1fr;
  }

  .catalog-card,
  .receipt-result-card,
  .selected-product-card,
  .replenishment-card,
  .abc-card,
  .purchase-group-head,
  .purchase-item-row,
  .purchase-review-card,
  .cycle-count-card,
  .profit-alert-card,
  .profit-product-card,
  .profit-sale-card,
  .expense-card {
    grid-template-columns: 1fr;
  }

  .catalog-card .product-actions {
    grid-column: auto;
  }

  .product-actions {
    justify-content: flex-start;
  }

  .span-2 {
    grid-column: span 1;
  }

  .span-4 {
    grid-column: span 1;
  }

  .stock-layout,
  .home-layout,
  .module-layout,
  .receipt-layout,
  .product-layout,
  .movements-layout,
  .catalog-layout,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .home-layout,
  .module-layout,
  .receipt-layout,
  .product-layout,
  .catalog-layout {
    padding-top: 16px;
  }

  .home-layout {
    padding-top: 0;
  }

  .movement-card {
    grid-template-columns: 1fr;
  }

  .event-card {
    grid-template-columns: 1fr;
  }

  .order-summary,
  .order-lines li,
  .sync-run-card,
  .replenishment-card,
  .abc-card {
    grid-template-columns: 1fr;
  }

  .replenishment-numbers,
  .abc-numbers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sync-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-actions {
    justify-content: flex-start;
  }

  .movement-type,
  .event-status,
  .movement-qty,
  .movement-cost,
  .event-card time,
  .order-summary time,
  .sync-run-card time,
  .replenishment-money,
  .purchase-group-head .movement-cost,
  .purchase-item-row .movement-cost,
  .cycle-count-card time,
  .expense-card time,
  .order-lines strong,
  .movement-card time {
    justify-self: start;
    text-align: left;
  }
}
