:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --text: #1c1917;
  --text-muted: #78716c;
  --text-faint: #a8a29e;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;

  --danger: #b91c1c;
  --danger-soft: #fef2f2;

  --warn: #b45309;
  --warn-soft: #fffbeb;

  --ok: #166534;
  --ok-soft: #f0fdf4;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 8px 24px rgba(15, 15, 15, 0.08);
  --shadow-lg: 0 24px 48px rgba(15, 15, 15, 0.16);

  --radius: 8px;
  --radius-lg: 14px;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

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

/* ===== topbar ===== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar__brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.topbar__brand:hover { text-decoration: none; }
.topbar__logo { font-size: 22px; color: var(--accent); }
.topbar__name { font-size: 17px; }
.topbar__tagline { color: var(--text-muted); font-weight: 400; font-size: 13px; }

.topbar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.topbar__user-name { color: var(--text-muted); }
.topbar__user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* ===== view shell ===== */

.view {
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}

/* ===== list view ===== */

.list-view__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.list-view__search {
  flex: 1;
}
.list-view__search input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.list-view__search input:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}
.list-view__subbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.filter-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.filter-toggle__btn {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
}
.filter-toggle__btn:hover { color: var(--text); }
.filter-toggle__btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.checkbox input { margin: 0; }

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-empty {
  margin-top: 64px;
  text-align: center;
  color: var(--text-muted);
}
.list-empty__icon { font-size: 36px; color: var(--text-faint); margin-bottom: 8px; }
.list-empty__title { font-size: 16px; color: var(--text); margin: 0 0 4px; }
.list-empty__hint { margin: 0; font-size: 14px; }

/* ===== card ===== */

.card {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  align-items: start;
  transition: border-color 0.12s ease, transform 0.05s ease;
}
.card:hover { border-color: var(--border-strong); }

.card--stopped { background: var(--surface-2); opacity: 0.85; }
.card--stopped .card__title { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--text-faint); }

.card__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}

.card__main { min-width: 0; }
.card__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.card__title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}
.card__version-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  letter-spacing: 0.02em;
}
.card__expires {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  white-space: nowrap;
}
.card__expires--soon { background: var(--warn-soft); color: var(--warn); }
.card__expires--today { background: var(--danger-soft); color: var(--danger); }
.card__expires--stopped { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

.card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.card__dot { color: var(--text-faint); }
.card__slug {
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 12px;
}
.card__owner { font-weight: 500; color: var(--text); }
.card__note {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.45;
}
.card__note:empty { display: none; }
.card__autoclean { color: var(--text-faint); }

.card__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  justify-content: flex-start;
}
.card__secondary-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

/* ===== buttons ===== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, transform 0.04s;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn[disabled]:hover { background: var(--surface); }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* The single most important button across the app — Copy link. Higher visual
   weight than other actions, consistent placement at the top-right of every card. */
.btn--copy {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 600;
  padding: 8px 16px;
  font-size: 13px;
  justify-content: center;
  min-width: 120px;
}
.btn--copy:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--copy:active { transform: translateY(1px); }

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

.btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  padding: 5px 10px;
}
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }

.link-btn {
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 0.95em;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--accent-hover); }

/* ===== versions disclosure ===== */

.versions-disclosure {
  margin: -2px 0 0 56px;
  padding: 0;
  border-left: 2px solid var(--border);
}
.versions-disclosure__toggle {
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.versions-disclosure__toggle:hover { color: var(--text); }
.versions-disclosure__caret {
  transition: transform 0.15s ease;
  font-size: 11px;
}
.versions-disclosure__toggle[aria-expanded="true"] .versions-disclosure__caret {
  transform: rotate(90deg);
}
.versions-disclosure__items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 0 4px 12px;
}

.older-version {
  display: grid;
  grid-template-columns: auto auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12.5px;
}
.older-version__chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.older-version__expires {
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  white-space: nowrap;
}
.older-version__expires--soon { background: var(--warn-soft); color: var(--warn); }
.older-version__expires--today { background: var(--danger-soft); color: var(--danger); }
.older-version__slug {
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11.5px;
}
.older-version__age { color: var(--text-faint); font-size: 11.5px; white-space: nowrap; }
.older-version__note { grid-column: 1 / -1; margin: 0; font-size: 12px; }
.older-version__note:empty { display: none; }
.older-version__actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
.older-version__actions .btn { font-size: 11.5px; padding: 4px 9px; }
.older-version__actions .btn--copy { min-width: 0; padding: 4px 11px; }

/* ===== new view ===== */

.back-link {
  display: inline-block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.back-link:hover { color: var(--text); }

.new-view h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 24px;
}

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 56px 24px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone.is-hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone__icon {
  font-size: 32px;
  color: var(--accent);
  margin-bottom: 12px;
  line-height: 1;
}
.dropzone__primary {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 4px;
}
.dropzone__secondary {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.dropzone__hint {
  font-size: 12.5px;
  color: var(--text-faint);
  margin: 0;
}
.dropzone__hint code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
}

/* upload form */
.upload-form { margin-top: 8px; }
.upload-summary {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.upload-summary strong { color: var(--text); }

.version-picker {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 20px;
  background: var(--surface);
}
.version-picker legend {
  font-size: 13px;
  font-weight: 600;
  padding: 0 6px;
  color: var(--text);
}
.version-picker .radio {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  padding: 4px 0;
}
.version-picker .radio input { margin: 0; }
.version-picker select {
  font: inherit;
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  margin-left: 4px;
}

.field {
  display: block;
  margin-bottom: 18px;
}
.field__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.field__hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 400;
}
.field__optional {
  color: var(--text-faint);
  font-weight: 400;
}
.field input[type="text"],
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.field input[type="text"]:focus,
.field textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}
.field input[type="text"][disabled] {
  background: var(--surface-2);
  color: var(--text-muted);
}
.field textarea {
  font-family: var(--font-sans);
  resize: vertical;
  min-height: 70px;
}

.slug-field {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 4px 6px 4px 12px;
}
.slug-field:focus-within {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}
.slug-field__prefix {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
}
.slug-field input {
  flex: 1;
  border: 0 !important;
  padding: 5px 0 !important;
  font-family: var(--font-mono);
  font-size: 13px;
  background: transparent;
}
.slug-field input:focus { outline: 0; }
.slug-field input[disabled] {
  background: transparent !important;
  color: var(--text-muted);
}
.slug-field .link-btn {
  font-size: 12px;
  padding: 0 8px;
}

.upload-form__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  gap: 16px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.upload-form__expiry-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}
.upload-form__actions {
  display: flex;
  gap: 8px;
}

/* upload done */
.upload-done {
  text-align: left;
  margin-top: 8px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.upload-done__check {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 12px;
}
.upload-done h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 12px;
}
.upload-done__copied {
  font-size: 13px;
  font-weight: 500;
  color: var(--ok);
  background: var(--ok-soft);
  padding: 3px 9px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}
.share-link-row {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  align-items: stretch;
}
.share-link {
  flex: 1;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 13px;
  overflow-x: auto;
  white-space: nowrap;
  display: flex;
  align-items: center;
}
.upload-done__actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

/* ===== drop overlay (drag anywhere) ===== */

.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(79, 70, 229, 0.08);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.drop-overlay[hidden] { display: none; }
.drop-overlay__inner {
  background: var(--surface);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  padding: 36px 56px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.drop-overlay__icon {
  font-size: 40px;
  color: var(--accent);
  margin-bottom: 8px;
}
.drop-overlay h2 {
  margin: 0 0 4px;
  font-size: 18px;
}
.drop-overlay p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}
.drop-overlay code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ===== modal ===== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 420px;
  width: 100%;
  padding: 22px 22px 18px;
}
.modal__title {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 8px;
}
.modal__body {
  font-size: 14px;
  color: var(--text);
  margin: 0 0 6px;
  line-height: 1.5;
}
.modal__attribution {
  font-size: 12.5px;
  margin: 0 0 18px;
}
.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ===== toast ===== */

.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: white;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  animation: toast-in 0.18s ease;
  max-width: 480px;
}
.toast--ok { background: #14532d; }
.toast--danger { background: var(--danger); }
.toast__undo {
  background: transparent;
  border: 0;
  color: white;
  text-decoration: underline;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.toast__undo:hover { opacity: 0.85; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== responsive ===== */

@media (max-width: 720px) {
  .list-view__bar { flex-wrap: wrap; }
  .list-view__search { order: 3; flex-basis: 100%; }
}

@media (max-width: 640px) {
  .view { padding: 20px 16px 60px; }
  .topbar { padding: 12px 16px; }
  .topbar__tagline { display: none; }
  .card { grid-template-columns: 1fr; }
  .card__avatar { display: none; }
  .card__actions { flex-direction: row; flex-wrap: wrap; }
  .upload-form__footer { flex-direction: column; align-items: stretch; }
  .upload-form__actions { justify-content: flex-end; }
  .versions-disclosure { margin-left: 8px; }
}
