:root {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --accent: #f59e0b;
  --accent-ink: #1f1300;
  --accent-soft: #fef3c7;
  --green: #10b981;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 12px rgb(0 0 0 / .04);
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f19;
    --bg-soft: #111827;
    --surface: #161e2e;
    --border: #253047;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --accent-soft: #3a2a07;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 800; font-size: 1.15rem; white-space: nowrap; }
.top-search { flex: 1; max-width: 520px; }
.top-search input, .hero-search input {
  width: 100%; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-soft);
}
.topbar nav { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.topbar nav a { color: var(--muted); font-weight: 500; }
.topbar nav a:hover { color: var(--text); }

.btn {
  padding: 8px 16px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-weight: 600;
}
.btn:hover { background: var(--bg-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .6; cursor: wait; }

.muted { color: var(--muted); margin: 0; }
.btn.link { border: 0; background: none; color: var(--muted); padding: 8px 4px; margin-right: auto; font-weight: 500; }
.btn.link:hover { color: var(--text); background: none; }
.btn.danger { color: #ef4444; }
.btn.liked { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
#userArea { display: flex; align-items: center; gap: 12px; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: .85rem; }
.user-menu .menu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); min-width: 160px; padding: 6px; display: flex; flex-direction: column; z-index: 20; }
.user-menu .menu a, .user-menu .menu button { padding: 8px 10px; border-radius: 6px; text-align: left; background: none; border: 0; cursor: pointer; color: var(--text); }
.user-menu .menu a:hover, .user-menu .menu button:hover { background: var(--bg-soft); }

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

/* Hero */
.hero {
  text-align: center; padding: 56px 16px 32px;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0 0 8px; letter-spacing: -0.02em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--muted); margin: 0 auto 28px; max-width: 620px; font-size: 1.1rem; }
.hero-search { display: flex; gap: 8px; max-width: 720px; margin: 0 auto; }
.hero-search input { padding: 14px 20px; font-size: 1.05rem; }
.hero-search .btn { border-radius: 999px; padding: 0 24px; white-space: nowrap; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.suggestions button {
  border: 1px solid var(--border); background: var(--bg-soft);
  border-radius: 999px; padding: 4px 12px; font-size: .85rem; color: var(--muted); cursor: pointer;
}
.suggestions button:hover { color: var(--text); border-color: var(--accent); }
.stats { display: flex; flex-wrap: wrap; gap: 16px 32px; justify-content: center; margin-top: 28px; color: var(--muted); font-size: .9rem; }
.stats b { color: var(--text); font-size: 1.1rem; display: block; }

/* AI answer */
.answer {
  border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
  padding: 20px 24px; margin: 24px 0;
}
.answer-head { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 8px; }
.answer-head .badge { background: var(--accent-soft); color: var(--accent); }
.answer-body { overflow-wrap: anywhere; }
.answer-body :first-child { margin-top: 0; }
.answer-body pre { overflow-x: auto; background: var(--bg-soft); padding: 12px; border-radius: 8px; }
.answer-body table { border-collapse: collapse; }
.answer-body td, .answer-body th { border: 1px solid var(--border); padding: 4px 8px; }
.answer-error { color: #ef4444; }
.cursor::after { content: "▍"; animation: blink 1s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

/* Sections & grid */
section { margin-top: 36px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 1.3rem; }
.section-head a { color: var(--muted); font-size: .9rem; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: .875rem;
}
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card .thumb { aspect-ratio: 4/3; background: var(--bg-soft); position: relative; overflow: hidden; }
/* Absolutely positioned so tall (portrait) images can't stretch the 4:3 box. */
.card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.card .rank {
  position: absolute; top: 8px; left: 8px;
  background: rgb(0 0 0 / .65); color: #fff; font-weight: 700; font-size: .8rem;
  padding: 2px 8px; border-radius: 6px;
}
.card .meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.card h3 { margin: 0; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .sub { color: var(--muted); font-size: .8rem; display: flex; gap: 10px; flex-wrap: wrap; }
.badge { font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--bg-soft); }

.empty { color: var(--muted); text-align: center; padding: 48px 16px; border: 1px dashed var(--border); border-radius: var(--radius); }

/* Browse */
.browse-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 28px 0 12px; }
.browse-head h1 { margin: 0; font-size: 1.6rem; flex: 1; }
.browse-head select { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }

/* Dialogs */
dialog {
  border: 1px solid var(--border); border-radius: 16px; padding: 0;
  background: var(--surface); color: var(--text);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
}
dialog::backdrop { background: rgb(0 0 0 / .5); }
.dialog-form { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.dialog-form h2 { margin: 0 0 4px; }
.dialog-form label { display: flex; flex-direction: column; gap: 4px; font-size: .875rem; font-weight: 600; }
.dialog-form input:not([type=file]), .dialog-form textarea, .dialog-form select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-soft); font-weight: 400;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.drop {
  border: 2px dashed var(--border); border-radius: 12px; min-height: 150px;
  display: flex !important; align-items: center; justify-content: center; text-align: center;
  cursor: pointer; color: var(--muted); font-weight: 400 !important; overflow: hidden;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop img { max-height: 220px; max-width: 100%; }
.form-error { color: #ef4444; margin: 0; min-height: 1em; font-size: .875rem; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }

dialog.detail { width: min(1000px, calc(100vw - 32px)); }
.detail-body { display: grid; grid-template-columns: 1.4fr 1fr; }
.detail-body .img-wrap { background: #000; display: flex; align-items: center; justify-content: center; min-height: 300px; }
.detail-body .img-wrap img { max-width: 100%; max-height: 75vh; display: block; }
.detail-body .info { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.detail-body h2 { margin: 0; }
.detail-body .desc { color: var(--muted); white-space: pre-wrap; margin: 0; }
.detail-body .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.detail-body .counts { display: flex; gap: 16px; color: var(--muted); font-size: .9rem; }
.detail-body .info .actions { justify-content: flex-start; margin-top: auto; }
.close-x { position: absolute; top: 10px; right: 12px; background: rgb(0 0 0 / .55); color: #fff; border: 0; border-radius: 50%; width: 32px; height: 32px; cursor: pointer; font-size: 1.1rem; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-weight: 500; z-index: 100;
}

@media (max-width: 720px) {
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .user-menu summary span:not(.avatar) { display: none; }
  .top-search { order: 3; flex-basis: 100%; max-width: none; }
  main { padding: 0 16px 48px; }
  .hero { padding-top: 32px; }
  .hero-search { flex-direction: column; }
  .hero-search .btn { padding: 12px; }
  .row { grid-template-columns: 1fr; }
  .detail-body { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}

/* ---------- Models ---------- */
.new-menu summary.btn { padding: 8px 16px; }
.chip.small { font-size: .78rem; padding: 3px 10px; }
.muted-inline { color: var(--muted); font-weight: 400; }
.badge.warn { background: #fef3c7; color: #92400e; }
@media (prefers-color-scheme: dark) { .badge.warn { background: #3a2a07; color: #fbbf24; } }

.model-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 12px; }
.model-row {
  display: flex; flex-direction: column; gap: 6px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: border-color .15s, transform .15s; min-width: 0;
}
.model-row:hover { border-color: var(--accent); transform: translateY(-1px); }
.model-row-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.model-row .slug { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-row .sub { color: var(--muted); font-size: .8rem; display: flex; gap: 12px; flex-wrap: wrap; }
.rank-inline { font-weight: 800; color: var(--accent); font-size: .85rem; }
.fw-icon { font-size: 1.1rem; }
#modelSearch input { padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }

.model-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 28px 0 16px; }
.model-head h1 { margin: 0 0 6px; font-size: 1.6rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.model-head .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; align-self: flex-start; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab .count { background: var(--bg-soft); border-radius: 999px; padding: 0 7px; font-size: .75rem; }
.model-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; }
.side-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface); }
.side-card h4 { margin: 0 0 10px; }
.side-card h4:not(:first-child) { margin-top: 16px; }
.side-card dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: .875rem; }
.side-card dt { color: var(--muted); }
.side-card dd { margin: 0; overflow-wrap: anywhere; }
.side-card .tags { display: flex; gap: 4px; flex-wrap: wrap; }

.markdown { overflow-wrap: anywhere; }
.markdown pre, .snippet pre { overflow-x: auto; background: var(--bg-soft); padding: 12px; border-radius: 8px; font-size: .85rem; }
.markdown table { border-collapse: collapse; display: block; overflow-x: auto; }
.markdown td, .markdown th { border: 1px solid var(--border); padding: 4px 8px; }
.markdown img { max-width: 100%; }

table.files { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.files th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--border); padding: 8px; }
table.files td { border-bottom: 1px solid var(--border); padding: 8px; vertical-align: middle; }
table.files td code { overflow-wrap: anywhere; }
.file-actions { white-space: nowrap; text-align: right; }
.btn.small { padding: 3px 10px; font-size: .8rem; }

.small-drop { min-height: 100px !important; margin-bottom: 12px; }
.upload-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 160px 150px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .875rem; }
.upload-row code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-row .bar { height: 6px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.upload-row .bar > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.upload-row.done .bar > div { background: var(--green); }
.upload-row.error .status { color: #ef4444; }

.snippet { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.snippet-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--bg-soft); }
.snippet pre { margin: 0; border-radius: 0; }
.warn-note { color: #b45309; font-size: .9rem; }

dialog.wide-dialog { width: min(760px, calc(100vw - 32px)); }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.dialog-form textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }

@media (max-width: 900px) {
  .model-body { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .model-list { grid-template-columns: 1fr; }
  .row3 { grid-template-columns: 1fr; }
  .upload-row { grid-template-columns: 1fr auto; }
  .upload-row .bar { grid-column: 1 / -1; }
  .new-menu summary.btn { padding: 8px 12px; }
}

/* ---------- Nav ---------- */
.topbar nav a.active { color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); padding-bottom: 2px; }

/* ---------- Datasets ---------- */
.table-scroll { overflow: auto; max-height: 560px; border: 1px solid var(--border); border-radius: 8px; }
table.data-preview { border-collapse: collapse; font-size: .82rem; min-width: 100%; }
table.data-preview th { position: sticky; top: 0; background: var(--bg-soft); text-align: left; font-weight: 600; }
table.data-preview th, table.data-preview td { border-bottom: 1px solid var(--border); padding: 6px 10px; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
#previewSel { margin-bottom: 10px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }

/* ---------- Forum ---------- */
.avatar.small { width: 22px; height: 22px; font-size: .72rem; display: inline-grid; vertical-align: middle; }
.forum-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; margin-top: 28px; }
.forum-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 80px; align-self: start; }
.btn.block { width: 100%; }
.cat-nav { display: flex; flex-direction: column; gap: 2px; }
.cat-nav a { padding: 8px 10px; border-radius: 8px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.cat-nav a:hover { background: var(--bg-soft); color: var(--text); }
.cat-nav a.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.cat-nav .count { margin-left: auto; font-size: .75rem; background: var(--bg-soft); border-radius: 999px; padding: 0 8px; }
.forum-main .browse-head { margin-top: 0; align-items: flex-start; }
.forum-main .browse-head h1 { flex: none; }
.forum-main .browse-head p { margin: 4px 0 0; }
#forumSearch input { padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }

.topic-list { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.topic-row { display: flex; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.topic-row:last-child { border-bottom: 0; }
.topic-row:hover { background: var(--bg-soft); }
.topic-main { flex: 1; min-width: 0; }
.topic-title { font-weight: 600; font-size: 1rem; overflow-wrap: anywhere; }
.topic-title:hover { color: var(--accent); }
.topic-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: 6px; }
.topic-excerpt { margin: 6px 0 0; color: var(--muted); font-size: .875rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.topic-stats { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: .75rem; text-align: center; }
.topic-stats b { display: block; color: var(--text); font-size: .95rem; }
.topic-active { min-width: 64px; text-align: right; }
.ref-chip { cursor: pointer; background: var(--accent-soft); border-color: transparent; color: var(--text); font-family: inherit; }
.topic-list.compact .topic-row { padding: 10px 12px; }
.topic-list.compact .topic-excerpt { display: none; }

.narrow { max-width: 860px; margin: 28px auto 0; }
.narrow > h1 { margin: 8px 0 16px; overflow-wrap: anywhere; }
.dialog-form.flat { padding: 0; }
.md-editor { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg-soft); }
.md-tabs { display: flex; gap: 2px; padding: 4px; border-bottom: 1px solid var(--border); }
.md-tabs button { background: none; border: 0; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 500; }
.md-tabs button.active { background: var(--surface); color: var(--text); }
.md-editor textarea { width: 100%; border: 0 !important; border-radius: 0 !important; resize: vertical; min-height: 140px; }
.md-preview { padding: 10px 12px; min-height: 140px; background: var(--surface); }

.post { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; background: var(--surface); }
.post.first { border-left: 4px solid var(--accent); }
.post-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .875rem; }
.post-body { margin-top: 8px; }
.post-body > :first-child { margin-top: 0; }
.post-body > :last-child { margin-bottom: 0; }
.post-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.replies-head { display: flex; align-items: center; gap: 8px; margin: 24px 0 12px; }
.live-dot { color: var(--green); font-size: .75rem; font-weight: 500; }
.reply-form { margin-top: 8px; }
.ref-card { display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px; background: var(--bg-soft); }
.ref-card img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; }
.ref-card .fw-icon { font-size: 1.6rem; }
.discuss-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.detail-discuss { border-top: 1px solid var(--border); padding-top: 12px; }
.detail-discuss h4 { margin: 0 0 8px; }

@media (max-width: 900px) {
  .forum-layout { grid-template-columns: 1fr; }
  .forum-side { position: static; }
  .cat-nav { flex-direction: row; overflow-x: auto; }
  .cat-nav a { white-space: nowrap; }
}
@media (max-width: 720px) {
  .topic-row { flex-direction: column; gap: 8px; }
  .topic-stats { justify-content: flex-start; text-align: left; }
  .topic-stats b { display: inline; margin-right: 3px; }
  .hide-sm { display: none; }
  .topbar nav { gap: 12px; }
}

/* Grid children default to min-width:auto, so a wide scroller (category bar, tables) would stretch the
   column past the viewport on phones. */
.forum-layout > *, .model-body > *, .narrow { min-width: 0; }
.new-menu summary.btn { white-space: nowrap; }
@media (max-width: 900px) {
  .forum-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .topbar nav { gap: 10px; flex-wrap: wrap; }
  .topbar nav a[data-nav] { font-size: .9rem; }
  .browse-head > form, .browse-head > select { flex: 1 1 140px; }
  #forumSearch input, #repoSearch input { width: 100%; }
  .post pre, .markdown pre { max-width: 100%; }
}
.md-editor textarea { font-family: inherit; font-size: .95rem; }

/* ---------- Footer ---------- */
body { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; width: 100%; }
.site-footer { border-top: 1px solid var(--border); padding: 20px 24px; color: var(--muted); font-size: .85rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; background: var(--bg-soft); }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }

/* ---------- Sign-in ---------- */
.sso-buttons { display: flex; flex-direction: column; gap: 8px; }
.sso-btn { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 16px; font-weight: 600; }
.sso-btn.google { background: #fff; color: #1f1f1f; border-color: #dadce0; }
.sso-btn.google:hover { background: #f8f9fa; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; margin: 4px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.user-menu .menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.identity-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; }
.identity { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.identity:last-child { border-bottom: 0; }
.identity > span:first-child { display: flex; align-items: center; gap: 8px; }

/* ---------- Admin ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface); display: flex; flex-direction: column; gap: 2px; }
.stat-card:hover { border-color: var(--accent); }
.stat-card b { font-size: 1.5rem; }
.stat-card span { color: var(--muted); font-size: .85rem; }
.admin-help { margin-top: 24px; border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 20px; background: var(--bg-soft); }
.admin-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.admin-toolbar input[type=search], .admin-toolbar select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.admin-toolbar input[type=search] { flex: 1 1 220px; }
.admin-toolbar .spacer { flex: 1; }
.select-all { display: flex; align-items: center; gap: 6px; font-size: .875rem; color: var(--muted); }
.admin-img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.admin-img { position: relative; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.admin-img:has(input:checked) { border-color: #ef4444; box-shadow: 0 0 0 2px #fecaca; }
.admin-img img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; cursor: zoom-in; }
.admin-img .sel { position: absolute; top: 8px; left: 8px; background: rgb(255 255 255 / .9); border-radius: 6px; padding: 4px 6px; }
.admin-img-meta { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; font-size: .8rem; min-width: 0; }
.admin-img-meta b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .875rem; }
.row-actions { display: flex; gap: 6px; margin-top: 6px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .875rem; background: var(--surface); }
.admin-table th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--border); padding: 8px; }
.admin-table td { border-bottom: 1px solid var(--border); padding: 8px; vertical-align: middle; }
#adminList { overflow-x: auto; }
.switch { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.load-more { text-align: center; margin: 16px 0; }
.tabs a.tab { text-decoration: none; }
