@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/vazirmatn.woff2") format("woff2-variations"), url("/fonts/vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  /* Brand (from the Hena logo) */
  --navy: #012241;
  --navy-2: #0e2f57;
  --red: #df1f24;
  --red-ink: #c4161b;      /* red for text on light surfaces (AA) */

  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #edf1f7;
  --text: #0e1f36;
  --text-2: #3d4f68;
  --text-3: #5b6c85;
  --border: #dde4ee;
  --brand: var(--navy);
  --brand-2: var(--navy);
  --on-brand: #ffffff;
  --accent: #14427c;
  --link-hover: var(--red-ink);
  --hot: var(--red);
  --hot-ink: var(--red-ink);
  --hot-bg: #fdecec;
  --chip-bg: #e8eef7;
  --chip-text: #1b3a63;
  --focus: #1d5bbf;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-1: 0 1px 2px rgb(1 34 65 / .06), 0 1px 3px rgb(1 34 65 / .07);
  --shadow-2: 0 6px 18px rgb(1 34 65 / .10);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #061224;
    --surface: #0b1d36;
    --surface-2: #122a4a;
    --text: #eaf0f8;
    --text-2: #b8c6da;
    --text-3: #91a4c0;
    --border: #1c3557;
    --brand: #020f20;
    --brand-2: var(--red);
    --on-brand: #ffffff;
    --accent: #9cc2f0;
    --link-hover: #ff7478;
    --hot: #ff4a50;
    --hot-ink: #ff7478;
    --hot-bg: #2b1220;
    --chip-bg: #16325a;
    --chip-text: #c9d9ef;
    --focus: #7fb0ff;
    --shadow-1: 0 1px 2px rgb(0 0 0 / .45);
    --shadow-2: 0 8px 24px rgb(0 0 0 / .5);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Vazirmatn", Tahoma, "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01";
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--link-hover); }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.5; margin: 0; text-wrap: balance; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--surface); padding: 8px 16px; z-index: 100; border-radius: 8px; box-shadow: var(--shadow-2); }
.skip-link:focus { top: 8px; }
.container { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: var(--s4); }
@media (min-width: 768px) { .container { padding-inline: var(--s5); } }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; background: var(--surface-2); padding: 0 4px; border-radius: 4px; }

/* ---------- Top bar & header ---------- */
.topbar { background: var(--navy); color: #cfdbea; font-size: 13px; border-bottom: 3px solid var(--red); }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; min-height: 34px; gap: var(--s4); }
.topbar-links { display: flex; gap: var(--s4); }
.topbar a { color: #cfdbea; display: inline-flex; align-items: center; gap: 4px; }
.topbar a:hover { color: #fff; }
.rss-link svg { color: #ff8a8d; }

.site-header { background: var(--surface); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding-block: var(--s3); flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: var(--s4); }
.brand .logo { flex: none; display: block; }
.brand .logo img { height: 52px; width: auto; }
.brand-sm .logo img { height: 40px; }
.brand-tag { font-size: 12.5px; line-height: 1.6; color: var(--text-3); font-weight: 500; padding-inline-start: var(--s4); border-inline-start: 1px solid var(--border); }

.search { display: flex; align-items: stretch; flex: 1 1 280px; max-width: 460px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; transition: border-color .2s var(--ease), box-shadow .2s var(--ease); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); background: var(--surface); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 18px; font: inherit; font-size: 15px; color: var(--text); outline: none; }
.search input::placeholder { color: var(--text-3); }
.search button { border: 0; background: transparent; color: var(--text-2); padding-inline: 16px; cursor: pointer; min-width: 48px; }
.search button:hover { color: var(--accent); }
.search-lg { max-width: 720px; margin-block: var(--s4) var(--s5); }
.search-lg button { background: var(--brand-2); color: var(--on-brand); font: inherit; font-weight: 700; padding-inline: 24px; }
.search-lg button:hover { color: var(--on-brand); background: var(--red-ink); }

/* category bar: the only pinned element (compact on phones) */
.catnav { border-block: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.catnav-row { display: flex; align-items: center; gap: var(--s2); }
.catnav-inner { flex: 1; min-width: 0; }
.menu { flex: none; }
.menu > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 15px; cursor: pointer; color: var(--on-brand); background: var(--navy); user-select: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { background: var(--red); }
.menu-panel { position: absolute; inset-inline: 0; top: 100%; background: var(--surface); border-bottom: 3px solid var(--red); box-shadow: 0 18px 30px -12px rgb(0 0 0 / .25); padding: var(--s4); max-height: calc(100dvh - 60px); overflow-y: auto; }
.menu-cats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.menu-cats a { display: flex; align-items: center; min-height: 48px; padding: 8px 14px; border-radius: var(--radius-sm); background: var(--surface-2); font-weight: 700; font-size: 16px; color: var(--text); }
.menu-cats a.active { background: var(--brand-2); color: var(--on-brand); }
.menu-links { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--border); }
.menu-links a { padding: 8px 2px; color: var(--text-2); font-weight: 600; }
@media (min-width: 768px) { .menu { display: none; } }
@media (max-width: 767px) {
  /* hint that the strip scrolls: fade its far (left) edge */
  .catnav-inner { -webkit-mask-image: linear-gradient(to left, #000 80%, transparent); mask-image: linear-gradient(to left, #000 80%, transparent); }
}
.catnav-inner { display: flex; gap: var(--s1); overflow-x: auto; scrollbar-width: none; padding-block: 6px; }
.catnav-inner::-webkit-scrollbar { display: none; }
.catnav a { white-space: nowrap; padding: 6px 14px; border-radius: 999px; font-size: 15px; font-weight: 600; color: var(--text-2); transition: background-color .15s var(--ease), color .15s var(--ease); }
.catnav a:hover { background: var(--surface-2); color: var(--text); }
.catnav a.active { background: var(--brand-2); color: var(--on-brand); }
.catnav a:hover:not(.active) { color: var(--hot-ink); }

/* ---------- Layout ---------- */
.main { padding-block: var(--s5) var(--s7); min-height: 60vh; }
.layout-2col { display: grid; gap: var(--s6); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) { .layout-2col { grid-template-columns: minmax(0, 1fr) 340px; } }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); flex-wrap: wrap; }
.section-head h2 { font-size: 22px; font-weight: 800; display: inline-flex; align-items: center; gap: 10px; }
.section-head h2::before, .page-head h1::before, .side-box h2::before {
  content: ""; flex: none; width: 22px; height: 18px; transform: skewX(-24deg);
  background: linear-gradient(90deg, var(--red) 0 38%, transparent 38% 55%, var(--accent) 55% 100%);
  border-radius: 2px;
}
.page-head h1 { display: inline-flex; align-items: center; gap: 12px; }
.section-note { margin: 0; color: var(--text-3); font-size: 14px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); margin-bottom: var(--s4); }
.page-head h1 { font-size: 28px; font-weight: 900; flex: 1 1 auto; }
.crumbs { width: 100%; font-size: 14px; color: var(--text-3); }
.crumbs a:hover { text-decoration: underline; }
.lead { color: var(--text-2); max-width: 70ch; }

/* ---------- Important ---------- */
.important { margin-bottom: var(--s7); }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--hot); box-shadow: 0 0 0 0 color-mix(in srgb, var(--hot) 60%, transparent); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.important-grid { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .important-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.important-side { display: grid; gap: var(--s3); align-content: start; }
@media (min-width: 900px) {
  /* side column fills the lead card's height: equal rows, content centered */
  .important-side { grid-auto-rows: 1fr; align-content: stretch; }
  .important-side .card-side { height: 100%; align-items: center; }
  .important-side .card-side .card-thumb { align-self: center; }
}
.important .card-feature { border-top: 4px solid var(--hot); }
.important-lead { align-self: start; }
.important-lead .card-feature { height: auto; }
.important .card-feature .card-title { font-size: 24px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; transition: box-shadow .2s var(--ease), border-color .2s var(--ease); }
.card:hover { box-shadow: var(--shadow-2); border-color: color-mix(in srgb, var(--hot) 30%, var(--border)); }
.card-body { padding: var(--s4); display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.card-title { font-size: 17px; font-weight: 700; line-height: 1.65; overflow-wrap: anywhere; }
.card-title a:hover { color: var(--link-hover); }
.card-summary { margin: 0; color: var(--text-2); font-size: 14.5px; line-height: 1.85; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.card-media { display: block; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.card-feature .card-summary { -webkit-line-clamp: 4; line-clamp: 4; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.card-feature:hover .card-media img { transform: scale(1.03); }

.card-row { display: flex; align-items: stretch; }
.card-row .card-body { flex: 1; }
.card-thumb { flex: none; width: 128px; background: var(--surface-2); margin: var(--s3); margin-inline-start: 0; border-radius: var(--radius-sm); overflow: hidden; align-self: flex-start; aspect-ratio: 4 / 3; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 640px) { .card-thumb { width: 168px; } }

/* compact card with thumbnail (important-news side column) */
.card-side { display: flex; align-items: flex-start; }
.card-side .card-body { flex: 1; padding: var(--s3) var(--s4); gap: 6px; }
.card-side .card-title { font-size: 15.5px; line-height: 1.7; }
.card-side .card-thumb { width: 112px; margin: var(--s3); margin-inline-start: 0; }
@media (min-width: 640px) { .card-side .card-thumb { width: 128px; } }

/* lead story: other outlets' headlines for the same story */
.lead-coverage { border-top: 1px dashed var(--border); padding-top: var(--s3); margin-top: var(--s1); }
.lead-coverage h4 { margin: 0 0 6px; font-size: 13px; font-weight: 800; color: var(--text-3); }
.lead-coverage ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lead-coverage li a { display: block; font-size: 14px; line-height: 1.8; color: var(--text-2); padding-inline-start: 12px; border-inline-start: 3px solid var(--hot); }
.lead-coverage li a:hover { color: var(--link-hover); }
.lc-src { font-weight: 800; color: var(--text); }

.card-compact { padding-block: var(--s3); border-bottom: 1px solid var(--border); }
.card-compact:last-child { border-bottom: 0; }
.card-compact .card-title { font-size: 15px; font-weight: 600; }

.news-list { display: grid; gap: var(--s3); }
.news-grid { display: grid; gap: var(--s3); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* meta row: source attribution on every item */
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; color: var(--text-3); }
.meta .source { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--text-2); }
.meta .source:hover { color: var(--link-hover); }
.src-dot { width: 20px; height: 20px; border-radius: 6px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; line-height: 1; }
.h0 { background: #0f766e; } .h1 { background: #1d4ed8; } .h2 { background: #b45309; } .h3 { background: #7c3aed; }
.h4 { background: #be123c; } .h5 { background: #047857; } .h6 { background: #0369a1; } .h7 { background: #4d7c0f; }
.cat-chip { background: var(--chip-bg); color: var(--chip-text); padding: 1px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.cat-chip:hover { background: var(--brand-2); color: var(--on-brand); }
.meta time { white-space: nowrap; }
.coverage { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--hot-ink); background: var(--hot-bg); padding: 2px 10px; border-radius: 999px; }
.coverage:hover { color: var(--hot-ink); text-decoration: underline; }

/* ---------- Sidebar ---------- */
.sidebar { display: grid; gap: var(--s4); align-content: start; }
@media (min-width: 1024px) { .sidebar { position: sticky; top: 72px; } }
.side-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s4); }
.side-box h2 { font-size: 17px; font-weight: 800; margin-bottom: var(--s2); padding-bottom: var(--s2); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.side-box h2::before { width: 16px; height: 13px; }
.ranked { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.ranked li { counter-increment: r; display: flex; gap: var(--s3); align-items: flex-start; }
.ranked li::before { content: counter(r, persian); font-size: 26px; font-weight: 900; color: var(--hot); line-height: 1.6; min-width: 24px; }
.ranked li .card-compact { flex: 1; }
.source-cloud { list-style: none; padding: 0; margin: var(--s2) 0; display: flex; flex-wrap: wrap; gap: 6px; }
.source-cloud a { display: inline-flex; gap: 6px; align-items: center; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.source-cloud a:hover { background: var(--brand-2); color: var(--on-brand); }
.source-cloud .count { font-size: 12px; opacity: .75; }
.more-link { font-size: 14px; font-weight: 700; color: var(--accent); }

/* ---------- Pager / empty ---------- */
.pager { display: flex; justify-content: center; align-items: center; gap: var(--s4); margin-top: var(--s6); flex-wrap: wrap; }
.pager a { padding: 10px 20px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-weight: 700; min-height: 44px; display: inline-flex; align-items: center; }
.pager a:hover { border-color: var(--hot); color: var(--hot-ink); }
.pager-info { color: var(--text-3); font-size: 14px; }
.empty { background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: var(--s6); text-align: center; color: var(--text-2); }
.empty-lg { padding: var(--s7) var(--s5); max-width: 640px; margin: var(--s6) auto; display: grid; gap: var(--s3); justify-items: center; }
.result-count { color: var(--text-2); }

/* ---------- Buttons ---------- */
.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 22px; border-radius: 999px; border: 0; background: var(--brand-2); color: var(--on-brand); font: inherit; font-weight: 700; cursor: pointer; transition: background-color .15s var(--ease); }
.btn-primary:hover { color: var(--on-brand); background: var(--red-ink); }
.btn-ghost, .btn-danger { min-height: 36px; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; }
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }
.btn-danger { color: var(--hot); }
.btn-danger:hover { background: var(--hot-bg); }
.rss-chip { font-size: 13px; font-weight: 700; color: var(--hot-ink); background: var(--hot-bg); padding: 4px 12px; border-radius: 999px; }

/* ---------- Story page ---------- */
.story { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s5); max-width: 820px; display: grid; gap: var(--s4); margin-bottom: var(--s6); }
.story h1 { font-size: clamp(22px, 3vw, 30px); font-weight: 900; }
.story-summary { font-size: 18px; color: var(--text-2); margin: 0; line-height: 2; }
.story .btn-primary { justify-self: start; }
.attribution-note { font-size: 14px; color: var(--text-3); margin: 0 0 var(--s4); }
.attribution-note a { color: var(--accent); font-weight: 700; }
.attribution-note a:hover { color: var(--link-hover); }
.coverage-list ul { list-style: none; padding: 0; margin: var(--s2) 0 0; }
.coverage-list h2, .related h2 { font-size: 19px; font-weight: 800; margin-bottom: var(--s3); }

/* ---------- Sources / prose ---------- */
.sources-grid { list-style: none; padding: 0; display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.source-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s4); display: grid; gap: 4px; }
.source-name { font-weight: 800; font-size: 17px; }
.source-count { font-size: 13px; color: var(--text-3); }
.source-site { font-size: 13px; color: var(--accent); direction: ltr; justify-self: end; }
.prose { max-width: 760px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s6); }
.prose h1 { font-size: 28px; font-weight: 900; margin-bottom: var(--s3); }
.prose h2 { font-size: 20px; font-weight: 800; margin-top: var(--s5); }
.prose a { color: var(--accent); text-decoration: underline; }
.prose li { margin-bottom: var(--s2); }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #cfdbea; border-top: 4px solid var(--red); padding-top: var(--s6); }
@media (prefers-color-scheme: dark) { .site-footer { background: #020f20; } }
.site-footer a:hover { color: #ffffff; }
.footer-inner { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) { .footer-inner { grid-template-columns: 2fr 1fr 1fr; } }
.footer-brand p { color: #b9c8dc; font-size: 14px; max-width: 52ch; }
.footer-links h2 { font-size: 15px; font-weight: 800; margin-bottom: var(--s2); color: #ffffff; }
.footer-links ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 14px; color: #b9c8dc; }
.footer-bottom { border-top: 1px solid rgb(255 255 255 / .12); margin-top: var(--s5); padding-block: var(--s4); font-size: 13px; color: #9fb2cc; }

/* ---------- Admin ---------- */
.auth-card { max-width: 380px; margin: var(--s7) auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s6); }
.auth-card h1 { font-size: 22px; margin-bottom: var(--s4); }
.auth-card form, .admin-form { display: grid; gap: var(--s3); }
.auth-card label, .admin-form label { font-size: 14px; font-weight: 600; display: grid; gap: 4px; }
input:not([type=search]), select { font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); min-height: 44px; }
.form-error { color: var(--hot); background: var(--hot-bg); padding: var(--s2) var(--s3); border-radius: var(--radius-sm); }
.admin-head form { margin: 0; }
.admin-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s5); margin-bottom: var(--s4); }
.admin-box h2 { font-size: 18px; margin-bottom: var(--s3); }
@media (min-width: 900px) { .admin-form { grid-template-columns: 2fr 1.2fr 1fr auto; align-items: end; } }
.hint { font-size: 14px; color: var(--text-3); margin-top: 0; }
.stats { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s5); margin: 0 0 var(--s4); }
.stats strong { font-size: 22px; display: block; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { text-align: start; padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table th { color: var(--text-3); font-weight: 700; }
.admin-table tr.muted { opacity: .55; }
.admin-table .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; max-width: 280px; overflow-wrap: anywhere; }
form.inline { display: flex; gap: 6px; margin: 0; }
.good { color: #15803d; font-weight: 700; }
.bad { color: var(--hot); font-weight: 700; cursor: help; }
.flash { background: var(--chip-bg); border: 1px solid var(--border); padding: var(--s3) var(--s4); border-radius: var(--radius-sm); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 520px) {
  .brand-tag { display: none; }
  .brand .logo img { height: 42px; }
  .topbar .today { display: none; }
  .topbar-inner { justify-content: center; }
  .card-title { font-size: 16px; }
  .important .card-feature .card-title { font-size: 20px; }
  .card-thumb { width: 104px; }
}

/* admin: visits */
.admin-actions { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.admin-actions form { margin: 0; }
.admin-grid { display: grid; gap: var(--s4); }
.admin-grid .admin-box { margin-bottom: 0; }
@media (min-width: 1024px) { .admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.admin-grid + .admin-box { margin-top: var(--s4); }
.seg { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); align-items: center; }
.seg a { padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-weight: 600; font-size: 14px; color: var(--text-2); }
.seg a.active { background: var(--brand-2); border-color: transparent; color: var(--on-brand); }
.seg-sm a { padding: 4px 12px; font-size: 13px; }
.seg-note { font-size: 13px; color: var(--text-3); }
.kind { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--chip-bg); color: var(--chip-text); }
.kind-0 { background: #dcfce7; color: #166534; }
.kind-1 { background: #dbeafe; color: #1e40af; }
.kind-2 { background: #f3e8ff; color: #6b21a8; }
.kind-3 { background: #fef3c7; color: #92400e; }
.kind-4 { background: #e5e7eb; color: #374151; }
.kind-5 { background: #fee2e2; color: #991b1b; }
@media (prefers-color-scheme: dark) {
  .kind-0 { background: #14532d; color: #bbf7d0; } .kind-1 { background: #1e3a8a; color: #bfdbfe; }
  .kind-2 { background: #581c87; color: #e9d5ff; } .kind-3 { background: #78350f; color: #fde68a; }
  .kind-4 { background: #374151; color: #e5e7eb; } .kind-5 { background: #7f1d1d; color: #fecaca; }
}
.admin-table.log td { font-size: 13px; }
.admin-table .nowrap { white-space: nowrap; }

/* live updates */
body { overflow-anchor: none; }  /* hena.js keeps the reading position itself */
@keyframes hena-new { from { box-shadow: 0 0 0 3px var(--red); background-color: color-mix(in srgb, var(--red) 8%, var(--surface)); } to { box-shadow: none; background-color: var(--surface); } }
.is-new { animation: hena-new 6s var(--ease) both; }
.live-toast { position: fixed; z-index: 40; inset-inline-start: 50%; bottom: 20px; transform: translate(50%, 140%); opacity: 0; transition: transform .3s var(--ease), opacity .3s var(--ease); border: 0; border-radius: 999px; padding: 10px 20px; min-height: 44px; font: inherit; font-weight: 800; font-size: 15px; color: #fff; background: var(--red); box-shadow: 0 10px 24px -8px rgb(0 0 0 / .45); cursor: pointer; }
.live-toast.show { transform: translate(50%, 0); opacity: 1; }
