:root {
  --bg: #0b0e13;
  --surface: #151a21;
  --surface-2: #1c2330;
  --border: #2a3241;
  --text: #eef2f6;
  --text-dim: #93a1b0;
  --blue: #2f7de1;
  --amber: #e8a53d;
  --purple: #8b5cf6;
  --green: #22a55e;
  --red: #e5484d;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

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

button, input { font-family: inherit; }

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(11, 14, 19, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  margin: 0 -16px 16px;
}
.topbar h1 { font-size: 1.05rem; margin: 0; font-weight: 700; }
.pill-link {
  font-size: 0.85rem;
  color: var(--blue);
  text-decoration: none;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.btn {
  display: block;
  width: 100%;
  min-height: 50px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn-confirm { background: var(--amber); color: #241a00; }
.btn-different { background: var(--purple); color: #fff; }
.btn-submit { background: var(--green); color: #04210e; }
.btn-next { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }

.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.state-idle { border-color: var(--border); }
.state-idle .badge { background: var(--surface-2); color: var(--text-dim); }
.state-pending { border-color: rgba(232, 165, 61, 0.4); }
.state-pending .badge { background: rgba(232, 165, 61, 0.15); color: var(--amber); }
.state-approved { border-color: rgba(34, 165, 94, 0.4); }
.state-approved .badge { background: rgba(34, 165, 94, 0.15); color: var(--green); }
.state-error { border-color: rgba(229, 72, 77, 0.4); }
.state-error .badge { background: rgba(229, 72, 77, 0.15); color: var(--red); }

.panel-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 4px; }
.panel-sub { color: var(--text-dim); font-size: 0.88rem; margin: 0 0 4px; }

.detail-list { margin: 12px 0 0; padding: 0; list-style: none; }
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-row dt { color: var(--text-dim); margin: 0; flex: 0 0 auto; }
.detail-row dd { margin: 0; font-weight: 600; text-align: right; word-break: break-word; }

.history-list { margin-top: 12px; }
.history-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-dim); margin-bottom: 4px; }
.history-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-dim);
  padding: 5px 0;
  border-bottom: 1px dashed var(--border);
}
.history-item:last-child { border-bottom: none; }
.history-empty { font-size: 0.82rem; color: var(--text-dim); font-style: italic; }

.field { margin-top: 12px; }
.field label { display: block; font-size: 0.82rem; color: var(--text-dim); margin-bottom: 5px; }
.field input {
  width: 100%;
  min-height: 46px;
  font-size: 1rem;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}
.field input:focus { outline: 2px solid var(--blue); outline-offset: 1px; }

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
table { width: 100%; border-collapse: collapse; min-width: 480px; }
th, td { text-align: left; padding: 8px 10px; font-size: 0.85rem; white-space: nowrap; }
thead th {
  color: var(--text-dim);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
}
tbody tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
td.empty { color: var(--text-dim); font-style: italic; text-align: center; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; text-align: center; }
.stat .num { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.stat .label { font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; }
.stat.registered .num { color: var(--blue); }
.stat.attended .num { color: var(--green); }
.stat.not-attended .num { color: var(--red); }
.stat.repeats .num { color: var(--amber); }

.section-title { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-dim); margin: 22px 0 8px; }
