:root {
  color-scheme: light;
  --ink: #172126;
  --muted: #617076;
  --line: #d8e1e4;
  --paper: #ffffff;
  --soft: #f3f7f5;
  --leaf: #236b5f;
  --leaf-dark: #174c44;
  --coral: #d85e4b;
  --amber: #d9a441;
  --blue: #346fa2;
  --shadow: 0 16px 40px rgba(25, 38, 44, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--soft);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  width: min(760px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0 16px;
}

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 30px;
  line-height: 1.12;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.lede,
.panel p,
.empty-state span {
  color: var(--muted);
}

.lede {
  margin-bottom: 0;
  line-height: 1.55;
}

#merchantLabel {
  color: var(--ink);
}

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

.steps span {
  display: grid;
  place-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.steps span.active {
  border-color: rgba(35, 107, 95, 0.38);
  background: #eaf3ef;
  color: var(--leaf-dark);
}

.panel {
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 1px 0 rgba(20, 40, 44, 0.04);
}

.merchant-panel,
.auth-panel {
  display: grid;
  gap: 14px;
}

.merchant-form {
  display: grid;
  gap: 13px;
}

.control-panel {
  display: grid;
  gap: 13px;
}

.field {
  display: grid;
  gap: 7px;
}

.phone-row,
.otp-row {
  display: grid;
  gap: 8px;
}

.phone-row {
  grid-template-columns: 132px minmax(0, 1fr);
}

.otp-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.otp-row .ghost-button {
  min-width: 116px;
}

label {
  color: var(--muted);
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fbfcfb;
  color: var(--ink);
  outline: 0;
}

input:focus,
select:focus {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(35, 107, 95, 0.13);
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button-row.compact {
  justify-content: flex-end;
}

.primary-button,
.ghost-button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
}

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

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

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

.ghost-button.active {
  border-color: rgba(35, 107, 95, 0.45);
  background: #eaf3ef;
  color: var(--leaf-dark);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  white-space: nowrap;
  border-radius: 999px;
  padding: 0 11px;
  background: #eaf3ef;
  color: var(--leaf);
  font-size: 12px;
  font-weight: 900;
}

.status-pill.live {
  background: #ffece8;
  color: var(--coral);
}

.status-pill.error {
  background: #fff4db;
  color: #9b650d;
}

.live-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 12px;
}

.error-box {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #f1c8a2;
  border-radius: 8px;
  background: #fff8ec;
  color: #81510b;
  font-weight: 700;
  line-height: 1.5;
}

.comment-feed {
  display: grid;
  gap: 10px;
  padding-bottom: 30px;
}

.comment {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 1px 0 rgba(20, 40, 44, 0.04);
}

.comment.new {
  animation: pop-in 0.18s ease-out;
  border-color: rgba(35, 107, 95, 0.4);
}

.avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #dbeae4;
  color: var(--leaf-dark);
  font-size: 18px;
  font-weight: 900;
}

.comment-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.comment-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 17px;
}

.comment-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.comment-message {
  margin-bottom: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.35;
}

.empty-state {
  display: grid;
  gap: 5px;
  place-items: center;
  min-height: 220px;
  padding: 24px;
  border: 1px dashed #c7d4d7;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  text-align: center;
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 18px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

a {
  color: var(--leaf-dark);
  font-weight: 800;
}

.legal-page {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 24px 18px 40px;
  line-height: 1.7;
}

.legal-page section,
.deletion-form {
  margin: 16px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.legal-page h1 {
  margin-bottom: 16px;
}

.legal-page h2 {
  margin-bottom: 8px;
  font-size: 18px;
}

.legal-updated {
  color: var(--muted);
  font-size: 13px;
}

.deletion-form {
  display: grid;
  gap: 13px;
}

.admin-shell {
  width: min(1120px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.admin-dashboard {
  display: grid;
  gap: 14px;
}

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

.admin-stat {
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.admin-stat span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-stat strong {
  font-size: 30px;
}

.admin-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-list {
  display: grid;
  gap: 8px;
}

.admin-check {
  display: grid;
  grid-template-columns: 150px 90px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.admin-check:last-child {
  border-bottom: 0;
}

.admin-check span,
.admin-table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.admin-check code {
  overflow-wrap: anywhere;
  color: var(--ink);
}

.admin-check .ok {
  color: var(--leaf);
}

.admin-check .warn {
  color: #9b650d;
}

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

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

.admin-table td {
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.admin-table small {
  color: var(--muted);
}

.danger-button {
  color: #9a2f24;
}

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

.backup-confirm {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
}

.backup-confirm input {
  width: auto;
  min-height: auto;
}

.restore-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

@keyframes pop-in {
  from {
    transform: translateY(-4px);
    opacity: 0.45;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 560px) {
  .app-shell,
  .admin-shell {
    padding: 14px;
  }

  .hero,
  .live-head {
    flex-direction: column;
    align-items: stretch;
  }

  h1 {
    font-size: 28px;
  }

  .button-row,
  .button-row.compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

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

  .button-row .primary-button {
    grid-column: 1 / -1;
  }

  .phone-row,
  .otp-row {
    grid-template-columns: 1fr;
  }

  .comment-message {
    font-size: 25px;
  }

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

  .admin-check {
    grid-template-columns: 1fr;
  }

  .restore-form {
    grid-template-columns: 1fr;
  }
}
