:root {
  --bg: #0a0a0c;
  --panel: #111114;
  --row: #0e0e11;
  --row-alt: #121216;
  --border: #26262d;
  --border-hi: #3a3a45;
  --text: #e6e6ea;
  --muted: #8b8b96;
  --accent: #9b59c9;
  --accent-dim: #6e3d91;
  --danger: #c45a6a;
  --success: #4f9a68;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { color-scheme: dark; }

body {
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
}

.bg-wash {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 420px at 50% -120px, rgba(110, 61, 145, 0.18), transparent 70%),
    #0a0a0c;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

button, input, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

::selection {
  background: #4a2d63;
  color: #fff;
}

.muted { color: var(--muted); }
.inline-form { display: inline; }

/* Nav */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 40px;
  padding: 0 14px;
  background: #0d0d10;
  border-bottom: 1px solid var(--border);
}

.nav-left,
.nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topnav a,
.link-btn {
  color: var(--muted);
  background: none;
  border: 0;
  font-size: 12px;
  cursor: pointer;
}

.topnav a:hover,
.link-btn:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text) !important;
  font-weight: 600;
  font-size: 13px !important;
}

.nav-brand:hover { text-decoration: none; }

.nav-logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.nav-user { color: #c9b3d8 !important; }

.container {
  width: min(1100px, calc(100% - 28px));
  min-height: calc(100vh - 90px);
  margin: 0 auto;
  padding: 22px 0 48px;
}

/* Home */
.hero {
  padding: 18px 0 14px;
  text-align: center;
}

.site-logo {
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
  object-fit: contain;
}

.site-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.site-tagline {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.search-section {
  max-width: 520px;
  margin: 0 auto 14px;
}

.search-options {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.search-options label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.search-options input { accent-color: var(--accent); }

.search-row { display: flex; }

.search-input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  color: var(--text);
  background: #0c0c0f;
  border: 1px solid var(--border);
  border-right: 0;
  outline: 0;
}

.search-input:focus { border-color: var(--border-hi); }
.search-input::placeholder { color: #5c5c66; }

.meta-line {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.meta-line strong {
  color: #c2c2ca;
  font-weight: 500;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  color: #f0e8f6;
  background: #2a1a36;
  border: 1px solid #4a325c;
  font-size: 12px;
  cursor: pointer;
}

.btn:hover {
  background: #352042;
  border-color: #634578;
  text-decoration: none;
  color: #fff;
}

.search-row .btn {
  border-radius: 0;
  height: 32px;
}

.btn-small {
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
}

.btn-full { width: 100%; }

.btn-ghost {
  color: var(--muted);
  background: transparent;
  border-color: var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  background: #15151a;
}

.btn-danger {
  color: #d98a97;
  background: transparent;
  border-color: #5c2d36;
}

.btn-danger:hover {
  background: #3a1c22;
  border-color: #7a3a46;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin: 10px 0;
}

.page-btn,
.page-num {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 24px;
  padding: 0 6px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
}

.page-btn:hover,
.page-num:hover,
.page-num.active {
  color: #fff;
  background: var(--accent-dim);
  border-color: #7a4f98;
  text-decoration: none;
}

/* Tables */
.table-section { margin: 16px 0; }

.section-title {
  padding: 7px 10px;
  color: #d0d0d6;
  background: #15151a;
  border: 1px solid var(--border);
  border-bottom: 0;
  font-size: 12px;
  font-weight: 600;
}

.pin-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  vertical-align: middle;
  background: var(--accent);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
}

.archive-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.archive-table th {
  padding: 6px 10px;
  color: var(--muted);
  background: #121216;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 500;
  text-align: left;
}

.archive-table td {
  height: 32px;
  padding: 5px 10px;
  color: #b6b6bf;
  border-bottom: 1px solid #1a1a20;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-table tbody tr:last-child td { border-bottom: 0; }
.archive-table tbody tr { background: var(--row); }
.archive-table tbody tr:nth-child(even) { background: var(--row-alt); }
.archive-table tbody tr:hover { background: #19191f; }
.archive-table .row-pinned { background: rgba(110, 61, 145, 0.12) !important; }

.archive-table th:first-child,
.archive-table td:first-child { width: 42%; }
.archive-table th:nth-child(2),
.archive-table td:nth-child(2) { width: 9%; text-align: center; }
.archive-table th:nth-child(3),
.archive-table td:nth-child(3) { width: 9%; text-align: center; }
.archive-table th:nth-child(4),
.archive-table td:nth-child(4) { width: 22%; }
.archive-table th:nth-child(5),
.archive-table td:nth-child(5) { width: 18%; text-align: right; }

.users-table th:first-child,
.users-table td:first-child { width: 36%; }
.users-table th:nth-child(2),
.users-table td:nth-child(2) { width: 24%; text-align: left; }
.users-table th:nth-child(3),
.users-table td:nth-child(3) { width: 14%; text-align: center; }
.users-table th:nth-child(4),
.users-table td:nth-child(4) { width: 26%; text-align: right; }

.paste-title {
  color: #e2e2e8;
  font-weight: 500;
}

.paste-title:hover { color: var(--accent); }

.author {
  font-size: 12px;
  font-weight: 500;
}

.role-tag {
  opacity: 0.7;
  font-size: 11px;
  font-weight: 400;
}

.col-date {
  color: var(--muted) !important;
  font-family: var(--mono);
  font-size: 11px !important;
}

.empty-row {
  height: 64px !important;
  color: var(--muted) !important;
  text-align: center !important;
}

.row-banned { opacity: 0.45; }

.badge {
  padding: 1px 5px;
  color: #cfcfd6;
  background: #17171c;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10px;
}

.badge-pinned {
  color: #c9a0e8;
  border-color: #4d3560;
}

.badge-private { color: #9a9aa3; }
.badge-banned {
  color: #d98a97;
  border-color: #5c2d36;
}

/* Forms / auth */
.auth-card,
.form-card,
.error-card {
  width: min(400px, 100%);
  margin: 40px auto;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.form-card { width: min(720px, 100%); }
.settings-card { width: min(520px, 100%); }

.auth-logo {
  display: block;
  width: 48px;
  height: 48px;
  margin: 0 auto 10px;
  object-fit: contain;
}

.auth-title,
.page-header .auth-title {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}

.auth-sub {
  margin: 6px 0 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.auth-form label,
.paste-form label {
  display: block;
  margin-bottom: 12px;
}

.auth-form label span,
.paste-form label > span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.auth-form input,
.paste-form input,
.paste-form textarea,
.comment-form textarea {
  width: 100%;
  padding: 8px 9px;
  color: var(--text);
  background: #0c0c0f;
  border: 1px solid var(--border);
  outline: 0;
  resize: vertical;
}

.auth-form input:focus,
.paste-form input:focus,
.paste-form textarea:focus,
.comment-form textarea:focus {
  border-color: var(--border-hi);
}

.auth-form .btn { margin-top: 4px; }

.auth-footer {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.mono {
  font-family: var(--mono) !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.alert {
  margin: 12px 0;
  padding: 8px 9px;
  font-size: 12px;
  border-left: 2px solid;
}

.alert-error {
  color: #d98a97;
  background: rgba(92, 45, 54, 0.25);
  border-color: var(--danger);
}

.alert-success {
  color: #8fc9a3;
  background: rgba(44, 84, 58, 0.25);
  border-color: var(--success);
}

.paste-form { margin-top: 16px; }

.paste-form textarea {
  min-height: 160px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-label input {
  width: auto;
  accent-color: var(--accent);
}

.checkbox-label span { margin: 0 !important; }

.form-actions,
.paste-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.settings-divider {
  margin: 20px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.settings-hint {
  margin: -6px 0 10px;
  font-size: 11px;
}

/* Profile */
.page-header { margin: 10px 0 18px; }
.profile-page { max-width: 880px; margin: 0 auto; }

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.profile-name {
  font-size: 20px;
  font-weight: 600;
}

.profile-role {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.profile-bio {
  margin: 10px 0 16px;
  padding: 12px;
  color: #c2c2ca;
  background: #0c0c0f;
  border: 1px solid var(--border);
  white-space: pre-wrap;
}

/* Paste */
.paste-view { max-width: 920px; margin: 0 auto; }

.paste-header {
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-bottom: 0;
}

.paste-header h1 {
  font-size: 18px;
  font-weight: 600;
}

.paste-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.meta-sep { color: #4a4a55; }

.paste-content {
  min-height: 280px;
  padding: 14px 16px;
  overflow-x: auto;
  color: #d6d6dc;
  background: #0c0c0f;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
}

.paste-videos {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.paste-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  border-top: 0;
}

.paste-video + .paste-video {
  border-top: 1px solid var(--border);
}

.paste-video iframe,
.paste-video video {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
}

.paste-header + .paste-videos .paste-video:first-child,
.paste-content + .paste-videos .paste-video:first-child {
  border-top: 1px solid var(--border);
}

.paste-actions { margin-top: 8px; }
.comments-section { margin-top: 22px; }
.comment-form { margin: 0 0 12px; }
.comment-form textarea {
  min-height: 70px;
  margin-bottom: 6px;
}

.comment-list { border-top: 1px solid var(--border); }

.comment {
  padding: 10px 8px;
  border-bottom: 1px solid #1a1a20;
}

.comment-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 11px;
}

.comment p {
  color: #c2c2ca;
  font-size: 12px;
  white-space: pre-wrap;
}

.empty-comment {
  padding: 16px 8px;
  color: var(--muted);
  text-align: center;
}

.back-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
}

.back-link:hover { color: var(--text); }

.error-card { text-align: center; }
.error-logo {
  margin-bottom: 8px;
  opacity: 0.8;
}
.error-card h1 { font-size: 18px; }
.error-card p {
  margin: 8px 0 16px;
  color: var(--muted);
}

.site-footer {
  padding: 14px;
  color: #5f5f69;
  border-top: 1px solid var(--border);
  font-size: 11px;
  text-align: center;
}

.footer-sep { margin: 0 6px; }

@media (max-width: 680px) {
  .topnav {
    align-items: flex-start;
    padding: 8px 10px;
  }

  .nav-left,
  .nav-right {
    flex-wrap: wrap;
    gap: 10px;
  }

  .nav-brand span { display: none; }
  .container { width: min(100% - 16px, 1100px); padding-top: 14px; }
  .site-logo { width: 44px; height: 44px; }
  .site-title { font-size: 18px; }
  .search-options { justify-content: flex-start; }

  .table-wrap { overflow: visible; border: 0; }
  .archive-table,
  .archive-table tbody { display: block; }
  .archive-table thead { display: none; }

  .archive-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    margin-bottom: 8px;
    padding: 10px;
    border: 1px solid var(--border);
  }

  .archive-table td {
    width: auto !important;
    height: auto;
    padding: 0;
    display: block;
    border: 0;
    text-align: left !important;
    white-space: normal;
  }

  .archive-table td:first-child {
    grid-column: 1 / -1;
    padding-bottom: 4px;
    border-bottom: 1px solid #1a1a20;
  }

  .archive-table td::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-size: 10px;
  }

  .archive-table td:first-child::before { display: none; }
  .archive-table .empty-row { padding: 20px !important; }
  .archive-table .empty-row::before { display: none; }

  .auth-card,
  .form-card,
  .error-card {
    margin: 20px auto;
    padding: 16px;
  }

  .profile-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .paste-header,
  .paste-content { padding: 12px; }
  .comment-head { flex-direction: column; gap: 4px; }
}
