:root {
  --ink: #17211e;
  --ink-soft: #3f4b47;
  --muted: #7b827e;
  --muted-light: #a3aaa6;
  --cream: #f2efe7;
  --cream-deep: #e8e3d8;
  --surface: #fffdf9;
  --paper: #fbf9f3;
  --forest: #163f33;
  --forest-deep: #102f27;
  --forest-light: #245746;
  --sage: #88a798;
  --teal: #397d69;
  --gold: #d8a64f;
  --gold-light: #f4dfb5;
  --coral: #dd705f;
  --coral-light: #f7dfda;
  --line: #e7e2d7;
  --line-dark: #d8d2c6;
  --success: #387c64;
  --warning: #c8872f;
  --danger: #c9584c;
  --shadow-sm: 0 5px 18px rgba(29, 40, 35, .05);
  --shadow-md: 0 16px 45px rgba(29, 40, 35, .09);
  --shadow-lg: 0 28px 80px rgba(18, 32, 27, .14);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --sidebar-width: 242px;
  --sans: "Avenir Next", "SF Pro Display", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --serif: "Iowan Old Style", "Baskerville", "Songti SC", "STSong", serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--cream);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 5%, rgba(216, 166, 79, .07), transparent 28%),
    var(--cream);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button {
  color: inherit;
}

button,
[data-view],
[data-upload],
[data-mapping],
[data-clear] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(57, 125, 105, .22);
  outline-offset: 2px;
}

svg {
  display: block;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 30px 20px 22px;
  color: #f5f1e7;
  background:
    radial-gradient(circle at 0 10%, rgba(126, 173, 149, .18), transparent 35%),
    linear-gradient(168deg, #173f33 0%, #102f27 100%);
  box-shadow: 8px 0 38px rgba(19, 48, 39, .1);
}

.sidebar::after {
  position: absolute;
  right: 0;
  bottom: 12%;
  width: 1px;
  height: 170px;
  content: "";
  background: linear-gradient(transparent, rgba(255,255,255,.18), transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 34px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--gold);
  border: 1px solid rgba(244, 223, 181, .25);
  border-radius: 50%;
  background: rgba(255,255,255,.035);
}

.brand-mark svg {
  width: 34px;
  height: 34px;
}

.brand strong {
  display: block;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .08em;
}

.brand small {
  display: block;
  margin-top: 1px;
  color: rgba(244, 239, 227, .47);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .18em;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  gap: 13px;
  min-height: 48px;
  padding: 0 14px;
  color: rgba(245, 241, 231, .62);
  border: 0;
  border-radius: 11px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, transform .18s ease;
}

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

.nav-item span:not(.nav-count):not(.nav-alert) {
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: .02em;
}

.nav-item:hover {
  color: rgba(255,255,255,.92);
  background: rgba(255,255,255,.06);
  transform: translateX(2px);
}

.nav-item.active {
  color: #fffdf7;
  background: rgba(255,255,255,.1);
}

.nav-item.active::before {
  position: absolute;
  left: -20px;
  width: 3px;
  height: 22px;
  content: "";
  border-radius: 0 4px 4px 0;
  background: var(--gold);
}

.nav-count,
.nav-alert {
  display: grid;
  min-width: 21px;
  height: 21px;
  margin-left: auto;
  padding: 0 5px;
  place-items: center;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 700;
}

.nav-count {
  color: var(--gold-light);
  background: rgba(216,166,79,.13);
}

.nav-alert {
  color: #fff;
  background: var(--coral);
}

.sidebar-spacer {
  flex: 1;
}

.privacy-card {
  display: flex;
  gap: 11px;
  padding: 15px 13px;
  margin-bottom: 20px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: rgba(12, 35, 28, .25);
}

.privacy-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--sage);
  border-radius: 8px;
  background: rgba(136,167,152,.1);
}

.privacy-icon svg {
  width: 17px;
}

.privacy-card strong {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
  font-weight: 600;
}

.privacy-card p {
  margin: 0;
  color: rgba(245,241,231,.44);
  font-size: 9.5px;
  line-height: 1.55;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  color: rgba(245,241,231,.4);
  font-size: 9.5px;
}

.sidebar-footer .version {
  margin-left: auto;
  color: rgba(245,241,231,.22);
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #7fc9a6;
  box-shadow: 0 0 0 3px rgba(127,201,166,.12);
}

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

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

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

.main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  height: 82px;
  align-items: center;
  justify-content: space-between;
  padding: 0 38px;
  border-bottom: 1px solid rgba(213, 207, 195, .78);
  background: rgba(245, 242, 235, .88);
  backdrop-filter: blur(16px);
}

.topbar-title .eyebrow {
  margin-bottom: 2px;
  font-size: 8px;
}

.topbar h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: .03em;
}

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .17em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fx-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,253,249,.78);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}

.fx-pill:hover {
  border-color: var(--line-dark);
  box-shadow: var(--shadow-sm);
}

.fx-pill span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
}

.fx-pill strong {
  font-size: 12px;
}

.fx-pill svg {
  width: 14px;
  color: var(--muted);
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255,255,255,.5);
}

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

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.primary-button {
  color: #fffdf7;
  border: 1px solid var(--forest);
  background: var(--forest);
  box-shadow: 0 6px 16px rgba(22,63,51,.13);
}

.primary-button:hover {
  background: var(--forest-light);
  transform: translateY(-1px);
  box-shadow: 0 9px 22px rgba(22,63,51,.18);
}

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

.secondary-button {
  color: var(--ink-soft);
  border: 1px solid var(--line-dark);
  background: transparent;
}

.secondary-button:hover {
  background: rgba(255,255,255,.56);
  box-shadow: var(--shadow-sm);
}

.ghost-button {
  color: var(--ink);
  border: 0;
  background: transparent;
}

.text-button {
  padding: 0;
  color: var(--muted);
  border: 0;
  background: transparent;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.text-button span {
  display: inline-block;
  margin-left: 3px;
  color: var(--ink);
  transition: transform .15s;
}

.text-button:hover {
  color: var(--ink);
}

.text-button:hover span {
  transform: translateX(3px);
}

.content {
  width: 100%;
  max-width: 1510px;
  padding: 30px 38px 56px;
  margin: 0 auto;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: viewIn .36s ease both;
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal {
  animation: revealUp .5s cubic-bezier(.2,.7,.2,1) both;
}

.metric-card:nth-child(2),
.source-card:nth-child(2) { animation-delay: .04s; }
.metric-card:nth-child(3),
.source-card:nth-child(3) { animation-delay: .08s; }
.metric-card:nth-child(4),
.source-card:nth-child(4) { animation-delay: .12s; }

@keyframes revealUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-card {
  position: relative;
  display: flex;
  min-height: 240px;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  padding: 36px 42px;
  color: #f9f5eb;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 72% 35%, rgba(168, 202, 182, .16), transparent 28%),
    linear-gradient(120deg, #193f34, #15362d 67%, #173328);
  box-shadow: 0 20px 50px rgba(20,53,43,.16);
}

.hero-card::before {
  position: absolute;
  top: -180px;
  right: 12%;
  width: 410px;
  height: 410px;
  content: "";
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 50%;
}

.hero-card::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  content: "";
  background: linear-gradient(transparent, var(--gold), transparent);
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 600px;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 16px;
  color: rgba(249,245,235,.55);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
}

.hero-kicker i {
  width: 20px;
  height: 1px;
  background: var(--gold);
}

.hero-copy h2 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: clamp(33px, 4vw, 48px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -.025em;
}

.hero-copy p {
  max-width: 530px;
  margin: 0;
  color: rgba(249,245,235,.6);
  font-size: 12.5px;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  gap: 8px;
  margin-top: 25px;
}

.primary-button.light {
  color: var(--forest-deep);
  border-color: #f6f0df;
  background: #f6f0df;
  box-shadow: none;
}

.primary-button.light:hover {
  background: #fffaf0;
}

.light-ghost {
  color: rgba(249,245,235,.72);
  border: 1px solid rgba(255,255,255,.11);
  background: rgba(255,255,255,.03);
}

.light-ghost:hover {
  background: rgba(255,255,255,.08);
}

.hero-formula {
  position: relative;
  z-index: 2;
  width: 272px;
  height: 190px;
  flex: 0 0 272px;
}

.orbit {
  position: absolute;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 50%;
}

.orbit-one {
  inset: -9px 1px -9px 1px;
}

.orbit-two {
  inset: 12px 22px;
  border-style: dashed;
  border-color: rgba(216,166,79,.18);
}

.formula-card {
  position: absolute;
  inset: 12px 22px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px 24px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  background: rgba(10, 34, 27, .6);
  box-shadow: 0 22px 45px rgba(8,25,20,.22);
  backdrop-filter: blur(12px);
}

.formula-label {
  color: rgba(249,245,235,.35);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: .18em;
}

.formula-card > strong {
  margin: 4px 0 11px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
}

.formula-line {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(249,245,235,.7);
  font-size: 10px;
}

.formula-line b {
  color: rgba(249,245,235,.3);
  font-weight: 400;
}

.formula-minus {
  margin-top: 4px;
  color: rgba(249,245,235,.52);
  font-size: 10px;
}

.formula-result {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 13px;
  padding-top: 10px;
  color: var(--gold-light);
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 10px;
  font-weight: 600;
}

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

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 19px 20px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255,253,249,.76);
  box-shadow: var(--shadow-sm);
}

.metric-card::after {
  position: absolute;
  right: -28px;
  bottom: -35px;
  width: 90px;
  height: 90px;
  content: "";
  border: 15px solid rgba(22,63,51,.025);
  border-radius: 50%;
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.metric-icon {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: var(--forest);
  border-radius: 9px;
  background: #eef2ed;
}

.metric-icon svg {
  width: 18px;
  height: 18px;
}

.metric-card.revenue .metric-icon {
  color: #a6772e;
  background: #f7eedc;
}

.metric-card.cost .metric-icon {
  color: #8b685b;
  background: #f4ebe6;
}

.metric-card.freight .metric-icon {
  color: #4f6f89;
  background: #eaf0f4;
}

.metric-tag {
  color: var(--muted-light);
  font-size: 9px;
  font-weight: 600;
}

.metric-label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10.5px;
}

.metric-value {
  display: block;
  font-family: var(--serif);
  font-size: clamp(22px, 2vw, 29px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.015em;
}

.metric-card.profit .metric-value {
  color: var(--forest);
}

.metric-card.profit .metric-value.negative {
  color: var(--danger);
}

.metric-card p {
  margin: 5px 0 0;
  color: var(--muted-light);
  font-size: 9px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(310px, .9fr);
  gap: 16px;
  margin-top: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255,253,249,.8);
  box-shadow: var(--shadow-sm);
}

.accounting-panel,
.match-panel,
.recent-panel {
  padding: 23px 25px;
}

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

.panel-header.compact {
  align-items: center;
}

.section-label {
  display: block;
  margin-bottom: 4px;
  color: #afb3ae;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: .16em;
}

.panel h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .015em;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.live-chip,
.safe-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 8.5px;
}

.live-chip i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #60a684;
  box-shadow: 0 0 0 3px rgba(96,166,132,.1);
}

.safe-chip {
  color: var(--success);
  border-color: rgba(56,124,100,.18);
  background: rgba(56,124,100,.05);
}

.accounting-visual {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: center;
  gap: 31px;
  margin-top: 22px;
}

.profit-donut {
  position: relative;
  display: grid;
  width: 166px;
  height: 166px;
  margin: 0 auto;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--forest) 0 35%, var(--gold) 35% 72%, #91a9a0 72% 86%, var(--line) 86% 100%);
  transition: background .6s ease;
}

.profit-donut::before {
  position: absolute;
  inset: 17px;
  content: "";
  border-radius: 50%;
  background: var(--surface);
}

.profit-donut::after {
  position: absolute;
  inset: 17px;
  content: "";
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 50%;
}

.donut-center {
  position: relative;
  z-index: 1;
  text-align: center;
}

.donut-center span {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.donut-center strong {
  display: block;
  margin-top: 1px;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.breakdown-row > div:first-child {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.breakdown-row i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--forest);
}

.breakdown-row i.dot-cost {
  background: var(--gold);
}

.breakdown-row i.dot-freight {
  background: #91a9a0;
}

.breakdown-row span {
  color: var(--muted);
  font-size: 10px;
}

.breakdown-row strong {
  font-size: 11px;
  font-weight: 600;
}

.bar-track {
  height: 5px;
  overflow: hidden;
  border-radius: 4px;
  background: #eeece5;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--forest);
  transition: width .55s cubic-bezier(.2,.8,.2,1);
}

.bar-track span.cost-bar {
  background: var(--gold);
}

.bar-track span.freight-bar {
  background: #91a9a0;
}

.formula-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  margin-top: 20px;
  border: 1px dashed var(--line-dark);
  border-radius: 9px;
  background: rgba(248,246,240,.74);
}

.formula-chip {
  color: var(--muted);
  font-size: 8.5px;
}

.formula-chip b {
  color: var(--ink-soft);
}

.formula-chip.result {
  margin-left: auto;
  color: var(--forest);
  font-weight: 700;
}

.formula-strip > i {
  color: #b7b7b1;
  font-size: 10px;
  font-style: normal;
}

.match-score-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 22px;
}

.match-score {
  position: relative;
  width: 118px;
  height: 118px;
  flex: 0 0 118px;
}

.match-score svg {
  width: 118px;
  height: 118px;
  transform: rotate(-90deg);
}

.match-score circle {
  fill: none;
  stroke-width: 8;
}

.score-bg {
  stroke: #ebe9e2;
}

.score-value {
  stroke: var(--forest);
  stroke-linecap: round;
  stroke-dasharray: 314.16;
  stroke-dashoffset: 314.16;
  transition: stroke-dashoffset .7s ease;
}

.match-score > div {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.match-score strong {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
}

.match-score span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 8px;
}

.match-stats {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 10px;
}

.match-stats > div {
  display: grid;
  grid-template-columns: 7px 1fr auto;
  align-items: center;
  gap: 8px;
}

.match-stats span:not(.status-dot) {
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-stats strong {
  font-size: 10.5px;
}

.match-note {
  padding: 10px 12px;
  margin-top: 18px;
  color: var(--muted);
  border-radius: 8px;
  background: #f6f3ec;
  font-size: 9.5px;
  line-height: 1.55;
}

.recent-panel {
  margin-top: 16px;
}

.compact-table-wrap {
  overflow-x: auto;
  margin: 18px -25px -23px;
}

.compact-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
}

.compact-table th {
  padding: 9px 14px;
  color: var(--muted-light);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(247,244,237,.65);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .04em;
  text-align: left;
}

.compact-table th:first-child,
.compact-table td:first-child {
  padding-left: 25px;
}

.compact-table th:last-child,
.compact-table td:last-child {
  padding-right: 25px;
}

.compact-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #efebe3;
  font-size: 10.5px;
}

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

.compact-table .empty-row td {
  padding: 0;
}

.table-empty {
  display: flex;
  min-height: 150px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.table-empty p {
  margin: 10px 0 5px;
  color: var(--muted);
  font-size: 10.5px;
}

.empty-illustration {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: #9ba7a1;
  border-radius: 50%;
  background: #f0f2ed;
}

.empty-illustration.small {
  width: 40px;
  height: 40px;
}

.empty-illustration svg {
  width: 27px;
}

.empty-illustration.small svg {
  width: 24px;
}

.view-intro,
.view-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 23px;
}

.view-intro h2,
.view-heading h2,
.help-hero h2 {
  margin: 3px 0 6px;
  font-family: var(--serif);
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -.015em;
}

.view-intro p,
.view-heading p,
.help-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
}

.intro-actions,
.heading-actions {
  display: flex;
  gap: 9px;
  flex: 0 0 auto;
}

.auto-import-card {
  display: flex;
  align-items: center;
  gap: 21px;
  padding: 22px 25px;
  margin-bottom: 16px;
  color: #f9f6ee;
  border-radius: var(--radius-md);
  background:
    linear-gradient(115deg, rgba(216,166,79,.08), transparent 35%),
    var(--forest);
  box-shadow: 0 14px 35px rgba(20,54,43,.13);
}

.auto-icon {
  display: grid;
  width: 57px;
  height: 57px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--gold-light);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 15px;
  background: rgba(255,255,255,.06);
}

.auto-icon svg {
  width: 29px;
}

.auto-copy {
  flex: 1;
}

.auto-copy h3 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
}

.auto-copy p {
  margin: 0;
  color: rgba(249,246,238,.54);
  font-size: 10.5px;
}

.auto-hints {
  display: flex;
  gap: 15px;
  margin-top: 9px;
}

.auto-hints span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(249,246,238,.38);
  font-size: 8px;
}

.auto-hints i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--sage);
}

.auto-import-card .primary-button {
  color: var(--forest);
  border-color: #f6f0df;
  background: #f6f0df;
  box-shadow: none;
}

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

.source-card {
  position: relative;
  display: flex;
  min-height: 240px;
  flex-direction: column;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255,253,249,.82);
  box-shadow: var(--shadow-sm);
  transition: border-color .16s, transform .16s, box-shadow .16s;
}

.source-card:hover {
  border-color: #d9d3c5;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.source-card.drag-over,
.auto-import-card.drag-over {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(216,166,79,.12), var(--shadow-md);
}

.source-card.imported {
  border-color: rgba(56,124,100,.28);
  background: linear-gradient(150deg, rgba(255,253,249,.9), rgba(238,247,242,.68));
}

.source-card.error {
  border-color: rgba(201,88,76,.3);
}

.source-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.source-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--forest);
  border-radius: 12px;
}

.source-icon svg {
  width: 23px;
}

.source-icon.platform {
  background: #eaf1eb;
}

.source-icon.erp {
  color: #a8701e;
  background: #f8efd9;
}

.source-icon.logistics {
  color: #4e718e;
  background: #eaf1f5;
}

.source-icon.cost {
  color: #96685a;
  background: #f5eae4;
}

.source-index {
  color: #d1cec6;
  font-family: var(--serif);
  font-size: 12px;
}

.source-required {
  align-self: flex-start;
  padding: 2px 6px;
  margin-top: 17px;
  color: var(--success);
  border-radius: 5px;
  background: rgba(56,124,100,.07);
  font-size: 7.5px;
  font-weight: 700;
}

.source-required.optional-tag {
  color: var(--muted);
  background: #f2f0ea;
}

.source-card h3 {
  margin: 7px 0 3px;
  font-size: 13.5px;
  font-weight: 600;
}

.source-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
}

.source-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 9px;
}

.source-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c5c5bf;
}

.source-card.imported .source-status {
  color: var(--success);
}

.source-card.imported .source-status i {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(56,124,100,.08);
}

.source-card.error .source-status {
  color: var(--danger);
}

.source-card.error .source-status i {
  background: var(--danger);
}

.source-meta {
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted-light);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 14px;
}

.source-upload {
  display: inline-flex;
  height: 32px;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  color: var(--ink-soft);
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  background: rgba(255,255,255,.5);
  font-size: 9.5px;
  font-weight: 600;
  cursor: pointer;
}

.source-upload span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.source-card.imported .source-upload {
  color: var(--success);
  border-color: rgba(56,124,100,.2);
}

.mini-button {
  height: 27px;
  padding: 0 8px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  font-size: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.mini-button:hover {
  color: var(--ink);
  border-color: var(--line-dark);
  background: rgba(255,255,255,.5);
}

.mini-button.danger:hover {
  color: var(--danger);
  border-color: rgba(201,88,76,.2);
}

.mini-button.accent {
  height: 30px;
  padding: 0 10px;
  color: var(--forest);
  border-color: rgba(56,124,100,.22);
  background: rgba(56,124,100,.055);
  font-weight: 600;
}

.mini-button.accent:hover {
  border-color: rgba(56,124,100,.38);
  background: rgba(56,124,100,.1);
}

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

.settings-panel {
  padding: 21px 23px;
}

.settings-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--muted);
  border-radius: 9px;
  background: #f3f1eb;
}

.settings-icon svg {
  width: 18px;
}

.settings-description {
  margin: 15px 0 10px;
  color: var(--muted);
  font-size: 9.5px;
}

.rate-input-wrap {
  display: flex;
  height: 46px;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9f7f1;
}

.rate-input-wrap span {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
}

.rate-input-wrap b {
  color: var(--muted-light);
  font-weight: 400;
}

.rate-input-wrap input {
  width: 70px;
  height: 29px;
  margin-left: auto;
  color: var(--forest);
  border: 1px solid var(--line-dark);
  border-radius: 7px;
  background: #fff;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}

.priority-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 16px 0 11px;
}

.priority-list > div {
  display: grid;
  grid-template-columns: 22px 90px 1fr;
  align-items: center;
  gap: 9px;
}

.priority-list > div > span {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  color: var(--forest);
  border-radius: 50%;
  background: #eaf1eb;
  font-size: 8px;
  font-weight: 700;
}

.priority-list strong {
  font-size: 9.5px;
  font-weight: 600;
}

.priority-list small {
  color: var(--muted-light);
  font-size: 8.5px;
}

.mapping-summary {
  padding: 22px 24px;
  margin-top: 16px;
}

.mapping-note {
  color: var(--muted-light);
  font-size: 9px;
}

.mapping-summary-empty {
  padding: 28px 18px;
  color: var(--muted-light);
  text-align: center;
  font-size: 10px;
}

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

.mapping-chip-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(249,247,241,.65);
}

.mapping-chip-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.mapping-chip-card strong {
  font-size: 9.5px;
}

.mapping-chip-card button {
  padding: 0;
  color: var(--success);
  border: 0;
  background: transparent;
  font-size: 8px;
  cursor: pointer;
}

.field-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.field-pills span {
  max-width: 100%;
  overflow: hidden;
  padding: 3px 6px;
  color: var(--muted);
  border-radius: 4px;
  background: #efede7;
  font-size: 7.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-pills span.missing {
  color: var(--danger);
  background: var(--coral-light);
}

.result-summary-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255,253,249,.72);
}

.result-summary-row > div {
  padding: 15px 20px;
  border-right: 1px solid var(--line);
}

.result-summary-row > div:last-child {
  border-right: 0;
}

.result-summary-row span {
  display: block;
  color: var(--muted);
  font-size: 8.5px;
}

.result-summary-row strong {
  display: block;
  margin-top: 2px;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
}

.orders-panel {
  overflow: hidden;
}

.orders-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.search-wrap {
  display: flex;
  width: min(290px, 32%);
  height: 37px;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #faf8f3;
}

.search-wrap svg {
  width: 16px;
  color: var(--muted-light);
}

.search-wrap input {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 10px;
}

.search-wrap input::placeholder {
  color: #aaa;
}

.segmented-filter {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f5f2eb;
}

.segmented-filter button {
  height: 29px;
  padding: 0 11px;
  color: var(--muted);
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 9px;
  cursor: pointer;
}

.segmented-filter button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 5px rgba(30,40,36,.09);
}

.select-control {
  height: 37px;
  padding: 0 29px 0 10px;
  margin-left: auto;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #faf8f3;
  font-size: 9px;
  cursor: pointer;
}

.select-control + .select-control {
  margin-left: 0;
}

.data-table-wrap {
  max-height: max(390px, calc(100vh - 355px));
  overflow: auto;
}

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

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 3;
}

.data-table th {
  padding: 10px 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: #f7f4ed;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .03em;
  text-align: left;
  white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 18px;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 18px;
}

.data-table th.num,
.data-table td.num {
  text-align: right;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eeeae2;
  font-size: 9.5px;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background .13s;
}

.data-table tbody tr:hover {
  background: rgba(238,242,237,.55);
}

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

.product-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
}

.product-thumb {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  overflow: hidden;
  place-items: center;
  color: #8ba096;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f2efe7;
  font-size: 10px;
}

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

.product-cell-info {
  min-width: 0;
}

.product-cell-info strong {
  display: block;
  max-width: 195px;
  overflow: hidden;
  font-size: 9.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-cell-info span {
  display: block;
  max-width: 195px;
  overflow: hidden;
  margin-top: 1px;
  color: var(--muted-light);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-id-line {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 7.5px;
  margin-top: 3px;
}

.order-id-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.merge-badge {
  flex: 0 0 auto;
  padding: 2px 5px;
  color: #9a6825;
  border-radius: 4px;
  background: #f8edd9;
  font-size: 6.5px;
  font-weight: 600;
}

.style-tags {
  display: flex;
  max-width: 135px;
  flex-wrap: wrap;
  gap: 3px;
}

.style-tag,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 5px;
  font-size: 8px;
  white-space: nowrap;
}

.style-tag {
  color: var(--forest);
  background: #eaf1eb;
}

.style-tag.unknown {
  color: var(--warning);
  background: #faf0df;
}

.money {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.money.positive {
  color: var(--success);
  font-weight: 600;
}

.money.negative {
  color: var(--danger);
  font-weight: 600;
}

.money.muted {
  color: var(--muted-light);
}

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

.status-badge.complete {
  color: var(--success);
  background: rgba(56,124,100,.075);
}

.status-badge.review {
  color: var(--warning);
  background: rgba(200,135,47,.08);
}

.status-badge.missing {
  color: var(--danger);
  background: rgba(201,88,76,.075);
}

.row-arrow {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--muted-light);
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 13px;
}

.data-table tr:hover .row-arrow {
  color: var(--forest);
  background: #e9efea;
}

.table-footer {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 8.5px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination button {
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 8.5px;
  cursor: pointer;
}

.pagination button:hover {
  border-color: var(--line);
}

.pagination button.active {
  color: #fff;
  background: var(--forest);
}

.pagination button:disabled {
  opacity: .35;
  cursor: default;
}

.funnel-card {
  display: flex;
  align-items: center;
  padding: 23px 27px;
  margin-bottom: 16px;
  color: #f8f5ec;
  border-radius: var(--radius-md);
  background: var(--forest);
  box-shadow: 0 14px 35px rgba(20,54,43,.12);
}

.funnel-step {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 11px;
}

.funnel-step > span {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--gold-light);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  font-size: 8px;
}

.funnel-step small {
  display: block;
  color: rgba(248,245,236,.42);
  font-size: 8px;
}

.funnel-step strong {
  display: block;
  margin-top: 1px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
}

.funnel-status {
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
}

.funnel-status.ok {
  background: #8ac2a5;
}

.funnel-status.warning {
  background: var(--gold);
}

.funnel-status.danger {
  background: var(--coral);
}

.funnel-line {
  width: 7%;
  height: 1px;
  margin: 0 20px;
  background: rgba(255,255,255,.12);
}

.funnel-line span {
  display: block;
  width: 38%;
  height: 100%;
  background: rgba(216,166,79,.55);
}

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

.exception-panel {
  padding: 19px;
}

.exception-head {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 11px;
}

.exception-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
}

.exception-icon svg {
  width: 20px;
}

.exception-icon.danger {
  color: var(--danger);
  background: var(--coral-light);
}

.exception-icon.warning {
  color: var(--warning);
  background: #f9eedf;
}

.exception-icon.neutral {
  color: #6e7f84;
  background: #edf1f1;
}

.exception-head h3 {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
}

.exception-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 8.5px;
}

.exception-head > strong {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 500;
}

.exception-list {
  display: flex;
  min-height: 130px;
  flex-direction: column;
  gap: 6px;
  margin-top: 16px;
}

.exception-empty {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  color: var(--muted-light);
  font-size: 9px;
  text-align: center;
}

.exception-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 9px;
  border-radius: 7px;
  background: #f8f5ef;
}

.exception-item div {
  min-width: 0;
}

.exception-item strong {
  display: block;
  overflow: hidden;
  font-size: 8.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exception-item span {
  display: block;
  overflow: hidden;
  color: var(--muted-light);
  font-size: 7.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exception-item button {
  flex: 0 0 auto;
  padding: 0;
  color: var(--muted);
  border: 0;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.exception-item:hover button {
  color: var(--forest);
}

.style-review-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 104px;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid #eee9df;
  border-radius: 9px;
  background: #faf8f3;
}

#missing-style-list {
  max-height: 430px;
  overflow-y: auto;
  padding-right: 2px;
}

.style-review-thumb {
  display: grid;
  width: 54px;
  height: 54px;
  overflow: hidden;
  padding: 0;
  place-items: center;
  color: var(--muted-light);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f0ede6;
  font-size: 7px;
  cursor: zoom-in;
}

.style-review-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.style-review-copy {
  min-width: 0;
}

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

.style-review-copy strong {
  color: var(--ink-soft);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  font-weight: 600;
}

.style-review-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 7.5px;
}

.style-review-select {
  width: 104px;
  height: 31px;
  padding: 0 22px 0 7px;
  color: var(--forest);
  border: 1px solid rgba(56,124,100,.2);
  border-radius: 7px;
  background: rgba(255,255,255,.78);
  font-size: 8px;
  cursor: pointer;
}

.rule-explanation {
  padding: 21px 23px;
  margin-top: 16px;
}

.logic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 18px;
}

.logic-grid > div {
  display: grid;
  grid-template-columns: 27px 1fr;
  align-items: center;
  column-gap: 9px;
}

.logic-number {
  display: grid;
  width: 27px;
  height: 27px;
  grid-row: span 2;
  place-items: center;
  color: var(--forest);
  border-radius: 8px;
  background: #eaf1eb;
  font-family: var(--serif);
  font-size: 11px;
}

.logic-grid strong {
  font-size: 10px;
  font-weight: 600;
}

.logic-grid p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.5;
}

.rule-summary {
  display: grid;
  grid-template-columns: 1fr 130px 130px;
  align-items: center;
  gap: 20px;
  padding: 22px 26px;
  margin-bottom: 16px;
  color: #f7f4ea;
  border-radius: var(--radius-md);
  background:
    linear-gradient(105deg, rgba(216,166,79,.12), transparent 34%),
    var(--forest);
}

.rule-summary-copy {
  display: flex;
  align-items: center;
  gap: 17px;
}

.rule-illustration {
  display: grid;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--gold-light);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
}

.rule-illustration svg {
  width: 44px;
}

.rule-summary h3 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
}

.rule-summary p {
  max-width: 630px;
  margin: 0;
  color: rgba(247,244,234,.48);
  font-size: 9.5px;
  line-height: 1.55;
}

.rule-stat {
  padding-left: 20px;
  border-left: 1px solid rgba(255,255,255,.1);
}

.rule-stat span {
  display: block;
  color: rgba(247,244,234,.45);
  font-size: 8px;
}

.rule-stat strong {
  display: block;
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 500;
}

.rules-panel {
  overflow: hidden;
}

.rules-panel > .panel-header {
  padding: 21px 22px;
}

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

.rules-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

.rules-table th {
  padding: 9px 18px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f7f4ed;
  font-size: 8px;
  font-weight: 600;
  text-align: left;
}

.rules-table td {
  padding: 12px 18px;
  border-bottom: 1px solid #eeeae2;
  font-size: 9.5px;
}

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

.style-name-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.style-swatch {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: var(--forest);
  border-radius: 9px;
  background: #edf2ed;
}

.style-swatch svg {
  width: 20px;
}

.inline-input {
  width: 100%;
  min-width: 90px;
  height: 32px;
  padding: 0 9px;
  color: var(--ink-soft);
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  font-size: 9px;
}

.inline-input:hover,
.inline-input:focus {
  border-color: var(--line);
  background: #fff;
}

.cost-input-wrap {
  display: inline-flex;
  width: 93px;
  height: 32px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #faf8f3;
}

.cost-input-wrap span {
  color: var(--muted);
  font-size: 9px;
}

.cost-input-wrap input {
  width: 100%;
  min-width: 0;
  padding: 0 0 0 4px;
  color: var(--ink);
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 10px;
  font-weight: 600;
}

.enabled-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--success);
  font-size: 8px;
}

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

.enabled-toggle.off {
  color: var(--muted-light);
}

.delete-rule {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--muted-light);
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 15px;
  cursor: pointer;
}

.delete-rule:hover {
  color: var(--danger);
  background: var(--coral-light);
}

.sku-cost-panel {
  padding: 21px 22px;
  margin-top: 16px;
}

.sku-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-top: 16px;
}

.sku-cost-card {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf8f3;
}

.sku-cost-card strong {
  display: block;
  overflow: hidden;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sku-cost-card span {
  color: var(--muted);
  font-size: 8px;
}

.sku-cost-card b {
  float: right;
  font-size: 9px;
}

.sku-cost-table-wrap {
  overflow-x: auto;
  margin: 17px -22px -21px;
}

.sku-cost-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.sku-cost-table th {
  padding: 9px 14px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f7f4ed;
  font-size: 8px;
  font-weight: 600;
  text-align: left;
}

.sku-cost-table th:first-child,
.sku-cost-table td:first-child {
  padding-left: 22px;
}

.sku-cost-table th:last-child,
.sku-cost-table td:last-child {
  padding-right: 22px;
}

.sku-cost-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #eeeae2;
  font-size: 9px;
}

.sku-cost-table tr:last-child td {
  border-bottom: 0;
}

.sku-cost-table .inline-input {
  min-width: 150px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.sku-cost-table .manual-style-input {
  font-family: var(--sans) !important;
}

.cost-source-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  color: var(--success);
  border-radius: 5px;
  background: rgba(56,124,100,.07);
  font-size: 7.5px;
  white-space: nowrap;
}

.cost-source-pill.imported {
  color: #8c6a35;
  background: #f7efdf;
}

.cost-row-action {
  padding: 0 6px;
  color: var(--muted);
  border: 0;
  background: transparent;
  font-size: 8px;
  cursor: pointer;
}

.cost-row-action:hover {
  color: var(--forest);
}

.cost-row-action.danger:hover {
  color: var(--danger);
}

.sku-cost-empty {
  display: flex;
  min-height: 135px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.sku-cost-empty p {
  margin: 7px 0 9px;
  color: var(--muted);
  font-size: 9px;
}

.sku-cost-empty strong {
  color: var(--ink-soft);
  font-size: 10px;
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 21px;
  margin-top: 16px;
  border: 1px dashed #dbd3c6;
  border-radius: 12px;
}

.danger-zone strong {
  display: block;
  font-size: 10px;
}

.danger-zone p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 8.5px;
}

.danger-text {
  color: var(--danger);
}

.vg-heading {
  align-items: center;
}

.vg-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr);
  gap: 16px;
  align-items: stretch;
}

.vg-calculator-panel {
  padding: 23px 24px;
}

.vg-form-block {
  margin-top: 21px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.vg-block-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 13px;
}

.vg-block-title span {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  color: var(--success);
  border-radius: 6px;
  background: rgba(56,124,100,.08);
  font-size: 7px;
  font-weight: 700;
}

.vg-block-title strong {
  font-size: 10px;
  font-weight: 600;
}

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

.vg-field {
  display: block;
}

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

.vg-field > span {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 8.5px;
}

.vg-field > span small {
  color: var(--muted-light);
  font-size: 7px;
}

.vg-field > input,
.vg-number-input {
  width: 100%;
  height: 39px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf8f3;
  font-size: 10px;
}

.vg-select {
  padding: 0 30px 0 10px;
  color: var(--ink-soft) !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  background: #faf8f3 !important;
  font-size: 9px !important;
  font-weight: 500 !important;
  cursor: pointer;
}

.vg-field > input {
  padding: 0 11px;
}

.vg-number-input {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
}

.vg-number-input b {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.vg-number-input input {
  width: 100%;
  min-width: 0;
  padding: 0;
  color: var(--ink);
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11px;
  font-weight: 600;
}

.vg-number-input:focus-within,
.vg-field > input:focus {
  border-color: rgba(56,124,100,.45);
  box-shadow: 0 0 0 3px rgba(56,124,100,.08);
}

.vg-number-input:has(input:disabled) {
  opacity: .45;
  background: #efede7;
}

.vg-formula-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 12px;
  margin-top: 20px;
  color: var(--muted);
  border: 1px dashed var(--line-dark);
  border-radius: 8px;
  background: #f8f5ef;
  font-size: 8.5px;
  line-height: 1.55;
}

.vg-formula-note span {
  flex: 0 0 auto;
  color: var(--success);
  font-weight: 600;
}

.vg-formula-note p {
  margin: 0;
}

.vg-fixed-rules {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 15px;
}

.vg-fixed-rules span {
  padding: 8px 9px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8f5ef;
  font-size: 8px;
  text-align: center;
}

.vg-fixed-rules b {
  display: block;
  margin-bottom: 1px;
  color: var(--ink-soft);
  font-size: 7px;
  font-weight: 500;
}

.vg-carrier-selector {
  margin-top: 15px;
}

.vg-carrier-selector-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 8.5px;
}

.vg-carrier-selector-label small {
  color: var(--muted-light);
  font-size: 7px;
}

.vg-carrier-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.vg-carrier-options label {
  display: flex;
  height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #faf8f3;
  font-size: 8.5px;
  cursor: pointer;
}

.vg-carrier-options label:has(input:checked) {
  color: var(--forest);
  border-color: rgba(56,124,100,.28);
  background: rgba(234,241,235,.72);
}

.vg-carrier-options label.compare {
  color: #966a2c;
  border-color: rgba(216,166,79,.2);
  background: #fbf4e7;
}

.vg-carrier-options input {
  width: 12px;
  height: 12px;
  margin: 0;
  accent-color: var(--forest);
}

.vg-carrier-hint {
  margin: 7px 0 0;
  color: var(--muted-light);
  font-size: 7.5px;
  line-height: 1.55;
}

.vg-logistics-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-top: 12px;
  border-radius: 8px;
  background: var(--line);
}

.vg-logistics-preview > div {
  padding: 9px 10px;
  background: #f8f5ef;
}

.vg-logistics-preview span {
  display: block;
  color: var(--muted);
  font-size: 7px;
}

.vg-logistics-preview strong {
  display: block;
  margin-top: 2px;
  color: var(--forest);
  font-size: 10px;
}

.vg-result-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
}

.vg-profit-card {
  flex: 1;
  padding: 24px;
  color: #f8f4ea;
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 90% 3%, rgba(216,166,79,.16), transparent 35%),
    var(--forest);
  box-shadow: 0 16px 38px rgba(20,54,43,.14);
}

.vg-profit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(248,244,234,.42);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: .13em;
}

.vg-profit-status {
  padding: 4px 7px;
  color: var(--gold-light);
  border: 1px solid rgba(244,223,181,.2);
  border-radius: 5px;
  background: rgba(255,255,255,.04);
  font-size: 7px;
  font-weight: 500;
  letter-spacing: 0;
}

.vg-profit-status.negative {
  color: #ffd4cc;
  border-color: rgba(255,212,204,.2);
}

.vg-profit-card > strong {
  display: block;
  margin: 16px 0 4px;
  font-family: var(--serif);
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -.025em;
}

.vg-profit-card > strong.negative {
  color: #ffd0c8;
}

.vg-profit-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(248,244,234,.5);
  font-size: 9px;
}

.vg-profit-meta b {
  color: var(--gold-light);
  font-size: 11px;
}

.vg-best-country {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  margin-top: 13px;
  color: var(--gold-light);
  border: 1px solid rgba(244,223,181,.2);
  border-radius: 7px;
  background: rgba(255,255,255,.045);
  font-size: 9px;
}

.vg-profit-bars {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding-top: 18px;
  margin-top: 22px;
  border-top: 1px solid rgba(255,255,255,.09);
}

.vg-profit-bars > div {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 69px;
  align-items: center;
  gap: 9px;
}

.vg-profit-bars span {
  color: rgba(248,244,234,.5);
  font-size: 8px;
}

.vg-profit-bars strong {
  color: rgba(248,244,234,.78);
  font-size: 9px;
  font-weight: 500;
  text-align: right;
}

.vg-bar {
  height: 5px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255,255,255,.1);
}

.vg-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
  transition: width .35s ease;
}

.vg-bar.cost i {
  background: #93a9a0;
}

.vg-summary-panel {
  padding: 17px 19px;
}

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

.vg-summary-grid > div {
  padding: 8px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.vg-summary-grid > div:nth-child(2n) {
  border-right: 0;
}

.vg-summary-grid > div:nth-last-child(-n+2) {
  border-bottom: 0;
}

.vg-summary-grid span,
.vg-break-even span {
  display: block;
  color: var(--muted);
  font-size: 7.5px;
}

.vg-summary-grid strong {
  display: block;
  margin-top: 2px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
}

.vg-break-even {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  margin-top: 13px;
  overflow: hidden;
  border-radius: 9px;
  background: var(--line);
}

.vg-break-even > div {
  padding: 10px 12px;
  background: #f8f5ef;
}

.vg-break-even strong {
  display: block;
  margin-top: 2px;
  color: var(--forest);
  font-size: 12px;
}

.vg-calculation-line {
  padding: 9px 11px;
  margin-top: 10px;
  overflow: hidden;
  color: var(--muted);
  border-radius: 7px;
  background: #f5f2eb;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vg-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 16px;
  margin-top: 16px;
}

.vg-country-results {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.vg-sensitivity-panel,
.vg-history-panel {
  overflow: hidden;
}

.vg-sensitivity-panel > .panel-header,
.vg-history-panel > .panel-header {
  padding: 20px 21px;
}

.vg-country-picker {
  padding: 0 21px 15px;
  border-bottom: 1px solid var(--line);
}

.vg-country-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.vg-country-picker-head strong {
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 600;
}

.vg-country-picker-head strong span {
  margin-left: 5px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
}

.vg-country-picker-head > div {
  display: flex;
  gap: 5px;
}

.vg-country-options {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
}

.vg-country-option {
  display: flex;
  min-width: 0;
  height: 28px;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #faf8f3;
  font-size: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.vg-country-option:has(input:checked) {
  color: var(--forest);
  border-color: rgba(56,124,100,.24);
  background: rgba(234,241,235,.7);
}

.vg-country-option input {
  width: 11px;
  height: 11px;
  margin: 0;
  accent-color: var(--forest);
}

.vg-country-option span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.vg-country-option small {
  margin-left: auto;
  color: var(--success);
  font-size: 6px;
}

.vg-country-empty {
  padding: 28px 20px !important;
  color: var(--muted);
  text-align: center;
}

.vg-sensitivity-table-wrap,
.vg-history-wrap {
  overflow-x: auto;
}

.vg-sensitivity-table,
.vg-history-table {
  width: 100%;
  min-width: 530px;
  border-collapse: collapse;
}

.vg-sensitivity-table {
  min-width: 880px;
}

.vg-sensitivity-table th,
.vg-history-table th {
  padding: 8px 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f7f4ed;
  font-size: 7.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.vg-sensitivity-table td,
.vg-history-table td {
  padding: 9px 13px;
  border-bottom: 1px solid #eeeae2;
  color: var(--ink-soft);
  font-size: 8.5px;
  white-space: nowrap;
}

.vg-sensitivity-table tr:last-child td,
.vg-history-table tr:last-child td {
  border-bottom: 0;
}

.vg-sensitivity-table tr.current {
  background: rgba(234,241,235,.55);
}

.vg-sensitivity-table tr.current td:first-child {
  color: var(--success);
  font-weight: 600;
}

.vg-profit-text {
  color: var(--success);
  font-weight: 600;
}

.vg-loss-text {
  color: var(--danger);
  font-weight: 600;
}

.vg-unavailable {
  color: var(--muted-light) !important;
  text-align: center;
}

.vg-eu-badge {
  display: inline-block;
  padding: 1px 4px;
  margin-left: 2px;
  color: var(--success);
  border-radius: 3px;
  background: rgba(56,124,100,.08);
  font-size: 6px;
  font-weight: 600;
  vertical-align: 1px;
}

.vg-carrier-badge {
  display: inline-block;
  padding: 3px 6px;
  color: #6e552c;
  border-radius: 4px;
  background: #f8efdf;
  font-size: 7.5px;
  font-weight: 600;
  white-space: nowrap;
}

.vg-history-table {
  min-width: 650px;
}

.vg-history-empty td {
  padding: 28px 15px !important;
  color: var(--muted-light);
  text-align: center;
}

.vg-record-name {
  display: block;
  max-width: 155px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vg-record-time {
  display: block;
  margin-top: 2px;
  color: var(--muted-light);
  font-size: 7px;
}

.vg-delete-record {
  padding: 0;
  color: var(--muted-light);
  border: 0;
  background: transparent;
  font-size: 13px;
  cursor: pointer;
}

.vg-delete-record:hover {
  color: var(--danger);
}

.help-hero {
  padding: 7px 0 23px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.guide-grid article {
  position: relative;
  overflow: hidden;
  min-height: 155px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255,253,249,.8);
}

.guide-grid article > span {
  display: inline-grid;
  width: 27px;
  height: 27px;
  place-items: center;
  color: var(--forest);
  border-radius: 50%;
  background: #eaf1eb;
  font-size: 8px;
  font-weight: 700;
}

.guide-grid h3 {
  margin: 15px 0 5px;
  font-family: var(--serif);
  font-size: 16px;
}

.guide-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.65;
}

.faq-panel {
  padding: 23px 25px;
  margin-top: 16px;
}

.faq-panel h3 {
  margin-bottom: 13px;
}

.faq-panel details {
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.faq-panel summary {
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.faq-panel details p {
  max-width: 860px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.7;
}

.faq-panel code {
  padding: 1px 4px;
  border-radius: 4px;
  background: #f0ede6;
  font-size: 8.5px;
}

.formula-reference {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 19px;
  margin-top: 16px;
  color: var(--forest);
  border: 1px dashed rgba(56,124,100,.25);
  border-radius: 11px;
  background: rgba(234,241,235,.65);
}

.formula-reference span {
  padding-right: 15px;
  border-right: 1px solid rgba(56,124,100,.18);
  font-size: 9px;
  font-weight: 600;
}

.formula-reference strong {
  font-size: 9.5px;
  font-weight: 600;
}

.mobile-brand {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(12,24,20,.46);
  backdrop-filter: blur(5px);
  animation: fadeIn .18s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; }
}

.modal {
  width: min(760px, 100%);
  max-height: min(84vh, 820px);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: modalIn .24s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal.rule-modal {
  width: min(510px, 100%);
}

.modal.fx-modal {
  width: min(430px, 100%);
}

.modal.sku-cost-modal {
  width: min(520px, 100%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 23px 25px 17px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 2px 0 3px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
}

.modal-head p {
  margin: 0;
  color: var(--muted);
  font-size: 9.5px;
}

.modal-close {
  flex: 0 0 auto;
}

.modal-body {
  max-height: calc(84vh - 150px);
  overflow-y: auto;
  padding: 20px 25px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 15px 25px;
  border-top: 1px solid var(--line);
  background: #faf8f3;
}

.sheet-select-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8f5ef;
}

.sheet-select-row label {
  color: var(--muted);
  font-size: 9px;
}

.sheet-select-row select {
  height: 30px;
  padding: 0 25px 0 9px;
  color: var(--ink);
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  background: #fff;
  font-size: 9px;
}

.sheet-select-row span {
  margin-left: auto;
  color: var(--muted-light);
  font-size: 8.5px;
}

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

.mapping-field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 9.5px;
  font-weight: 600;
}

.mapping-field label small {
  color: var(--muted-light);
  font-size: 7.5px;
  font-weight: 400;
}

.mapping-field.required label small {
  color: var(--danger);
}

.mapping-field select {
  width: 100%;
  height: 36px;
  padding: 0 30px 0 10px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf8f3;
  font-size: 9px;
}

.mapping-field select.unmapped {
  color: var(--danger);
  border-color: rgba(201,88,76,.25);
  background: #fff8f7;
}

.mapping-preview {
  margin-top: 19px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.mapping-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: #f7f4ed;
}

.mapping-preview-head strong {
  font-size: 9px;
}

.mapping-preview-head span {
  color: var(--muted);
  font-size: 8px;
}

.mapping-preview table {
  width: 100%;
  border-collapse: collapse;
}

.mapping-preview th,
.mapping-preview td {
  max-width: 150px;
  overflow: hidden;
  padding: 6px 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 7.5px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.rule-form label {
  color: var(--ink-soft);
  font-size: 9.5px;
  font-weight: 600;
}

.rule-form input,
.rule-form textarea {
  display: block;
  width: 100%;
  padding: 9px 11px;
  margin-top: 5px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: #faf8f3;
  font-size: 10px;
}

.rule-form textarea {
  resize: vertical;
}

.rule-form small {
  display: block;
  margin-top: 4px;
  color: var(--muted-light);
  font-size: 8px;
  font-weight: 400;
}

.input-prefix {
  display: flex;
  height: 39px;
  align-items: center;
  padding: 0 10px;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf8f3;
}

.input-prefix input {
  padding: 0;
  margin: 0 0 0 5px;
  border: 0;
  background: transparent;
}

.fx-conversion {
  display: grid;
  grid-template-columns: 1fr 30px 1fr;
  align-items: center;
  gap: 10px;
  padding: 7px 0 15px;
}

.fx-conversion > div {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf8f3;
  text-align: center;
}

.fx-conversion span {
  display: block;
  font-size: 16px;
  font-weight: 700;
}

.fx-conversion small {
  color: var(--muted);
  font-size: 8px;
}

.fx-equals {
  color: var(--muted-light) !important;
  font-size: 17px !important;
  font-weight: 400 !important;
  text-align: center;
}

.fx-cny input {
  display: block;
  width: 100%;
  padding: 0;
  color: var(--forest);
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 23px;
  font-weight: 700;
  text-align: center;
}

.sku-priority-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--muted);
  border: 1px dashed rgba(56,124,100,.22);
  border-radius: 8px;
  background: rgba(234,241,235,.6);
  font-size: 8.5px;
}

.sku-priority-note span {
  padding-right: 9px;
  color: var(--success);
  border-right: 1px solid rgba(56,124,100,.18);
  font-weight: 600;
}

.sku-priority-note strong {
  color: var(--forest);
  font-weight: 500;
}

.order-drawer {
  position: fixed;
  inset: 0;
  z-index: 110;
}

.drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(12,24,20,.34);
  backdrop-filter: blur(2px);
}

.drawer-panel {
  position: absolute;
  inset: 0 0 0 auto;
  display: flex;
  width: min(570px, 92vw);
  flex-direction: column;
  background: var(--surface);
  box-shadow: -20px 0 60px rgba(17,35,28,.15);
  animation: drawerIn .28s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes drawerIn {
  from { transform: translateX(45px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 25px 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h3 {
  margin: 3px 0 5px;
  font-family: var(--serif);
  font-size: 22px;
}

.drawer-head h3.merged-order-title {
  max-width: 460px;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.drawer-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 8.5px;
}

.drawer-status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 25px 35px;
}

.drawer-profit-card {
  padding: 20px;
  color: #f8f5ed;
  border-radius: 14px;
  background: var(--forest);
}

.drawer-profit-card > span {
  color: rgba(248,245,237,.48);
  font-size: 8px;
}

.drawer-profit-card > strong {
  display: block;
  margin: 3px 0 13px;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
}

.drawer-profit-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.1);
}

.drawer-profit-breakdown > div {
  padding: 0 12px;
  border-right: 1px solid rgba(255,255,255,.1);
}

.drawer-profit-breakdown > div:first-child {
  padding-left: 0;
}

.drawer-profit-breakdown > div:last-child {
  border-right: 0;
}

.drawer-profit-breakdown span {
  display: block;
  color: rgba(248,245,237,.42);
  font-size: 7.5px;
}

.drawer-profit-breakdown strong {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
}

.drawer-section {
  margin-top: 22px;
}

.drawer-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.drawer-section-title h4 {
  margin: 0;
  font-family: var(--serif);
  font-size: 14px;
}

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

.drawer-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-line-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 11px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbf9f4;
}

.drawer-product-img {
  display: grid;
  width: 52px;
  height: 52px;
  overflow: hidden;
  place-items: center;
  color: #91a49a;
  border-radius: 9px;
  background: #eeebe3;
}

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

.drawer-line-info {
  min-width: 0;
}

.drawer-line-info > strong {
  display: block;
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-line-info > span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 7.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-line-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.drawer-line-controls select {
  max-width: 104px;
  height: 29px;
  padding: 0 22px 0 7px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 8px;
}

.drawer-line-cost {
  min-width: 55px;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 600;
  text-align: right;
}

.drawer-empty-lines {
  padding: 20px;
  color: var(--muted);
  border: 1px dashed var(--line-dark);
  border-radius: 10px;
  font-size: 9px;
  text-align: center;
}

.drawer-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.drawer-info-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #faf8f3;
}

.drawer-info-item span {
  display: block;
  color: var(--muted);
  font-size: 7.5px;
}

.drawer-info-item strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-warning {
  display: flex;
  gap: 9px;
  padding: 11px 12px;
  margin-top: 16px;
  color: #8e5f20;
  border: 1px solid #efdec2;
  border-radius: 9px;
  background: #fcf5e9;
  font-size: 8.5px;
  line-height: 1.55;
}

.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  display: flex;
  width: min(340px, calc(100vw - 44px));
  flex-direction: column;
  gap: 8px;
}

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 190;
  display: grid;
  padding: 28px;
  place-items: center;
  pointer-events: none;
  background: rgba(10, 34, 27, .64);
  backdrop-filter: blur(9px);
  animation: dropFadeIn .16s ease both;
}

.drop-overlay::before {
  position: absolute;
  inset: 17px;
  content: "";
  border: 2px dashed rgba(244, 223, 181, .55);
  border-radius: 24px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05);
}

.drop-overlay-card {
  position: relative;
  display: flex;
  width: min(560px, calc(100vw - 56px));
  flex-direction: column;
  align-items: center;
  padding: 45px 46px 39px;
  color: #fbf7ec;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% -20%, rgba(216,166,79,.2), transparent 52%),
    rgba(18, 52, 42, .88);
  box-shadow: 0 34px 100px rgba(7, 24, 18, .38);
  text-align: center;
  animation: dropCardIn .22s cubic-bezier(.2,.8,.2,1) both;
}

.drop-overlay-icon {
  display: grid;
  width: 78px;
  height: 78px;
  margin-bottom: 19px;
  place-items: center;
  color: var(--gold-light);
  border: 1px solid rgba(244,223,181,.28);
  border-radius: 22px;
  background: rgba(255,255,255,.055);
  box-shadow: 0 14px 35px rgba(7,24,18,.18);
}

.drop-overlay-icon svg {
  width: 43px;
}

.drop-overlay-kicker {
  color: rgba(251,247,236,.38);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .2em;
}

.drop-overlay-card > strong {
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 500;
  letter-spacing: .02em;
}

.drop-overlay-card > p {
  max-width: 410px;
  margin: 9px 0 0;
  color: rgba(251,247,236,.53);
  font-size: 10.5px;
  line-height: 1.7;
}

.drop-overlay-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 22px;
}

.drop-overlay-chips span {
  padding: 5px 10px;
  color: rgba(251,247,236,.65);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  background: rgba(255,255,255,.045);
  font-size: 8px;
}

@keyframes dropFadeIn {
  from { opacity: 0; }
}

@keyframes dropCardIn {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  color: #f8f5ed;
  border-radius: 10px;
  background: var(--forest-deep);
  box-shadow: var(--shadow-md);
  font-size: 10px;
  line-height: 1.5;
  animation: toastIn .25s ease both;
}

.toast.error {
  background: #7a342e;
}

.toast.warning {
  background: #735227;
}

.toast i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  margin-top: 3px;
  border-radius: 50%;
  background: var(--gold-light);
}

.toast.error i {
  background: #ffd3cb;
}

.toast.removing {
  animation: toastOut .2s ease both;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px); }
}

.loading-ring {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1220px) {
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .source-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .mapping-chip-grid,
  .sku-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .exception-grid {
    grid-template-columns: 1fr;
  }

  .exception-list {
    min-height: auto;
  }

  .exception-empty {
    min-height: 60px;
  }
}

@media (max-width: 980px) {
  :root {
    --sidebar-width: 210px;
  }

  .content,
  .topbar {
    padding-right: 24px;
    padding-left: 24px;
  }

  .hero-card {
    padding: 32px;
  }

  .hero-formula {
    width: 240px;
    flex-basis: 240px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .vg-layout,
  .vg-bottom-grid {
    grid-template-columns: 1fr;
  }

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

  .accounting-visual {
    grid-template-columns: 165px 1fr;
  }

  .result-summary-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .result-summary-row > div:nth-child(2) {
    border-right: 0;
  }

  .result-summary-row > div:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }

  .orders-toolbar {
    flex-wrap: wrap;
  }

  .search-wrap {
    width: 100%;
    flex-basis: 100%;
  }

  .select-control {
    margin-left: 0;
  }

  .rule-summary {
    grid-template-columns: 1fr 90px 90px;
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }

  .guide-grid article {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .sidebar {
    transform: translateX(-105%);
    transition: transform .25s ease;
  }

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

  .main {
    margin-left: 0;
  }

  .topbar {
    height: 68px;
    padding: 0 16px;
  }

  .topbar-title {
    display: none;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-brand strong {
    font-family: var(--serif);
    font-size: 17px;
    letter-spacing: .05em;
  }

  .menu-toggle {
    width: 32px;
    height: 32px;
  }

  .help-button {
    display: none;
  }

  .top-import {
    min-height: 35px;
    padding: 0 11px;
  }

  .content {
    padding: 17px 14px 38px;
  }

  .hero-card {
    min-height: 0;
    padding: 28px 23px;
  }

  .hero-formula {
    display: none;
  }

  .hero-copy h2 {
    font-size: 34px;
  }

  .hero-copy p {
    font-size: 11px;
  }

  .metric-grid,
  .source-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .vg-field-grid {
    grid-template-columns: 1fr;
  }

  .vg-country-picker {
    padding-right: 15px;
    padding-left: 15px;
  }

  .vg-country-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vg-fixed-rules {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vg-carrier-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vg-field.wide {
    grid-column: auto;
  }

  .vg-calculator-panel,
  .vg-profit-card {
    padding: 19px 18px;
  }

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

  .vg-summary-grid > div,
  .vg-summary-grid > div:nth-child(2n),
  .vg-summary-grid > div:nth-last-child(-n+2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .vg-summary-grid > div:last-child {
    border-bottom: 0;
  }

  .metric-card {
    min-height: 135px;
  }

  .accounting-panel,
  .match-panel,
  .recent-panel {
    padding: 19px 18px;
  }

  .accounting-visual {
    grid-template-columns: 1fr;
  }

  .profit-donut {
    width: 145px;
    height: 145px;
  }

  .formula-strip {
    display: none;
  }

  .match-score-wrap {
    gap: 15px;
  }

  .compact-table-wrap {
    margin: 16px -18px -19px;
  }

  .view-intro,
  .view-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .view-intro h2,
  .view-heading h2 {
    font-size: 27px;
  }

  .intro-actions,
  .heading-actions {
    width: 100%;
  }

  .intro-actions button,
  .heading-actions button {
    flex: 1;
  }

  .auto-import-card {
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
  }

  .auto-copy {
    flex-basis: calc(100% - 75px);
  }

  .auto-import-card > .primary-button {
    width: 100%;
  }

  .auto-hints {
    display: none;
  }

  .source-card {
    min-height: 220px;
  }

  .mapping-chip-grid,
  .sku-grid {
    grid-template-columns: 1fr;
  }

  .result-summary-row strong {
    font-size: 16px;
  }

  .orders-toolbar {
    padding: 12px;
  }

  .segmented-filter {
    overflow-x: auto;
    flex: 1;
  }

  .segmented-filter button {
    padding: 0 9px;
  }

  .select-control {
    flex: 1;
  }

  .funnel-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 17px;
    padding: 20px;
  }

  .funnel-line {
    display: none;
  }

  .logic-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .style-review-item {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .style-review-select {
    width: 100%;
    grid-column: 1 / -1;
  }

  .rule-summary {
    grid-template-columns: 1fr 1fr;
    padding: 19px;
  }

  .rule-summary-copy {
    grid-column: 1 / -1;
  }

  .rule-stat {
    padding: 10px 0 0;
    border-top: 1px solid rgba(255,255,255,.1);
    border-left: 0;
  }

  .danger-zone {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .mapping-fields {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal {
    max-height: 92vh;
  }

  .modal-body {
    max-height: calc(92vh - 150px);
    padding: 17px;
  }

  .modal-head {
    padding: 19px 17px 14px;
  }

  .modal-footer {
    padding: 13px 17px;
  }

  .drawer-panel {
    width: 100%;
  }

  .drawer-head {
    padding: 20px 18px 15px;
  }

  .drawer-body {
    padding: 18px 18px 30px;
  }

  .drawer-line-card {
    grid-template-columns: 44px 1fr;
  }

  .drawer-product-img {
    width: 44px;
    height: 44px;
  }

  .drawer-line-controls {
    grid-column: 1 / -1;
    justify-content: space-between;
    padding-top: 5px;
    border-top: 1px solid var(--line);
  }

  .drawer-info-grid {
    grid-template-columns: 1fr;
  }

  .fx-pill {
    padding: 0 8px;
  }

  .fx-pill span {
    display: none;
  }

  .formula-reference {
    align-items: flex-start;
    flex-direction: column;
  }

  .formula-reference span {
    padding: 0;
    border: 0;
  }

  .drop-overlay {
    padding: 16px;
  }

  .drop-overlay::before {
    inset: 9px;
    border-radius: 18px;
  }

  .drop-overlay-card {
    width: 100%;
    padding: 35px 23px 31px;
  }

  .drop-overlay-card > strong {
    font-size: 23px;
  }
}

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