:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f7faf8;
  --ink: #17211b;
  --muted: #63706a;
  --line: #dfe6e2;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --blue: #2563eb;
  --warn: #b45309;
  --danger: #b42318;
  --shadow: 0 12px 32px rgba(23, 33, 27, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(15, 118, 110, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 118, 110, 0.07) 1px, transparent 1px),
    repeating-linear-gradient(135deg, rgba(37, 99, 235, 0.055) 0 1px, transparent 1px 76px),
    var(--bg);
  background-size: 34px 34px, 34px 34px, 152px 152px, auto;
  background-attachment: fixed;
  color: var(--ink);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: -2;
  background:
    linear-gradient(90deg, transparent 0 8%, rgba(15, 118, 110, 0.11) 8% 8.18%, transparent 8.18% 100%),
    linear-gradient(0deg, transparent 0 18%, rgba(37, 99, 235, 0.09) 18% 18.16%, transparent 18.16% 100%),
    linear-gradient(90deg, transparent 0 76%, rgba(15, 118, 110, 0.08) 76% 76.12%, transparent 76.12% 100%),
    linear-gradient(0deg, transparent 0 72%, rgba(37, 99, 235, 0.07) 72% 72.12%, transparent 72.12% 100%);
  background-size: 280px 180px, 320px 220px, 420px 260px, 380px 240px;
  opacity: 0.9;
}

body::after {
  z-index: -1;
  background:
    repeating-linear-gradient(0deg, transparent 0 7px, rgba(15, 23, 42, 0.026) 7px 8px),
    linear-gradient(180deg, rgba(244, 246, 248, 0) 0%, rgba(244, 246, 248, 0.72) 58%, rgba(244, 246, 248, 0.94) 100%);
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  outline: none;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  padding: 10px 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

label,
.field-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: 28px 18px;
}

.auth-brand {
  width: min(560px, 100%);
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 112px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #d7e4dd;
  overflow: hidden;
  flex: 0 0 auto;
}

.brand-mark img {
  width: 106px;
  height: 46px;
  display: block;
  object-fit: contain;
}

.auth-brand h1,
.brand h1,
.topbar h2,
.section-header h3,
.list-title h4 {
  margin: 0;
  letter-spacing: 0;
}

.auth-brand h1 {
  font-size: 24px;
}

.auth-brand h1,
.brand h1 {
  display: inline-block;
  background: linear-gradient(92deg, #0b5f59 0%, #13b8a6 34%, #2563eb 72%, #38bdf8 100%);
  background-size: 140% auto;
  background-clip: text;
  color: transparent;
  font-weight: 900;
  text-shadow: 0 0 18px rgba(37, 99, 235, 0.16);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-brand p,
.brand p,
.section-header p,
.auth-footnote {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-brand .brand-slogan {
  margin-top: 6px;
  color: #26362f;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.45;
}

.auth-card {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-tab {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}

.auth-tab.active {
  background: #e9f6f2;
  border-color: #b7ddd4;
  color: var(--accent-dark);
}

.auth-form,
.staff-form {
  display: none;
  gap: 12px;
}

.auth-form.active,
.staff-form:not([hidden]) {
  display: grid;
}

.staff-login {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.staff-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  padding: 0;
  font-weight: 700;
}

.language-widget {
  position: relative;
  z-index: 50;
  min-height: 54px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 12px 24px 0;
  pointer-events: none;
}

.language-trigger {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(23, 33, 27, 0.1);
  padding: 0 12px;
  font-weight: 800;
  pointer-events: auto;
}

.language-trigger svg {
  width: 17px;
  height: 17px;
}

.language-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.language-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 24px;
  min-width: 148px;
  display: grid;
  overflow: hidden;
  border: 1px solid #cbd5df;
  border-radius: 8px;
  background: #444952;
  box-shadow: 0 14px 34px rgba(23, 33, 27, 0.18);
  pointer-events: auto;
}

.language-menu button {
  min-height: 42px;
  border: 0;
  background: transparent;
  color: #fff;
  text-align: left;
  padding: 0 18px;
  font-size: 16px;
  font-weight: 700;
}

.language-menu button:hover,
.language-menu button.active {
  background: #5c6d84;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  background: #fbfcfa;
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.brand h1 {
  font-size: 18px;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab,
.ghost-button,
.primary-button,
.secondary-button,
.danger-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  white-space: nowrap;
  font-weight: 700;
}

.nav-tab {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  color: var(--muted);
}

.nav-tab.active {
  background: #e9f6f2;
  border-color: #b7ddd4;
  color: var(--ink);
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  background: #eaf1ff;
  color: #1647a3;
  border-color: #d6e4ff;
}

.ghost-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.danger-button {
  background: #fff1f0;
  color: var(--danger);
  border-color: #ffd8d4;
}

.primary-button svg[data-lucide="loader-circle"],
.secondary-button svg[data-lucide="loader-circle"] {
  animation: spin 0.8s linear infinite;
}

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

.full-button {
  width: 100%;
}

.compact-button {
  min-height: 32px;
  padding: 0 10px;
}

.nav-tab svg,
.ghost-button svg,
.primary-button svg,
.secondary-button svg,
.danger-button svg,
.search-box svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.operator-panel {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
}

.toolbar,
.form-actions,
.order-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.notice {
  border-radius: 8px;
  border: 1px solid #bfe4d8;
  background: #edf8f4;
  color: #155d52;
  padding: 12px 14px;
  margin-bottom: 18px;
  line-height: 1.5;
}

.auth-notice {
  margin: 0 0 14px;
}

.notice.error {
  border-color: #ffd8d4;
  background: #fff1f0;
  color: var(--danger);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.flow-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.flow-strip span {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.flow-strip .active {
  background: #e9f6f2;
  border-color: #b7ddd4;
  color: var(--accent-dark);
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-header.compact {
  margin-top: 26px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.wide {
  grid-column: span 4;
}

.service-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.service-card {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 6px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.service-card strong {
  font-size: 18px;
}

.service-card span {
  color: var(--muted);
  font-weight: 700;
}

.service-card.selected {
  border-color: var(--accent);
  background: #eefaf6;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.form-actions {
  justify-content: space-between;
}

.form-total {
  color: var(--accent-dark);
  font-size: 18px;
}

.split-layout,
.admin-layout {
  display: grid;
  gap: 18px;
}

.split-layout {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.pipeline-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.admin-layout {
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, 0.8fr);
  align-items: start;
}

.seller-ready-box {
  min-width: min(420px, 100%);
  display: grid;
  gap: 8px;
}

.seller-ready-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) 76px auto;
  gap: 8px;
  align-items: center;
}

.ready-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.ready-status.online {
  color: #087443;
}

.ready-status.stale {
  color: var(--warn);
}

.seat-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  box-shadow: none;
}

.seat-strip strong {
  display: block;
  margin-bottom: 2px;
}

.seat-strip span {
  color: var(--muted);
  font-size: 13px;
}

.seat-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.seat-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
}

.seat-pill.ready {
  border-color: #bbf7d0;
  background: #ecfdf3;
  color: #087443;
}

.seat-pill.muted {
  color: var(--muted);
}

.search-box {
  min-width: min(360px, 100%);
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 11px;
}

.search-box input {
  height: auto;
  padding: 0;
  border: 0;
}

.search-box input:focus {
  box-shadow: none;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric,
.order-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric {
  padding: 14px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.metric strong {
  font-size: 24px;
}

.list-title {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
}

.list-title span {
  color: var(--muted);
  font-size: 13px;
}

.order-list {
  display: grid;
  gap: 10px;
}

.order-card {
  padding: 14px;
  box-shadow: 0 4px 16px rgba(23, 33, 27, 0.05);
}

.order-card.expired {
  border-color: #f6c7c0;
  background: #fffafa;
}

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

.order-card-head > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #edf8f4;
  color: #12645a;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.pending_payment,
.status-pill.need_link {
  background: #fff7ed;
  color: var(--warn);
}

.status-pill.claimed {
  background: #eaf1ff;
  color: var(--blue);
}

.status-pill.submitted {
  background: #f5f0ff;
  color: #6b3fb6;
}

.status-pill.disputed {
  background: #fff1f0;
  color: var(--danger);
}

.status-pill.refunded,
.status-pill.cancelled,
.status-pill.settled {
  background: #eef2f6;
  color: #425466;
}

.amount {
  color: var(--accent-dark);
  white-space: nowrap;
}

.order-timeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 12px;
}

.order-timeline span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.order-timeline b {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #eef2f6;
  color: #51605a;
  font-size: 11px;
}

.order-timeline .done {
  border-color: #bbf7d0;
  background: #ecfdf3;
  color: #087443;
}

.order-timeline .done b,
.order-timeline .current b {
  background: var(--accent);
  color: #fff;
}

.order-timeline .current {
  border-color: #b7ddd4;
  background: #e9f6f2;
  color: var(--accent-dark);
}

.order-meta {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 12px;
  font-size: 13px;
}

.order-meta dt {
  color: var(--muted);
}

.order-meta dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.link-list {
  display: grid;
  gap: 4px;
  margin-top: 10px;
}

.order-link,
.masked-link {
  color: var(--accent-dark);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.masked-link {
  margin-top: 10px;
  color: var(--muted);
}

.order-note {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.order-actions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.inline-form {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.empty-state {
  min-height: 92px;
  display: grid;
  place-items: center;
  border: 1px dashed #cad5ce;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
  text-align: center;
  padding: 18px;
}

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

table {
  width: 100%;
  min-width: 430px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #fbfcfa;
}

.audit-title {
  margin-top: 18px;
}

.seller-account-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
}

.seller-account-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
}

.seller-account-item {
  display: grid;
  grid-template-columns: minmax(130px, 1.2fr) minmax(100px, 1fr) minmax(120px, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.seller-account-item strong,
.seller-account-item span {
  display: block;
}

.seller-account-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.seller-account-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.audit-list {
  max-height: 360px;
  overflow: auto;
  padding: 10px 12px;
}

.audit-item {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.5;
}

.audit-item:last-child {
  border-bottom: 0;
}

.audit-item time {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .nav-tab {
    justify-content: center;
  }

  .split-layout,
  .pipeline-grid,
  .admin-layout,
  .seller-account-form,
  .seller-account-item {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .language-widget {
    min-height: 50px;
    padding: 10px 14px 0;
  }

  .language-menu {
    right: 14px;
  }

  .main,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .section-header,
  .seat-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar button {
    flex: 1 1 130px;
  }

  .flow-strip,
  .order-timeline,
  .form-grid,
  .service-cards,
  .metric-grid,
  .nav-tabs,
  .seller-ready-row,
  .staff-actions {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: span 1;
  }

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