:root {
  color-scheme: light;
  --bg: #fafafa;
  --panel: #ffffff;
  --text: #0a0a0a;
  --text-2: #404040;
  --text-3: #737373;
  --muted: #737373;
  --line: #e5e5e5;
  --line-strong: #d4d4d4;
  --accent: #0a0a0a;
  --accent-soft: #f5f5f5;
  --success: #15803d;
  --success-soft: #ecfdf5;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.04);
  --shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.06), 0 2px 4px -2px rgb(0 0 0 / 0.04);
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0a0a0a;
    --panel: #141414;
    --text: #fafafa;
    --text-2: #a3a3a3;
    --text-3: #737373;
    --line: #262626;
    --line-strong: #404040;
    --accent: #fafafa;
    --accent-soft: #1a1a1a;
    --success: #4ade80;
    --success-soft: rgba(74, 222, 128, 0.1);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.1);
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.4);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.5);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  height: 56px;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--text);
}

nav {
  display: flex;
  gap: 0.125rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

nav a, nav button, nav select {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  min-height: 32px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
nav select {
  width: auto;
  padding-right: 1.75rem;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path fill='none' stroke='%23737373' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round' d='M2 4l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
}
@media (prefers-color-scheme: dark) {
  nav select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path fill='none' stroke='%23a3a3a3' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round' d='M2 4l3 3 3-3'/></svg>");
  }
}
nav a:hover, nav button:hover, nav select:hover {
  background: var(--accent-soft);
  color: var(--text);
}

/* ---------- Custom select ---------- */
.select {
  position: relative;
  display: inline-block;
}
.select-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.625rem 0.4rem 0.75rem;
  background: transparent;
  color: var(--text-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  min-height: 32px;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.select-trigger:hover,
.select.is-open .select-trigger {
  background: var(--accent-soft);
  color: var(--text);
}
.select-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 12%, transparent);
}
.select-chevron {
  color: var(--text-3);
  transition: transform 0.18s var(--ease);
  flex: 0 0 auto;
}
.select.is-open .select-chevron {
  transform: rotate(180deg);
}
.select-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 0.25rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 1px;
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 0.12s var(--ease), transform 0.12s var(--ease);
}
.select.is-open .select-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.select-option {
  display: block;
  width: 100%;
  padding: 0.4rem 0.625rem;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s var(--ease);
}
.select-option:hover {
  background: var(--accent-soft);
}
.select-option.is-selected {
  font-weight: 600;
}


/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  min-height: 32px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease), color 0.12s var(--ease);
}
.btn:hover {
  background: var(--accent-soft);
  border-color: var(--line-strong);
}
.btn:active { transform: translateY(0.5px); }

.btn.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.btn.primary:hover {
  background: var(--text);
  border-color: var(--text);
  opacity: 0.88;
}

.btn.danger {
  color: var(--danger);
  background: transparent;
  border-color: var(--line);
}
.btn.danger:hover {
  background: var(--danger-soft);
  border-color: transparent;
}

.btn.block { width: 100%; }

/* ---------- Shell & sections ---------- */
.shell {
  width: min(1080px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 5rem;
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1rem;
  align-items: stretch;
}

/* ---------- Cards ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-xs);
}

/* ---------- Typography ---------- */
h1, h2 {
  letter-spacing: -0.02em;
  line-height: 1.25;
  font-weight: 600;
  color: var(--text);
}
h1 { font-size: 1.625rem; margin: 0 0 0.5rem; }
h2 { font-size: 1rem; margin: 0; font-weight: 600; }

.hero h1 {
  font-size: 2.125rem;
  line-height: 1.15;
  letter-spacing: -0.025em;
  max-width: 20ch;
  margin: 0.5rem 0 1rem;
  font-weight: 600;
}

.eyebrow {
  margin: 0;
  color: var(--text-2);
  font-weight: 500;
  font-size: 13px;
}

.lead {
  color: var(--text-2);
  font-size: 14.5px;
  max-width: 56ch;
  margin: 0;
  line-height: 1.55;
}

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

/* ---------- Layout helpers ---------- */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.stack { display: grid; gap: 1rem; }
.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.split { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.section-gap { margin-top: 2.5rem; }

.project-card { min-height: 160px; transition: box-shadow 0.15s var(--ease), transform 0.15s var(--ease); }
.project-card:hover { box-shadow: var(--shadow-sm); }

/* ---------- Pill / status ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.125rem 0.625rem;
  color: var(--text-2);
  background: var(--panel);
  font-size: 12px;
  font-weight: 500;
}

.status-live,
.status-pending_review,
.status-review_failed,
.status-suspended {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: 999px;
  padding: 0.125rem 0.5rem;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
}
.status-live::before,
.status-pending_review::before,
.status-review_failed::before,
.status-suspended::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.status-live { color: var(--success); background: var(--success-soft); }
.status-live::before { background: var(--success); }
.status-pending_review { color: #9a6700; background: #fff7d6; }
.status-pending_review::before { background: #d29922; }
.status-review_failed,
.status-suspended { color: var(--danger); background: var(--danger-soft); }
.status-review_failed::before,
.status-suspended::before { background: var(--danger); }

/* ---------- Forms ---------- */
form { display: grid; gap: 1rem; }
label {
  display: grid;
  gap: 0.375rem;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}
.inline-check { display: flex; gap: 0.5rem; align-items: center; }
.inline-check input { width: auto; }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 14px;
  transition: border-color 0.12s var(--ease), box-shadow 0.12s var(--ease);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 12%, transparent);
}
textarea { min-height: 96px; resize: vertical; }

/* ---------- Dropzone (file input) ---------- */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 1.5rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--accent-soft);
  cursor: pointer;
  text-align: center;
  color: var(--text-2);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
  min-height: 132px;
}
.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--text);
  background: var(--panel);
}
.dropzone-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
}
.dropzone-input:focus {
  box-shadow: none;
  outline: none;
}
.dropzone-input:focus-visible + .dropzone-icon {
  /* focus ring on the visual container, not the hidden input */
}
.dropzone:focus-within {
  border-color: var(--text);
  background: var(--panel);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 8%, transparent);
}
.dropzone-icon {
  color: var(--text-3);
  width: 22px;
  height: 22px;
  margin-bottom: 0.25rem;
  pointer-events: none;
  transition: color 0.15s var(--ease);
}
.dropzone-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  pointer-events: none;
}
.dropzone-meta {
  font-size: 12px;
  color: var(--text-3);
  pointer-events: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 0.5rem;
}
.dropzone.has-file {
  border-style: solid;
  border-color: var(--line);
  background: var(--panel);
}
.dropzone.has-file .dropzone-icon {
  color: var(--success);
}
.dropzone.has-file .dropzone-meta {
  color: var(--text);
  font-weight: 500;
}


/* ---------- Notice / feedback ---------- */
.notice {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.625rem 0.875rem;
  color: var(--text-2);
  background: var(--accent-soft);
  font-size: 13px;
  line-height: 1.5;
}

.error { color: var(--danger); }
.success { color: var(--success); }

/* ---------- Table ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  font-size: 13px;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 0.625rem 0.875rem;
  text-align: left;
  vertical-align: middle;
}
th {
  color: var(--text-2);
  font-weight: 500;
  background: var(--accent-soft);
  font-size: 12px;
}
tr:last-child td { border-bottom: 0; }
tr:hover td { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }

code {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.0625rem 0.3125rem;
  font-family: var(--font-mono);
  font-size: 0.875em;
}

/* ---------- Modal (custom confirm) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: color-mix(in srgb, #000 50%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: modal-overlay-in 0.15s var(--ease);
}
.modal-overlay.is-closing {
  animation: modal-overlay-out 0.15s var(--ease) forwards;
}
@keyframes modal-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modal-overlay-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  min-width: 320px;
  max-width: 440px;
  width: 100%;
  animation: modal-in 0.18s var(--ease);
}
.modal-overlay.is-closing .modal {
  animation: modal-out 0.15s var(--ease) forwards;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes modal-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(4px) scale(0.98); }
}
.modal-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.modal-message {
  margin: 0 0 1.25rem;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.55;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hero, .grid, .two { grid-template-columns: 1fr; }
  .topbar { height: auto; padding: 0.75rem 1rem; flex-direction: column; align-items: stretch; }
  nav { justify-content: flex-start; }
  .hero h1 { font-size: 1.75rem; max-width: none; }
}
