:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --line: #d9dee7;
  --text: #1f2933;
  --muted: #667085;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --warning: #b54708;
  --ok: #067647;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 58px;
  padding: 0 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 800;
  color: var(--text);
  font-size: 18px;
}

nav {
  display: flex;
  flex: 1;
  gap: 6px;
  overflow-x: auto;
}

nav a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--muted);
  white-space: nowrap;
}

nav a.active {
  background: #e7f5f2;
  color: var(--accent-strong);
}

main {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 18px;
}

section {
  margin-top: 22px;
}

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

.compact-title {
  margin-bottom: 4px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.metric strong {
  display: block;
  font-size: 28px;
  line-height: 1.1;
}

.metric span,
.muted {
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.stack {
  display: grid;
  gap: 12px;
}

.filters {
  display: flex;
  gap: 10px;
  margin: 12px 0 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.status-select {
  width: auto;
  min-width: 132px;
  min-height: 32px;
  padding: 5px 8px;
}

.compact-button {
  min-height: 32px;
  padding: 0 9px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

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

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

tr:last-child td {
  border-bottom: 0;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

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

button.ghost,
button.secondary {
  background: #fff;
  color: var(--accent-strong);
}

button.danger {
  border-color: var(--danger);
  background: var(--danger);
}

.inline {
  display: inline-flex;
  margin: 0 6px 0 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pill.paid,
.pill.active,
.pill.on_time,
.pill.submitted {
  background: #ecfdf3;
  color: var(--ok);
}

.pill.pending,
.pill.pending_payment,
.pill.waiting_payment,
.pill.late {
  background: #fffaeb;
  color: var(--warning);
}

.pill.removed,
.pill.absent,
.pill.failed {
  background: #fef3f2;
  color: var(--danger);
}

.qr-layout {
  display: grid;
  grid-template-columns: minmax(280px, 720px) minmax(260px, 420px);
  gap: 20px;
  align-items: start;
}

.qr-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.qr-box img {
  display: block;
  width: 100%;
  height: auto;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.login-box {
  width: min(420px, calc(100% - 32px));
  margin: 0;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-box p {
  margin: 8px 0 20px;
  color: var(--muted);
}

.alert {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #fef3f2;
  color: var(--danger);
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 12px;
  }

  main {
    padding: 16px;
  }

  .split,
  .qr-layout {
    grid-template-columns: 1fr;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}

