:root {
  --bg: #f4f8f5;
  --panel: #ffffff;
  --ink: #173028;
  --muted: #64736d;
  --line: #dce8e1;
  --green: #17845f;
  --green-dark: #0e684a;
  --mint: #e8f6ef;
  --blue: #2563eb;
  --amber: #b7791f;
  --red: #c2413a;
  --shadow: 0 14px 36px rgba(26, 77, 58, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #f7fbf8 0%, var(--bg) 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  background: var(--green);
  cursor: pointer;
}

button:hover {
  background: var(--green-dark);
}

button.secondary {
  color: var(--green-dark);
  background: var(--mint);
}

button.primary {
  background: var(--green);
}

button.link-button {
  justify-self: center;
  padding: 6px 8px;
  color: var(--muted);
  background: transparent;
}

button.link-button:hover {
  color: var(--green-dark);
  background: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  background: #f8fbf9;
}

.topbar,
main,
.tabs {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 38px;
}

h3 {
  font-size: 18px;
}

.user-pill,
.status-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: #fff;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.tabs button,
.admin-tabs button {
  color: var(--muted);
  background: transparent;
}

.tabs button.active,
.admin-tabs button.active {
  color: #fff;
  background: var(--green);
}

main {
  padding: 18px 0 40px;
}

.view,
.admin-view {
  display: none;
}

.view.active,
.admin-view.active {
  display: block;
}

.hero-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  border-radius: 8px;
  padding: 24px;
  color: #fff;
  background: linear-gradient(135deg, #157a57 0%, #22a06f 55%, #52b788 100%);
  box-shadow: var(--shadow);
}

.hero-panel .eyebrow,
.hero-panel p {
  color: rgba(255, 255, 255, 0.86);
}

.hero-panel .status-badge {
  border-color: rgba(255, 255, 255, 0.38);
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.panel.narrow {
  max-width: 520px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.facts {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.facts div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 10px;
}

.facts span,
.manual-box p,
.result,
#adminHint {
  color: var(--muted);
}

.manual-box {
  border-radius: 8px;
  padding: 12px;
  background: #f8fbf9;
}

.form-row,
.filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.filters {
  grid-template-columns: 180px minmax(160px, 1fr) auto;
  margin-bottom: 16px;
}

.checkin-button {
  width: 100%;
  min-height: 56px;
  font-size: 18px;
  font-weight: 700;
}

.checkin-only {
  display: grid;
  gap: 10px;
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
}

.checkin-only strong {
  font-size: 28px;
}

.table-wrap {
  overflow-x: auto;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.editor {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 0.8fr auto auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.user-editor {
  grid-template-columns: 1fr 1fr 1.6fr auto auto auto auto;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink);
  white-space: nowrap;
}

.checkline input {
  width: auto;
  min-height: auto;
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.list-item p {
  margin: 4px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.list-item p.openid {
  font-size: 12px;
}

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

.danger {
  background: var(--red);
}

.danger:hover {
  background: #9f2f2a;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  max-width: min(480px, calc(100vw - 32px));
  border-radius: 8px;
  padding: 12px 16px;
  color: #fff;
  background: rgba(15, 104, 74, 0.94);
  opacity: 0;
  transition: all 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 840px) {
  .grid.two,
  .form-row,
  .filters,
  .editor,
  .user-editor {
    grid-template-columns: 1fr;
  }

  .hero-panel,
  .topbar,
  .panel-head,
  .list-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .tabs {
    overflow-x: auto;
  }

  h2 {
    font-size: 30px;
  }
}
