:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #6b6b6b;
  --border: #e6e6e6;
  --fill: #f7f7f7;
}

* {
  box-sizing: border-box;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: var(--text);
}

header {
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header a {
  text-decoration: none;
}

header nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

header nav a[data-tab].active {
  font-weight: 700;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

main.wide {
  max-width: none;
  padding: 24px 16px 48px;
}

h1, h2 {
  font-weight: 560;
  letter-spacing: -0.02em;
}

.muted {
  color: var(--muted);
}

.shop-tryon-inputs,
.shop-tryon-results {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.shop-tryon-input,
.shop-tryon-result {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.shop-tryon-input img,
.shop-tryon-output {
  background: var(--fill);
  display: block;
  margin: 0 0 12px;
  max-height: 560px;
  object-fit: contain;
  width: 100%;
}

.shop-tryon-result h3 {
  margin: 0;
}

@media (max-width: 700px) {
  .shop-tryon-inputs,
  .shop-tryon-results {
    grid-template-columns: 1fr;
  }
}

.card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  margin: 12px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-variant-numeric: tabular-nums;
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
}

.data-table {
  table-layout: fixed;
  font-size: 11px;
  line-height: 1.25;
}

.data-table th,
.data-table td {
  padding: 2px 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table .col-id,
.data-table .col-user_id,
.data-table .col-gmail_id {
  width: 8em;
}

.data-table .col-process_status {
  width: 16ch;
}

.data-table .col-source,
.data-table .col-kind,
.data-table .col-stream,
.data-table .col-pending,
.data-table .col-event_type,
.data-table .col-needs_reauth {
  width: 8em;
}

.data-table [class$="_at"],
.data-table [class$="_date"] {
  width: 26ch;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--text);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  padding: 8px 14px;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.btn.secondary {
  background: var(--fill);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.compact {
  padding: 6px 10px;
  font-size: 13px;
}

.sync-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 10px 0;
  flex-wrap: wrap;
}

.sync-name {
  min-width: 140px;
  font-weight: 500;
}

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

.btn:disabled,
.btn.secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.busy:disabled {
  opacity: 1;
}

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--muted);
}

.badge.ok {
  background: #e8f5e9;
  color: #1b5e20;
}

.flash {
  background: #f0f7ff;
  border: 1px solid #c8ddf5;
  border-radius: 8px;
  padding: 10px 14px;
}

.counts-table {
  max-width: 560px;
  font-size: 13px;
}

.counts-table th,
.counts-table td {
  padding: 3px 8px;
  border-bottom: 0;
}

.counts-table tr.group-start td {
  border-top: 1px solid var(--border);
}

.counts-table tr:last-child td {
  border-bottom: 1px solid var(--border);
}

.counts-table th:last-child,
.counts-table td.num {
  text-align: right;
  width: 1%;
  white-space: nowrap;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--fill);
  padding: 12px;
  border-radius: 8px;
}

label {
  display: block;
  margin: 12px 0 4px;
  color: var(--muted);
  font-size: 13px;
}

input, select, textarea {
  width: 100%;
  max-width: 420px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

textarea {
  max-width: none;
  min-height: 140px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

details {
  margin: 12px 0;
}

.eval-card {
  padding: 8px 10px;
  margin: 6px 0;
}

.eval-card pre {
  max-height: 200px;
  overflow: auto;
}

.eval-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.eval-kinds .btn.compact {
  padding: 2px 8px;
  font-size: 12px;
}

.eval-line {
  margin: 4px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eval-card details {
  margin: 4px 0 0;
}

.eval-card .status-line {
  margin: 2px 0 0;
  min-height: 1.2em;
}

.eval-actions {
  display: flex;
  gap: 8px;
  margin: 12px 0 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.btn .spinner {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
}

.btn.secondary .spinner {
  border-color: var(--border);
  border-top-color: var(--text);
}

.loading,
.status-line.busy {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.tab-checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: inherit;
  font-size: 14px;
}

.tab-checks input {
  width: auto;
  max-width: none;
  padding: 0;
}

.whitelist-table {
  width: max-content;
  min-width: 100%;
}

.whitelist-table th,
.whitelist-table td {
  white-space: nowrap;
  vertical-align: middle;
}

.whitelist-table .tab-group-header {
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.whitelist-table .tab-feature-header {
  font-size: 12px;
}

.whitelist-table th:not(:first-child),
.whitelist-table td:not(:first-child) {
  text-align: center;
}

.whitelist-table .user-cell {
  min-width: 220px;
  text-align: left;
}

.whitelist-table .admit-cell {
  min-width: 220px;
  text-align: left;
}

.whitelist-table .admit-cell select {
  width: 130px;
  max-width: none;
  vertical-align: middle;
}

.whitelist-table .admit-user {
  vertical-align: middle;
}

.whitelist-table .checkbox-cell {
  width: 1%;
  padding: 8px 12px;
}

.whitelist-table .checkbox-cell input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.whitelist-table .save-cell {
  min-width: 100px;
}

.prompt-run {
  margin: 24px 0;
}

.prompt-run-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.prompt-run-prompt {
  flex: 1;
  min-width: 0;
  margin: 0;
  max-height: 140px;
  overflow: auto;
  font-size: 12px;
}

.prompt-run-time {
  align-self: center;
  font-size: 12px;
  white-space: nowrap;
}

.prompt-run-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  align-items: start;
}

.prompt-run-col {
  margin: 0;
  min-width: 0;
}

.prompt-run-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.prompt-run-meta {
  font-size: 12px;
  white-space: nowrap;
}

.prompt-run-text {
  word-break: break-word;
}

.prompt-run-text > :first-child {
  margin-top: 0;
}

.prompt-run-text > :last-child {
  margin-bottom: 0;
}

.prompt-run-text p,
.prompt-run-text ul,
.prompt-run-text ol,
.prompt-run-text pre,
.prompt-run-text table,
.prompt-run-text blockquote {
  margin: 0 0 10px;
}

.prompt-run-text ul,
.prompt-run-text ol {
  padding-left: 22px;
}

.prompt-run-text li {
  margin: 3px 0;
}

.prompt-run-text li > ul,
.prompt-run-text li > ol {
  margin: 3px 0 0;
}

.prompt-run-text h1,
.prompt-run-text h2,
.prompt-run-text h3,
.prompt-run-text h4,
.prompt-run-text h5,
.prompt-run-text h6 {
  font-size: 15px;
  margin: 14px 0 6px;
}

.prompt-run-text code {
  background: var(--fill);
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 12px;
}

.prompt-run-text pre code {
  background: none;
  padding: 0;
}

.prompt-run-text blockquote {
  border-left: 3px solid var(--border);
  padding-left: 10px;
  color: var(--muted);
}

.prompt-run-text hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

.prompt-run-error {
  color: #b3261e;
  margin: 0 0 8px;
}

.prompt-run-col pre {
  max-height: 240px;
  overflow: auto;
  font-size: 12px;
}
