/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Ice palette ─────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:          #06090f;   /* deep polar night       */
  --bg-card:     #0b1521;   /* ice shelf              */
  --bg-hover:    #101f30;   /* frost surface          */
  --bg-sidebar:  #080e18;   /* slightly darker        */

  /* Borders */
  --border:      #172535;   /* ice crack              */
  --border-soft: #1a2d40;

  /* Text */
  --text:        #c8e8f4;   /* glacier surface        */
  --text-dim:    #5f8faa;   /* deep ice               */
  --text-muted:  #2e546a;   /* submerged              */

  /* Accent — electric glacier blue */
  --accent:      #34c5e8;
  --accent-dim:  #259ab8;
  --accent-glow: rgba(52, 197, 232, .12);

  /* Links */
  --link:        #5dd4f2;
  --link-hover:  #90e6ff;

  /* Tab active underline */
  --tab-active:  #34c5e8;

  --radius: 6px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;

  /* Sidebar width */
  --sidebar-w: 220px;
  --header-h:  50px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ── Header ──────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: #050810;
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  letter-spacing: -.2px;
}
.logo i { font-size: 18px; opacity: .9; }
.logo span { color: var(--text-dim); font-weight: 400; }
.logo strong { color: var(--accent); font-weight: 700; }
.logo:hover { color: var(--accent); }

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-submit {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 16px;
  background: var(--accent);
  color: #050810 !important;
  font-weight: 700;
  font-size: 13px;
  border-radius: var(--radius);
  transition: background .15s;
}
.btn-submit:hover { background: var(--link-hover); }

.btn-login {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 13px;
  transition: border-color .15s, color .15s;
}
.btn-login:hover { border-color: var(--accent); color: var(--accent); }

/* ── User menu (logged-in state) ─────────────────────────────── */
.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.user-avatar--initials {
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-avatar--sm { width: 22px; height: 22px; font-size: 10px; }

.user-name {
  font-size: 13px;
  color: var(--text-dim);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12px;
  transition: border-color .15s, color .15s;
}
.btn-logout:hover { border-color: #f87171; color: #f87171; }

/* ── Auth error banner ───────────────────────────────────────── */
.auth-error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(248, 113, 113, .08);
  border: 1px solid rgba(248, 113, 113, .25);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #f87171;
}
.auth-error-banner i:first-child { flex-shrink: 0; }
.banner-dismiss {
  margin-left: auto;
  color: rgba(248, 113, 113, .5);
  font-size: 14px;
}
.banner-dismiss:hover { color: #f87171; }

/* ── Page layout ─────────────────────────────────────────────── */
.page-layout {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 0;
  align-items: start;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 0 20px 0;
  border-right: 1px solid var(--border);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  gap: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ─ Sort tabs ─ */
.sort-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
}

.sort-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  transition: color .15s, background .15s;
  border-left: 2px solid transparent;
}
.sort-tab i { width: 16px; text-align: center; font-size: 13px; }
.sort-tab:hover { color: var(--text); background: var(--bg-hover); }
.sort-tab.active {
  color: var(--accent);
  background: var(--accent-glow);
  border-left-color: var(--accent);
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 14px 12px;
}

/* ─ Sidebar sections ─ */
.sidebar-section { padding: 0 12px; }

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
}

/* ─ Category list ─ */
.category-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.category-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 13px;
  transition: color .15s, background .15s;
  border-left: 2px solid transparent;
}
.category-list i { width: 14px; text-align: center; font-size: 12px; }
.category-list a:hover {
  color: var(--cat-color, var(--text));
  background: var(--bg-hover);
}
.category-list a.active {
  color: var(--cat-color, var(--accent));
  background: color-mix(in srgb, var(--cat-color, var(--accent)) 8%, transparent);
  border-left-color: var(--cat-color, var(--accent));
  font-weight: 600;
}

/* ─ Sponsor section ─ */
.sponsor-section { margin-top: 2px; }

.sponsor-box {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sponsor-headline {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.sponsor-body {
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.65;
}
.sponsor-body strong { color: var(--text); }

.sponsor-perks {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sponsor-perks li {
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 7px;
}
.sponsor-perks i {
  color: var(--accent);
  font-size: 10px;
  flex-shrink: 0;
}

.btn-sponsor-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 12px;
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  color: var(--accent) !important;
  font-size: 12px;
  font-weight: 600;
  transition: background .15s, border-color .15s;
}
.btn-sponsor-cta:hover {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: var(--accent);
}

/* ── Main content ────────────────────────────────────────────── */
.content {
  padding: 20px 0 40px 24px;
  min-width: 0;
}

/* Active filter bar */
.active-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.filter-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--cat-color) 40%, transparent);
  background: color-mix(in srgb, var(--cat-color) 10%, transparent);
  color: var(--cat-color, var(--text-dim));
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .2px;
}

.clear-filter {
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.clear-filter:hover { color: var(--text-dim); }

/* ── Story list ──────────────────────────────────────────────── */
.story-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.story-item {
  display: flex;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color .15s, background .15s;
}
.story-item:hover {
  border-color: var(--border-soft);
  background: var(--bg-hover);
}

/* Vote column */
.vote-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 36px;
  padding-top: 2px;
}

.vote-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  width: 30px;
  height: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: color .15s, border-color .15s, background .15s;
}
.vote-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
}
.vote-btn.voted {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
}

.vote-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

/* Story body */
.story-body { flex: 1; min-width: 0; }

.story-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--cat-color) 35%, transparent);
  background: color-mix(in srgb, var(--cat-color) 10%, transparent);
  color: var(--cat-color, var(--text-dim));
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
}

.nsfw-tag {
  background: rgba(200, 0, 0, .12);
  border: 1px solid rgba(200, 0, 0, .3);
  color: #f87171;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: .4px;
}

.story-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 5px;
}
.story-title a { color: var(--text); }
.story-title a:hover { color: var(--link-hover); }

.story-excerpt {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}
.story-meta i { margin-right: 3px; }
.meta-link { color: var(--text-muted); }
.meta-link:hover { color: var(--text-dim); }

.share-links {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.share-links a { color: var(--text-muted); font-size: 13px; }
.share-links a:hover { color: var(--accent); }

/* ── Load more ───────────────────────────────────────────────── */
.load-more-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 0;
}

.btn-load-more {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  padding: 8px 24px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color .15s, border-color .15s, background .15s;
}
.btn-load-more:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
}

.load-spinner { color: var(--text-muted); }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.empty-state i {
  font-size: 44px;
  margin-bottom: 16px;
  display: block;
  opacity: .3;
}
.empty-state p { font-size: 15px; }
.empty-state a { color: var(--accent); }

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  font-size: 12px;
  color: var(--text-muted);
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--text-dim); }
.sep { margin: 0 6px; }

/* ── Success banner ──────────────────────────────────────────── */
.success-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(52, 197, 232, .08);
  border: 1px solid rgba(52, 197, 232, .25);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--accent);
}
.success-banner i:first-child { flex-shrink: 0; }

/* ── Submit page ─────────────────────────────────────────────── */
.submit-page { max-width: 800px; }

.submit-header { margin-bottom: 28px; }
.submit-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.submit-header h1 i { color: var(--accent); }
.submit-sub { color: var(--text-dim); font-size: 13px; }

/* ─ Form fields ─ */
.form-field { margin-bottom: 22px; }
.form-field.has-error .form-input,
.form-field.has-error .form-select { border-color: #f87171; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-dim);
  margin-bottom: 7px;
}
.required { color: var(--accent); }

.form-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s;
  font-family: var(--font);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus { border-color: var(--accent); }

.select-wrap { position: relative; }
.form-select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  padding: 9px 36px 9px 12px;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border-color .15s;
  font-family: var(--font);
}
.form-select:focus { border-color: var(--accent); }
.form-select option { background: #0d1821; }
.select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 11px;
  pointer-events: none;
}

.form-error {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #f87171;
  font-size: 12px;
  margin-top: 6px;
}

/* ─ Markdown editor ─ */
.editor-wrap {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}
.form-field.has-error .editor-wrap { border-color: #f87171; }

.editor-tabs {
  display: flex;
  align-items: center;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  gap: 2px;
  min-height: 38px;
}

.editor-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
}
.editor-tab:hover { color: var(--text-dim); }
.editor-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 1px;
  margin-left: auto;
}
.toolbar-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: color .15s, background .15s;
}
.toolbar-btn:hover { color: var(--text); background: var(--bg-hover); }
.toolbar-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 3px;
}

.editor-textarea {
  display: block;
  width: 100%;
  min-height: 320px;
  background: var(--bg-card);
  border: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.7;
  padding: 14px 16px;
  resize: vertical;
  outline: none;
}
.editor-textarea::placeholder { color: var(--text-muted); }

.editor-preview {
  min-height: 320px;
  background: var(--bg-card);
}

/* ─ Rendered Markdown body ─ */
.md-body {
  padding: 14px 16px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.75;
}
.md-body h1, .md-body h2, .md-body h3 {
  color: var(--text);
  font-weight: 700;
  margin: 1.2em 0 .5em;
  line-height: 1.3;
}
.md-body h1 { font-size: 1.5em; }
.md-body h2 { font-size: 1.25em; }
.md-body h3 { font-size: 1.1em; }
.md-body p  { margin: .75em 0; }
.md-body a  { color: var(--link); }
.md-body a:hover { color: var(--link-hover); }
.md-body strong { color: var(--text); font-weight: 700; }
.md-body em { font-style: italic; }
.md-body blockquote {
  border-left: 3px solid var(--accent-dim);
  margin: .8em 0;
  padding: .4em 1em;
  color: var(--text-dim);
  background: var(--bg-hover);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.md-body code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--mono);
  font-size: .88em;
  color: #7ee8fa;
}
.md-body pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  overflow-x: auto;
  margin: .8em 0;
}
.md-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: .9em;
}
.md-body ul, .md-body ol { padding-left: 1.6em; margin: .6em 0; }
.md-body li { margin: .25em 0; }
.md-body table {
  width: 100%;
  border-collapse: collapse;
  margin: .8em 0;
  font-size: .92em;
}
.md-body th, .md-body td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}
.md-body th { background: var(--bg); color: var(--text-dim); }
.preview-empty { color: var(--text-muted); font-style: italic; }
.md-body del { text-decoration: line-through; color: var(--text-muted); }

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.char-counter { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.md-hint { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }

/* ─ Submit actions ─ */
.submit-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.btn-cancel {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 13px;
  transition: border-color .15s, color .15s;
}
.btn-cancel:hover { border-color: #555; color: var(--text); }

.btn-submit-story {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 22px;
  background: var(--accent);
  color: #050810;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s;
}
.btn-submit-story:hover { background: var(--link-hover); }

/* ── Admin link in header ────────────────────────────────────── */
.btn-admin-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid rgba(52, 197, 232, .3);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
  transition: border-color .15s, background .15s;
}
.btn-admin-link:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
}

/* ── Wide layout (no sidebar) ────────────────────────────────── */
.page-layout--wide {
  grid-template-columns: 1fr;
  max-width: none;
}
.page-layout--wide .content { padding: 20px 0 40px 0; }

/* ── Admin page ──────────────────────────────────────────────── */
.admin-page { padding-bottom: 48px; }

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.admin-header-title {
  display: flex;
  align-items: center;
  gap: 14px;
}
.admin-header-title i {
  font-size: 28px;
  color: var(--accent);
  opacity: .8;
}
.admin-header-title h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.admin-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.btn-admin-back {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 13px;
  transition: border-color .15s, color .15s;
}
.btn-admin-back:hover { color: var(--text); border-color: #444; }

/* ─ Admin nav tabs ─ */
.admin-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.admin-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ─ Toolbar ─ */
.admin-toolbar {
  margin-bottom: 16px;
}
.admin-toolbar form {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}
.admin-search {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  padding: 8px 12px 8px 34px;
  outline: none;
  font-family: var(--font);
  transition: border-color .15s;
}
.admin-search:focus { border-color: var(--accent); }
.admin-search::placeholder { color: var(--text-muted); }
.search-spinner {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 12px;
}

/* Status filter tabs (radio-based) */
.status-tabs {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.status-tab-radio { display: none; }
.status-tab-label {
  padding: 4px 14px;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s, background .15s;
  user-select: none;
}
.status-tab-label:hover { color: var(--text-dim); }
.status-tab-label.active,
.status-tab-radio:checked + .status-tab-label {
  background: var(--bg-hover);
  color: var(--accent);
}

/* ─ Table ─ */
.admin-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table thead {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.admin-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  white-space: nowrap;
}
.admin-table td {
  padding: 11px 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.story-row { background: var(--bg-card); transition: background .1s; }
.story-row:last-child td { border-bottom: none; }
.story-row:hover { background: var(--bg-hover); }

/* Column widths */
.col-id     { width: 50px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.col-title  { /* expands freely */ }
.col-cat    { width: 140px; white-space: nowrap; }
.col-author { width: 200px; color: var(--text-dim); font-size: 12px; }
.col-date   { width: 110px; color: var(--text-dim); font-size: 12px; line-height: 1.4; white-space: nowrap; }
.time-sub   { color: var(--text-muted); }
.col-status { width: 120px; white-space: nowrap; }
.col-actions{ width: 90px; }

.story-title-cell {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.mod-reason {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  font-style: italic;
}
.mod-reason i {
  font-style: normal;
  margin-right: 2px;
}
.story-row--rejected .mod-reason { color: #f87171; }
.story-row--approved .mod-reason { color: #34c564; }

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
}
.status-badge--pending  {
  background: rgba(245, 158, 11, .12);
  border: 1px solid rgba(245, 158, 11, .3);
  color: #f59e0b;
}
.status-badge--approved {
  background: rgba(52, 197, 100, .1);
  border: 1px solid rgba(52, 197, 100, .3);
  color: #34c564;
}
.status-badge--rejected {
  background: rgba(248, 113, 113, .1);
  border: 1px solid rgba(248, 113, 113, .3);
  color: #f87171;
}

/* Action buttons */
.col-actions { text-align: left; }
.action-btns { display: flex; align-items: center; gap: 4px; }
.action-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: color .15s, border-color .15s, background .15s;
  color: var(--text-muted);
}
.action-btn--approve:hover {
  color: #34c564;
  border-color: #34c564;
  background: rgba(52, 197, 100, .08);
}
.action-btn--reject:hover {
  color: #f87171;
  border-color: #f87171;
  background: rgba(248, 113, 113, .08);
}
.action-btn--pending:hover {
  color: #f59e0b;
  border-color: #f59e0b;
  background: rgba(245, 158, 11, .08);
}

/* Empty row */
.admin-empty-row td {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}
.admin-empty-row i {
  display: block;
  font-size: 32px;
  margin-bottom: 10px;
  opacity: .3;
}

.text-muted { color: var(--text-muted); }
.col-avatar { width: 36px; }
.story-count {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 9px;
  font-size: 12px;
  color: var(--text-dim);
}

/* ── Prose / static pages (Privacy, About, …) ───────────────── */
.prose-page {
  max-width: 760px;
}

.prose-header {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.prose-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.prose-header h1 i { color: var(--accent); }
.prose-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.prose-lead {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.7;
}

.prose-section {
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.prose-section--last {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.prose-section h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}
.prose-section h2 i {
  color: var(--accent);
  font-size: 14px;
  width: 16px;
  text-align: center;
}
.prose-section p {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.75;
  margin-bottom: 10px;
}
.prose-section p:last-child { margin-bottom: 0; }
.prose-section strong { color: var(--text); }
.prose-section a { color: var(--link); }
.prose-section a:hover { color: var(--link-hover); }

.prose-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.prose-list li {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.65;
  padding-left: 18px;
  position: relative;
}
.prose-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent-dim);
}
.prose-list strong { color: var(--text); }
.prose-list a { color: var(--link); }
.prose-list a:hover { color: var(--link-hover); }

.prose-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
  margin-bottom: 14px;
}
.prose-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.prose-table thead {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.prose-table th {
  padding: 9px 12px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  white-space: nowrap;
}
.prose-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  vertical-align: top;
  line-height: 1.55;
}
.prose-table tr:last-child td { border-bottom: none; }

.prose-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: var(--accent-glow);
  border: 1px solid rgba(52, 197, 232, .18);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.6;
}
.prose-note i { color: var(--accent); margin-top: 2px; flex-shrink: 0; }
.prose-note strong { color: var(--text); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 820px) {
  .page-layout {
    grid-template-columns: 1fr;
    padding: 0 16px;
  }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0;
    overflow: visible;
  }
  .sort-nav { flex-direction: row; padding: 0 8px; }
  .sort-tab { border-left: none; border-bottom: 2px solid transparent; }
  .sort-tab.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }
  .sidebar-divider { display: none; }
  .sponsor-section { display: none; }
  .sidebar-section { padding: 8px; }
  .content { padding: 16px 0 32px 0; }
}
