:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e2e5ea;
  --text: #1a1d23;
  --muted: #6b7280;
  --accent: #2c6e49;
  --accent-dark: #1f4f34;
  --danger: #b3261e;
  --paid: #1f7a3f;
  --unpaid: #b3261e;
  --pending: #9a6b00;
}

* { box-sizing: border-box; }

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

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 32px 0 12px; color: var(--text); }
.subtitle { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

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

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.paid { background: #e5f4ea; color: var(--paid); }
.badge.unpaid { background: #fbe9e8; color: var(--unpaid); }
.badge.overdue { background: var(--unpaid); color: white; }
.badge.pending { background: #fdf3e0; color: var(--pending); }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 32px 0 12px;
}
.section-header h2 { margin: 0; }
.section-header select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: white;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }

input[type="text"], input[type="password"] {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: none; }
.row input[type="text"] { flex: 1; }

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

.top-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

.link-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: #f0f2f5;
  padding: 8px 10px;
  border-radius: 6px;
  word-break: break-all;
}

.notice {
  background: #e5f4ea;
  color: var(--paid);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.warning {
  background: #fdf3e0;
  color: var(--pending);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

iframe.pay-frame {
  width: 100%;
  height: 640px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.pay-modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.pay-modal-bg.open { display: flex; }
.pay-modal {
  background: white;
  border-radius: 10px;
  width: min(680px, 92vw);
  max-height: 90vh;
  overflow: auto;
  padding: 16px;
}
.pay-modal-close {
  float: right;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 18px;
  color: var(--muted);
}
