:root {
  color-scheme: light;
  --bg: #f3f5f0;
  --panel: #ffffff;
  --ink: #17201a;
  --muted: #637067;
  --line: #dce2da;
  --accent: #0f7b5c;
  --accent-strong: #0a6047;
  --danger: #b33a33;
  --pending: #a86706;
  --shadow: 0 20px 50px rgba(31, 45, 35, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 123, 92, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(171, 92, 45, 0.1), transparent 35%),
    var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(360px, 1fr);
  gap: 28px;
  width: min(1180px, calc(100% - 32px));
  margin: 32px auto;
  align-items: start;
}

.editor,
.preview-panel {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(220, 226, 218, 0.95);
  box-shadow: var(--shadow);
}

.editor {
  border-radius: 8px;
  padding: 24px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.12;
  letter-spacing: 0;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.notice {
  margin: 20px 0;
  padding: 12px 14px;
  border: 1px solid #e8d9b9;
  border-radius: 8px;
  background: #fff8e8;
  color: #6c4b12;
  font-size: 14px;
  line-height: 1.55;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.span-2 {
  grid-column: span 2;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 123, 92, 0.14);
}

.input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 8px;
}

.input-action button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.input-action button:hover {
  background: #f7faf6;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.actions button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 760;
}

.actions button:hover {
  background: var(--accent-strong);
}

.actions .secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.actions .secondary:hover {
  background: #f7faf6;
}

.preview-panel {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 64px);
  border-radius: 8px;
  padding: 28px;
}

.phone-frame {
  width: min(390px, 100%);
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.receipt {
  position: relative;
  overflow: hidden;
  min-height: 844px;
  border-radius: 0;
  background: #fff;
  padding: 0;
  isolation: isolate;
}

.watermark {
  display: none;
}

.receipt::before {
  content: "";
  position: absolute;
  right: 22px;
  bottom: 28px;
  z-index: 5;
  width: auto;
  color: rgba(179, 58, 51, 0.52);
  font-weight: 900;
  font-size: 13px;
  transform: none;
  word-spacing: 0;
  pointer-events: none;
}

.detail-nav {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  height: 70px;
  padding: 0 18px;
}

.detail-nav h2 {
  margin: 0;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
}

.back-icon {
  display: block;
  width: 14px;
  height: 14px;
  border-left: 3px solid #202124;
  border-bottom: 3px solid #202124;
  transform: rotate(45deg);
}

.amount-summary {
  padding: 28px 20px 38px;
  border-bottom: 1px solid #f0f0f0;
}

.amount-summary p {
  margin: 0 0 19px;
  color: #34373a;
  font-size: 17px;
  font-weight: 400;
}

.amount-summary h3 {
  margin: 0;
  color: #292b2e;
  font-size: 34px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0;
}

.amount-summary span {
  display: none;
}

.details {
  margin: 0;
  padding: 0 20px;
  background: #fff;
}

.details + .details {
  border-top: 9px solid #f4f4f4;
}

.details div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 15px 0;
}

.detail-list div {
  padding: 17px 0;
}

dt {
  color: #707377;
  font-size: 16px;
  line-height: 1.46;
  font-weight: 400;
}

dd {
  margin: 0;
  min-width: 0;
  color: #242629;
  font-size: 16px;
  line-height: 1.46;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.counterparty-row {
  min-height: 70px;
}

.counterparty-row dd {
  display: grid;
  gap: 2px;
}

.counterparty-row strong {
  font: inherit;
}

.receipt-footer {
  min-height: 213px;
  margin: 0;
  padding: 24px 20px 80px;
  background: #f4f4f4;
  color: #6c7074;
  font-size: 15px;
  line-height: 1.55;
}

.receipt-footer p {
  margin: 0;
}

.receipt-footer strong {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: block;
  max-width: 210px;
  margin: 0;
  color: rgba(179, 58, 51, 0.74);
  font-size: 10px;
  line-height: 1.35;
  text-align: right;
}

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

  .preview-panel {
    min-height: auto;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: 100%;
    margin: 0;
  }

  .editor,
  .preview-panel {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    padding: 18px;
  }

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

  .span-2 {
    grid-column: auto;
  }

  .phone-frame {
    padding: 0;
    border-radius: 0;
    width: min(390px, 100%);
  }

  .receipt {
    min-height: 844px;
    border-radius: 0;
  }
}
