:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e0e3e8;
  --text: #1c1f26;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --paid: #16a34a;
  --pending: #d97706;
  --overdue: #dc2626;
  --radius: 8px;
}

* { box-sizing: border-box; }

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

header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 { font-size: 18px; margin: 0; }

nav {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

nav button {
  background: none;
  border: none;
  padding: 12px 16px;
  font-size: 14px;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

nav button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

main {
  padding: 24px;
  max-width: 960px;
  margin: 0 auto;
}

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

.panel h2 {
  margin-top: 0;
  font-size: 15px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--muted);
  gap: 4px;
}

input, select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

button.submit, button.action {
  background: var(--accent);
  color: white;
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  height: fit-content;
}

button.submit:hover, button.action:hover { background: var(--accent-hover); }

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

tr:hover { background: #fafbfc; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}
.badge.paid { background: var(--paid); }
.badge.pending { background: var(--pending); }
.badge.overdue { background: var(--overdue); }

button.small {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  cursor: pointer;
}
button.small:hover { background: #f0f1f3; }

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

#gate {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

#gate .box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 320px;
  text-align: center;
}

#gate input {
  width: 100%;
  margin: 12px 0;
}

.error-text { color: var(--overdue); font-size: 13px; margin-top: 8px; }

.csv-box {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

textarea {
  width: 100%;
  min-height: 90px;
  font-family: monospace;
  font-size: 12px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.hidden { display: none !important; }
