:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-alt: #10182c;
  --panel: linear-gradient(180deg, rgba(21, 31, 54, 0.96), rgba(28, 39, 68, 0.94));
  --panel-strong: #0f1728;
  --panel-soft: rgba(13, 21, 39, 0.92);
  --surface: #0d1527;
  --surface-soft: rgba(15, 23, 40, 0.9);
  --ink: #eef4ff;
  --muted: #9fb0d3;
  --border: #2a375d;
  --accent: #6ea8fe;
  --accent-strong: #4f92fb;
  --accent-soft: rgba(110, 168, 254, 0.16);
  --success: #28c76f;
  --warning: #ffb020;
  --danger: #ea5455;
  --cyan: #24c8db;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  font-family: "Manrope", sans-serif;
  line-height: 1.5;
  font-weight: 500;
  color: var(--ink);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3f8;
  --bg-alt: #f6f9fc;
  --panel: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 252, 0.96));
  --panel-strong: #ffffff;
  --panel-soft: rgba(255, 255, 255, 0.92);
  --surface: #ffffff;
  --surface-soft: rgba(255, 255, 255, 0.88);
  --ink: #182438;
  --muted: #5a708c;
  --border: rgba(24, 36, 56, 0.14);
  --accent: #2f68db;
  --accent-strong: #1f57cf;
  --accent-soft: rgba(47, 104, 219, 0.12);
  --success: #209b65;
  --warning: #c88417;
  --danger: #d25555;
  --cyan: #229eb0;
  --shadow: 0 18px 40px rgba(44, 72, 114, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 14% 14%, rgba(110, 168, 254, 0.2), transparent 24%),
    radial-gradient(circle at 84% 18%, rgba(36, 200, 219, 0.14), transparent 16%),
    radial-gradient(circle at 50% 100%, rgba(234, 84, 85, 0.08), transparent 20%),
    linear-gradient(180deg, var(--bg), #08101b 60%, #060b14 100%);
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at 14% 14%, rgba(47, 104, 219, 0.12), transparent 24%),
    radial-gradient(circle at 84% 18%, rgba(34, 158, 176, 0.1), transparent 16%),
    linear-gradient(180deg, #f6f9fc 0%, #eef3f8 60%, #e7edf5 100%);
}

html[data-embedded="true"],
html[data-embedded="true"] body {
  min-height: 100%;
}

html[data-embedded="true"] body {
  background: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.portal-frame {
  position: relative;
  min-height: 100vh;
  padding: 20px 18px 56px;
}

html[data-embedded="true"] .portal-frame {
  min-height: 100%;
  padding: 0;
}

.portal-background {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(110, 168, 254, 0.16), transparent 24%),
    radial-gradient(circle at 88% 20%, rgba(36, 200, 219, 0.12), transparent 18%),
    radial-gradient(circle at 50% 92%, rgba(234, 84, 85, 0.08), transparent 24%);
  pointer-events: none;
}

.topbar,
.page-shell,
.workspace-layout {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.workspace-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  align-items: start;
  gap: 24px;
}

html[data-embedded="true"] .workspace-layout,
html[data-embedded="true"] .page-shell {
  width: 100%;
  max-width: none;
  margin: 0;
}

html[data-embedded="true"] .workspace-layout {
  display: block;
  gap: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

html[data-embedded="true"] .portal-background,
html[data-embedded="true"] .topbar {
  display: none !important;
}

.topbar-title,
.page-title,
.hero-panel h2,
.panel h3 {
  margin: 0;
  line-height: 1;
  letter-spacing: -0.04em;
}

.topbar-title {
  max-width: 640px;
  font-size: clamp(2rem, 3.4vw, 2.85rem);
  font-weight: 800;
}

.topbar-eyebrow {
  margin: 0 0 6px;
}

.topbar-subtitle {
  margin: 8px 0 0;
  max-width: 54ch;
  color: var(--muted);
  font-size: 0.96rem;
}

.topbar-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.theme-toggle-button {
  min-width: 118px;
}

.topbar-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--ink);
  white-space: nowrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(159, 176, 211, 0.7);
}

.status-dot.is-online {
  background: var(--success);
  box-shadow: 0 0 14px rgba(40, 199, 111, 0.55);
}

.mobile-nav-toggle,
.mobile-nav-backdrop,
.mobile-nav-head {
  display: none;
}

.hamburger {
  appearance: none;
  display: inline-flex;
  flex-direction: column;
  position: relative;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 42px;
  height: 42px;
  padding: 10px 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(15, 23, 40, 0.92);
  color: var(--ink);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.hamburger:hover {
  transform: translateY(-1px);
  border-color: rgba(110, 168, 254, 0.38);
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.mobile-nav-notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(234, 84, 85, 0.28);
}

.tenant-chip {
  min-width: 220px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(15, 23, 40, 0.82);
  box-shadow: var(--shadow);
  color: var(--ink);
}

.tenant-chip span,
.tenant-chip strong,
.tenant-chip small {
  display: block;
}

.tenant-chip span,
.tenant-chip small {
  color: var(--muted);
}

.tenant-chip span {
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tenant-chip strong {
  margin-top: 6px;
  font-size: 1.02rem;
}

.main-nav {
  margin-bottom: 0;
  position: sticky;
  top: 20px;
  align-self: start;
}

html[data-embedded="true"] .main-nav {
  position: static;
  top: auto;
  align-self: auto;
  width: 100%;
  margin: 0 0 18px;
}

.main-nav-shell {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(8, 12, 20, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.main-nav-shell--module {
  grid-template-columns: 1fr;
  align-items: start;
}

html[data-embedded="true"] .main-nav-shell {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

html[data-embedded="true"] .main-nav-shell--module {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

html[data-embedded="true"] #moduleHomeLink {
  display: none;
}

html[data-embedded="true"] .nav-action-group {
  align-self: stretch;
}

html[data-embedded="true"] .submenu-nav {
  margin-top: 8px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 52px;
  padding: 12px 15px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.nav-link:hover {
  transform: translateY(-1px);
  border-color: rgba(110, 168, 254, 0.4);
  color: var(--ink);
}

.nav-link.is-active {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #08101b;
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(110, 168, 254, 0.22);
}

.nav-link-button {
  width: 100%;
  appearance: none;
  cursor: pointer;
  font: inherit;
}

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

.submenu-nav {
  margin-top: 10px;
}

.submenu-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.submenu-heading strong {
  color: var(--ink);
  font-size: 0.95rem;
  letter-spacing: 0;
}

.scroll-rail {
  cursor: grab;
}

.scroll-rail.is-dragging {
  cursor: grabbing;
}

.scroll-rail.is-dragging > * {
  user-select: none;
  -webkit-user-select: none;
}

.page-shell {
  display: grid;
  gap: 24px;
  min-width: 0;
}

html[data-embedded="true"] .page-shell {
  gap: 18px;
}

.stack-lg {
  display: grid;
  gap: 24px;
}

.stack-md {
  display: grid;
  gap: 18px;
}

.panel,
.hero-panel,
.modal-card {
  border: 1px solid var(--border);
  border-radius: 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.panel,
.hero-panel {
  padding: 28px;
}

.compact-panel {
  padding: 22px 24px;
}

.narrow-panel {
  max-width: 720px;
  width: 100%;
  justify-self: center;
}

.login-panel {
  margin-top: 22px;
}

.hero-panel {
  position: relative;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.9fr);
  overflow: hidden;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -60px -80px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(36, 200, 219, 0.26), transparent 68%);
}

.hero-copy,
.hero-stats,
.panel-heading {
  position: relative;
  z-index: 1;
}

.hero-panel h2 {
  max-width: 760px;
  font-size: clamp(2.1rem, 4vw, 3.4rem);
  font-weight: 800;
}

.muted-copy {
  color: var(--muted);
  font-size: 1rem;
  margin: 0;
}

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.hero-stats {
  display: grid;
  gap: 14px;
}

.snapshot-tile {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 40, 0.92);
}

.snapshot-tile span,
.snapshot-tile strong {
  display: block;
}

.snapshot-tile span {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.snapshot-tile strong {
  margin-top: 8px;
  font-size: 1.5rem;
  line-height: 1;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.catalog-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.panel h3 {
  margin-top: 10px;
  font-size: 1.8rem;
}

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

.field span {
  font-size: 0.86rem;
  color: var(--muted);
}

.field input,
.field select,
.field textarea,
input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 40, 0.94);
  color: var(--ink);
}

.field textarea,
textarea {
  min-height: 160px;
  padding: 14px 16px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(110, 168, 254, 0.4);
  box-shadow: 0 0 0 4px rgba(110, 168, 254, 0.12);
}

.button-primary,
.button-danger,
.button-secondary,
.modal-close,
.copy-button,
.whatsapp-button,
.history-action,
.year-switcher button,
.tab,
.note-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, border-color 180ms ease;
}

.button-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #08101b;
  box-shadow: 0 12px 24px rgba(110, 168, 254, 0.22);
}

.button-danger {
  background: linear-gradient(180deg, #ff7a7b, var(--danger));
  color: #fff;
  box-shadow: 0 12px 24px rgba(234, 84, 85, 0.22);
}

.button-secondary {
  background: rgba(15, 23, 40, 0.9);
  border-color: var(--border);
  color: var(--ink);
}

.button-primary:hover,
.button-danger:hover,
.button-secondary:hover,
.modal-close:hover,
.copy-button:hover,
.whatsapp-button:hover,
.history-action:hover,
.year-switcher button:hover,
.tab:hover {
  transform: translateY(-1px);
}

.button-primary:disabled,
.button-danger:disabled,
.button-secondary:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.login-cta {
  justify-self: start;
}

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

.action-group {
  display: grid;
  gap: 10px;
  align-content: start;
}

.action-row .action-group {
  flex: 1 1 220px;
}

.toolbar-trigger {
  width: 100%;
}

.toolbar-trigger.has-badge {
  justify-content: space-between;
}

.toolbar-trigger.has-caret {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toolbar-trigger.has-caret::after {
  content: "▾";
  flex: 0 0 auto;
  font-size: 0.92rem;
  opacity: 0.78;
}

.submenu {
  display: none;
  gap: 10px;
}

.submenu.is-open {
  display: grid;
}

.submenu > * {
  width: 100%;
}

.submenu-mobile-head {
  display: none;
}

.submenu-inline {
  width: 100%;
  min-width: 0;
  margin-top: 2px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(8, 12, 20, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  position: relative;
}

.action-row > * {
  flex: 1 1 220px;
}

.order-actions-panel {
  position: static;
}

.order-actions-bar {
  position: sticky;
  top: 12px;
  z-index: 40;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(15, 23, 40, 0.96);
  box-shadow: var(--shadow);
}

.safety-stock-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(8, 12, 20, 0.62);
}

.safety-stock-control {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.safety-stock-control span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.safety-stock-control input {
  min-height: 44px;
}

.has-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.has-badge.has-alert {
  border-color: rgba(248, 113, 113, 0.48);
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.12);
}

.order-estimate-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 22px;
  border: 1px solid rgba(110, 168, 254, 0.22);
  background: rgba(110, 168, 254, 0.08);
}

.order-estimate-copy {
  display: grid;
  gap: 6px;
}

.order-estimate-label {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.order-estimate-copy strong {
  font-size: 1.4rem;
  line-height: 1;
}

.order-estimate-meta {
  margin: 0;
  max-width: 42ch;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: right;
}

.history-edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 22px;
  border: 1px solid rgba(255, 176, 32, 0.28);
  background: rgba(255, 176, 32, 0.1);
}

.history-edit-banner-copy {
  display: grid;
  gap: 4px;
}

.history-edit-banner-label {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--warning);
}

.history-edit-banner-copy strong {
  font-size: 1rem;
  line-height: 1.2;
}

.history-edit-banner-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.warehouse-filter-field {
  width: min(240px, 100%);
}

.search-field.compact {
  width: min(260px, 100%);
}

.table-wrap {
  overflow: auto;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: rgba(13, 21, 39, 0.92);
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: transparent;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.product-row-toggle {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  cursor: default;
}

.product-row-copy {
  min-width: 0;
}

.product-row-chevron {
  display: none;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  position: relative;
}

.product-row-chevron::before {
  content: "";
  position: absolute;
  inset: 5px 4px 4px 5px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 180ms ease;
}

th {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: rgba(15, 23, 40, 0.96);
}

tbody tr:hover {
  background: rgba(110, 168, 254, 0.08);
}

.product-title {
  font-weight: 700;
}

.product-detail-row {
  display: none;
}

.product-detail-row.is-expanded {
  display: table-row;
}

.product-row.is-expanded .product-row-chevron::before {
  transform: rotate(225deg);
}

.product-lot-cell select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 40, 0.94);
  color: var(--ink);
}

.product-supplier-cell select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 40, 0.94);
  color: var(--ink);
}

.product-detail-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(15, 23, 40, 0.94);
}

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

.product-detail-item,
.product-detail-quantity {
  display: grid;
  gap: 6px;
}

.product-detail-item select,
.product-detail-quantity input,
.product-detail-callout input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 40, 0.94);
  color: var(--ink);
}

.product-detail-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.product-detail-callout {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(110, 168, 254, 0.22);
  background: rgba(110, 168, 254, 0.08);
}

.product-detail-callout-title {
  font-weight: 700;
}

.product-detail-callout-copy {
  font-size: 0.84rem;
  color: var(--muted);
}

.product-meta,
.product-note {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.table-wrap input[type="number"] {
  width: 86px;
  min-height: 42px;
  padding: 0 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 40, 0.94);
  color: var(--ink);
  text-align: center;
}

.empty-state,
.note-empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 9, 17, 0.72);
  backdrop-filter: blur(12px);
}

.modal[hidden] {
  display: none;
}

.modal-card {
  width: min(860px, calc(100vw - 24px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px;
  position: relative;
}

.modal-card.wide {
  width: min(1040px, calc(100vw - 24px));
}

.modal-close {
  position: sticky;
  top: 0;
  margin-left: auto;
  background: rgba(15, 23, 40, 0.96);
  border-color: var(--border);
  color: var(--ink);
}

.modal-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.summary-group,
.history-group,
.goal-card,
.note-card,
.comparison-grid {
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: rgba(13, 21, 39, 0.9);
}

.summary-group + .summary-group,
.history-group + .history-group,
.goal-card + .goal-card {
  margin-top: 14px;
}

.history-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.history-title-row h4 {
  margin: 0;
}

.history-fiscal-match-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(40, 199, 111, 0.35);
  background: rgba(40, 199, 111, 0.12);
  color: var(--success);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.summary-list + .summary-brand-focus {
  margin-top: 14px;
}

.summary-brand-focus {
  border-color: rgba(40, 199, 111, 0.34);
  background:
    radial-gradient(circle at top right, rgba(40, 199, 111, 0.18), transparent 42%),
    rgba(11, 28, 25, 0.94);
}

.summary-brand-focus .summary-group-head {
  align-items: flex-start;
}

.summary-brand-focus .eyebrow {
  margin: 0 0 4px;
  color: #28c76f;
}

.summary-brand-focus pre {
  border-color: rgba(40, 199, 111, 0.22);
}

.goal-card.is-editing {
  border-color: rgba(110, 168, 254, 0.45);
  box-shadow: inset 0 0 0 1px rgba(110, 168, 254, 0.14);
}

.goal-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.goal-edit-form {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(159, 176, 211, 0.18);
}

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

.goal-edit-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.summary-group pre,
.supplier-pre,
pre {
  margin: 12px 0;
  padding: 16px;
  border-radius: 18px;
  background: rgba(15, 23, 40, 0.96);
  overflow: auto;
  white-space: pre-wrap;
  color: var(--ink);
}

.summary-actions,
.history-actions,
.supplier-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.supplier-catalog-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  margin-top: 18px;
}

.product-editor-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.product-editor-page-head h3 {
  margin: 0;
}

.field-control-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.field-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 40, 0.94);
  color: var(--ink);
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.field-icon-button:hover:not(:disabled),
.field-icon-button:focus-visible {
  border-color: rgba(110, 168, 254, 0.32);
  background: rgba(110, 168, 254, 0.12);
}

.field-icon-button:disabled {
  opacity: 0.62;
  cursor: wait;
}

.field-icon-button svg {
  width: 20px;
  height: 20px;
}

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

.supplier-catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.supplier-catalog-copy {
  margin: 0;
}

.supplier-catalog-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(110, 168, 254, 0.16);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.toolbar-notification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(8, 16, 27, 0.86);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(8, 16, 27, 0.2);
}

.toggle-field {
  align-content: end;
}

.toggle-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 12px;
}

.supplier-catalog-sample,
.supplier-catalog-preview {
  display: grid;
  gap: 12px;
}

.supplier-catalog-library-list {
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.supplier-catalog-library-item {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 40, 0.86);
  color: var(--ink);
  text-align: left;
  display: grid;
  gap: 6px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.supplier-catalog-library-item:hover {
  transform: translateY(-1px);
  border-color: rgba(110, 168, 254, 0.28);
}

.supplier-catalog-library-item.is-active {
  border-color: rgba(110, 168, 254, 0.42);
  background: rgba(110, 168, 254, 0.12);
}

.supplier-catalog-library-item strong,
.supplier-catalog-library-item span,
.supplier-catalog-library-item small {
  display: block;
}

.supplier-catalog-library-item span,
.supplier-catalog-library-item small {
  color: var(--muted);
}

.supplier-catalog-sample-head {
  display: grid;
  gap: 6px;
}

.supplier-catalog-table-wrap {
  max-height: 420px;
}

.supplier-catalog-table th,
.supplier-catalog-table td {
  min-width: 120px;
  vertical-align: top;
}

.supplier-catalog-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.supplier-catalog-result {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 40, 0.82);
  font-size: 0.84rem;
  font-weight: 700;
}

.supplier-catalog-result-exact_code,
.supplier-catalog-result-exact_identity,
.supplier-catalog-result-exact_name,
.supplier-catalog-result-strong_name {
  border-color: rgba(40, 199, 111, 0.35);
  color: #8de8b2;
}

.supplier-catalog-result-new {
  border-color: rgba(110, 168, 254, 0.35);
  color: #9fc5ff;
}

.supplier-catalog-result-ambiguous {
  border-color: rgba(255, 176, 32, 0.35);
  color: #ffd27b;
}

.supplier-catalog-result-skipped {
  border-color: rgba(234, 84, 85, 0.35);
  color: #ffb1b2;
}

.product-editor-head {
  display: grid;
  gap: 8px;
}

.product-editor-head h4 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.1;
}

.product-editor-list {
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.product-editor-item {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 40, 0.86);
  color: var(--ink);
  text-align: left;
  display: grid;
  gap: 6px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.product-editor-item:hover {
  transform: translateY(-1px);
  border-color: rgba(110, 168, 254, 0.28);
}

.product-editor-item.is-active {
  border-color: rgba(110, 168, 254, 0.42);
  background: rgba(110, 168, 254, 0.12);
}

.product-editor-item strong,
.product-editor-item span,
.product-editor-item small {
  display: block;
}

.product-editor-item span,
.product-editor-item small {
  color: var(--muted);
}

.product-editor-linked-panel {
  display: grid;
  gap: 14px;
}

.product-editor-linked-list {
  display: grid;
  gap: 10px;
}

.product-editor-linked-item {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 40, 0.86);
  color: var(--ink);
  text-align: left;
  display: grid;
  gap: 6px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.product-editor-linked-item:hover {
  transform: translateY(-1px);
  border-color: rgba(110, 168, 254, 0.28);
}

.product-editor-linked-item.is-active {
  border-color: rgba(110, 168, 254, 0.42);
  background: rgba(110, 168, 254, 0.12);
}

.product-editor-linked-item strong,
.product-editor-linked-item span,
.product-editor-linked-item small {
  display: block;
}

.product-editor-linked-item span,
.product-editor-linked-item small {
  color: var(--muted);
}

.product-editor-linked-toolbar {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.summary-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}

.summary-kpi {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 40, 0.94);
}

.summary-kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 1.2rem;
  line-height: 1;
}

.summary-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

.summary-partial-confirm {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 14px 16px;
  margin: 0 0 14px;
  border: 1px solid rgba(110, 168, 254, 0.28);
  border-radius: 18px;
  background: rgba(110, 168, 254, 0.1);
}

.summary-partial-confirm strong {
  display: block;
}

.summary-partial-confirm p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.summary-partial-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.summary-confirmed-banner,
.summary-empty-state {
  padding: 16px 18px;
  margin: 0 0 14px;
  border-radius: 20px;
  border: 1px solid rgba(40, 199, 111, 0.3);
  background:
    radial-gradient(circle at top right, rgba(40, 199, 111, 0.16), transparent 46%),
    rgba(10, 31, 29, 0.88);
}

.summary-confirmed-banner strong,
.summary-empty-state strong {
  display: block;
}

.summary-confirmed-banner p,
.summary-empty-state p {
  margin: 6px 0 0;
  color: var(--muted);
}

.summary-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 18px 0 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-section-heading strong {
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
}

.summary-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.summary-group-head h4 {
  margin: 0;
}

.summary-group-head span {
  color: var(--muted);
  font-weight: 700;
}

.summary-supplier-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.summary-supplier-check input {
  width: 16px;
  height: 16px;
  accent-color: #6ea8fe;
}

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

.understock-search {
  margin: 12px 0 16px;
}

.understock-search input {
  width: 100%;
}

.understock-card {
  margin-top: 0;
}

.understock-empty-filter {
  margin-top: 0;
}

.understock-gap {
  color: #fecaca;
}

.understock-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.understock-metrics span {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(8, 12, 20, 0.48);
  color: var(--muted);
  font-size: 0.8rem;
}

.understock-metrics strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.copy-button,
.history-action {
  background: rgba(15, 23, 40, 0.96);
  border-color: var(--border);
  color: var(--ink);
}

.whatsapp-button {
  background: linear-gradient(180deg, #28c76f, #20aa5e);
  color: #08101b;
  box-shadow: 0 12px 24px rgba(40, 199, 111, 0.18);
}

.history-action.is-danger,
.note-delete {
  background: rgba(234, 84, 85, 0.12);
  border-color: rgba(234, 84, 85, 0.22);
  color: var(--danger);
}

.summary-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.year-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.year-panel-copy h3 {
  margin: 0;
}

.year-panel-copy .muted-copy {
  margin: 8px 0 0;
}

.year-panel-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.year-panel-active {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 18px;
  border: 1px solid rgba(110, 168, 254, 0.22);
  background: rgba(110, 168, 254, 0.12);
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 800;
}

.year-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.year-switcher button {
  min-height: 44px;
  padding: 0 14px;
  background: rgba(15, 23, 40, 0.94);
  border-color: var(--border);
  color: var(--ink);
}

.year-switcher button.is-active {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #08101b;
  border-color: transparent;
}

.tab-strip {
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(13, 21, 39, 0.9);
}

.tab {
  flex: 1;
  background: transparent;
  color: var(--muted);
}

.tab.is-active {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #08101b;
  box-shadow: 0 10px 24px rgba(110, 168, 254, 0.18);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.comparison-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 18px;
}

.comparison-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.comparison-tile strong {
  display: block;
  margin-top: 8px;
  font-size: 1.9rem;
  line-height: 1;
}

.comparison-tile em {
  display: block;
  margin-top: 6px;
  font-style: normal;
}

.delta-positive {
  color: var(--success) !important;
}

.delta-negative {
  color: var(--danger) !important;
}

.goal-progress {
  margin-top: 12px;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(110, 168, 254, 0.14);
}

.goal-progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
}

.notes-list {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.note-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.note-card p {
  margin: 10px 0 0;
  white-space: pre-wrap;
}

.note-composer,
.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

.inline-error {
  color: var(--danger);
  font-weight: 700;
}

.flash {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  max-width: min(420px, calc(100vw - 24px));
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(13, 21, 39, 0.96);
  color: var(--ink);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

@media (max-width: 1200px) {
  .toolbar-grid {
    grid-auto-flow: column;
    grid-auto-columns: minmax(240px, 1fr);
    overflow-x: auto;
    padding-bottom: 4px;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
  }

  .toolbar-grid > * {
    scroll-snap-align: start;
  }

  .toolbar-grid::-webkit-scrollbar {
    height: 8px;
  }

  .toolbar-grid::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(110, 168, 254, 0.34);
  }

  .toolbar-grid::-webkit-scrollbar-track {
    background: rgba(15, 23, 40, 0.3);
  }
}

@media (max-width: 1024px) {
  .workspace-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 18px;
  }

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

  .topbar-side {
    justify-content: flex-start;
  }

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

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

  .year-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .year-panel-controls {
    justify-content: flex-start;
  }

  .supplier-catalog-layout {
    grid-template-columns: 1fr;
  }

  .product-editor-list {
    max-height: min(40vh, 320px);
  }

  .product-editor-linked-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  body.mobile-nav-open {
    overflow: hidden;
  }

  body.mobile-submenu-open {
    overflow: hidden;
  }

  html[data-embedded="true"] body.mobile-nav-open {
    overflow: auto;
  }

  .workspace-layout {
    display: block;
    width: auto;
    z-index: auto;
  }

  html[data-embedded="true"] .workspace-layout {
    display: block;
    width: 100%;
    gap: 16px;
  }

  .portal-frame {
    padding: 16px 12px 40px;
  }

  html[data-embedded="true"] .portal-frame {
    padding: 0;
  }

  .topbar {
    position: sticky;
    top: 10px;
    z-index: 90;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    padding: 14px;
  }

  .mobile-nav-toggle {
    display: inline-flex;
  }

  html[data-embedded="true"] .mobile-nav-toggle,
  html[data-embedded="true"] .mobile-nav-head,
  html[data-embedded="true"] .mobile-nav-backdrop {
    display: none !important;
  }

  .brand-copy {
    min-width: 0;
  }

  .topbar-eyebrow {
    margin-bottom: 4px;
  }

  .topbar-subtitle,
  .topbar-side {
    display: none;
  }

  .main-nav {
    position: fixed;
    inset: 0;
    z-index: 120;
    width: 100vw;
    margin: 0;
    padding: max(18px, env(safe-area-inset-top)) 14px max(22px, env(safe-area-inset-bottom));
    overflow-y: auto;
    transform: translateY(-100%);
    transition: transform 220ms ease;
    top: 0;
    background:
      radial-gradient(circle at 18% 0%, rgba(110, 168, 254, 0.18), transparent 34%),
      linear-gradient(180deg, rgba(8, 12, 20, 0.99), rgba(10, 16, 29, 0.99));
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.42);
    isolation: isolate;
  }

  html[data-embedded="true"] .main-nav {
    position: static;
    inset: auto;
    width: 100%;
    margin: 0 0 16px;
    padding: 0;
    overflow: visible;
    transform: none;
    background: transparent;
    box-shadow: none;
    isolation: auto;
  }

  .main-nav.is-open {
    transform: translateY(0);
  }

  html[data-embedded="true"] .main-nav.is-open {
    transform: none;
  }

  .mobile-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(5, 10, 18, 0.28);
    backdrop-filter: blur(2px);
  }

  .mobile-nav-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: rgba(8, 12, 20, 0.92);
    box-shadow: var(--shadow);
  }

  .mobile-nav-title {
    display: block;
    margin-top: 4px;
    font-size: 1.05rem;
    letter-spacing: -0.03em;
  }

  .mobile-nav-close {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(15, 23, 40, 0.92);
    color: var(--ink);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
  }

  .main-nav-shell {
    display: grid;
    gap: 14px;
    min-width: 0;
    width: 100%;
    grid-template-columns: 1fr;
    padding: 0;
    overflow: visible;
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
  }

  .main-nav-shell--module {
    display: grid;
  }

  html[data-embedded="true"] .main-nav-shell--module {
    grid-template-columns: 1fr;
  }

  .nav-link {
    width: 100%;
    min-height: 58px;
    padding: 0 1.05rem;
    border-radius: 20px;
    justify-content: flex-start;
  }

  .nav-action-group {
    min-width: 0;
  }

  .submenu-nav {
    min-width: 0;
  }

  .submenu-inline.is-open {
    position: fixed;
    inset: 0;
    z-index: 260;
    display: grid;
    align-content: start;
    gap: 12px;
    margin: 0;
    padding: max(18px, env(safe-area-inset-top)) 14px max(22px, env(safe-area-inset-bottom));
    overflow-y: auto;
    border: 0;
    border-radius: 0;
    background:
      radial-gradient(circle at 18% 0%, rgba(110, 168, 254, 0.2), transparent 34%),
      linear-gradient(180deg, rgba(8, 12, 20, 0.99), rgba(10, 16, 29, 0.99));
    box-shadow: none;
  }

  .submenu-mobile-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    margin-bottom: 4px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: rgba(15, 23, 40, 0.92);
    box-shadow: var(--shadow);
  }

  .submenu-mobile-head strong {
    display: block;
    font-size: 1.05rem;
    line-height: 1.15;
    letter-spacing: -0.03em;
  }

  .submenu-mobile-head small {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.35;
  }

  .submenu-mobile-back {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(13, 21, 39, 0.94);
    color: var(--ink);
    font-weight: 800;
  }

  .submenu-mobile-back::before {
    content: "‹";
    margin-right: 6px;
    font-size: 1.25rem;
    line-height: 0;
  }

  .panel,
  .hero-panel,
  .modal-card {
    padding: 20px;
  }

  .compact-panel {
    padding: 18px;
  }

  .hero-panel {
    gap: 18px;
  }

  .hero-panel h2 {
    max-width: none;
    font-size: clamp(1.8rem, 8vw, 2.35rem);
    line-height: 1.06;
  }

  .hero-copy .muted-copy {
    font-size: 0.95rem;
  }

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

  .snapshot-tile {
    padding: 12px;
    border-radius: 16px;
  }

  .snapshot-tile strong {
    font-size: 1.25rem;
  }

  .year-panel-controls {
    width: 100%;
    gap: 10px;
  }

  .year-switcher {
    width: 100%;
  }

  .toolbar-grid {
    grid-auto-columns: minmax(220px, 82vw);
  }

  .panel-heading,
  .modal-head {
    align-items: stretch;
  }

  .catalog-filters {
    width: 100%;
    justify-content: stretch;
  }

  .search-field {
    width: 100%;
  }

  .warehouse-filter-field {
    width: 100%;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    min-width: 0;
  }

  .order-actions-bar {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .action-row > * {
    width: 100%;
    flex: 0 0 auto;
  }

  .action-row .action-group {
    width: 100%;
  }

  .submenu-inline {
    margin-top: 0;
  }

  .order-actions-bar {
    padding: 10px;
  }

  .order-estimate-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .history-edit-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .order-estimate-meta {
    max-width: none;
    text-align: left;
  }

  .order-actions-bar .action-group {
    grid-column: span 1;
  }

  .order-actions-bar .submenu-inline {
    grid-column: 1 / -1;
  }

  .login-cta,
  .topbar-cta {
    width: 100%;
  }

  .year-panel-active {
    min-width: 68px;
    min-height: 46px;
    font-size: 1.05rem;
  }

  thead {
    display: none;
  }

  table,
  tbody,
  .product-row {
    display: block;
  }

  tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .product-row {
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(15, 23, 40, 0.9);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
    overflow: hidden;
  }

  .product-row > td {
    display: none;
    border-bottom: 0;
    padding: 0;
  }

  .product-row > td.product-primary-cell {
    display: block;
  }

  .product-row-toggle {
    min-height: 74px;
    padding: 14px;
    cursor: pointer;
  }

  .product-row-copy {
    display: grid;
    gap: 5px;
  }

  .product-title {
    font-size: 1rem;
    line-height: 1.25;
  }

  .product-row-chevron {
    display: block;
  }

  .product-detail-row td {
    display: block;
    padding: 0 0 14px;
    border-bottom: 0;
  }

  .product-detail-row.is-expanded {
    display: block;
  }

  .product-detail-row.is-expanded td {
    padding: 0 10px 10px;
  }

  .product-detail-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 96px;
    gap: 10px;
    align-items: end;
    padding: 14px;
    border-radius: 18px;
    background: rgba(15, 23, 40, 0.94);
  }

  .product-detail-grid {
    display: contents;
  }

  .product-detail-item strong {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
  }

  .product-detail-quantity input {
    width: 100%;
  }

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

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

  .summary-partial-actions {
    justify-content: stretch;
  }

  .summary-partial-actions button {
    flex: 1 1 100%;
  }

  .summary-group-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .goal-edit-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar-title {
    font-size: 1.8rem;
  }

  .page-title,
  .hero-panel h2,
  .panel h3 {
    font-size: 1.5rem;
  }

  .main-nav-shell {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .year-panel-active {
    display: none;
  }

  .year-switcher button {
    flex: 1 1 calc(50% - 6px);
  }

  .order-actions-bar {
    grid-template-columns: 1fr;
  }

  .order-actions-bar .action-group,
  .order-actions-bar .submenu-inline {
    grid-column: auto;
  }

  .safety-stock-bar,
  .safety-stock-control,
  .safety-stock-bar .button-secondary {
    width: 100%;
  }

  .understock-metrics {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 12px 14px;
    font-size: 0.88rem;
  }
}

html[data-theme="light"] .portal-background {
  background:
    radial-gradient(circle at 12% 18%, rgba(47, 104, 219, 0.1), transparent 24%),
    radial-gradient(circle at 88% 20%, rgba(34, 158, 176, 0.08), transparent 18%),
    radial-gradient(circle at 50% 92%, rgba(210, 85, 85, 0.06), transparent 24%);
}

html[data-theme="light"] .topbar,
html[data-theme="light"] .main-nav,
html[data-theme="light"] .tenant-chip,
html[data-theme="light"] .topbar-status-pill,
html[data-theme="light"] .button-secondary,
html[data-theme="light"] .submenu,
html[data-theme="light"] .submenu-inline,
html[data-theme="light"] .hamburger,
html[data-theme="light"] .mobile-nav-head,
html[data-theme="light"] .mobile-nav-close,
html[data-theme="light"] .main-nav-shell,
html[data-theme="light"] .modal-card,
html[data-theme="light"] .modal-close,
html[data-theme="light"] .order-actions-bar,
html[data-theme="light"] .safety-stock-bar,
html[data-theme="light"] .order-estimate-card,
html[data-theme="light"] .history-edit-banner,
html[data-theme="light"] .field input,
html[data-theme="light"] .field select,
html[data-theme="light"] .field textarea,
html[data-theme="light"] .product-detail-panel,
html[data-theme="light"] .year-panel,
html[data-theme="light"] .year-panel-active,
html[data-theme="light"] .table-wrap {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(24, 36, 56, 0.12);
  color: var(--ink);
}

html[data-theme="light"] .panel,
html[data-theme="light"] .hero-panel,
html[data-theme="light"] .login-panel,
html[data-theme="light"] .order-actions-panel {
  background: var(--panel);
}

html[data-theme="light"] .summary-group,
html[data-theme="light"] .history-group,
html[data-theme="light"] .goal-card,
html[data-theme="light"] .note-card,
html[data-theme="light"] .comparison-grid,
html[data-theme="light"] .summary-kpi,
html[data-theme="light"] .tab-strip,
html[data-theme="light"] .snapshot-tile,
html[data-theme="light"] .supplier-catalog-result,
html[data-theme="light"] .supplier-catalog-library-item,
html[data-theme="light"] .product-editor-item,
html[data-theme="light"] .product-editor-linked-item,
html[data-theme="light"] .copy-button,
html[data-theme="light"] .history-action,
html[data-theme="light"] .year-switcher button,
html[data-theme="light"] .summary-group pre,
html[data-theme="light"] .supplier-pre,
html[data-theme="light"] pre,
html[data-theme="light"] th,
html[data-theme="light"] .field-icon-button,
html[data-theme="light"] .flash {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(24, 36, 56, 0.12);
  color: var(--ink);
}

html[data-theme="light"] .understock-metrics span {
  background: rgba(246, 249, 252, 0.86);
}

html[data-theme="light"] .summary-brand-focus {
  border-color: rgba(23, 142, 86, 0.24);
  background:
    radial-gradient(circle at top right, rgba(40, 199, 111, 0.14), transparent 42%),
    rgba(241, 250, 245, 0.96);
}

html[data-theme="light"] .summary-brand-focus .eyebrow {
  color: #178e56;
}

html[data-theme="light"] .summary-group pre,
html[data-theme="light"] .supplier-pre,
html[data-theme="light"] pre {
  box-shadow: inset 0 0 0 1px rgba(24, 36, 56, 0.06);
}

html[data-theme="light"] .flash {
  box-shadow: 0 18px 40px rgba(44, 72, 114, 0.12);
}

html[data-theme="light"] .toolbar-notification-badge {
  background: rgba(47, 104, 219, 0.16);
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px rgba(47, 104, 219, 0.12);
}

html[data-theme="light"] .product-editor-item.is-active {
  background: rgba(47, 104, 219, 0.12);
  border-color: rgba(47, 104, 219, 0.24);
}

html[data-theme="light"] .product-editor-linked-item.is-active {
  background: rgba(47, 104, 219, 0.12);
  border-color: rgba(47, 104, 219, 0.24);
}

html[data-theme="light"] .product-row,
html[data-theme="light"] .product-row > td,
html[data-theme="light"] .product-row > td.product-primary-cell,
html[data-theme="light"] .product-detail-row td,
html[data-theme="light"] .product-row-toggle {
  background: transparent;
  color: var(--ink);
}

html[data-theme="light"] .product-row.is-expanded,
html[data-theme="light"] .product-row:hover {
  background: rgba(47, 104, 219, 0.06);
}

html[data-theme="light"] .product-row.is-expanded > td.product-primary-cell,
html[data-theme="light"] .product-row:hover > td.product-primary-cell {
  background: rgba(47, 104, 219, 0.04);
}

html[data-theme="light"] .button-secondary:hover,
html[data-theme="light"] .button-secondary:focus-visible,
html[data-theme="light"] .hamburger:hover,
html[data-theme="light"] .mobile-nav-close:hover,
html[data-theme="light"] .modal-close:hover,
html[data-theme="light"] .nav-link:hover,
html[data-theme="light"] .nav-link.is-active {
  background: rgba(47, 104, 219, 0.1);
  border-color: rgba(47, 104, 219, 0.18);
  color: var(--accent-strong);
}

html[data-theme="light"] .status-dot {
  background: rgba(90, 112, 140, 0.45);
}

html[data-theme="light"] .muted-copy,
html[data-theme="light"] .topbar-subtitle,
html[data-theme="light"] .tenant-chip span,
html[data-theme="light"] .tenant-chip small {
  color: var(--muted);
}

html[data-theme="light"] table,
html[data-theme="light"] th,
html[data-theme="light"] td {
  color: var(--ink);
}

html[data-theme="light"] tbody tr:hover {
  background: rgba(47, 104, 219, 0.06);
}

html[data-theme="light"] .product-lot-cell select,
html[data-theme="light"] .product-supplier-cell select,
html[data-theme="light"] .product-detail-item select,
html[data-theme="light"] .product-detail-quantity input,
html[data-theme="light"] .product-detail-callout input,
html[data-theme="light"] .table-wrap input[type="number"] {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(24, 36, 56, 0.14);
  color: var(--ink);
}

html[data-theme="light"] .product-lot-cell select option,
html[data-theme="light"] .product-supplier-cell select option,
html[data-theme="light"] .product-detail-item select option {
  background: #ffffff;
  color: var(--ink);
}

@media (max-width: 820px) {
  html[data-theme="light"] .main-nav,
  html[data-theme="light"] .submenu-inline.is-open {
    background:
      radial-gradient(circle at 18% 0%, rgba(47, 104, 219, 0.12), transparent 34%),
      linear-gradient(180deg, rgba(246, 249, 252, 0.99), rgba(231, 237, 245, 0.99));
  }

  html[data-theme="light"] .submenu-mobile-head,
  html[data-theme="light"] .submenu-mobile-back,
  html[data-theme="light"] .product-row {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(24, 36, 56, 0.12);
    color: var(--ink);
  }

  html[data-theme="light"] .product-detail-panel {
    background: rgba(255, 255, 255, 0.94);
  }
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .main-nav,
html[data-theme="dark"] .tenant-chip,
html[data-theme="dark"] .topbar-status-pill,
html[data-theme="dark"] .button-secondary,
html[data-theme="dark"] .submenu,
html[data-theme="dark"] .submenu-inline,
html[data-theme="dark"] .hamburger,
html[data-theme="dark"] .mobile-nav-head,
html[data-theme="dark"] .mobile-nav-close,
html[data-theme="dark"] .main-nav-shell,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .modal-close,
html[data-theme="dark"] .order-actions-bar,
html[data-theme="dark"] .safety-stock-bar,
html[data-theme="dark"] .order-estimate-card,
html[data-theme="dark"] .history-edit-banner,
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .product-detail-panel,
html[data-theme="dark"] .year-panel,
html[data-theme="dark"] .year-panel-active,
html[data-theme="dark"] .table-wrap {
  background: rgba(15, 23, 40, 0.92);
  border-color: var(--border);
  color: var(--ink);
}

html[data-theme="dark"] .summary-group,
html[data-theme="dark"] .history-group,
html[data-theme="dark"] .goal-card,
html[data-theme="dark"] .note-card,
html[data-theme="dark"] .comparison-grid,
html[data-theme="dark"] .summary-kpi,
html[data-theme="dark"] .tab-strip,
html[data-theme="dark"] .snapshot-tile,
html[data-theme="dark"] .supplier-catalog-result,
html[data-theme="dark"] .supplier-catalog-library-item,
html[data-theme="dark"] .product-editor-item,
html[data-theme="dark"] .product-editor-linked-item,
html[data-theme="dark"] .copy-button,
html[data-theme="dark"] .history-action,
html[data-theme="dark"] .year-switcher button,
html[data-theme="dark"] .summary-group pre,
html[data-theme="dark"] .supplier-pre,
html[data-theme="dark"] pre,
html[data-theme="dark"] th,
html[data-theme="dark"] .field-icon-button,
html[data-theme="dark"] .flash {
  background: rgba(13, 21, 39, 0.96);
  border-color: var(--border);
  color: var(--ink);
}

html[data-theme="dark"] .product-row,
html[data-theme="dark"] .product-row > td,
html[data-theme="dark"] .product-row > td.product-primary-cell,
html[data-theme="dark"] .product-detail-row td,
html[data-theme="dark"] .product-row-toggle {
  background: transparent;
  color: var(--ink);
}
