: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%);
}

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

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

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

.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,
.main-nav,
.page-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.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);
}

.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;
  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: 28px;
}

.main-nav-shell {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(0, 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: minmax(0, 1fr) repeat(3, minmax(0, 1fr));
  align-items: start;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  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;
}

.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;
}

.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-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);
}

.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%);
}

.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-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;
}

.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;
}

.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-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-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(260px, 0.95fr) minmax(0, 1.4fr);
  margin-top: 18px;
}

.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);
}

.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-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;
}

.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) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

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

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

  .main-nav-shell--module {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .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-layout {
    grid-template-columns: 1fr;
  }
}

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

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

  .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;
  }

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

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

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

  .main-nav {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 110;
    width: min(320px, calc(100vw - 28px));
    margin: 0;
    padding: 18px 12px;
    overflow-y: auto;
    transform: translateX(calc(-100% - 18px));
    transition: transform 220ms ease;
  }

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

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

  .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: 12px;
    min-width: 0;
    width: 100%;
    grid-template-columns: 1fr;
    padding: 0;
    overflow: visible;
  }

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

  .nav-link {
    width: 100%;
    min-height: 46px;
    padding: 0 1rem;
    justify-content: flex-start;
  }

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

  .submenu-nav {
    min-width: 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;
  }

  .search-field {
    width: 100%;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    min-width: 0;
  }

  .order-actions-bar {
    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 {
    top: 8px;
    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;
  }

  .product-row {
    border-bottom: 1px solid var(--border);
  }

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

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

  .product-row-toggle {
    padding: 0 2px;
    cursor: pointer;
  }

  .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-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 96px;
    gap: 10px;
    align-items: end;
  }

  .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;
  }

  .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;
  }

  .product-detail-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 92px;
  }

  .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;
  }

  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"] .modal-card,
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"] .button-secondary:hover,
html[data-theme="light"] .button-secondary:focus-visible,
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"] .product-lot-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-detail-item select option {
  background: #ffffff;
  color: var(--ink);
}
