:root {
  --page-bg: #f8f9fa;
  --surface: #ffffff;
  --surface-muted: #f3f4f6;
  --navy: #0f172a;
  --navy-light: #1e293b;
  --text: #333333;
  --muted: #667085;
  --border: #e5e7eb;
  --shadow: 0 2px 14px rgba(15, 23, 42, .07);
  --content-width: 1200px;
}

* { box-sizing: border-box; }
html { background: var(--page-bg); }
body { margin: 0; min-width: 320px; background: var(--page-bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.7; }
a { color: inherit; text-decoration: none; outline: none; border: none; }
a:hover { color: #475569; }
a:focus { outline: none; border: none; }
img { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.container { width: min(var(--content-width), calc(100% - 40px)); margin: 0 auto; padding: 0 20px; }

/* Public shell */
.site-header { background: var(--navy); color: #ffffff; border-bottom: 1px solid #243247; }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: nowrap; gap: 15px; min-height: 72px; }
.brand { flex-shrink: 0; white-space: nowrap; color: #ffffff; font-size: 1.25rem; font-weight: 800; letter-spacing: .01em; }
.brand:hover { color: #ffffff; }
.site-nav { flex-wrap: nowrap !important; flex: 1; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; align-items: center; flex: 1; justify-content: flex-start; gap: 12px; color: #dbe1ea; font-size: .92rem; }
.site-nav a { font-size: 14px; padding: 0 5px; white-space: nowrap; color: #dbe1ea; }
.site-nav a:hover { color: #ffffff; }
.site-nav a.is-active { color: #ffffff; font-weight: 800; }
.header-tools { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.site-search { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.site-search input { width: 80px; margin: 0; padding: 6px 9px; color: #111827; background: #ffffff; border: 1px solid #cbd5e1; border-radius: 5px; font-size: .82rem; }
.site-search button { padding: 6px 10px; color: #ffffff; background: var(--navy-light); border: 1px solid #64748b; border-radius: 5px; font-size: .82rem; }
.site-search button:hover { background: #334155; }
.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; }
.page-content { padding-top: 48px; padding-bottom: 48px; }
.site-footer { margin-top: 64px; background: #f3f4f6; border-top: 1px solid var(--border); color: var(--muted); font-size: .875rem; text-align: center; }
.footer-inner { padding-top: 32px; padding-bottom: 32px; }
.site-footer p { margin: 0 0 6px; }
.footer-nav { display: flex; justify-content: center; gap: 18px; margin-top: 14px; }
.footer-nav a { color: #475569; }
.footer-nav a:hover { color: var(--navy); }

/* Homepage */
.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; gap: 40px; }
.section-heading { margin-bottom: 28px; padding: 4px 0 18px 18px; border-left: 6px solid var(--navy); border-bottom: 1px solid #e5e7eb; }
.section-heading h1 { margin: 8px 0 0; color: #111827; font-size: clamp(2rem, 4vw, 2.7rem); font-weight: 800; line-height: 1.18; }
.eyebrow { margin: 0; color: var(--navy); font-size: .78rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.post-list { display: grid; gap: 28px; }
.post-card { display: grid; grid-template-columns: 40% 60%; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.post-card-media { min-height: 190px; background: #e5e7eb; }
.post-card-media img { width: 100%; height: 100%; object-fit: cover; }
.post-card-placeholder { width: 100%; height: 100%; min-height: 190px; background: linear-gradient(135deg, #e5e7eb, #cbd5e1); }
.post-card-body { padding: 24px; }
.post-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--navy); font-size: .78rem; font-weight: 700; }
.post-meta time { color: var(--muted); font-weight: 400; }
.post-card h2 { margin: 10px 0 0; color: #111827; font-size: 1.45rem; line-height: 1.3; }
.post-card h2 a:hover { color: #475569; }
.post-excerpt { margin: 12px 0 0; color: var(--muted); line-height: 1.65; }
.post-byline { margin: 18px 0 0; color: #8490a0; font-size: .82rem; }
.popular-panel { padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.popular-panel h2 { margin: 0; color: #111827; font-size: 1.15rem; line-height: 1.3; }
.popular-panel ol { display: grid; gap: 18px; margin: 20px 0 0; padding: 0; list-style: none; }
.popular-panel li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; }
.popular-panel .rank { color: var(--navy); font-size: 1.35rem; font-weight: 800; line-height: 1.2; }
.popular-panel li a { color: #374151; font-size: .95rem; font-weight: 700; line-height: 1.45; }
.popular-panel li a:hover { color: #475569; }
.popular-panel li p { margin: 3px 0 0; color: var(--muted); font-size: .75rem; }
.empty-state { display: grid; min-height: 300px; place-items: center; align-content: center; gap: 16px; padding: 40px 24px; color: var(--muted); background: var(--surface); border: 1px solid #e5e7eb; border-radius: 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, .05); text-align: center; word-break: normal; white-space: normal; }
.empty-state-icon { width: 96px; height: 96px; }
.empty-state p { max-width: 30rem; margin: 0; font-size: 1rem; }
.popular-panel .sidebar-empty-state { display: block; min-height: 0; padding: 18px 0 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; color: var(--muted); text-align: left; word-break: normal; white-space: normal; }
.sidebar-stack { display: grid; gap: 20px; }
.sidebar-card, .authority-card { padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.sidebar-card h2, .authority-card h2 { margin: 0; color: #111827; font-size: 1.08rem; line-height: 1.3; }
.latest-links { display: grid; gap: 14px; margin: 18px 0 0; padding: 0; list-style: none; }
.latest-links li { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.latest-links li:last-child { padding-bottom: 0; border-bottom: 0; }
.latest-links a { color: #374151; font-size: .9rem; font-weight: 700; line-height: 1.5; }
.latest-links a:hover { color: var(--navy); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-start; margin-top: 16px; }
.tag-cloud a { padding: 5px 10px; color: #475569; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 999px; font-size: .78rem; }
.tag-cloud a:hover { color: #ffffff; background: var(--navy); border-color: var(--navy); }
.tag-link { text-decoration: none; }
.authority-card { background: #f3f4f6; }
.authority-card p { margin: 12px 0 16px; color: #4b5563; font-size: .88rem; line-height: 1.7; }
.authority-card a { color: var(--navy); font-size: .86rem; font-weight: 700; }
.author-list { display: grid; gap: 12px; margin-top: 16px; }
.author-chip { display: flex; align-items: center; gap: 12px; padding: 6px; color: #374151; border-radius: 8px; font-size: .9rem; font-weight: 700; }
.author-chip:hover { color: var(--navy); background: var(--surface-muted); }
.author-chip img { flex: 0 0 40px; width: 40px; height: 40px; object-fit: cover; border-radius: 50%; }
.author-copy { min-width: 0; display: grid; gap: 3px; }
.author-copy strong { line-height: 1.25; }
.author-copy small { overflow: hidden; color: var(--muted); font-size: .76rem; font-weight: 400; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.author-page { max-width: 960px; margin: 0 auto; }
.author-profile { display: flex; align-items: center; gap: 24px; margin-bottom: 42px; padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.author-profile img { flex: 0 0 96px; width: 96px; height: 96px; border: 1px solid var(--border); border-radius: 50%; object-fit: cover; box-shadow: 0 4px 14px rgba(15, 23, 42, .14); }
.author-profile h1 { margin: 8px 0 10px; color: #111827; font-size: 2rem; }
.author-profile p:last-child { margin: 0; color: var(--muted); line-height: 1.7; }
.author-articles h2 { margin: 8px 0 0; color: #111827; font-size: 2rem; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 32px; color: var(--muted); font-size: .9rem; }
.pagination a { padding: 8px 12px; color: #ffffff; background: var(--navy); border-radius: 5px; }
.pagination a:hover { color: #ffffff; background: var(--navy-light); }
#sentinel { width: 100%; height: 1px; }
.load-more { display: block; margin: 20px auto 0; padding: 10px 22px; color: #ffffff; background: var(--navy); border: 0; border-radius: 5px; cursor: pointer; font: inherit; }
.load-more:disabled { opacity: .6; cursor: wait; }
.seo-pagination { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Article content */
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 40px; }
.article-page { max-width: none; margin: 0; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; color: var(--muted); font-size: .85rem; }
.breadcrumbs a { color: var(--navy); }
.breadcrumbs a:hover { color: var(--navy-light); }
.breadcrumb-current { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.article-header { padding-bottom: 30px; border-bottom: 1px solid var(--border); }
.article-cover { display: block; width: 100%; max-height: 560px; aspect-ratio: 16 / 9; object-fit: cover; object-position: center; border-radius: 14px; margin-top: 18px; }
.article-header h1 { margin: 10px 0 0; color: #111827; font-size: clamp(2.25rem, 5vw, 3.4rem); font-weight: 800; line-height: 1.18; }
.update-time { margin: 12px 0 0; color: var(--navy); font-size: .9rem; font-weight: 700; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 15px 0; color: var(--muted); font-size: .88rem; }
.article-meta img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.article-page .prose { max-width: none; margin-top: 28px; }
.data-card { margin-top: 26px; padding: 18px 20px; color: #123b70; background: #eff6ff; border: 2px solid #1d4e89; border-radius: 8px; font-size: 1rem; line-height: 1.7; }
.risk-notice { margin: 34px 0; padding: 16px 18px; color: #7f1d1d; background: #fef2f2; border: 1px solid #fecaca; border-radius: 7px; font-size: .9rem; }
.static-page { padding: 36px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.text-link { color: var(--navy); font-weight: 700; }
.contact-form { display: grid; gap: 18px; margin-top: 30px; }
.form-note { margin: 0; color: var(--muted); font-size: .85rem; }
.prose { max-width: 860px; margin: 0 auto; color: var(--text); font-size: 1.08rem; line-height: 1.8; }
.prose h1, .prose h2, .prose h3 { margin: 1.8em 0 .7em; color: #111827; font-weight: 800; line-height: 1.3; }
.prose h1 { font-size: 2.15rem; }
.prose h2 { font-size: 1.6rem; }
.prose p { margin: 1.2em 0; }
.prose img { margin: 28px auto; border-radius: 8px; }
.prose table { width: 100%; margin: 28px 0; border-collapse: collapse; background: var(--surface); text-align: center; }
.table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 620px; }
.prose th, .prose td { padding: 11px 14px; border: 1px solid var(--border); text-align: center; vertical-align: middle; }
.prose th { background: var(--surface-muted); color: #1f2937; font-weight: 700; }
.ad-slot { min-height: 12px; }

/* Admin shell */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { position: fixed; inset: 0 auto 0 0; width: 256px; height: 100vh; overflow-y: auto; padding: 24px; background: var(--navy); color: #ffffff; border-right: 1px solid #243247; }
.admin-sidebar .brand { color: #ffffff; }
.admin-sidebar .brand span { color: #cbd5e1; }
.admin-nav { display: grid; gap: 8px; margin-top: 40px; }
.admin-nav-group { display: grid; gap: 4px; margin-bottom: 14px; }
.admin-nav-group p { margin: 0 14px 4px; color: #94a3b8; font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.admin-nav a { padding: 12px 14px; border-radius: 7px; color: #ffffff; }
.admin-nav a:hover { background: var(--navy-light); color: #ffffff; }
.admin-nav a.is-active { background: #1e40af; color: #ffffff; font-weight: 700; box-shadow: inset 3px 0 #93c5fd; }
.admin-main { width: 100%; margin-left: 256px; padding: 40px; color: var(--text); }
.admin-main h1 { margin: 0; color: #111827; font-size: 2rem; font-weight: 800; line-height: 1.2; }
.admin-main h1 + * { margin-top: 28px; }
.admin-main table { width: 100%; border-collapse: collapse; background: var(--surface); box-shadow: var(--shadow); }
.admin-main th, .admin-main td { padding: 14px 18px; border: 1px solid var(--border); text-align: center; }
.admin-main th { background: var(--surface-muted); color: #374151; font-weight: 700; }
.admin-main td { color: #4b5563; }
.admin-main td:first-child { color: #111827; font-weight: 600; text-align: left; }
.admin-page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.admin-page-heading h1 { margin-top: 6px; }
.admin-muted { margin: 6px 0 0; color: var(--muted); font-size: .9rem; }
.admin-action-button { display: inline-flex; align-items: center; padding: 12px 18px; color: #ffffff; background: #123b70; border-radius: 7px; box-shadow: 0 4px 10px rgba(15, 23, 42, .16); font-weight: 700; white-space: nowrap; }
.admin-action-button:hover { color: #ffffff; background: #1d4e89; }
.admin-table-card { margin-top: 28px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.admin-table-scroll { overflow-x: auto; }
.admin-main .admin-table-card table { min-width: 760px; box-shadow: none; }
.admin-main .admin-title-cell { min-width: 280px; }
.admin-status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.admin-status.is-published { color: #166534; background: #dcfce7 !important; }
.admin-status.is-draft { color: #92400e; background: #fef3c7; }
.admin-row-actions { display: flex; align-items: center; justify-content: center; gap: 14px; white-space: nowrap; }
.admin-row-actions a { color: #1d4e89; font-weight: 700; }
.admin-row-actions a:hover { color: #123b70; text-decoration: underline; }
.admin-row-actions button { padding: 0; color: #b91c1c; background: transparent; font-weight: 700; }
.admin-row-actions button:hover { color: #7f1d1d; text-decoration: underline; }
.admin-row-actions button:disabled { opacity: .5; cursor: wait; }
.admin-empty { padding: 42px !important; color: var(--muted) !important; text-align: center !important; }
.admin-pagination { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 24px; color: var(--muted); }
.admin-pagination a, .admin-pagination span { padding: 8px 13px; border-radius: 6px; }
.admin-pagination a { color: #ffffff; background: var(--navy); }
.admin-pagination a:hover { color: #ffffff; background: var(--navy-light); }
.admin-pagination span { color: #9ca3af; background: #e5e7eb; }
.admin-message { min-height: 1.7em; margin: 14px 0 0; color: #166534; }
.admin-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 28px; }
.admin-stat-card, .admin-panel { padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.admin-stat-card { display: grid; gap: 10px; }
.admin-stat-card span { color: var(--muted); font-size: .9rem; }
.admin-stat-card strong { color: #111827; font-size: 2rem; line-height: 1; }
.admin-panel { margin-top: 24px; }
.admin-panel h2 { margin: 0 0 18px; color: #111827; font-size: 1.15rem; }
.admin-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.admin-section-heading a { color: #1d4e89; font-weight: 700; }
.admin-recent-list { display: grid; gap: 0; }
.admin-recent-list a { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 0; color: #1f2937; border-top: 1px solid var(--border); }
.admin-recent-list a:hover { color: #1d4e89; }
.admin-recent-list small { color: var(--muted); white-space: nowrap; }
.admin-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 24px 0 14px; }
.admin-check-label { display: inline-flex; align-items: center; gap: 7px; margin-right: 8px; }
.admin-toolbar input[type="checkbox"], .admin-main table input[type="checkbox"] { width: auto; margin: 0; accent-color: #1d4e89; }
.admin-tool-button { padding: 8px 13px; color: #1d4e89; background: #eff6ff; border: 1px solid #bfdbfe; }
.admin-tool-button.danger, .admin-row-delete { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
.admin-row-delete { padding: 6px 10px; border: 1px solid; }
.admin-settings-form { display: grid; gap: 20px; max-width: 960px; margin-top: 28px; }
.admin-form-panel { max-width: 960px; }
.admin-form-panel form { margin-top: 0; }
.form-stack { display: grid; gap: 24px; max-width: 960px; margin-top: 32px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
label { display: block; color: #374151; font-size: .9rem; }
input, select, textarea { display: block; width: 100%; margin-top: 8px; padding: 11px 13px; color: var(--text); background: #ffffff; border: 1px solid #d1d5db; border-radius: 7px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #64748b; outline-offset: 1px; }
.button, button { padding: 11px 18px; border: 0; border-radius: 7px; }
.author-form-actions { display: flex; gap: 12px; align-items: center; }
.primary { width: fit-content; color: #ffffff; background: var(--navy); font-weight: 700; }
.author-cancel-button { color: #374151; background: #ffffff; border: 1px solid #d1d5db; border-radius: 7px; padding: 11px 18px; }
.author-cancel-button:hover { color: #374151; background: #f3f4f6; }
.primary:hover, .login-card button:hover { color: #ffffff; background: var(--navy-light); }
.editor-toolbar { display: flex; gap: 6px; margin-top: 8px; padding: 8px; background: var(--surface-muted); border: 1px solid #d1d5db; border-bottom: 0; border-radius: 7px 7px 0 0; }
.editor-toolbar button { padding: 5px 10px; color: var(--navy); background: #ffffff; border: 1px solid var(--border); }
.editor { min-height: 320px; padding: 16px; color: var(--text); background: #ffffff; border: 1px solid #d1d5db; border-radius: 0 0 7px 7px; line-height: 1.8; }
.editor h2 { margin: 1em 0 .5em; font-size: 1.5rem; }
.editor p { margin: .8em 0; }
.success { color: #166534; }
.error { color: #b91c1c; }
.hidden { display: none; }
.not-found-page { max-width: 760px; margin: 0 auto; padding: 64px 36px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); text-align: center; }
.not-found-page h1 { margin: 10px 0; color: #111827; font-size: clamp(2rem, 5vw, 3.5rem); }
.not-found-page > p:not(.eyebrow) { color: var(--muted); }
.not-found-page .button { display: inline-block; margin-top: 18px; }
.recommended-posts { margin-top: 48px; text-align: left; }
.recommended-posts h2 { color: #111827; font-size: 1.2rem; }
.recommended-posts ul { display: grid; gap: 10px; padding-left: 20px; }
.recommended-posts a { color: var(--navy); font-weight: 700; }

/* Admin login */
.login-shell { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: min(100%, 390px); padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.login-card h1 { margin: 12px 0 28px; color: #111827; font-size: 1.6rem; }
.login-card form { display: grid; gap: 18px; }
.login-card button { width: 100%; color: #ffffff; background: var(--navy); font-weight: 700; }
.login-card p { margin: 0; }
.login-card .text-sky-400 { color: var(--navy); font-size: .8rem; letter-spacing: .2em; text-transform: uppercase; }

@media (max-width: 820px) {
  .home-layout { grid-template-columns: 1fr; }
  .article-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; width: 100%; padding: 16px; }
  .admin-layout { display: block; }
  .admin-nav { display: flex; flex-wrap: wrap; margin-top: 16px; }
  .admin-nav a { padding: 8px 10px; }
  .admin-main { margin-left: 0; padding: 24px 16px; }
}
@media (max-width: 620px) {
  .container { width: calc(100% - 24px); padding: 0 12px; }
  .site-header-inner { gap: 14px; }
  .page-content { padding-top: 32px; padding-bottom: 32px; }
  .post-card { grid-template-columns: 1fr; }
  .site-search { width: 100%; margin-left: 0; }
  .site-search input { flex: 1; width: auto; }
  .author-profile { align-items: flex-start; flex-direction: column; }
  .post-card-media, .post-card-placeholder { min-height: 160px; }
  .form-grid { grid-template-columns: 1fr; }
  .admin-main { overflow-x: auto; }
  .admin-main table { min-width: 650px; }
  .admin-page-heading { align-items: stretch; flex-direction: column; }
  .admin-action-button { justify-content: center; }
  .author-form-actions { width: 100%; justify-content: space-between; }
  .author-form-actions .button { width: 100%; text-align: center; }
  .admin-stat-grid { grid-template-columns: 1fr; }
  .admin-recent-list a { align-items: flex-start; flex-direction: column; gap: 5px; }
}


/* Article reading experience and internal-link module */
.article-header h1 { max-width: 900px; margin-bottom: 20px; font-size: clamp(2rem, 4vw, 32px); }
.article-header .update-time { display: none; }
.article-meta { margin-top: 10px; color: #98a2b3; font-size: .78rem; }
.article-meta a, .article-meta span { color: #98a2b3; }
.data-card { padding: 22px 24px; color: #123b70; background: #f0f7ff; border: 0; border-left: 4px solid #1d4e89; border-radius: 6px; }
.prose { color: #333; font-size: 16px; line-height: 1.8; }
.prose p { margin: 0 0 24px; }
.prose img { width: 100%; margin: 30px 0; border-radius: 10px; box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
.prose-figure { margin: 30px 0 !important; padding: 10px; background-color: #f8fafc; border-radius: 8px; text-align: center; }
.prose-figure img { max-width: 100%; border-radius: 6px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
.prose-figure figcaption { margin-top: 10px; font-size: 14px; color: #64748b; font-style: italic; }
.related-posts { margin-top: 44px; padding-top: 28px; border-top: 1px solid var(--border); }
.related-heading h2 { margin: 6px 0 20px; color: #111827; font-size: 1.35rem; }
.related-post-grid { display: grid; gap: 12px; }
.related-post-card { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 16px; align-items: center; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; box-shadow: 0 2px 10px rgba(15, 23, 42, .05); }
.related-post-card:hover { border-color: #93c5fd; box-shadow: 0 6px 18px rgba(29, 78, 137, .12); }
.related-post-media, .related-post-media img, .related-post-media > span { display: block; width: 116px; height: 76px; overflow: hidden; border-radius: 6px; background: linear-gradient(135deg, #dbeafe, #e5e7eb); }
.related-post-media img { object-fit: cover; }
.related-post-body { display: grid; gap: 5px; min-width: 0; }
.related-post-body small, .related-post-body time { color: #98a2b3; font-size: .75rem; }
.related-post-body strong { overflow: hidden; color: #27364b; font-size: .95rem; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.related-empty { color: var(--muted); }
@media (max-width: 620px) { .related-post-card { grid-template-columns: 92px minmax(0, 1fr); gap: 12px; } .related-post-media, .related-post-media img, .related-post-media > span { width: 92px; height: 68px; } }

/* Local WYSIWYG editor and article media polish */
.admin-action-button { gap: 8px; margin-top: 2px; }
.editor-toolbar.ql-toolbar { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding: 8px; border: 1px solid #d1d5db; border-bottom: 0; border-radius: 7px 7px 0 0; }
.editor-toolbar .ql-formats { display: inline-flex; align-items: center; gap: 4px; margin: 0; }
.editor-toolbar button, .editor-toolbar select { min-height: 28px; }
.editor { min-height: 320px; padding: 16px; background: #fff; border: 1px solid #d1d5db; border-radius: 0 0 7px 7px; line-height: 1.8; }
.editor .ql-editor { min-height: 288px; padding: 0; color: #333; font-size: 16px; line-height: 1.8; }
.editor .ql-editor p { margin: 0 0 24px; }
.prose figure, .editor .ql-editor figure { margin: 32px 0; }
.prose figure img, .editor .ql-editor img { display: block; width: 100%; max-height: 560px; object-fit: cover; border-radius: 12px; box-shadow: 0 10px 28px rgba(15, 23, 42, .14); }
.prose figcaption, .editor .ql-editor figcaption { margin-top: 10px; color: #64748b; font-size: .84rem; line-height: 1.5; text-align: center; }

.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; color: #fff; background: #123b70; border-radius: 7px; box-shadow: 0 4px 10px rgba(15,23,42,.16); font-weight: 700; white-space: nowrap; }
.btn-primary:hover { color: #fff; background: #1d4e89; }
.admin-page-heading { align-items: center; }

/* Quill isolation: keep global CMS controls from turning Snow icons into white blocks. */
#toolbar.ql-toolbar { display: block; padding: 8px 6px; background: #fff; border: 1px solid #d1d5db; border-radius: 7px 7px 0 0; font-family: inherit; }
#toolbar.ql-toolbar .ql-formats { display: inline-flex; align-items: center; margin-right: 10px; vertical-align: middle; }
#toolbar.ql-toolbar button { width: 28px; height: 28px; margin: 0 1px; padding: 3px 5px; color: #444; background: transparent; border: 0; border-radius: 3px; }
#toolbar.ql-toolbar button:hover { color: #123b70; background: #eff6ff; }
#toolbar.ql-toolbar .ql-picker { color: #444; }
#toolbar.ql-toolbar .ql-picker-label { border: 0; }
#toolbar.ql-toolbar .ql-picker-options { z-index: 5; background: #fff; }
#toolbar.ql-toolbar .ql-stroke { stroke: currentColor; }
#toolbar.ql-toolbar .ql-fill { fill: currentColor; }
#toolbar.ql-toolbar .ql-picker.ql-expanded .ql-picker-label { color: #123b70; }
#toolbar.ql-toolbar .ql-picker-label, #toolbar.ql-toolbar .ql-picker-item {
  color: #444;
  font-family: inherit;
  font-size: 14px;
}
#toolbar.ql-toolbar select.ql-header, #toolbar.ql-toolbar select.ql-size {
  display: none;
}
#toolbar.ql-toolbar .ql-picker {
  display: inline-block;
  float: none;
  height: 28px;
  margin: 0 4px 0 0;
  vertical-align: middle;
}
#toolbar.ql-toolbar .ql-picker.ql-header { width: 98px; }
#toolbar.ql-toolbar .ql-picker.ql-size { width: 82px; }
#toolbar.ql-toolbar .editor-image-button {
  width: auto;
  color: #123b70;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 13px;
}

#editor.ql-container { height: auto; min-height: 320px; padding: 0; border: 1px solid #d1d5db; border-top: 0; border-radius: 0 0 7px 7px; font-family: inherit; }
#editor .ql-editor { min-height: 320px; padding: 18px 16px; color: #333; font-size: 16px; line-height: 1.8; }
#editor .ql-editor h1, #editor .ql-editor h2, #editor .ql-editor h3 { margin: 1.2em 0 .6em; color: #111827; line-height: 1.35; }
#editor .ql-editor h1 { font-size: 2rem; } #editor .ql-editor h2 { font-size: 1.55rem; } #editor .ql-editor h3 { font-size: 1.25rem; }
#editor .ql-editor p { margin: 0 0 20px; }
#editor .ql-editor ol, #editor .ql-editor ul { margin: 0 0 20px; padding-left: 2em; }
#editor .ql-editor blockquote { margin: 20px 0; padding-left: 16px; border-left: 4px solid #93c5fd; color: #475569; }

.database-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; max-width: 1200px; margin-top: 28px; }
.database-card { margin-top: 0; }
.database-card p { color: var(--muted); }
.database-danger { border-color: #fecaca; }
.button.danger { color: #ffffff; background: #b91c1c; }
.button.danger:hover { color: #ffffff; background: #991b1b; }
.button.danger-outline { margin-left: 8px; color: #b91c1c; background: #ffffff; border: 1px solid #fecaca; }
.button.danger-outline:hover { color: #7f1d1d; background: #fef2f2; }
@media (max-width: 900px) { .database-card-grid { grid-template-columns: 1fr; } }

.database-card { position: relative; min-height: 250px; padding: 28px; }
.database-card-icon { display: grid; width: 42px; height: 42px; margin-bottom: 18px; place-items: center; color: #123b70; background: #eff6ff; border-radius: 12px; font-size: 1.35rem; font-weight: 800; }
.database-card-icon.danger-icon { color: #b91c1c; background: #fef2f2; }
.database-card h2 { margin-bottom: 12px; }
.database-card form { display: grid; gap: 14px; }
.database-card input[type="file"] { display: block; width: 100%; margin-top: 8px; padding: 8px; color: #475569; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 7px; font-size: .86rem; }
.database-card .button { margin-top: 10px; }
.database-history { max-width: 1200px; margin-top: 28px; padding: 28px; }
.database-history-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.database-history-heading h2 { margin: 4px 0 8px; color: #111827; }
.database-count { padding: 7px 12px; color: #1d4e89; background: #eff6ff; border-radius: 999px; font-size: .85rem; font-weight: 700; white-space: nowrap; }
.database-table-wrap { overflow-x: auto; }
.database-table { width: 100%; min-width: 680px; border-collapse: collapse; }
.database-table th, .database-table td { padding: 16px 14px; border-bottom: 1px solid #e5e7eb; text-align: left; }
.database-table th { color: #64748b; background: #f8fafc; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
.database-table td { color: #334155; }
.database-table code { color: #1e3a8a; font-size: .9rem; }
.database-actions { display: flex; align-items: center; gap: 16px; white-space: nowrap; }
.database-download, .database-delete { padding: 0; background: transparent; border: 0; font-weight: 700; }
.database-download { color: #1d4e89; }
.database-restore { color: #c26a0b; }
.database-delete { color: #b91c1c; }
.database-download:hover, .database-delete:hover { text-decoration: underline; }
.database-empty { display: grid; min-height: 150px; place-items: center; align-content: center; gap: 8px; color: #64748b; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px; text-align: center; }
.database-empty strong { color: #334155; font-size: 1.05rem; }
@media (max-width: 900px) { .database-history { padding: 20px; } .database-history-heading { display: block; } .database-count { display: inline-block; margin-top: 12px; } }

.contact-honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.admin-message-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.message-content { max-width: 360px; white-space: pre-wrap; word-break: break-word; }
.admin-empty { padding: 32px !important; color: var(--muted); text-align: center; }
.form-note.success, .admin-message.success { color: #166534; }
.form-note.error, .admin-message.error { color: #b91c1c; }

.form-actions, .button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.form-actions .button, .button-row .button { width: auto; }
.cancel-button { color: #374151; background: #ffffff; border: 1px solid #d1d5db; }
.cancel-button:hover { color: #374151; background: #f3f4f6; }
@media (max-width: 640px) { .form-actions .button, .button-row .button { flex: 1 1 auto; text-align: center; } }

/* FOOTER */
.site-footer { background:#0f172a; color:#94a3b8; padding:40px 20px; margin-top:60px; font-family:system-ui,sans-serif; }
.footer-inner { max-width:1100px; margin:0 auto; text-align:center; }
.footer-inner p { margin:4px 0; font-size:14px; }
.footer-sub { font-size:12px; color:#475569; }
.footer-nav a { color:#cbd5e1; text-decoration:none; margin:0 8px; }
.footer-nav a:hover { color:#e2e8f0; }
.tag-blue { background: #e0f2fe !important; color: #0369a1 !important; }
.tag-green { background: #dcfce7 !important; color: #15803d !important; }
.tag-orange { background: #ffedd5 !important; color: #c2410c !important; }
.tag-purple { background: #f3e8ff !important; color: #7e22ce !important; }
.tag-pink { background: #fce7f3 !important; color: #be185d !important; }

/* Responsive shell reflow */
body { overflow-x: hidden; }
@media (max-width: 1024px) {
  .home-layout, .article-layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar-stack { width: 100%; }
}
@media (max-width: 768px) {
  .lang-desktop { display: none !important; }
  .lang-mobile { display: block !important; padding: 15px; color: #fff; text-align: left; }
  .home-layout, .article-layout { display: flex; flex-direction: column; }
  .home-layout > section, .article-layout > article,
  .home-layout > .sidebar-stack, .article-layout > .sidebar-stack { width: 100%; min-width: 0; }
  .site-header-inner { flex-wrap: nowrap; gap: 15px; }
  .site-nav { flex: 1; flex-wrap: wrap; justify-content: flex-start; gap: 10px 15px; }
  .site-search { max-width: 100%; }
}

@media (max-width: 768px) {
  .post-card { display: flex; flex-direction: column; margin-bottom: 16px; }
  .post-card-media, .post-card-media img { width: 100%; height: auto; }
  .prose { min-width: 0; font-size: max(16px, 1em); }
  .prose table { display: block; max-width: 100%; overflow-x: auto; white-space: nowrap; }
  body > header a, body > main button, body > main a.button { min-height: 44px; padding: 10px; }
}

@media (max-width: 768px) {
  .footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; }
  .footer-nav a { white-space: nowrap; margin: 0; }
  .site-nav { gap: 4px 8px; }
  .site-nav a { display: inline-block; padding: 5px 10px; white-space: nowrap; }
  .site-search { display: flex; width: 100%; gap: 8px; }
  .site-search input { flex: 1; min-width: 0; }
  .site-search button { height: 40px; white-space: nowrap; }
}
@media (max-width: 768px) {
  .mobile-nav-toggle { display: inline-flex; align-items: center; justify-content: center; margin-left: auto; padding: 8px 12px; color: #fff; background: var(--navy-light); border: 1px solid #64748b; }
  .site-nav { display: none; flex: 1 0 100%; flex-direction: column; align-items: stretch; gap: 4px; }
  .site-nav.is-open { display: flex; }
  .site-nav a { display: block; }
}
@media (min-width: 769px) { .mobile-nav-toggle { display: none; } }

/* mobile header overflow fix */
@media (max-width: 768px) {
 body { overflow-x: hidden; }
 .site-header-inner { position: relative; }
 .site-nav.is-open { position: absolute; top: 100%; left: 0; width: 100%; box-sizing: border-box; background-color: #0f172a; z-index: 1000; padding: 20px; display: flex; flex-direction: column; color: #fff; }
 .site-nav.is-open a { color: #fff; }
 .site-search { width: 100%; padding: 0 10px; box-sizing: border-box; min-width: 0; }
 .site-search input { flex: 1; min-width: 0; width: auto !important; }
 .site-search button { flex-shrink: 0; }
}

@media (max-width: 768px) {
 .site-header { width: 100%; box-sizing: border-box; background-color: #0f172a; }
 .site-header-inner { position: relative; width: 100%; box-sizing: border-box; background-color: #0f172a; padding: 10px 15px; display: flex; flex-wrap: wrap; align-items: center; }
 .site-header-inner > .brand, .site-header-inner > .mobile-nav-toggle { display: flex; align-items: center; }
 .site-header-inner > .brand { margin-right: auto; }
 .site-nav { position: absolute; top: 100%; left: 0; width: 100%; background-color: #0f172a; display: none; flex-direction: column; padding: 15px; z-index: 1000; box-sizing: border-box; }
 .site-nav.is-open { display: flex; }
 .site-nav a { color: #fff; width: 100%; box-sizing: border-box; }
 .header-tools { width: 100%; min-width: 0; box-sizing: border-box; padding: 0; }
 .site-search { display: flex; width: 100%; min-width: 0; box-sizing: border-box; padding: 0; }
 .site-search input { width: 100% !important; max-width: 100%; min-width: 0; flex: 1 1 0; box-sizing: border-box; }
 .site-search button { flex: 0 0 auto; }
 body { overflow-x: hidden; }
}

@media (max-width: 768px) {
 .site-header { width: 100vw !important; max-width: 100% !important; margin: 0 !important; padding: 10px 15px !important; box-sizing: border-box !important; background-color: #0f172a !important; }
 .site-header-inner { position: relative !important; display: flex !important; justify-content: space-between !important; align-items: center !important; width: 100% !important; max-width: 100% !important; margin: 0 !important; padding: 0 !important; box-sizing: border-box !important; flex-wrap: wrap !important; background-color: #0f172a !important; }
 .site-nav { width: 100% !important; display: none !important; flex-direction: column !important; padding-top: 15px !important; box-sizing: border-box !important; background-color: #0f172a !important; }
 .site-nav.is-open { display: flex !important; position: static !important; }
 .header-tools { display: flex !important; flex-direction: column !important; width: 100% !important; min-width: 0 !important; padding-top: 15px !important; box-sizing: border-box !important; }
 .site-search { display: flex !important; flex-direction: row !important; width: 100% !important; min-width: 0 !important; gap: 10px !important; margin-bottom: 15px !important; box-sizing: border-box !important; }
 .site-search input { flex: 1 !important; width: auto !important; min-width: 0 !important; max-width: 100% !important; box-sizing: border-box !important; }
 .site-search button { flex-shrink: 0 !important; }
 body { overflow-x: hidden !important; }
}

.language-switch-mobile { display: none; }
@media (max-width: 768px) { .language-switch-desktop { display: none !important; } .site-nav .language-switch-mobile { display: block; width: 100%; box-sizing: border-box; padding: 5px 10px; font-size: 14px; color: #fff; text-align: left; } }
@media (min-width: 769px) { .language-switch-desktop { display: inline-flex; } }

.lang-mobile { display: none; }

/* Final mobile navigation: fixed offcanvas panel with page backdrop. */
.nav-backdrop { display: none; }
@media (max-width: 768px) {
  body.nav-open { overflow: hidden; }
  .site-header { position: relative; z-index: 1100; }
  .site-header-inner { min-height: 64px; }
  .mobile-nav-toggle { display: inline-flex !important; width: 44px; height: 44px; align-items: center; justify-content: center; margin-left: auto; padding: 0; color: #fff; background: transparent; border: 1px solid #64748b; border-radius: 7px; font-size: 1.35rem; }
  .mobile-nav-toggle:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
  .site-nav { position: fixed !important; inset: 0 0 0 auto !important; z-index: 1200; display: flex !important; flex: none !important; flex-direction: column !important; align-items: stretch !important; justify-content: flex-start !important; width: 85% !important; max-width: 320px !important; height: 100vh !important; max-height: 100vh !important; box-sizing: border-box !important; min-height: 0; margin: 0 !important; padding: 76px 20px 24px !important; overflow: hidden; background: var(--navy) !important; box-shadow: -12px 0 30px rgba(0, 0, 0, .28); transform: translateX(105%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; }
  .site-nav-links { display: flex; flex: 0 1 auto; min-height: 0; flex-direction: column; overflow-y: auto; overflow-x: hidden; padding-bottom: 0; }
  .site-nav.is-open { transform: translateX(0); visibility: visible; transition-delay: 0s; }
  .site-nav a { display: flex !important; align-items: center; width: 100%; min-height: 48px; margin: 0 !important; padding: 12px 10px !important; color: #f8fafc !important; border-bottom: 1px solid rgba(148, 163, 184, .22); font-size: 1rem; line-height: 1.35; white-space: normal; }
  .site-nav a:hover, .site-nav a.is-active { color: #fff !important; background: rgba(148, 163, 184, .16); }
  .lang-mobile { display: block !important; width: 100%; margin: 0 !important; padding: 8px 0 0 !important; }
  .site-nav .language-switch-mobile { border-bottom: 0; }
  .header-tools { position: static !important; display: flex !important; flex: 0 0 auto; flex-direction: column !important; width: 100% !important; margin-top: auto; padding: 24px 0 0 !important; pointer-events: auto; }
  .header-tools { position: static !important; right: auto; bottom: auto; left: auto; z-index: auto; display: flex !important; flex: 0 0 auto !important; flex-shrink: 0 !important; flex-direction: column !important; width: 100% !important; margin: 30px 0 40px !important; gap: 12px; box-sizing: border-box; padding: 0 !important; background: transparent; }
  .site-search { display: flex !important; flex: 0 0 auto; flex-direction: row !important; width: 100% !important; gap: 8px; margin: 0 !important; padding: 0 !important; }
  .site-search input { width: auto !important; min-width: 0; flex: 1 1 auto; height: 44px; padding: 10px 12px; border-radius: 7px; font-size: .95rem; }
  .site-search button { flex: 0 0 auto; min-width: 68px; min-height: 44px; padding: 10px 14px; border-radius: 7px; }
  .lang-desktop { display: none !important; }
  .nav-backdrop { position: fixed; inset: 0; z-index: 1050; display: block; width: 100%; height: 100%; padding: 0; background: rgba(2, 6, 23, .58); border: 0; }
  .nav-backdrop[hidden] { display: none; }
}
@media (min-width: 769px) { .mobile-nav-toggle, .nav-backdrop { display: none !important; } }
