:root {
  --bg: #09111f;
  --bg-soft: #101b2d;
  --panel: rgba(10, 20, 36, 0.76);
  --panel-strong: rgba(9, 17, 31, 0.94);
  --line: rgba(151, 179, 220, 0.18);
  --text: #ecf4ff;
  --text-muted: #9fb5d2;
  --primary: #38d3c8;
  --primary-strong: #23a8a0;
  --accent: #ffb04a;
  --danger: #ff6f7c;
  --success: #67d891;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-ui: "Space Grotesk", "PingFang SC", "Microsoft YaHei", sans-serif;
  --page-primary: var(--primary);
  --page-primary-strong: #5fe5dc;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(56, 211, 200, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 176, 74, 0.16), transparent 25%),
    linear-gradient(160deg, #07101d 0%, #09111f 55%, #111f35 100%);
  color: var(--text);
  font-family: var(--font-ui);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent 85%);
}

body[data-page="studio"] {
  --page-primary: #ffb457;
  --page-primary-strong: #ffd898;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.page-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: 36px;
  background: linear-gradient(135deg, rgba(7, 17, 31, 0.9), rgba(15, 32, 56, 0.88));
  box-shadow: var(--shadow);
}

.hero--compact {
  padding-bottom: 32px;
}

.hero__content {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.hero__eyebrow,
.panel__eyebrow,
.download-card__eyebrow {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 14px;
}

.hero h1,
.panel h2,
.download-card h2 {
  margin: 0;
  line-height: 1.05;
}

.hero h1 {
  font-size: clamp(36px, 5vw, 72px);
}

.hero p {
  margin: 18px 0 0;
  max-width: 650px;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-muted);
}

.hero__actions,
.upload-zone__actions,
.upload-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.hero__actions--tight {
  margin-top: 0;
}

.upload-toolbar--align-end {
  justify-content: flex-end;
}

.hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero__chips span,
.batch-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 13px;
}

.hero__glow {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(20px);
}

.hero__glow--left {
  left: -100px;
  top: -120px;
  background: rgba(56, 211, 200, 0.12);
}

.hero__glow--right {
  right: -80px;
  top: -70px;
  background: rgba(255, 176, 74, 0.12);
}

.main-grid,
.download-grid {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}

.main-grid {
  grid-template-columns: 1.1fr 0.9fr;
  grid-template-areas:
    "auth account"
    "uploader uploader"
    "results results"
    "payments notifications"
    "orders orders";
}

body[data-page="app"]:not(.is-authenticated) .main-grid > .panel:not(.panel--auth) {
  display: none;
}

body[data-page="studio"]:not(.is-authenticated) .main-grid--studio > .panel:not(.panel--auth) {
  display: none;
}

.main-grid--studio {
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "auth account"
    "shop shop"
    "inventory inventory"
    "earnings funds"
    "settings settings";
}

.download-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel,
.download-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  padding: 24px;
}

.panel--auth {
  grid-area: auth;
}

.panel--account {
  grid-area: account;
}

.panel--uploader {
  grid-area: uploader;
}

.panel--results {
  grid-area: results;
}

.panel--payments {
  grid-area: payments;
}

.panel--notifications {
  grid-area: notifications;
}

.panel--orders {
  grid-area: orders;
}

.panel--shop {
  grid-area: shop;
}

.panel--inventory {
  grid-area: inventory;
}

.panel--earnings {
  grid-area: earnings;
}

.panel--funds {
  grid-area: funds;
}

.panel--settings {
  grid-area: settings;
}

.download-card--wide {
  grid-column: 1 / -1;
}

.panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.panel__header > :first-child {
  flex: 1 1 320px;
  min-width: 0;
}

.segmented {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.segmented__item {
  border: 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.segmented__item.is-active {
  background: rgba(56, 211, 200, 0.16);
  color: var(--text);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
  filter: saturate(0.5);
}

.button--primary {
  background: linear-gradient(135deg, var(--page-primary), var(--page-primary-strong));
  color: #021019;
  font-weight: 700;
}

.button--ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.09);
  color: var(--text);
}

.button--small {
  min-height: 40px;
  padding: 0 14px;
}

.notice {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  margin-bottom: 16px;
}

.notice.is-error {
  color: #ffd7db;
  border-color: rgba(255, 111, 124, 0.32);
  background: rgba(255, 111, 124, 0.1);
}

.notice.is-success {
  color: #d8ffea;
  border-color: rgba(103, 216, 145, 0.32);
  background: rgba(103, 216, 145, 0.1);
}

.form {
  display: none;
  gap: 14px;
}

.form.is-active,
.form--upload {
  display: grid;
}

.field-row,
.field-group {
  display: grid;
  gap: 12px;
}

.field-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-row--single {
  grid-template-columns: minmax(0, 1fr);
}

.field-group--sms {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span,
.field__label > span {
  color: var(--text-muted);
  font-size: 13px;
}

.field__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field__meta {
  flex: 0 0 auto;
  font-size: 12px;
  font-style: normal;
  line-height: 1;
  letter-spacing: 0.02em;
}

.field__meta.is-required {
  color: #ff6f61;
}

.field__meta.is-optional {
  color: #ff9f5a;
}

.field__meta.is-auto {
  color: #8fb3d8;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  background: rgba(4, 10, 20, 0.6);
  color: var(--text);
  min-height: 48px;
  padding: 12px 14px;
}

.field input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
}

.field textarea {
  min-height: 108px;
  resize: vertical;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-muted);
}

.agreement-box {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.agreement-box__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.agreement-box__details summary {
  cursor: pointer;
  color: var(--primary);
}

.agreement-box__text {
  margin: 14px 0 0;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--text-muted);
  font-family: var(--font-ui);
  line-height: 1.7;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.035);
}

.stat-card span,
.meta-list span,
.batch-summary span {
  color: var(--text-muted);
  font-size: 13px;
}

.stat-card strong,
.meta-list strong,
.batch-summary strong {
  font-size: 20px;
}

.stat-card small {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.meta-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.meta-list--compact {
  margin-top: 0;
}

.meta-list > div,
.batch-summary > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.upload-zone {
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 12px 16px;
  border: 1px dashed rgba(56, 211, 200, 0.35);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(56, 211, 200, 0.08), rgba(255, 255, 255, 0.03));
  gap: 2px;
}

.upload-zone__icon {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border-radius: 24px;
  background: rgba(4, 15, 26, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 700;
  letter-spacing: 0.16em;
}

.upload-zone h3 {
  margin: 4px 0 0;
  font-size: 14px;
}

.upload-zone p {
  margin: 2px 0 0;
  font-size: 12px;
}

.upload-zone p,
.upload-zone__hint {
  color: var(--text-muted);
}

.field-row--filters {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.selected-files {
  display: grid;
  gap: 10px;
  max-height: 160px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.selected-file {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.batch-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.batch-summary > div {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  border-bottom: none;
  flex-direction: column;
  align-items: flex-start;
}

.result-list {
  display: grid;
  gap: 18px;
}

.empty-state {
  padding: 28px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  text-align: center;
}

.result-card {
  display: grid;
  gap: 16px;
  padding: 20px;
  border-radius: 24px;
  background: var(--panel-strong);
  border: 1px solid rgba(56, 211, 200, 0.18);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.result-card + .result-card {
  margin-top: 16px;
}

.result-card__header,
.result-card__toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

/* Default two-column layout; portrait and landscape variants share this behavior. */
.result-card__body {
  display: grid;
  grid-template-columns: minmax(200px, 48%) 1fr;
  gap: 16px;
  align-items: start;
}

.result-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.result-card__actions [data-delete-task] {
  color: var(--danger);
  border-color: rgba(255, 111, 124, 0.32);
}

.result-card__actions [data-delete-task]:hover {
  background: rgba(255, 111, 124, 0.08);
  border-color: rgba(255, 111, 124, 0.45);
}

.result-card__hidden-fields {
  display: none;
}

.result-card__params {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.025);
}

.result-card__section-title {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.ann-form__hint {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.ann-stage {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: transparent;
  line-height: 0;
  width: 100%;
  touch-action: pan-y;
}

.ann-stage__img {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: 50% 50%;
  transition: transform 0.05s linear;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}

.ann-form__input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.ann-form__input-wrap .ann-form__input,
.ann-form__input-wrap .ann-form__select {
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
}

.ann-form__field-confirm {
  flex: 0 0 auto;
  padding: 5px 10px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: rgba(56, 211, 200, 0.1);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.ann-form__field-confirm:hover {
  background: rgba(56, 211, 200, 0.2);
}
.ann-form__field-confirm.is-confirmed {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.ann-form__select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239fb5d2' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

/* Native drop-down list option: Force a dark background with white text to ensure it is readable by all browsers */
.ann-form__select option {
  background-color: #1a2740;
  color: #ecf4ff;
}
.ann-form__select option:disabled {
  color: #9fb5d2;
  font-style: italic;
}

.ann-form__row--confirm,
.ann-form__confirm {
  display: none;
}

.ann-stage__img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
  background: #0a0a0a;
  transform-origin: 50% 50%;
  transition: transform 0.05s linear;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}

.ann-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
}

.ann-form__row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ann-form__row--wide {
  grid-column: 1 / -1;
}

.ann-form__label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: none;
}

.ann-form__input {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  font-family: inherit;
  min-width: 0;
  transition: border-color 0.15s;
}
.ann-form__input:focus {
  outline: none;
  border-color: rgba(56, 211, 200, 0.5);
  background: rgba(56, 211, 200, 0.05);
}
.ann-form__input.is-dirty,
.ann-form__select.is-dirty {
  border-color: var(--accent);
  background: rgba(255, 176, 74, 0.08);
}
.ann-form__input.is-dirty:focus,
.ann-form__select.is-dirty:focus {
  border-color: var(--accent);
  background: rgba(255, 176, 74, 0.12);
}
.ann-form__input:placeholder-shown {
  color: rgba(255,255,255,0.22);
  font-style: italic;
}

.ann-form__hint {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

@media (max-width: 600px) {
  .ann-form {
    grid-template-columns: 1fr;
  }
  .ann-form__row--wide {
    grid-column: 1;
  }
}

.ann-pill,
.ann-overlay {
  display: none;
}
.result-card__body--landscape .ann-stage {
  max-height: none;
}
.result-card__body--landscape .ann-stage__img {
  width: 100%;
  height: auto;
}

.ann-stage__empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.ann-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ann-pill {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: auto;
  z-index: 2;
  max-width: 60%;
}

.ann-pill__label {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 4px 0 0 4px;
  background: rgba(74, 155, 217, 0.85);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}

.ann-pill__input {
  flex: 1 1 0;
  min-width: 40px;
  padding: 2px 6px;
  border: 1px solid rgba(74, 155, 217, 0.6);
  border-radius: 0 4px 4px 0;
  background: rgba(26, 60, 94, 0.9);
  color: #F9E79F;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  outline: none;
}
.ann-pill__input:focus {
  border-color: #38d3c8;
  background: rgba(26, 60, 94, 1);
}

.result-card__grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
}

.compare-image {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  max-height: 360px;
  aspect-ratio: 3 / 4;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(9, 18, 30, 0.92);
}

.compare-image--thumbnail {
  width: 220px;
  min-height: 220px;
  max-height: 280px;
  cursor: zoom-in;
}

.compare-image__hint {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: inline-flex;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(7, 13, 23, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.compare-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.compare-image-slot {
  width: 220px;
  max-width: 100%;
  min-width: 0;
  align-self: start;
}

.ocr-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ocr-overlay__empty {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(8, 17, 28, 0.72);
  color: var(--text-muted);
  font-size: 12px;
}

.ocr-tag {
  position: absolute;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 181, 71, 0.7);
  background: rgba(255, 181, 71, 0.14);
  color: #fff6da;
  font-size: 11px;
  line-height: 1.2;
  cursor: pointer;
  overflow: hidden;
  backdrop-filter: blur(4px);
}

.ocr-tag:hover {
  background: rgba(255, 181, 71, 0.24);
}

.ocr-tag span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.ocr-inline-editor {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 3;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 13, 23, 0.94);
  display: grid;
  gap: 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

.ocr-inline-editor__title {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.ocr-inline-editor__field {
  color: var(--text-muted);
  font-size: 13px;
}

.ocr-inline-editor__select {
  width: 100%;
}

.ocr-inline-editor__input {
  width: 100%;
}

.ocr-inline-editor__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.result-panel {
  display: grid;
  gap: 14px;
}

.result-panel__primary {
  display: grid;
  gap: 14px;
  align-content: start;
}

.result-panel__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
}

.result-fields {
  display: grid;
  gap: 12px;
}

.result-card__subline {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13px;
}

.result-match-preview {
  display: grid;
  gap: 10px;
}

.result-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.result-preview-list {
  display: grid;
  gap: 10px;
}

.result-preview-list__item {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 13px;
  align-items: center;
}

.result-preview-list__item strong {
  color: var(--text-primary);
  font-size: 14px;
}

.result-preview-empty {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
}

.match-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 18px;
}

.match-table th,
.match-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

.match-table th {
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.match-table td {
  word-break: break-word;
}

.progress-stack,
.payment-grid,
.notification-list {
  display: grid;
  gap: 14px;
}

.progress-stack {
  margin-top: 18px;
}

.progress-card,
.payment-card,
.notification-card,
.table-shell,
.qr-shell,
.trade-compose,
.trade-records,
.order-detail-grid,
.order-compare,
.json-card {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.035);
}

.progress-card,
.payment-card,
.trade-compose,
.trade-records,
.notification-card,
.order-detail-grid,
.json-card {
  padding: 16px;
}

.progress-card div,
.payment-card__header,
.notification-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-card p,
.notification-card p,
.payment-hint,
.record-subtitle,
.order-dialog__muted {
  margin: 8px 0 0;
  color: var(--text-muted);
  line-height: 1.7;
}

body.is-authenticated .progress-card p {
  display: none;
}

.payment-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.payment-grid > .payment-card:last-child {
  grid-column: 1 / -1;
}

.field-group--inline {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preset-chip {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.preset-chip.is-active {
  border-color: rgba(56, 211, 200, 0.45);
  background: rgba(56, 211, 200, 0.16);
}

.qr-shell {
  min-height: 220px;
  padding: 16px;
}

.qr-shell__grid,
.order-detail-grid,
.trade-console {
  display: grid;
  gap: 16px;
}

.qr-shell__grid {
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  align-items: start;
}

.qr-shell__stack {
  display: grid;
  gap: 16px;
}

.qr-shell__image {
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  padding: 10px;
}

.qr-shell__image-wrap {
  position: relative;
  display: inline-block;
  width: fit-content;
}

.qr-shell__image img {
  display: block;
  width: 100%;
  height: auto;
}

.qr-shell__meta {
  display: grid;
  gap: 10px;
}

.qr-shell__panel {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.qr-shell__panel--mobile {
  justify-items: stretch;
}

.qr-shell__hint {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.qr-shell__channel-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.qr-shell__badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 42px;
  height: 42px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.qr-shell__note {
  color: var(--text-muted);
  line-height: 1.7;
}

.qr-shell__cta {
  width: min(100%, 320px);
  justify-content: center;
  text-decoration: none;
}

.studio-upgrade-payment {
  margin-bottom: 16px;
}

.studio-upgrade-payment .qr-shell {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.payment-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.payment-status-badge.is-error {
  background: rgba(255, 111, 124, 0.14);
  color: #ffd7db;
}

.payment-status-badge.is-success {
  background: rgba(103, 216, 145, 0.16);
  color: #d8ffea;
}

.notification-list {
  min-height: 320px;
}

.notification-card img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.notification-card {
  display: grid;
  gap: 10px;
  cursor: pointer;
}

.notification-card.is-unread {
  border-color: rgba(56, 211, 200, 0.32);
}

.notification-card[data-priority="important"] {
  border-left: 4px solid var(--accent);
}

.notification-card[data-priority="urgent"] {
  border-left: 4px solid var(--danger);
}

.notification-card__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 13px;
}

.notification-card__content {
  white-space: pre-wrap;
  color: var(--text);
  line-height: 1.75;
}

.table-toolbar,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dialog__header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.payment-card--account {
  display: grid;
  gap: 14px;
}

.account-profile-card {
  margin-top: 0;
}

#account-dialog .dialog__body {
  display: grid;
  gap: 16px;
}

#account-meta strong {
  font-size: 16px;
}

#account-meta .detail-item__value-row {
  justify-content: flex-end;
}

#account-meta .button--small {
  min-height: 28px;
  padding: 0 10px;
}

.account-edit-panel {
  display: grid;
  gap: 10px;
}

.account-edit-panel .section-note {
  margin-top: 0;
}

.field-row--compact {
  grid-template-columns: minmax(0, 1fr);
}

.upload-toolbar--tight {
  justify-content: flex-start;
}

.order-side-orders {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.upgrade-guide {
  display: grid;
  gap: 16px;
}

.upgrade-guide__toolbar {
  align-items: end;
}

.upgrade-guide__note {
  margin-top: -2px;
}

.upgrade-guide__current {
  min-height: 74px;
  align-content: center;
}

.upgrade-guide__routes {
  padding: 18px;
}

.upgrade-guide__matrix {
  padding: 18px;
}

.upgrade-guide__cards {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.upgrade-guide__card {
  display: grid;
  gap: 14px;
}

.upgrade-rate-table-shell {
  overflow-x: auto;
  overflow-y: hidden;
}

.upgrade-rate-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

.upgrade-rate-table th,
.upgrade-rate-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}

.upgrade-rate-table th:first-child,
.upgrade-rate-table td:first-child {
  text-align: left;
}

.upgrade-rate-table th {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.upgrade-rate-table tbody tr.is-current-level td {
  background: rgba(56, 211, 200, 0.08);
}

.upgrade-rate-table td strong {
  display: inline-block;
}

.table-toolbar {
  justify-content: space-between;
  margin-bottom: 14px;
}

.stack-grid {
  display: grid;
  gap: 16px;
}

.progress-meter {
  position: relative;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-meter__bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), #ffb04a);
  transition: width 0.25s ease;
}

.section-note {
  color: var(--text-muted);
  line-height: 1.7;
}

.code-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-muted);
}

.trade-console {
  grid-template-columns: minmax(340px, 0.9fr) minmax(0, 1.1fr);
}

.table-shell {
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#orders-dialog .table-shell {
  overflow-x: auto;
  overflow-y: hidden;
}

#orders-dialog .table-shell td {
  vertical-align: middle;
}

#orders-dialog .record-actions {
  align-items: center;
  gap: 6px;
}

#orders-dialog .table-shell td:nth-child(3),
#orders-dialog .table-shell td:nth-child(7) {
  white-space: nowrap;
  overflow: visible;
}

#orders-dialog .table-shell td:nth-child(3) .payment-status-badge {
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.05;
}

#orders-dialog .table-shell td:nth-child(7) .button--small {
  min-height: 32px;
  padding: 0 12px;
  line-height: 1;
}

.table-shell table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
}

.table-shell th,
.table-shell td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  vertical-align: top;
}

.table-shell th {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.table-shell td strong {
  display: block;
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.order-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}
.order-detail-grid > .detail-card {
  height: 100%;
  align-self: stretch;
}

.detail-card {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.035);
}

.detail-card__title {
  margin: 0;
  font-size: 16px;
}

.detail-grid {
  display: grid;
  gap: 10px;
  align-content: start;
  grid-auto-rows: min-content;
}

.detail-item {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-item span {
  color: var(--text-muted);
  font-size: 13px;
}

.detail-item__value-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-item__value-row strong {
  min-width: 0;
}

.detail-item__copy {
  min-height: 28px;
  padding: 0 10px;
  flex: 0 0 auto;
  font-size: 12px;
}

.order-action-row {
  justify-content: flex-start;
}
.order-detail-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
}
.order-detail-compare__side {
  display: grid;
  grid-template-rows: auto minmax(280px, 1fr);
  gap: 8px;
  min-width: 0;
}
.order-detail-compare__label {
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 2px;
}
.order-detail-compare .trade-compare-stage--static {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.order-detail-compare .trade-compare-stage__static-img {
  width: 100%;
  height: 100%;
  max-height: none;
  display: block;
  object-fit: contain;
}
.order-detail-compare .trade-compare-stage--empty {
  min-height: 280px;
  height: 100%;
}
@media (max-width: 640px) {
  .order-detail-compare {
    grid-template-columns: 1fr;
  }
}

.order-compare {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.order-compare__image {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}

.order-compare__image img {
  display: block;
  width: 100%;
  height: auto;
}

.json-card pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-muted);
  line-height: 1.65;
  font-family: Consolas, "SFMono-Regular", monospace;
}

.dialog {
  width: min(720px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  border: 1px solid rgba(245, 166, 35, .25);
  border-radius: 24px;
  padding: 0;
  color: var(--text);
  background: #0f1829;
  box-shadow: 0 8px 40px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.04), inset 0 1px 0 rgba(255,255,255,.05);
  overflow: hidden;
  overscroll-behavior: contain;
}

.dialog--wide {
  width: min(1080px, calc(100vw - 24px));
}

.dialog--annotation {
  width: min(1180px, calc(100vw - 24px));
}

.dialog--trade-compare {
  width: min(1320px, calc(100vw - 24px));
}

.dialog::backdrop {
  background: rgba(3, 9, 18, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.dialog__header,
.dialog__body {
  padding: 20px 22px;
}

.dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dialog__body {
  max-height: calc(100vh - 128px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

html.dialog-scroll-lock,
body.dialog-scroll-lock {
  overflow: hidden;
  overscroll-behavior: none;
}

.annotation-dialog__layout {
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.annotation-dialog__stage {
  display: grid;
  gap: 14px;
  justify-items: start;
}

.annotation-dialog__stage-note {
  color: var(--text-muted);
  font-size: 13px;
}

.annotation-dialog__panel {
  display: grid;
  gap: 14px;
}

.annotation-dialog__summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.annotation-dialog__summary > div {
  min-width: 0;
}

.annotation-dialog__summary strong {
  font-size: 15px;
  word-break: break-word;
}

.annotation-dialog .compare-image {
  width: 100%;
  min-height: 520px;
  max-height: min(76vh, 860px);
}

.annotation-dialog .ocr-tag {
  font-size: 12px;
}

.download-card {
  display: grid;
  gap: 18px;
}

.download-card p,
.download-card__meta {
  color: var(--text-muted);
  line-height: 1.75;
}

@media (max-width: 1024px) {
  .main-grid,
  .download-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "auth"
      "account"
      "uploader"
      "results"
      "payments"
      "notifications"
      "orders";
  }

  .main-grid--studio {
    grid-template-areas:
      "auth"
      "account"
      "shop"
      "inventory"
      "earnings"
      "funds"
      "settings";
  }

  .result-card__grid,
  .field-row,
  .payment-grid,
  .order-side-orders,
  .trade-console,
  .annotation-dialog__summary,
  .annotation-dialog__layout,
  .order-detail-grid,
  .qr-shell__grid,
  .upgrade-guide__cards {
    grid-template-columns: 1fr;
  }

  .batch-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid--dialog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100vw - 16px, 1480px);
    padding-top: 16px;
    padding-bottom: 40px;
  }

  .hero,
  .panel,
  .download-card {
    padding: 18px;
    border-radius: 24px;
  }

  .hero h1 {
    font-size: 38px;
  }

  .field-group--sms {
    grid-template-columns: 1fr;
  }

  .field-group--inline {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .batch-summary {
    grid-template-columns: 1fr;
  }

  .stats-grid--dialog {
    grid-template-columns: 1fr;
  }

  #orders-dialog .table-shell {
    overflow-x: auto;
  }

  #orders-dialog .table-shell table {
    min-width: 0;
    table-layout: fixed;
  }

  #orders-dialog .table-shell th:nth-child(1),
  #orders-dialog .table-shell td:nth-child(1),
  #orders-dialog .table-shell th:nth-child(6),
  #orders-dialog .table-shell td:nth-child(6) {
    display: none;
  }

  #orders-dialog .table-shell th,
  #orders-dialog .table-shell td {
    padding: 8px 4px;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
  }

  #orders-dialog .table-shell th:nth-child(2),
  #orders-dialog .table-shell td:nth-child(2) {
    width: 18%;
  }

  #orders-dialog .table-shell th:nth-child(3),
  #orders-dialog .table-shell td:nth-child(3) {
    width: 20%;
    overflow: visible;
  }

  #orders-dialog .table-shell th:nth-child(4),
  #orders-dialog .table-shell td:nth-child(4) {
    width: 18%;
    overflow: visible;
    text-overflow: clip;
  }

  #orders-dialog .table-shell th:nth-child(5),
  #orders-dialog .table-shell td:nth-child(5) {
    width: 24%;
  }

  #orders-dialog .table-shell th:nth-child(7),
  #orders-dialog .table-shell td:nth-child(7) {
    width: 16%;
    text-align: center;
  }

  #orders-dialog .table-shell td:nth-child(5) {
    white-space: normal;
    line-height: 1.3;
  }

  #orders-dialog .table-shell th:nth-child(4) {
    font-size: 11px;
  }

  #orders-dialog .table-shell td:nth-child(3) .payment-status-badge {
    display: inline-flex;
    max-width: 100%;
    padding: 6px 8px;
    font-size: 11px;
    line-height: 1;
  }

  #orders-dialog .table-shell td:nth-child(7) .button {
    min-width: 0;
    padding: 6px 10px;
    font-size: 12px;
  }
}

.landing-grid {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}

.hero--landing {
  min-height: 320px;
  display: flex;
  align-items: flex-end;
}

.hero--portal .hero__content {
  max-width: 620px;
}

.portal-grid,
.compat-grid,
.status-grid {
  display: grid;
  gap: 16px;
}

.portal-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portal-grid--compact {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.15fr) minmax(280px, 0.9fr);
}

.compat-grid,
.status-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.portal-card,
.feature-tile,
.status-card {
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  padding: 22px;
}

.portal-card {
  display: grid;
  gap: 14px;
  min-height: 100%;
  text-align: center;
  justify-items: center;
}

.portal-card__tag {
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.portal-card h3,
.timeline__item h3,
.feature-tile strong,
.status-card strong {
  margin: 0;
}

.portal-card p,
.portal-list,
.timeline__item p,
.feature-tile p,
.site-footer,
.site-footer a {
  color: var(--text-muted);
}

.portal-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
}

.portal-actions {
  margin-top: auto;
}

.portal-card--agent {
  box-shadow: inset 0 0 0 1px rgba(56, 211, 200, 0.12);
}

.portal-card--studio {
  box-shadow: inset 0 0 0 1px rgba(255, 176, 74, 0.12);
}

.portal-card--cta h3 {
  font-size: 28px;
}

.portal-actions--split {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.portal-actions--split .button {
  flex: 1 1 180px;
}

.timeline {
  display: grid;
  gap: 14px;
}

.timeline__item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.timeline__index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(56, 211, 200, 0.2), rgba(255, 176, 74, 0.18));
  color: var(--text);
  font-weight: 700;
}

.feature-tile,
.status-card {
  display: grid;
  gap: 12px;
}

.status-card span {
  color: var(--text-muted);
  font-size: 13px;
}

.panel--guest-note {
  background:
    linear-gradient(135deg, rgba(7, 17, 31, 0.94), rgba(17, 31, 53, 0.9)),
    radial-gradient(circle at top left, rgba(56, 211, 200, 0.08), transparent 30%);
}

.empty-state--locked {
  align-items: start;
  text-align: left;
}

.site-footer {
  display: grid;
  gap: 12px;
  margin-top: 24px;
  padding: 18px 24px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.site-footer__brand,
.site-footer__links,
.site-footer__icp {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.site-footer__brand strong {
  color: var(--text);
}

.site-footer__links a:hover {
  color: var(--text);
}

.site-footer__icp a {
  color: var(--text-muted);
}

.site-footer__icp a:hover {
  color: var(--text);
}

@media (max-width: 1024px) {
  .portal-grid,
  .compat-grid,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .portal-actions--split {
    flex-direction: column;
  }
}

body[data-page="studio"] {
  --bg: #140f12;
  --bg-soft: #21161f;
  --panel: rgba(24, 16, 24, 0.8);
  --panel-strong: rgba(20, 15, 18, 0.94);
  --line: rgba(255, 206, 139, 0.14);
  --text: #fff5ec;
  --text-muted: #d2bfaf;
  --primary: #ff9966;
  --primary-strong: #ff7d54;
  --accent: #ffd782;
  --success: #87d8ae;
  background:
    radial-gradient(circle at top left, rgba(255, 153, 102, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 215, 130, 0.12), transparent 24%),
    linear-gradient(160deg, #120d11 0%, #171018 58%, #221722 100%);
}

.page-shell--home {
  width: min(1360px, calc(100vw - 32px));
}

.page-shell--workspace {
  width: min(1320px, calc(100vw - 28px));
  display: grid;
  gap: 16px;
}

.home-layout {
  display: grid;
  gap: 20px;
}

.home-section {
  border: 1px solid var(--line);
  border-radius: 32px;
  background: rgba(8, 18, 32, 0.8);
  box-shadow: var(--shadow);
  padding: 28px;
}

body[data-page="studio"] .home-section,
body[data-page="studio"] .panel,
body[data-page="studio"] .download-card {
  background: linear-gradient(180deg, rgba(27, 18, 26, 0.92), rgba(21, 15, 21, 0.88));
}

.home-section--hero,
.workspace-hero {
  position: relative;
  overflow: hidden;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-mark img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.28));
}

.brand-mark--workspace img {
  width: 56px;
  height: 56px;
}

.home-section__eyebrow {
  margin-bottom: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--accent);
}

.home-section--hero h1 {
  margin: 0;
  font-size: clamp(20px, 6vw, 56px);
  line-height: 1.08;
}

.home-lead,
.workspace-hero__lead {
  margin: 18px 0 0;
  max-width: 700px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.75;
}

.flow-strip,
.workspace-steps {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.flow-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.flow-strip li,
.workspace-steps li {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.flow-strip li {
  font-weight: 600;
  min-height: 92px;
  align-content: center;
}

.workspace-hero {
  padding: 28px 30px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at top left, rgba(56, 211, 200, 0.12), transparent 30%),
    linear-gradient(135deg, rgba(7, 17, 31, 0.95), rgba(13, 27, 49, 0.92));
  box-shadow: var(--shadow);
}

body[data-page="studio"] .workspace-hero {
  background:
    radial-gradient(circle at top right, rgba(255, 215, 130, 0.14), transparent 28%),
    linear-gradient(135deg, rgba(24, 16, 24, 0.94), rgba(42, 22, 33, 0.92));
}

.workspace-hero h1 {
  margin: 0;
  font-size: clamp(28px, 3.5vw, 44px);
  line-height: 1.08;
}

body.is-authenticated .workspace-hero {
  padding: 18px 22px;
}

body.is-authenticated .workspace-hero__lead,
body.is-authenticated .workspace-download-meta,
body.is-authenticated .workspace-steps,
body.is-authenticated .workspace-hero .hero__actions {
  display: none;
}

body.is-authenticated .workspace-hero h1 {
  font-size: clamp(24px, 2.6vw, 34px);
}

.workspace-download-meta {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 14px;
}

.workspace-steps {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  display: none;
}

.workspace-steps li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
  font-weight: 700;
}

.workspace-steps li strong {
  font-size: 15px;
}

.workspace-steps li em {
  font-style: normal;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.section-heading h2,
.workspace-hero h2,
.home-section h2 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.12;
}

.section-heading p {
  margin: 0;
  max-width: 460px;
  color: var(--text-muted);
  line-height: 1.7;
}

.portal-grid--home {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portal-card--clean {
  min-height: 160px;
  justify-content: space-between;
  gap: 14px;
}

.main-grid--agent-redesign,
.main-grid--studio-redesign {
  display: grid;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-areas: none !important;
  gap: 18px;
  margin-top: 18px;
}

.workflow-nav {
  display: none;
  gap: 10px;
  margin: 14px 0 4px;
  flex-wrap: wrap;
  position: sticky;
  top: 10px;
  z-index: 15;
}

body.is-authenticated .workflow-nav {
  display: flex;
}

.workflow-nav__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 14px;
  transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  backdrop-filter: blur(10px);
}

.workflow-nav__item:hover {
  transform: translateY(-1px);
  color: var(--text);
  border-color: rgba(56, 211, 200, 0.4);
}

body[data-page="studio"] .workflow-nav__item {
  background: rgba(255, 176, 74, 0.06);
}

body[data-page="studio"] .workflow-nav__item:hover {
  border-color: rgba(255, 176, 74, 0.45);
}

.main-grid--agent-redesign > *,
.main-grid--studio-redesign > * {
  grid-area: auto !important;
}

.panel--workspace-auth,
.panel--workspace-overview,
.panel--step {
  padding: 22px 24px;
}

.panel--workspace-auth h2,
.panel--workspace-overview h2,
.panel--step h2 {
  font-size: 24px;
}

body.is-authenticated .panel--workspace-overview h2,
body.is-authenticated .panel--step h2 {
  font-size: 20px;
}

.panel__copy {
  margin: 8px 0 0;
  max-width: 58ch;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.65;
}

.stats-grid--compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stats-grid--studio {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.progress-stack--compact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.workspace-split {
  display: grid;
  gap: 18px;
}

.workspace-split--agent {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

.workspace-split--studio {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.batch-summary--compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel__header--results {
  align-items: flex-start;
}

.section-note--flow {
  margin: 18px 0 16px;
  color: var(--danger);
  font-weight: 600;
  line-height: 1.7;
}

.result-list--workflow {
  display: grid;
  gap: 18px;
  scroll-margin-top: 24px;
}

.result-card {
  padding: 20px;
  border-radius: 24px;
}

.result-card__grid {
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  align-items: start;
}

.result-panel {
  display: grid;
  gap: 0;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.03);
}

.result-card__section {
  display: grid;
  gap: 12px;
  padding: 0;
  border-radius: 0;
  border: none;
  background: none;
}

.result-card__section + .result-card__section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.result-card__section-title {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.result-panel__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.result-panel__meta > div {
  min-width: 0;
}

.result-panel__meta strong,
.result-fields input,
.result-fields textarea,
.result-fields select {
  word-break: break-word;
}

.result-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.result-fields .field textarea {
  min-height: 120px;
}

.result-match .notice {
  margin-bottom: 0;
}

.match-list {
  display: grid;
  gap: 16px;
}

.match-task-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}

.match-task-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.match-task-card__header-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.match-task-card__filters {
  align-items: end;
}

.match-task-card__meta {
  color: var(--text-muted);
  font-size: 13px;
}

.match-task-card__table {
  overflow-x: auto;
}

.match-table--selection {
  width: 100%;
  table-layout: fixed;
}

.match-table--selection col.match-table__col--shop { width: 12%; }
.match-table--selection col.match-table__col--device { width: 12%; }
.match-table--selection col.match-table__col--character { width: 18%; }
.match-table--selection col.match-table__col--gold { width: 14%; }
.match-table--selection col.match-table__col--sect { width: 16%; }
.match-table--selection col.match-table__col--career { width: 16%; }
.match-table--selection col.match-table__col--action { width: 124px; }

.match-table--selection td:last-child,
.match-table--selection th:last-child {
  white-space: nowrap;
  text-align: center;
}

.match-table--selection td:last-child .button {
  width: 104px;
  justify-content: center;
}

.match-row--selected td {
  background: rgba(74, 255, 216, 0.06);
}

.match-row--disabled td {
  color: rgba(220, 233, 255, 0.34);
  background: rgba(255, 255, 255, 0.012);
}

.match-row--disabled {
  opacity: 0.42;
}

.match-row--disabled td .button {
  opacity: 0.52;
}

.trade-balance-value {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.trade-inline-action {
  min-height: 32px;
  padding-inline: 12px;
}

.trade-console--guided {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
}

.stack-grid--studio,
.stack-grid--settings {
  display: grid;
  gap: 16px;
}

.stack-grid--studio {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.stack-grid--settings {
  grid-template-columns: 1fr;
}

.stack-grid--settings > form {
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
}

.main-grid--agent-redesign .field-row,
.main-grid--studio-redesign .field-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.main-grid--agent-redesign .panel--auth,
.main-grid--studio-redesign .panel--auth {
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
}

.main-grid--agent-redesign .hero__actions,
.main-grid--studio-redesign .hero__actions {
  margin-top: 0;
}

.workspace-download-meta {
  display: none;
}

.panel--workspace-overview .stats-grid--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel--workspace-overview .progress-stack--compact {
  grid-template-columns: 1fr;
}

.panel--workspace-overview .progress-card {
  min-height: 0;
}

.match-table th,
.match-table td {
  font-size: 13px;
}

.result-card__section-title {
  font-size: 12px;
}

.result-panel__meta strong {
  font-size: 15px;
}

.site-footer--home {
  margin-top: 0;
}

@media (min-width: 2200px) {
  body[data-page="app"].is-authenticated .main-grid--agent-redesign {
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.55fr);
    align-items: start;
  }

  body[data-page="app"].is-authenticated #step-upload,
  body[data-page="app"].is-authenticated #step-results,
  body[data-page="app"].is-authenticated .workspace-split--agent,
  body[data-page="app"].is-authenticated #step-orders {
    grid-column: 1;
  }

  body[data-page="app"].is-authenticated #step-overview {
    grid-column: 2;
    grid-row: 1 / span 3;
    position: sticky;
    top: 66px;
  }

  body[data-page="app"].is-authenticated .workspace-split--agent {
    grid-template-columns: 1fr;
  }

  body[data-page="studio"].is-authenticated .main-grid--studio-redesign {
    grid-template-columns: minmax(280px, 0.55fr) minmax(0, 1.8fr);
    align-items: start;
  }

  body[data-page="studio"].is-authenticated #studio-overview {
    grid-column: 1;
    grid-row: 1 / span 2;
    position: sticky;
    top: 66px;
  }

  body[data-page="studio"].is-authenticated #studio-shop,
  body[data-page="studio"].is-authenticated #studio-inventory,
  body[data-page="studio"].is-authenticated .workspace-split--studio,
  body[data-page="studio"].is-authenticated #studio-settings {
    grid-column: 2;
  }

  body[data-page="studio"].is-authenticated .workspace-split--studio {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 2199px) {
  .flow-strip,
  .workspace-steps,
  .portal-grid--home,
  .workspace-split--agent,
  .workspace-split--studio,
  .trade-console--guided,
  .stack-grid--studio,
  .stack-grid--settings,
  .stats-grid--compact,
  .stats-grid--studio,
  .progress-stack--compact {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: start;
  }

  .main-grid--agent-redesign .panel--auth,
  .main-grid--studio-redesign .panel--auth {
    max-width: none;
  }
}

@media (max-width: 1180px) {
  .result-card__grid,
  .result-panel__meta,
  .result-fields,
  .annotation-dialog__summary {
    grid-template-columns: 1fr;
  }
  .ann-stage {
    max-height: none;
  }
}

@media (max-width: 600px) {
  .ann-form {
    grid-template-columns: 1fr 1fr;
  }
  .ann-form__row--wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .ann-form {
    grid-template-columns: 1fr;
  }
  .ann-stage {
    max-height: none;
  }
  .ann-pill__input {
    font-size: 10px;
    padding: 1px 4px;
  }
}

@media (max-width: 760px) {
  /* Ignorance */
  .result-card__body,
  .result-card__body--portrait,
  .result-card__body--landscape {
    display: flex;
    flex-direction: column;
    gap: 12px;
    grid-template-columns: unset;
  }

  .page-shell--home,
  .page-shell--workspace {
    width: calc(100% - 16px);
    overflow-x: hidden;
  }

  .home-section,
  .workspace-hero,
  .panel,
  .download-card {
    padding: 18px;
    border-radius: 24px;
  }

  .brand-mark {
    align-items: start;
  }

  .brand-mark img {
    width: 48px;
    height: 48px;
  }

  .home-section--hero h1 {
    font-size: 22px;
  }

  .workspace-hero h1 {
    font-size: 30px;
  }

  .panel--workspace-auth h2,
  .panel--workspace-overview h2,
  .panel--step h2,
  .section-heading h2 {
    font-size: 24px;
  }

  .field-row,
  .field-row--filters,
  .field-group--sms,
  .field-group--inline {
    grid-template-columns: 1fr;
  }

  .hero__actions,
  .upload-zone__actions,
  .upload-toolbar {
    flex-direction: column;
  }

  .upload-zone__actions {
    align-items: stretch;
  }
}

/* ========== NAV ACTIONS: bell + gear ========== */
.workflow-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.workflow-nav__links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Bell icon */
.nav-bell {
  position: relative;
}
.nav-bell__badge {
  font-size: 11px;
  background: var(--accent, #f5a623);
  color: #000;
  border-radius: 10px;
  padding: 0 6px;
  min-width: 18px;
  text-align: center;
  font-weight: 700;
}
.nav-bell__dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 340px;
  max-height: 420px;
  background: var(--surface, #1a1a2e);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  overflow-y: auto;
  z-index: 1000;
}
.nav-bell.is-open .nav-bell__dropdown {
  display: block;
}
.nav-bell__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

/* Gear button */
.nav-gear__trigger {
  background: none;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  padding: 6px 12px;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  transition: background .15s;
}
.nav-gear__trigger:hover {
  background: rgba(255,255,255,.08);
}

/* ========== SETTINGS DIALOG ========== */
.dialog--settings {
  max-width: 680px;
}
.settings-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding-bottom: 0;
}
.settings-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 18px;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  font-size: 14px;
  transition: color .15s, border-color .15s;
}
.settings-tab:hover {
  color: rgba(255,255,255,.8);
}
.settings-tab.is-active {
  color: var(--accent, #f5a623);
  border-bottom-color: var(--accent, #f5a623);
}
.settings-panel {
  display: none;
}
.settings-panel.is-active {
  display: block;
}
.settings-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,.06);
  margin: 14px 0;
}

/* Compact inline forms for settings */
.form--inline h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}
.form--inline .field-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.form--inline .field {
  flex: 1;
  min-width: 120px;
}
.form--inline .button--small {
  white-space: nowrap;
}

/* Stats grid in dialog */
.stats-grid--dialog {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

/* Compact empty state */
.empty-state--compact {
  padding: 20px 16px;
  text-align: center;
}
.empty-state--compact p {
  margin: 0;
  opacity: .6;
  font-size: 13px;
}

/* ========== TABLE FIX: prevent first column truncation ========== */
.table-shell th:first-child,
.table-shell td:first-child {
  min-width: 70px;
}
.table-shell th,
.table-shell td {
  white-space: nowrap;
  padding: 8px 10px;
}

/* ========== WIZARD NAV (step progress bar) ========== */
.wizard-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(255,255,255,.03);
  border-radius: 12px;
  margin-bottom: 16px;
  gap: 16px;
  flex-wrap: wrap;
}
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
}
.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: rgba(255,255,255,.4);
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all .2s;
  font-size: 14px;
}
.wizard-step:hover {
  color: rgba(255,255,255,.7);
  background: rgba(255,255,255,.05);
}
.wizard-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.15);
  font-weight: 700;
  font-size: 13px;
  transition: all .2s;
}
.wizard-step__line {
  width: 28px;
  height: 2px;
  background: rgba(255,255,255,.1);
  flex-shrink: 0;
}
.wizard-step.is-active {
  color: #fff;
}
.wizard-step.is-active .wizard-step__num {
  border-color: var(--accent, #f5a623);
  background: var(--accent, #f5a623);
  color: #000;
}
.wizard-step.is-done {
  color: rgba(255,255,255,.6);
}
.wizard-step.is-done .wizard-step__num {
  border-color: #2ecc71;
  background: #2ecc71;
  color: #000;
}
.wizard-step.is-done .wizard-step__num::after {
  content: "✓";
  font-size: 14px;
}
.wizard-step.is-done .wizard-step__num {
  font-size: 0;
}

/* ========== NAV ACTION BUTTONS (multi-function) ========== */
.nav-action-btn,
.nav-bell__trigger {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  width: 52px;
  height: 52px;
  color: rgba(255,255,255,.6);
  cursor: pointer;
  font-size: 11px;
  padding: 0;
  flex-shrink: 0;
  transition: all .15s;
  text-decoration: none;
  position: relative;
  overflow: visible;
}
.nav-action-btn:hover,
.nav-bell__trigger:hover {
  color: #fff;
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.2);
}
.nav-action-btn svg,
.nav-bell__trigger svg {
  flex-shrink: 0;
}
.nav-action-btn__index-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  min-width: 26px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent, #f5a623);
  color: #111;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}
.nav-action-btn__index-badge[hidden],
.nav-action-btn__index-badge:empty {
  display: none !important;
}
.nav-action-btn--logout {
  border-color: rgba(231,76,60,.3);
  color: rgba(231,76,60,.7);
}
.nav-action-btn--logout:hover {
  background: rgba(231,76,60,.15);
  color: #e74c3c;
}

/* ========== WIZARD PANELS ========== */
.wizard-panel {
  display: none;
}
.wizard-panel.is-active {
  display: block;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.wizard-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.wizard-panel__header h2 {
  font-size: 20px;
  margin: 0;
}
.wizard-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.button--lg {
  padding: 12px 28px;
  font-size: 15px;
}

/* ========== FLOATING ORDER TRACKER BAR ========== */
.order-tracker {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  pointer-events: none;
}
.order-tracker__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-top: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 -4px 20px rgba(0,0,0,.4);
  pointer-events: auto;
}
.order-tracker__info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.order-tracker__icon {
  font-size: 18px;
}
.order-tracker__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px;
  padding: 4px 12px;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  min-width: 72px;
  white-space: nowrap;
}
.order-tracker__toggle::after {
  content: "▲";
  color: rgba(255,255,255,.92);
  font-size: 11px;
  line-height: 1;
}
.order-tracker__toggle[aria-expanded="true"]::after {
  content: "▼";
}
.order-tracker__panel {
  display: none;
  background: var(--surface, #1a1a2e);
  border-top: 1px solid rgba(255,255,255,.08);
  overflow: hidden;
  pointer-events: auto;
}
.order-tracker.is-expanded .order-tracker__panel {
  display: block;
}
.order-tracker__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px 8px;
}
.order-tracker__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 20px 14px;
  max-height: 188px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Tracker alert state */
.order-tracker.has-alert .order-tracker__bar {
  background: linear-gradient(135deg, #8b1a1a 0%, #6b2020 100%);
  border-top-color: #e74c3c;
  animation: trackerPulse 1.5s infinite;
}
@keyframes trackerPulse {
  0%, 100% { box-shadow: 0 -4px 20px rgba(231,76,60,.3); }
  50% { box-shadow: 0 -4px 30px rgba(231,76,60,.6); }
}

/* ========== CONFIRM DIALOG ========== */
.confirm-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.confirm-compare__side h4 {
  margin: 0 0 8px;
  font-size: 14px;
}
.confirm-compare__img {
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.4);
  overflow: hidden;
}
.confirm-compare__img img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
}
.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ========== WIZARD-MAIN BOTTOM PADDING (for floating bar) ========== */
.wizard-main {
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}

/* ========== SEGMENTED (mode toggle) small adjustments ========== */
.segmented {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,.05);
  border-radius: 8px;
  padding: 2px;
}
.segmented__item {
  padding: 6px 14px;
  border: none;
  background: none;
  color: rgba(255,255,255,.5);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
}
.segmented__item.is-active {
  background: var(--accent, #f5a623);
  color: #000;
  font-weight: 600;
}

/* ========== BATCH PILL ========== */
.batch-pill {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.6);
}

/* ========== PRESET ROW (recharge amounts) ========== */
.preset-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.preset-row button {
  padding: 6px 16px;
  border: 1px solid rgba(255,255,255,.15);
  background: none;
  color: rgba(255,255,255,.7);
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
}
.preset-row button:hover,
.preset-row button.is-active {
  border-color: var(--accent, #f5a623);
  color: var(--accent, #f5a623);
}

/* ========== LOGIN-GATED: hide wizard before auth ========== */
body:not(.is-authenticated) .wizard-panel,
body:not(.is-authenticated) .wizard-nav,
body:not(.is-authenticated) .order-tracker {
  display: none !important;
}

/* ========== INPUT MODE PANELS (upload / manual) ========== */
.input-mode-panel {
  display: none;
}
.input-mode-panel.is-active {
  display: block;
  animation: fadeIn .2s ease;
}

/* ========== MANUAL ENTRY FORM ========== */
.manual-entry__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.manual-form {
  display: none;
}
.manual-form.is-active {
  display: block;
}
.manual-entry__actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.manual-items {
  margin-top: 16px;
}
.manual-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 14px;
}
.manual-item__info {
  display: flex;
  gap: 16px;
  align-items: center;
}
.manual-item__remove {
  background: none;
  border: none;
  color: #e74c3c;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
}

/* field spanning full row */
.field--full {
  flex: 1 1 100%;
}

/* ========== BACK TO HOME LINK ========== */
.back-home-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
  font-size: 13px;
  padding: 5px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.5);
  text-decoration: none;
  background: rgba(255,255,255,.03);
  transition: all .2s;
}
.back-home-link:hover {
  color: #fff;
  border-color: rgba(56,211,200,.35);
  background: rgba(56,211,200,.06);
}

/* ========== HOMEPAGE EXTRAS ========== */

/* entry cards */
.home-entry-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.035);
  text-decoration: none;
  color: #fff;
  transition: all .25s;
}
.home-entry-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.home-entry-card--agent {
  border-color: rgba(56,211,200,.15);
}
.home-entry-card--agent:hover {
  border-color: rgba(56,211,200,.4);
  background: rgba(56,211,200,.06);
}
.home-entry-card--studio {
  border-color: rgba(255,176,74,.15);
}
.home-entry-card--studio:hover {
  border-color: rgba(255,176,74,.4);
  background: rgba(255,176,74,.06);
}
.home-entry-card__tag {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.home-entry-card strong {
  font-size: 18px;
  font-weight: 700;
}

/* download row */
.home-download-row {
  text-align: center;
  margin-top: 20px;
}
.home-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 10px;
  border: 1px solid rgba(56,211,200,.2);
  color: rgba(255,255,255,.6);
  text-decoration: none;
  background: linear-gradient(135deg, rgba(56,211,200,.06), rgba(255,255,255,.02));
  transition: all .25s;
}
.home-download-btn:hover {
  color: #fff;
  border-color: rgba(56,211,200,.45);
  background: linear-gradient(135deg, rgba(56,211,200,.12), rgba(255,255,255,.04));
  box-shadow: 0 0 16px rgba(56,211,200,.1);
}
.home-download-btn__hint {
  font-size: 11px;
  color: rgba(255,255,255,.3);
}

/* Return home button: Hidden on the desktop (with one in the header), displayed on the mobile device */
.nav-action-btn--home {
  display: none;
  text-decoration: none;
}
@media (max-width: 760px) {
  .confirm-compare-grid .trade-compare-stage {
    width: min(100%, 78vw, 320px);
    max-width: 100%;
    margin-inline: auto;
  }

  .nav-action-btn--home {
    display: flex;
  }
}

/* Photo upload: Hidden by default on the computer end, displayed on the mobile end */
#capture-photo {
  display: none;
}

@media (max-width: 760px) {
  #capture-photo { display: inline-flex; }

  /* Page container overflow prevention */
  .page-shell--home,
  .page-shell--workspace {
    width: calc(100% - 16px);
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Focal ratio */
  body.is-authenticated .workspace-hero { display: none; }

  /* wizard-nav two-line layout, anti-overflow */
  .wizard-nav {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 10px;
    gap: 6px;
  }
  .wizard-steps {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: visible;
    max-width: 100%;
  }
  /* The numbers are on top and the text is at the bottom. Six numbers can fit in one line */
  .wizard-step {
    flex-direction: column;
    align-items: center;
    padding: 2px 4px;
    gap: 3px;
    font-size: 10px;
  }
  .wizard-step__text {
    display: block;
    font-size: 10px;
  }
  .wizard-step__num {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
  .wizard-step__line {
    width: 10px;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 14px;
  }

  /* "Nav button" */
  .nav-actions { display: flex; justify-content: flex-end; gap: 3px; flex-wrap: wrap; max-width: 100%; }
  .nav-action-btn,
  .nav-bell__trigger {
    width: 40px;
    height: 40px;
    font-size: 9px;
    gap: 1px;
  }
  .nav-action-btn svg,
  .nav-bell__trigger svg { width: 13px; height: 13px; }
  .nav-action-btn__index-badge {
    top: -7px;
    right: -8px;
    min-width: 24px;
    height: 16px;
    padding: 0 5px;
    font-size: 9px;
  }

  /* Mobile result card: above the picture, below the parameters */
  .result-card__body,
  .result-card__body--portrait,
  .result-card__body--landscape {
    display: flex;
    flex-direction: column;
    gap: 12px;
    grid-template-columns: unset;
  }
  .result-card__params {
    width: 100%;
  }

  .ann-stage {
    width: min(100%, 78vw, 320px);
    margin-inline: auto;
  }

  .ann-form__input-wrap {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px;
  }

  .ann-form__field-confirm {
    padding: 5px 8px;
    font-size: 11px;
  }

  .match-task-card__table {
    overflow: hidden;
    width: 100%;
  }

  .match-table--selection,
  .match-table--selection thead,
  .match-table--selection tbody {
    display: block;
    width: 100%;
  }

  .match-table--selection {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }

  .match-table--selection colgroup {
    display: none;
  }

  .match-table--selection thead tr,
  .match-table--selection tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.25fr) minmax(0, 0.95fr) minmax(0, 0.95fr) minmax(54px, 0.78fr);
    column-gap: 6px;
    width: 100%;
    align-items: stretch;
  }

  .match-table--selection th:nth-child(2),
  .match-table--selection td:nth-child(2),
  .match-table--selection th:nth-child(4),
  .match-table--selection td:nth-child(4) {
    display: none;
  }

  .match-table--selection th,
  .match-table--selection td {
    display: block;
    min-width: 0;
    padding: 8px 0;
    white-space: normal;
    word-break: break-all;
    overflow-wrap: anywhere;
    overflow: visible;
    text-overflow: clip;
    font-size: 11px;
    line-height: 1.25;
  }

  .match-table--selection th:nth-child(1),
  .match-table--selection td:nth-child(1) {
    text-align: left;
  }

  .match-table--selection th:nth-child(3),
  .match-table--selection td:nth-child(3) {
    text-align: left;
  }

  .match-table--selection th:nth-child(5),
  .match-table--selection td:nth-child(5) {
    text-align: left;
  }

  .match-table--selection th:nth-child(6),
  .match-table--selection td:nth-child(6) {
    text-align: left;
  }

  .match-table--selection th:nth-child(7),
  .match-table--selection td:nth-child(7) {
    display: flex;
    align-items: center;
    justify-content: stretch;
    text-align: center;
  }

  .match-table--selection td:last-child .button {
    width: 100%;
    min-width: 0;
    max-width: none;
    height: 26px;
    min-height: 26px;
    padding: 0 4px;
    font-size: 11px;
    line-height: 1;
    justify-content: center;
  }

  .section-note--flow {
    word-break: break-all;
    overflow-wrap: break-word;
    white-space: normal;
  }

  /* Step title line: The title and the toggle button are divided into two lines */
  .wizard-panel__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .wizard-panel__header .segmented { width: 100%; }
  .wizard-panel__header .segmented__item {
    flex: 1;
    font-size: 12px;
    padding: 6px 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* The three filters stay together */
  .field-row--filters { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .field-row--filters .field span { font-size: 10px; }
  .field-row--filters select { font-size: 12px; padding: 6px 4px; }

  /* Upload area full-width button */
  .upload-zone {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .upload-zone p { white-space: normal; word-break: break-word; }
  .upload-zone__actions { flex-direction: column; align-items: stretch; }
  .upload-zone__actions .button { width: 100%; justify-content: center; }
}
.portal-grid--two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .portal-grid--two {
    grid-template-columns: 1fr;
  }
  .home-entry-card {
    padding: 20px 16px;
  }
}

/* step 5/6 confirm and complete cards */
.active-order-card {
  min-width: 0;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  gap: 10px;
}
.confirm-countdown {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 176, 74, 0.1);
  border: 1px solid rgba(255, 176, 74, 0.4);
  color: var(--accent);
  font-size: 14px;
  text-align: center;
}
.confirm-countdown--urgent {
  background: rgba(255, 111, 124, 0.12);
  border-color: rgba(255, 111, 124, 0.5);
  color: var(--danger);
  animation: pulse-border 1s ease-in-out infinite;
}
@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 111, 124, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(255, 111, 124, 0); }
}

.active-order-card--confirm {
  border-color: var(--accent);
  background: rgba(255,176,74,0.06);
}
.active-order-card__info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  min-width: 0;
  flex: 0 1 auto;
}
.active-order-card__info strong {
  font-size: 15px;
  line-height: 1.2;
  min-width: 0;
  max-width: 132px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.active-order-card .batch-pill {
  padding: 4px 8px;
  font-size: 11px;
  gap: 4px;
  flex: 0 0 auto;
}
.active-order-card__meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 0;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1 1 auto;
}
.active-order-card__actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  flex: 0 0 auto;
  margin-left: auto;
}
.active-order-card[data-focus-order-key] { cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.active-order-card[data-focus-order-key]:hover { border-color: rgba(197,160,89,0.45); background: rgba(255,255,255,0.06); }
.active-order-card--focused { border-color: var(--accent) !important; background: rgba(197,160,89,0.08) !important; }

.order-tracker__list .button--small {
  padding: 5px 10px;
  font-size: 12px;
  min-height: 32px;
}

@media (max-width: 1024px) {
  .order-tracker__list {
    max-height: 188px;
  }
}

@media (max-width: 760px) {
  .order-tracker__header {
    padding: 10px 12px 8px;
  }

  .order-tracker__list {
    padding: 0 12px 12px;
    gap: 8px;
    max-height: min(34vh, 220px);
  }

  .active-order-card {
    padding: 9px 10px;
    border-radius: 10px;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .active-order-card__info strong {
    font-size: 14px;
    max-width: 110px;
  }

  .active-order-card__meta {
    font-size: 11px;
    width: 100%;
    order: 3;
  }

  .active-order-card__actions {
    width: 100%;
    margin-left: 0;
    order: 4;
    flex-wrap: wrap;
  }
}

.confirm-order-card {
  padding: 20px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  display: grid;
  gap: 14px;
}
.confirm-order-card--waiting { border-color: var(--accent); background: rgba(255,176,74,0.05); }
.confirm-order-card--done { border-color: var(--success); background: rgba(103,216,145,0.05); }
.confirm-order-card__header { display: flex; align-items: center; gap: 12px; }
.confirm-order-card__meta { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; font-size: 13px; }
.confirm-order-card__meta > div { display: flex; flex-direction: column; gap: 2px; }
.confirm-order-card__meta span { color: var(--text-muted); font-size: 11px; }
.confirm-order-card__note { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.confirm-order-card__note--highlight { color: var(--accent); font-weight: 600; }
.confirm-order-card__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.confirm-order-card__compare-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.confirm-order-card__compare-bar--compact {
  margin-bottom: 2px;
}
.confirm-order-card__compare-hint {
  flex: 1 1 320px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}
.confirm-order-card__compare-settings {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(280px, 1.1fr);
  gap: 14px;
  align-items: stretch;
  padding: 14px;
  border: 1px solid rgba(255,176,74,0.18);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.025)),
    radial-gradient(circle at top left, rgba(255,176,74,0.1), transparent 36%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}
.compare-toggle-panel {
  display: grid;
  gap: 8px;
  align-content: center;
}
.compare-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,176,74,0.28);
  background: rgba(255,176,74,0.08);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}
.compare-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.compare-toggle--locked {
  cursor: not-allowed;
  opacity: 0.78;
}
.compare-toggle__title {
  letter-spacing: 0.01em;
}
.compare-status {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
}
.compare-status__title {
  font-size: 13px;
  font-weight: 700;
}
.compare-status__message,
.compare-toggle__hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.compare-status__meta {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  line-height: 1.45;
  text-transform: none;
}
.compare-status--warn .compare-status__title {
  color: var(--accent);
}
.compare-status--info .compare-status__title {
  color: #8cc7ff;
}
.compare-status--success .compare-status__title {
  color: var(--success);
}
.compare-status--error .compare-status__title {
  color: #ff8f8f;
}
.compare-timeout-note {
  display: none;
  margin: 8px 0 2px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,121,121,0.28);
  background:
    linear-gradient(180deg, rgba(255,121,121,0.12), rgba(255,121,121,0.06)),
    rgba(255,121,121,0.04);
  color: #ffd0d0;
  font-size: 13px;
  font-weight: 600;
}
.compare-timeout-note--visible {
  display: block;
}
.confirm-order-card__status { font-size: 20px; font-weight: 700; }
.confirm-order-card__item { margin: 0; font-size: 14px; color: var(--text-muted); }
.trade-flow-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.detail-card--compact {
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
}
.detail-card__title--compact {
  font-size: 14px;
}
.detail-card--compact .detail-item {
  padding: 10px 12px;
  border-radius: 14px;
}

.confirm-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.confirm-compare-grid--dialog {
  margin-top: 16px;
  gap: 16px;
}
.confirm-compare-side {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.confirm-compare-side__label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.button--compare {
  min-width: 156px;
  border-color: rgba(255, 176, 74, 0.6);
  color: #ffd392;
  background: linear-gradient(180deg, rgba(255, 176, 74, 0.16), rgba(255, 176, 74, 0.08));
  box-shadow: 0 8px 24px rgba(255, 176, 74, 0.12);
  font-weight: 700;
  align-self: flex-start;
}
.button--compare:hover {
  border-color: rgba(255, 176, 74, 0.82);
  background: linear-gradient(180deg, rgba(255, 176, 74, 0.22), rgba(255, 176, 74, 0.12));
}
.trade-compare-stage {
  min-height: clamp(320px, 32vw, 400px);
  height: clamp(320px, 32vw, 400px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #06080d;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: none;
}
.trade-compare-stage .ann-stage__img,
.trade-compare-stage__img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.trade-compare-stage--empty {
  display: grid;
  place-items: center;
}
.trade-compare-stage--static {
  min-height: clamp(320px, 32vw, 400px);
  height: clamp(320px, 32vw, 400px);
  padding: 8px;
  border-radius: 12px;
  background: #0a0a0a;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.trade-compare-stage__static-img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  display: block;
  border-radius: 10px;
  object-fit: contain;
}
.trade-compare-stage__empty {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 20px;
  font-size: 12px;
  color: var(--text-muted);
}
.confirm-img {
  width: 100%;
  border-radius: 10px;
  max-height: 260px;
  object-fit: contain;
  background: #0a0a0a;
  display: block;
}
.confirm-img--empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  font-size: 12px;
  color: var(--text-muted);
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.confirm-img-hint {
  font-size: 12px;
  color: var(--text-muted);
}
.confirm-img-hint img {
  margin-top: 6px;
  max-height: 160px;
  width: auto;
  border-radius: 8px;
}
@media (max-width: 600px) {
  .confirm-compare-grid { grid-template-columns: 1fr; }
  .confirm-img { max-height: 200px; }
}

.complete-card {
  padding: 28px 20px;
  border-radius: 18px;
  display: grid;
  gap: 12px;
  text-align: left;
  justify-items: stretch;
  align-items: start;
}
.complete-card--success { border: 1px solid var(--success); background: rgba(103,216,145,0.06); }
.complete-card--fail { border: 1px solid var(--danger); background: rgba(255,111,124,0.06); }
.complete-card__headline {
  display: flex;
  align-items: center;
  gap: 14px;
}
.complete-card__headline-copy {
  display: grid;
  gap: 4px;
}
.complete-card__icon {
  font-size: 40px;
  width: 48px;
  text-align: center;
}
.complete-card h3 { margin: 0; font-size: 20px; }
.complete-card__item { font-size: 15px; color: var(--text-muted); margin: 0; }
.complete-card__result {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.complete-card__result span {
  font-size: 12px;
  color: var(--text-muted);
}
.complete-card__result strong {
  font-size: 15px;
  line-height: 1.6;
}
.complete-card__compare {
  width: 100%;
  text-align: left;
}
.complete-card__compare .confirm-order-card__compare-bar {
  grid-column: 1 / -1;
}
.complete-card__compare .confirm-compare-side__label {
  text-align: left;
}
.qr-shell__meta > .complete-card__compare {
  display: none;
}

.trade-compare-dialog__summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}
.trade-compare-dialog__summary > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.trade-compare-dialog__summary span {
  font-size: 11px;
  color: var(--text-muted);
}
.trade-compare-dialog__summary strong {
  font-size: 15px;
  word-break: break-word;
}
.trade-compare-dialog__hint {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted);
}
.trade-compare-dialog__layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.trade-compare-dialog__panel {
  display: grid;
  gap: 8px;
}
.trade-compare-dialog__panel .trade-compare-stage {
  height: min(68vh, 760px);
  min-height: 360px;
}

@media (max-width: 600px) {
  .confirm-order-card__meta,
  .trade-flow-details,
  .confirm-order-card__compare-settings { grid-template-columns: 1fr; }
  .confirm-order-card__compare-bar {
    align-items: stretch;
  }
  .compare-status {
    min-width: 0;
    width: 100%;
  }
  .compare-toggle {
    width: 100%;
    justify-content: center;
  }
  .trade-compare-stage {
    min-height: clamp(240px, 56vw, 300px);
    height: clamp(240px, 56vw, 300px);
  }
  .trade-compare-stage--static {
    min-height: clamp(220px, 52vw, 280px);
    height: clamp(220px, 52vw, 280px);
    padding: 6px;
  }
  .trade-compare-dialog__summary {
    grid-template-columns: 1fr 1fr;
  }
  .trade-compare-dialog__layout {
    grid-template-columns: 1fr;
  }
  .trade-compare-dialog__panel .trade-compare-stage {
    min-height: 260px;
    height: min(54vh, 520px);
  }
}

/* manual entry item rows */
.manual-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.03);
}
.manual-item-row strong {
  flex: 0 0 auto;
}
.manual-item-row span {
  flex: 1 1 0;
  color: var(--text-muted);
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.manual-item-row .button {
  flex: 0 0 auto;
}
.manual-item-row__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
@media (max-width: 600px) {
  .manual-item-row {
    flex-wrap: wrap;
  }
  .manual-item-row span {
    width: 100%;
    order: 3;
  }
  .manual-item-row__actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 760px) {
  /* Keep the account dialog stats readable on narrow mobile browsers, especially iOS WebKit. */
  #account-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  #account-stats .stat-card {
    min-width: 0;
    padding: 14px 12px;
    align-content: start;
  }

  #account-stats .stat-card strong {
    font-size: clamp(18px, 5.4vw, 24px);
    line-height: 1.2;
    word-break: keep-all;
    overflow-wrap: normal;
  }

  #account-stats .stat-card span,
  #account-stats .stat-card small {
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  #account-profile-settings,
  #account-payment-settings {
    padding: 14px;
  }

  #account-meta,
  #account-payment-summary {
    gap: 8px;
  }

  #account-meta > div,
  #account-payment-summary > div {
    padding: 10px 0;
  }
}

@media (max-width: 420px) {
  #account-dialog .dialog__header,
  #account-dialog .dialog__body {
    padding: 16px;
  }

  #account-stats .stat-card {
    padding: 12px 10px;
    border-radius: 18px;
  }

  #account-stats .stat-card strong {
    font-size: 18px;
  }
}

#referral-dialog-body {
  display: grid;
  gap: 14px;
}

#referral-dialog-body > .section-note,
#referral-dialog-body > .detail-card,
#referral-dialog-body > #referral-summary-grid {
  margin: 0;
}

.referral-rules-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.referral-routes-card,
.referral-risk-card {
  gap: 12px;
  padding: 14px;
}

.referral-routes-card__title,
.referral-risk-card__title {
  margin: 0;
}

.referral-risk-card__title {
  color: #FFB26B;
}

.referral-stage-stack {
  display: grid;
  gap: 10px;
}

.referral-stage-card {
  padding: 12px 14px;
  border-radius: 16px;
}

.referral-stage-card--primary {
  border: 1px solid rgba(26,173,25,0.55);
  background: rgba(18,62,51,0.92);
}

.referral-stage-card--secondary {
  border: 1px solid rgba(197,160,89,0.55);
  background: rgba(74,53,17,0.92);
}

#referral-rules-note {
  margin-top: 0;
}

@media (max-width: 760px) {
  #referral-dialog-body {
    gap: 12px;
  }

  .referral-rules-grid {
    gap: 12px;
  }

  .referral-routes-card,
  .referral-risk-card {
    padding: 12px;
  }
}
