:root {
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --text: #1b1f27;
  --muted: #6b7280;
  --border: #e2e5ea;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --good: #16a34a;
  --bad: #dc2626;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.wrap.wide { max-width: 720px; }

h1 { font-size: 1.4rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
p.sub { color: var(--muted); margin: 0 0 20px; font-size: 0.92rem; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 12px 0 4px;
}
label:first-child { margin-top: 0; }

input[type=text], input[type=number], input[type=email], select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  color: var(--text);
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  width: 100%;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { background: #9ca3af; cursor: not-allowed; }

.btn-secondary { background: #eef0f3; color: var(--text); }
.btn-danger { background: #fee2e2; color: var(--bad); }

.amount {
  font-size: 2.2rem;
  font-weight: 700;
  text-align: center;
  margin: 4px 0 2px;
}

.ref { text-align: center; color: var(--muted); font-size: 0.9rem; margin-bottom: 4px; }

.qr-box { text-align: center; }
.qr-box img { width: 240px; height: 240px; image-rendering: pixelated; }

.link-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.link-row input { flex: 1; font-size: 0.8rem; }
.link-row button { width: auto; white-space: nowrap; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-paid { background: #dcfce7; color: #166534; }
.badge-expired, .badge-canceled { background: #fee2e2; color: var(--bad); }

.status-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

#card-element {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 6px;
}

.error-msg { color: var(--bad); font-size: 0.88rem; margin: 6px 0 0; min-height: 1.2em; }
.hint { color: var(--muted); font-size: 0.8rem; margin-top: 6px; }

.success-box { text-align: center; padding: 20px 0; }
.success-box .check {
  font-size: 3rem;
  color: var(--good);
  line-height: 1;
  margin-bottom: 8px;
}

table.settings-table { width: 100%; border-collapse: collapse; }
table.settings-table th, table.settings-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background-color: #d1d5db; border-radius: 999px; transition: .15s;
}
.slider:before {
  content: ""; position: absolute; height: 18px; width: 18px;
  left: 3px; bottom: 3px; background-color: white; border-radius: 50%; transition: .15s;
}
input:checked + .slider { background-color: var(--good); }
input:checked + .slider:before { transform: translateX(20px); }

nav.top {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 720px; margin: 0 auto; padding: 14px 16px 0;
  font-size: 0.85rem;
}
nav.top a { color: var(--muted); text-decoration: none; }
nav.top a:hover { color: var(--accent); }

.tip-encourage {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.88rem;
  margin: 4px 0 14px;
}

.tip-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tip-btn {
  width: auto;
  flex: 1;
  min-width: 64px;
  padding: 10px 6px;
  background: #eef0f3;
  color: var(--text);
  font-size: 0.9rem;
}
.tip-btn.selected { background: var(--accent); color: #fff; }

.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
  color: var(--muted);
  margin-top: 10px;
}
.total-row-final {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 6px;
}