@font-face { font-family: Urbanist; src: url('fonts/Urbanist_400Regular.ttf'); font-weight: 400; font-display: swap; }
@font-face { font-family: Urbanist; src: url('fonts/Urbanist_500Medium.ttf'); font-weight: 500; font-display: swap; }
@font-face { font-family: Urbanist; src: url('fonts/Urbanist_600SemiBold.ttf'); font-weight: 600; font-display: swap; }
@font-face { font-family: Urbanist; src: url('fonts/Urbanist_700Bold.ttf'); font-weight: 700; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0b0e13;
  --card: #161a21;
  --card-2: #1d222b;
  --text: #f2f4f7;
  --text-2: #b6bdc7;
  --muted: #6b7684;
  --accent: #58c0f0;
  --accent-start: #6be0ec;
  --accent-end: #4a9bf2;
  --on-accent: #05131b;
  --accent-soft: rgba(88, 192, 240, 0.15);
  --negative: #f26d6d;
  --warning: #f2b45a;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 Urbanist, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[hidden] { display: none !important; }

main { max-width: 1040px; margin: 0 auto; padding: 24px 16px 80px; }

h1 { font-size: 28px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 19px; font-weight: 700; margin: 0 0 14px; }
p { margin: 0 0 12px; }

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

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--text-2);
  font-weight: 600;
  padding: 10px 14px;
  white-space: nowrap;
}
.tab[aria-selected='true'] { color: var(--text); border-bottom-color: var(--accent); }

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

.narrow { max-width: 420px; margin: 12vh auto 0; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.full { grid-column: 1 / -1; }

label, .field-label { display: block; color: var(--text-2); font-size: 14px; font-weight: 500; margin-bottom: 6px; }

input, select, textarea {
  width: 100%;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, .choice:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
textarea { min-height: 72px; resize: vertical; }

button { font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px; padding: 10px 16px; border: 1px solid var(--border); }
button:disabled { opacity: 0.5; cursor: default; }
.primary { background: linear-gradient(135deg, var(--accent-start), var(--accent-end)); border-color: transparent; color: var(--on-accent); }
.ghost { background: none; color: var(--text); }
.small { padding: 6px 10px; font-size: 14px; }
.danger { background: none; color: var(--negative); border-color: rgba(242, 109, 109, 0.4); }

.segmented { display: flex; gap: 8px; flex-wrap: wrap; }
.segmented button { background: var(--card-2); color: var(--text-2); }
.segmented button[aria-pressed='true'] { color: var(--text); border-color: var(--accent); }

.signups { max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-bottom-color: var(--border);
  color: var(--text);
  cursor: pointer;
}
.choice:last-child { border-bottom-color: transparent; }
.choice:has(input:checked) { border-color: var(--accent); border-radius: 10px; }
.choice input { width: auto; flex: none; }
.choice-main { min-width: 0; flex: 1; }
.choice-name { font-weight: 600; }
.choice-meta { color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }

.badge {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  padding: 1px 9px;
  white-space: nowrap;
}
.badge.active { border-color: var(--accent); color: var(--accent); }
.badge.warn { border-color: rgba(242, 180, 90, 0.5); color: var(--warning); }
.badge.bad { border-color: rgba(242, 109, 109, 0.5); color: var(--negative); }

.notice { border-radius: 10px; border: 1px solid var(--border); padding: 10px 12px; margin-bottom: 14px; color: var(--text); }
.notice.ok { border-color: var(--accent); }
.notice.warn { border-color: rgba(242, 180, 90, 0.5); }
.notice.bad { border-color: rgba(242, 109, 109, 0.5); }

.hint { color: var(--text-2); font-size: 14px; }
.empty { color: var(--text-2); padding: 12px 0; margin: 0; }
.qr { display: block; width: 200px; height: 200px; background: #fff; border-radius: 10px; margin: 8px auto 14px; padding: 8px; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 14px; overflow-wrap: anywhere; color: var(--text-2); }

.actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; margin-top: 16px; }

table { width: 100%; border-collapse: collapse; }
th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  padding: 8px 10px 8px 0;
  border-bottom: 1px solid var(--border);
}
td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
td.row-actions { text-align: right; white-space: nowrap; padding-right: 0; }

dialog {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  max-width: 420px;
  width: calc(100% - 32px);
  padding: 20px;
}
dialog::backdrop { background: rgba(5, 8, 12, 0.7); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

@media (max-width: 680px) {
  h1 { font-size: 22px; }
  .topbar button { white-space: nowrap; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--border); padding: 10px 0; }
  tr:last-child { border-bottom: 0; }
  td { border: 0; padding: 3px 0; }
  td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
  td:empty { display: none; }
  td.row-actions { text-align: left; }
  td.row-actions::before { content: none; }
}
