:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --green: #16803a;
  --green-soft: #eefaf1;
  --green-border: #ccebd5;
  --red: #c92727;
  --red-soft: #fff2f2;
  --red-border: #f1cece;
  --shadow: 0 14px 40px rgba(17, 24, 39, 0.06);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #4b5563;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.sync-box {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 150px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.75);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d19b15;
  box-shadow: 0 0 0 4px rgba(209, 155, 21, .12);
}

.sync-box.is-ok .sync-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(22, 128, 58, .12);
}

.sync-box.is-error .sync-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(201, 39, 39, .12);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  min-height: 116px;
  padding: 19px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-card.stat-printed {
  border-color: var(--green-border);
  background: linear-gradient(135deg, #fff 0%, var(--green-soft) 100%);
}

.stat-card.stat-pending {
  border-color: var(--red-border);
  background: linear-gradient(135deg, #fff 0%, var(--red-soft) 100%);
}

.stat-label {
  display: block;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.stat-value {
  display: block;
  font-size: 2.45rem;
  line-height: 1;
  letter-spacing: -.04em;
}

.stat-printed .stat-value { color: var(--green); }
.stat-pending .stat-value { color: var(--red); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}

.search-box svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #9ca3af;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search-box input {
  width: 100%;
  height: 46px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: #374151;
  font-weight: 700;
}

.refresh-button:hover { border-color: #cbd5e1; }
.refresh-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.table-card {
  overflow: hidden;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }

th, td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #fafafa;
  color: #6b7280;
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  color: #374151;
  font-size: .9rem;
}

td:first-child {
  color: var(--text);
  font-weight: 750;
}

tr.person-row { transition: background .15s ease; }
tr.person-row.is-printed { background: var(--green-soft); }
tr.person-row.is-pending { background: var(--red-soft); }
tr.person-row:last-child td { border-bottom: 0; }
tr.person-row:hover { filter: brightness(.992); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 210px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: .73rem;
  font-weight: 750;
  line-height: 1.2;
}

.status-pill::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-pill.printed {
  background: #dcf5e3;
  color: #146c31;
}
.status-pill.printed::before { background: var(--green); }
.status-pill.pending {
  background: #fde0e0;
  color: #a61f1f;
}
.status-pill.pending::before { background: var(--red); }

.action-heading, .action-cell { text-align: center; }

.print-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 11px;
  background: #111827;
  color: #fff;
  transition: transform .12s ease, opacity .12s ease;
}

.print-button:hover { transform: translateY(-1px); }
.print-button:disabled { opacity: .45; cursor: wait; transform: none; }
.print-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state, .error-state {
  padding: 56px 24px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: #111827;
  color: #fff;
  font-weight: 800;
}

.empty-state h2, .error-state h2 { margin: 0 0 8px; font-size: 1.1rem; }
.empty-state p, .error-state p { margin: 0; color: var(--muted); font-size: .9rem; }
.error-state button {
  margin-top: 16px;
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: #111827;
  color: white;
  font-weight: 700;
}

.footer-note {
  margin-top: 13px;
  color: #8a919d;
  font-size: .76rem;
  text-align: right;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  max-width: min(420px, calc(100% - 40px));
  padding: 12px 15px;
  border-radius: 12px;
  background: #111827;
  color: white;
  font-size: .84rem;
  font-weight: 600;
  box-shadow: 0 18px 50px rgba(0,0,0,.2);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: .2s ease;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #a61f1f; }

@media (max-width: 760px) {
  .app-shell { width: min(100% - 20px, 1220px); padding-top: 22px; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 14px; }
  .stats { grid-template-columns: 1fr; gap: 9px; }
  .stat-card { min-height: 86px; padding: 15px 16px; }
  .stat-label { margin-bottom: 8px; }
  .stat-value { font-size: 2rem; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .refresh-button { justify-content: center; }
  th, td { padding: 12px 13px; }
  .footer-note { text-align: left; }
}
