:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --shell: #101316;
  --shell-soft: #1a1f22;
  --surface: #ffffff;
  --surface-2: #f8faf7;
  --ink: #151716;
  --muted: #667068;
  --line: #dde4dc;
  --accent: #24745d;
  --accent-2: #0f9f7a;
  --accent-soft: #e6f5ee;
  --blue: #315fbd;
  --blue-soft: #e7eefc;
  --warn: #b65b11;
  --warn-soft: #fff1d9;
  --danger: #b33a35;
  --shadow: 0 18px 48px rgba(15, 23, 20, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--shell);
  color: #fff;
  padding: 18px;
}

.brand-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: linear-gradient(160deg, #1d2427, #111416);
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: var(--accent-2);
  font-weight: 900;
}

h1 {
  font-size: 17px;
  line-height: 1.25;
}

.brand-card p,
.hint,
.section-head p,
.card-muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.brand-card p,
.sidebar .hint {
  color: #a9b8b0;
}

.nav-stack {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.nav-item {
  width: 100%;
  border-radius: 14px;
  background: transparent;
  color: #bfccc5;
  padding: 12px 14px;
  text-align: left;
  font-weight: 750;
}

.nav-item.active,
.nav-item:hover {
  background: var(--shell-soft);
  color: #fff;
}

.side-panel {
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: #151a1d;
  padding: 14px;
}

.panel-title,
.section-head,
.hero-card,
.strategy-title,
.h5-title-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.panel-title {
  align-items: center;
  margin-bottom: 12px;
  font-weight: 850;
}

.status-pill,
.tag,
.score-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-pill.online {
  background: var(--accent-soft);
  color: var(--accent);
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 11px;
  color: #c7d4cd;
  font-size: 12px;
  font-weight: 800;
}

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

.sidebar input,
.sidebar select,
.sidebar textarea {
  border-color: rgba(255, 255, 255, 0.1);
  background: #0f1315;
  color: #fff;
}

textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(15, 159, 122, 0.15);
}

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

.hero-card,
.board-card,
.metric-card,
.partner-card,
.action-card,
.mini-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-card {
  margin-bottom: 16px;
  padding: 22px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

h2 {
  max-width: 760px;
  font-size: clamp(26px, 3.4vw, 42px);
  line-height: 1.08;
}

.hero-actions,
.inline-actions,
.card-actions,
.h5-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  min-height: 40px;
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 850;
  white-space: nowrap;
}

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

.btn.primary:hover {
  background: #195d49;
}

.btn.dark {
  background: var(--ink);
  color: #fff;
}

.btn.ghost {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.btn.danger {
  background: #fde7e3;
  color: var(--danger);
}

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

.metric-card {
  padding: 16px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.75fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.board-card {
  min-width: 0;
  padding: 16px;
}

.section-head {
  align-items: center;
  margin-bottom: 14px;
}

h3 {
  font-size: 20px;
  line-height: 1.2;
}

.partner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.merchant-toolbar {
  display: grid;
  grid-template-columns: 180px minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.type-manager {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.65fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.type-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 850;
}

.type-chip button {
  min-height: 20px;
  width: 20px;
  border-radius: 999px;
  padding: 0;
  background: rgba(36, 116, 93, 0.12);
  color: var(--accent);
}

.type-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.merchant-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.merchant-table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
}

.merchant-table th,
.merchant-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.merchant-table th {
  background: #f3f7f2;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.merchant-table tr.active td {
  background: #eef9f3;
}

.merchant-table td p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.partner-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    transform 0.18s ease;
}

.partner-card:hover,
.partner-card.active {
  border-color: var(--accent-2);
  transform: translateY(-1px);
}

.partner-card h4 {
  font-size: 17px;
}

.tag {
  width: fit-content;
  background: var(--blue-soft);
  color: var(--blue);
}

.tag.green {
  background: var(--accent-soft);
  color: var(--accent);
}

.tag.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

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

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

.editor-form {
  display: grid;
  gap: 10px;
}

.strategy-board {
  margin-bottom: 16px;
}

.strategy-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
  gap: 14px;
}

.strategy-layout.empty-state,
.h5-preview.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  color: var(--muted);
  text-align: center;
}

.strategy-summary {
  display: grid;
  gap: 12px;
  align-content: start;
}

.summary-block {
  border-radius: 18px;
  background: #eef9f3;
  padding: 14px;
  line-height: 1.6;
  border: 1px solid #ccebdd;
}

.score-pill {
  background: var(--accent);
  color: #fff;
}

.flow-list,
.list-stack,
.records-list {
  display: grid;
  gap: 9px;
}

.mini-card {
  padding: 12px;
  box-shadow: none;
}

.mini-card strong,
.action-card strong {
  display: block;
  margin-bottom: 6px;
}

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

.action-card {
  padding: 14px;
  box-shadow: none;
  background: var(--surface-2);
}

.action-card p,
.mini-card p,
.h5-phone p,
.record-row p {
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.h5-preview {
  display: grid;
  gap: 14px;
}

.h5-phone {
  border-radius: 30px;
  background: #0f1719;
  padding: 14px;
  color: #fff;
  max-width: 390px;
}

.h5-screen {
  min-height: 560px;
  border-radius: 24px;
  background: #f7faf7;
  color: var(--ink);
  padding: 18px;
}

.h5-screen h4 {
  font-size: 24px;
  line-height: 1.12;
}

.h5-screen .offer {
  margin: 14px 0;
  border-radius: 18px;
  background: #e9f8ef;
  padding: 14px;
}

.h5-actions {
  justify-content: flex-start;
}

.flow-line {
  display: grid;
  gap: 10px;
}

.flow-line div {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
  padding: 13px;
}

.flow-line strong {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
}

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

.record-row {
  display: grid;
  grid-template-columns: 1.1fr 0.85fr 0.85fr 0.7fr;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.hidden {
  display: none;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(8, 13, 11, 0.42);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(100%, 520px);
  height: 100%;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 55px rgba(10, 20, 16, 0.18);
  transform: translateX(100%);
  transition: transform 0.2s ease;
}

.drawer.open {
  pointer-events: auto;
}

.drawer.open .drawer-mask {
  opacity: 1;
}

.drawer.open .drawer-panel {
  transform: translateX(0);
}

.drawer-body {
  display: grid;
  gap: 10px;
  padding: 0 16px 18px;
}

.qr-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px;
  gap: 12px;
  align-items: end;
}

.qr-upload img {
  width: 108px;
  height: 108px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  object-fit: cover;
  background: var(--surface-2);
}

.qr-upload img:not([src]) {
  display: none;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .work-grid,
  .strategy-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .main,
  .sidebar {
    padding: 14px;
  }

  .hero-card,
  .section-head,
  .panel-title,
  .strategy-title,
  .h5-title-row {
    display: grid;
  }

  .hero-actions,
  .inline-actions {
    justify-content: stretch;
  }

  .hero-actions .btn,
  .inline-actions .btn {
    flex: 1 1 140px;
  }

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

  .record-row {
    grid-template-columns: 1fr;
  }

  .merchant-toolbar,
  .type-manager,
  .type-add {
    grid-template-columns: 1fr;
  }
}
