/* ==========================================================================
   Neutral Modern Design System & Application Stylesheet
   ==========================================================================
   A warm, high-legibility, low-glare design system built with CSS Custom
   Properties, supporting system dark mode and explicit [data-theme] toggles.
   ========================================================================== */

:root {
  /* Daylight Paper & Slate Light Palette */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --surface-elevated: #ffffff;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Architectural Slate Accents */
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-subtle: rgba(37, 99, 235, 0.09);
  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.11);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.11);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.11);

  /* Typography */
  --font-serif: "Charter", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;

  /* Spacing & Layout */
  --max-width-site: 1520px;
  --max-width-reading: 70ch;
  --header-height: 44px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;

  /* Layered Architectural Shadows */
  --shadow-sm: 0 1px 3px rgba(22, 24, 29, 0.05), 0 1px 2px rgba(22, 24, 29, 0.03);
  --shadow-md: 0 6px 18px rgba(22, 24, 29, 0.07), 0 2px 5px rgba(22, 24, 29, 0.04);
  --shadow-lg: 0 16px 40px rgba(22, 24, 29, 0.13);

  /* Global UI/UX Design System Semantic Tokens */
  --bg-primary: #f8fafc;
  --bg-canvas: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-overlay: #e2e8f0;
  --bg-glass: rgba(255, 255, 255, 0.88);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --accent-primary: #2563eb;
  --accent-secondary: #0284c7;
  --border-subtle: #e2e8f0;
  --border-focus: #2563eb;
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.06);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

[hidden] {
  display: none !important;
}

/* System Dark Mode Preference (unless overridden by [data-theme="light"]) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120;
    --surface: #0f172a;
    --surface-muted: #1e293b;
    --surface-elevated: #1e293b;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #1e293b;
    --border-strong: #334155;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --accent-subtle: rgba(56, 189, 248, 0.15);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.14);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.14);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.14);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.38);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.48);
    --shadow-lg: 0 16px 42px rgba(0, 0, 0, 0.68);
  }
}

/* Explicit Dark Theme Override */
[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #0f172a;
  --surface-muted: #1e293b;
  --surface-elevated: #1e293b;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #1e293b;
  --border-strong: #334155;
  --accent: #38bdf8;
  --accent-hover: #0ea5e9;
  --accent-subtle: rgba(56, 189, 248, 0.15);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.14);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.14);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.38);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.48);
  --shadow-lg: 0 16px 42px rgba(0, 0, 0, 0.68);
  --bg-primary: #0b1120;
  --bg-canvas: #0b1120;
  --bg-surface: #0f172a;
  --bg-elevated: #1e293b;
  --bg-overlay: #222e46;
  --bg-glass: rgba(15, 23, 42, 0.85);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --accent-primary: #3b82f6;
  --accent-secondary: #38bdf8;
  --border-subtle: #1e293b;
  --border-focus: #38bdf8;
  --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.35);
}

/* Explicit Light Theme Override */
[data-theme="light"] {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --surface-elevated: #ffffff;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-subtle: rgba(37, 99, 235, 0.09);
  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.11);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.11);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.11);
  --bg-primary: #f8fafc;
  --bg-canvas: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --accent-primary: #2563eb;
  --accent-secondary: #0284c7;
  --border-subtle: #e2e8f0;
  --border-focus: #2563eb;
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
}

/* ==========================================================================
   1. Base & Reset
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

img,
video,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

code,
pre,
kbd {
  font-family: var(--font-mono);
}

/* ==========================================================================
   2. Layout Containers & Sticky Site Header
   ========================================================================== */
.container,
.site-container {
  width: 100%;
  max-width: var(--max-width-site);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.reading-container {
  width: 100%;
  max-width: var(--max-width-reading);
  margin: 0 auto;
}

main,
.main-content {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--max-width-site);
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--header-height);
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}

.site-header .header-inner,
.navbar {
  width: 100%;
  max-width: var(--max-width-site);
  margin: 0 auto;
  padding: 0.3rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: nowrap;
}

/* Compact Identity Card Inside the Top Menu Bar */
.vsite-identity-card,
.brand.vsite-identity-card {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.26rem 0.65rem;
  background-color: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.vsite-identity-card:hover,
.brand.vsite-identity-card:hover {
  border-color: var(--accent);
  background-color: var(--surface);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.vsite-identity-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 0;
}

.brand,
.site-brand,
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  text-decoration: none;
}

.brand:hover,
.site-brand:hover,
.brand-logo:hover {
  color: var(--accent);
  text-decoration: none;
}

.brand-avatar {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-strong);
  background-color: var(--surface);
  box-shadow: var(--shadow-sm);
}

.brand-title {
  display: block;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.brand-subtitle {
  display: block;
  font-size: 0.67rem;
  color: var(--text-muted);
  line-height: 1.2;
  margin-top: 0.1rem;
  max-width: 210px;
}

@media (max-width: 1180px) {
  .brand-subtitle {
    display: none;
  }
}

/* Centered Module Navigation Bar (Top of Screen, Tightened Spacing) */
.module-nav,
.site-nav,
.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.16rem;
  list-style: none;
  margin: 0 auto;
  padding: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
  flex: 1;
}

.module-nav::-webkit-scrollbar {
  display: none;
}

.module-nav a,
.site-nav a,
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.26rem 0.52rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.nav-link-icon {
  display: inline-flex;
  align-items: center;
  opacity: 0.8;
}

.nav-link-icon svg {
  width: 13px;
  height: 13px;
}

.module-nav a:hover,
.site-nav a:hover,
.nav-link:hover {
  background-color: var(--surface-muted);
  color: var(--text);
  text-decoration: none;
}

.module-nav a.active,
.site-nav a.active,
.nav-link.active,
.module-nav a[aria-current="page"] {
  background-color: var(--accent-subtle);
  color: var(--accent);
  font-weight: 600;
}

.header-actions,
.user-menu {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
  flex-shrink: 0;
}
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.45rem 0.25rem 0.6rem;
  background-color: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

/* Profile Hero & Section Headers */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.profile-hero-avatar {
  width: 96px;
  height: 96px;
  min-width: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-strong);
  background-color: var(--surface-muted);
  box-shadow: var(--shadow-md);
}

.profile-hero-text {
  flex: 1;
  min-width: 0;
}

.profile-hero-text h1 {
  margin: 0 0 0.4rem;
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 2.5vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 68ch;
}

.hero-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.section-header h1,
.section-header h2 {
  margin: 0;
  font-family: var(--font-serif);
  letter-spacing: -0.01em;
}

.empty-state {
  background-color: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 2.25rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state p {
  margin: 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  background-color: var(--surface);
  color: var(--text-muted);
  padding: 1.5rem 0;
  font-size: 0.875rem;
  margin-top: auto;
}

.site-footer .footer-inner {
  max-width: var(--max-width-site);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ==========================================================================
   3. Role Badges & Post Status Badges
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid transparent;
}

/* Role / Visibility Badges */
.badge-admin {
  background-color: rgba(185, 28, 28, 0.12);
  color: var(--danger);
  border-color: rgba(185, 28, 28, 0.28);
}

.badge-family {
  background-color: rgba(46, 111, 64, 0.12);
  color: var(--success);
  border-color: rgba(46, 111, 64, 0.28);
}

.badge-work {
  background-color: var(--accent-subtle);
  color: var(--accent);
  border-color: rgba(43, 91, 132, 0.28);
}

.badge-public {
  background-color: var(--surface-muted);
  color: var(--text-muted);
  border-color: var(--border-strong);
}

/* Content Lifecycle Status Badges */
.badge-published {
  background-color: var(--success-bg);
  color: var(--success);
  border-color: rgba(46, 111, 64, 0.3);
}

.badge-scheduled {
  background-color: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(180, 83, 9, 0.3);
}

.badge-draft {
  background-color: var(--surface-muted);
  color: var(--text-muted);
  border-color: var(--border-strong);
}

.badge-unpublished {
  background-color: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(185, 28, 28, 0.3);
}

/* ==========================================================================
   4. Buttons, Forms, Cards, Alerts & Tables
   ========================================================================== */
.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.05rem;
  font-family: var(--font-sans);
  font-size: 0.925rem;
  font-weight: 500;
  line-height: 1.3;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background-color: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.btn:hover {
  background-color: var(--surface-muted);
  text-decoration: none;
  color: var(--text);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #FFFFFF;
}

.btn-secondary,
.btn-outline {
  background-color: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover,
.btn-outline:hover {
  background-color: var(--surface-muted);
}

.btn-success {
  background-color: var(--success);
  border-color: var(--success);
  color: #FFFFFF;
}

.btn-danger {
  background-color: var(--danger);
  border-color: var(--danger);
  color: #FFFFFF;
}

.btn-danger:hover {
  opacity: 0.9;
  color: #FFFFFF;
}

.btn-sm {
  padding: 0.32rem 0.68rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.75rem 1.4rem;
  font-size: 1rem;
}

/* Forms */
.form-group,
.field-group {
  margin-bottom: 1.25rem;
}

.form-row,
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

label,
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.form-hint,
.help-text {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="search"],
input[type="number"],
input[type="datetime-local"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* Cards & Panels */
.card,
.panel {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-header,
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.page-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.85rem;
  line-height: 1.25;
}

/* Flash Alerts */
.alert,
.flash-message {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
  font-size: 0.925rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.alert-success,
.flash-success {
  background-color: var(--success-bg);
  color: var(--success);
  border-color: rgba(46, 111, 64, 0.3);
}

.alert-warning,
.flash-warning {
  background-color: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(180, 83, 9, 0.3);
}

.alert-danger,
.alert-error,
.flash-error {
  background-color: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(185, 28, 28, 0.3);
}

/* Data Tables */
.table-responsive,
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--surface);
}

table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.925rem;
  text-align: left;
}

th,
td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  background-color: var(--surface-muted);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tr:last-child td {
  border-bottom: none;
}

/* ==========================================================================
   5. Blog Post Cards, Article Typography & Embedded Media
   ========================================================================== */
.post-list,
.blog-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.post-card,
.blog-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.65rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.module-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.post-card:hover,
.blog-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.post-card-meta,
.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.meta-sep {
  color: var(--border-strong);
  user-select: none;
}

.version-tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.1rem 0.45rem;
  background-color: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
}

.back-link {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.read-more-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: auto;
  text-decoration: none;
}

.read-more-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.post-card-title {
  margin: 0 0 0.6rem;
  font-family: var(--font-serif);
  font-size: 1.45rem;
  line-height: 1.3;
}

.post-card-title a {
  color: var(--text);
  text-decoration: none;
}

.post-card-title a:hover {
  color: var(--accent);
}

.post-card-summary,
.post-excerpt {
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.65;
  margin: 0 0 1rem;
}

/* Long-form Blog Reading Typography */
.blog-article {
  max-width: var(--max-width-reading);
  width: 100%;
  margin: 0 auto;
}

.article-body,
.post-content,
.prose,
.wiki-content,
.editor-preview-pane {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.75;
  max-width: var(--max-width-reading);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  color: var(--text);
  word-wrap: break-word;
}

.article-header,
.post-header {
  max-width: var(--max-width-reading);
  width: 100%;
  margin: 0 auto 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.article-title {
  font-family: var(--font-serif);
  font-size: clamp(1.85rem, 3.5vw, 2.5rem);
  line-height: 1.2;
  margin: 0.5rem 0 0.85rem;
  letter-spacing: -0.015em;
}

.post-lead {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
}

.article-footer {
  max-width: var(--max-width-reading);
  margin: 3rem auto 0;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.author-card {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.author-avatar {
  width: 60px;
  height: 60px;
  min-width: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-strong);
  background-color: var(--surface-muted);
}

.author-info {
  flex: 1;
  min-width: 0;
}

.author-info strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.2rem;
  color: var(--text);
}

.author-info p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.post-content h1,
.post-content h2,
.post-content h3,
.editor-preview-pane h1,
.editor-preview-pane h2,
.editor-preview-pane h3 {
  font-family: var(--font-serif);
  color: var(--text);
  line-height: 1.3;
  margin-top: 2em;
  margin-bottom: 0.65em;
  font-weight: 700;
}

.article-body h1,
.editor-preview-pane h1 {
  font-size: 1.85rem;
}

.article-body h2,
.editor-preview-pane h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
}

.article-body h3,
.editor-preview-pane h3 {
  font-size: 1.25rem;
}

.article-body p,
.post-content p,
.editor-preview-pane p {
  margin: 0 0 1.35em;
}

.article-body ul,
.article-body ol,
.editor-preview-pane ul,
.editor-preview-pane ol {
  margin: 0 0 1.35em;
  padding-left: 1.6em;
}

.article-body li,
.editor-preview-pane li {
  margin-bottom: 0.4em;
}

.article-body blockquote,
.post-content blockquote,
.editor-preview-pane blockquote {
  margin: 1.5em 0;
  padding: 0.75em 1.25em;
  border-left: 4px solid var(--accent);
  background-color: var(--surface-muted);
  color: var(--text-muted);
  font-style: italic;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.article-body code,
.post-content code,
.editor-preview-pane code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background-color: var(--surface-muted);
  padding: 0.18em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.article-body pre,
.post-content pre,
.editor-preview-pane pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  background-color: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  margin: 1.5em 0;
}

.article-body pre code,
.post-content pre code,
.editor-preview-pane pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

/* Media Embeds: Images & Native HTML5 Videos */
.media-embed,
figure.media-image,
figure.media-video {
  margin: 1.85rem 0;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.65rem;
  box-shadow: var(--shadow-sm);
}

figure.media-image img {
  width: 100%;
  max-height: 620px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  margin: 0 auto;
  background-color: var(--surface-muted);
}

figure.media-video video,
.media-embed video,
video {
  width: 100%;
  max-height: 540px;
  border-radius: 8px;
  background: #000;
  display: block;
}

.media-embed figcaption {
  margin-top: 0.55rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   6. Simplistic WYSIWYG / Live-Preview Editor Layout
   ========================================================================== */
.editor-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.55rem 0.75rem;
  background-color: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}

.editor-toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.editor-toolbar-divider {
  width: 1px;
  height: 22px;
  background-color: var(--border-strong);
  margin: 0 0.25rem;
}

.editor-btn,
.toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.35rem 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.editor-btn:hover,
.toolbar-btn:hover {
  background-color: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
}

.editor-btn.active,
.toolbar-btn.active {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

/* View Mode Switcher Pills */
.editor-mode-switcher {
  display: inline-flex;
  align-items: center;
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.editor-mode-switcher .editor-btn,
.editor-mode-btn {
  border: none;
  background: transparent;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
}

.editor-mode-switcher .editor-btn.active,
.editor-mode-btn.active {
  background-color: var(--accent);
  color: #FFFFFF;
}

/* Editor Workspace & 3 View Modes (mode-split, mode-visual, mode-source) */
.editor-workspace {
  display: grid;
  min-height: 480px;
  position: relative;
  background-color: var(--surface);
}

.editor-workspace.mode-split {
  grid-template-columns: 1fr 1fr;
}

.editor-workspace.mode-split .editor-source-pane {
  display: flex;
  border-right: 1px solid var(--border);
}

.editor-workspace.mode-split .editor-preview-pane {
  display: block;
}

.editor-workspace.mode-visual {
  grid-template-columns: 1fr;
}

.editor-workspace.mode-visual .editor-source-pane {
  display: none;
}

.editor-workspace.mode-visual .editor-preview-pane {
  display: block;
  max-width: 76ch;
  width: 100%;
  margin: 0 auto;
}

.editor-workspace.mode-source {
  grid-template-columns: 1fr;
}

.editor-workspace.mode-source .editor-source-pane {
  display: flex;
}

.editor-workspace.mode-source .editor-preview-pane {
  display: none;
}

.editor-source-pane {
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.editor-textarea,
.editor-source-pane textarea,
textarea[name="markdown_content"] {
  width: 100%;
  min-height: 480px;
  height: 100%;
  padding: 1.25rem;
  border: none;
  border-radius: 0;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--surface);
}

.editor-textarea:focus,
.editor-source-pane textarea:focus {
  outline: none;
  box-shadow: none;
}

.editor-preview-pane {
  padding: 1.5rem 1.75rem;
  min-height: 480px;
  max-height: 760px;
  overflow-y: auto;
  outline: none;
  max-width: none;
}

.editor-preview-pane[contenteditable="true"]:focus {
  box-shadow: inset 0 0 0 2px var(--accent-subtle);
}

.editor-preview-pane .media-embed {
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.editor-preview-pane .media-embed:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

/* Status Bar & Upload Indicator */
.editor-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.85rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  background-color: var(--surface-muted);
  border-top: 1px solid var(--border);
}

/* Drag and Drop Upload Overlay */
.editor-drop-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(43, 91, 132, 0.14);
  backdrop-filter: blur(2px);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-md);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30;
  pointer-events: none;
}

.editor-shell.is-dragging .editor-drop-overlay,
.editor-drop-overlay.active {
  display: flex;
}

.editor-drop-message {
  background-color: var(--surface);
  color: var(--text);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-weight: 600;
  border: 1px solid var(--accent);
}

/* Media Library Drawer & Version History Timeline Table */
.media-library-drawer {
  background-color: var(--surface-muted);
  border-top: 1px solid var(--border);
  padding: 1rem 1.25rem;
}

.media-library-drawer[hidden] {
  display: none;
}

.media-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.media-library-item {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.78rem;
}

.media-library-item img,
.media-library-item video {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 4px;
  background-color: #000;
}

.version-history-section {
  margin-top: 2rem;
}

.version-history-table {
  width: 100%;
  border-collapse: collapse;
}

.version-history-table td,
.version-history-table th {
  padding: 0.7rem 0.95rem;
}

/* ==========================================================================
   7. Image Gallery Grid & Full-Viewport Lightbox Modal
   ========================================================================== */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.album-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  display: flex;
  flex-direction: column;
}

.album-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.album-card-cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background-color: var(--surface-muted);
}

.album-card-body {
  padding: 1.1rem 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.photo-card {
  group: photo;
  position: relative;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.photo-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.photo-card img,
.photo-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background-color: var(--surface-muted);
}

.photo-card-caption,
.photo-card-body {
  padding: 0.75rem 0.9rem;
}

.photo-card-title {
  font-weight: 600;
  font-size: 0.925rem;
  margin: 0 0 0.2rem;
  color: var(--text);
}

.photo-card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Lightbox Dialog Modal */
dialog.lightbox-modal,
#photo-lightbox {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: none;
  background-color: rgba(12, 12, 10, 0.94);
  color: #F5F4F0;
  z-index: 1000;
}

dialog.lightbox-modal::backdrop,
#photo-lightbox::backdrop {
  background-color: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
}

dialog.lightbox-modal[open],
#photo-lightbox[open] {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent);
}

.lightbox-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 3.5rem;
  min-height: 0;
  user-select: none;
}

.lightbox-image,
#lightbox-img {
  max-width: 90vw;
  max-height: 76vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65);
}

.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background-color: rgba(28, 27, 24, 0.7);
  color: #FFFFFF;
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.lightbox-nav-btn:hover {
  background-color: rgba(43, 91, 132, 0.9);
}

.lightbox-prev,
#lightbox-prev {
  left: 1.25rem;
}

.lightbox-next,
#lightbox-next {
  right: 1.25rem;
}

.lightbox-close,
#lightbox-close {
  background-color: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
}

.lightbox-footer {
  padding: 1rem 1.75rem 1.35rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.lightbox-caption-group h3,
#lightbox-title {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  color: #FFFFFF;
}

.lightbox-caption-group p,
#lightbox-caption {
  margin: 0;
  font-size: 0.9rem;
  color: #D0CEC4;
}

/* ==========================================================================
   8. WebRTC Video/Audio Call Stage & Pre-Call Lobby
   ========================================================================== */
.call-lobby {
  max-width: 760px;
  margin: 0 auto 2rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.lobby-preview-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 360px;
  background-color: #0E0E0C;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.lobby-preview-box video {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  transform: scaleX(-1);
}

.call-container {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.25rem;
  align-items: start;
}

.call-container.no-sidebar,
.call-container:not(:has(.call-sidebar)) {
  grid-template-columns: 1fr;
}

.video-stage {
  position: relative;
  width: 100%;
  min-height: 480px;
  background-color: #10100E;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
}

.remote-video-grid,
#remote-videos,
#remote-video-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 400px;
}

.remote-peer-tile,
.video-tile {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 240px;
  background-color: #1A1A17;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.remote-peer-tile video,
.video-tile video {
  width: 100%;
  height: 100%;
  max-height: 540px;
  object-fit: cover;
  background-color: #000;
}

.peer-label {
  position: absolute;
  bottom: 0.65rem;
  left: 0.65rem;
  background-color: rgba(18, 18, 16, 0.75);
  color: #FFFFFF;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 500;
  backdrop-filter: blur(4px);
}

/* Picture-in-Picture Local Video */
.local-video-pip {
  position: absolute;
  bottom: 5.25rem;
  right: 1.25rem;
  width: 190px;
  aspect-ratio: 16 / 9;
  background-color: #1C1C19;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  z-index: 20;
}

.local-video-pip video,
#local-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.local-video-pip video.is-rear-camera,
.local-video-pip video.is-screen-share {
  transform: none;
}

/* Call Controls Bar (Pill Buttons) */
.call-controls-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0.85rem 1.25rem;
  margin-top: 0.75rem;
  background-color: rgba(28, 28, 25, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-pill);
  backdrop-filter: blur(8px);
  z-index: 25;
  align-self: center;
}

.call-control-btn,
.call-controls-bar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background-color: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.call-control-btn:hover,
.call-controls-bar button:hover {
  background-color: rgba(255, 255, 255, 0.22);
}

.call-control-btn.is-muted,
.call-control-btn.is-off,
.call-controls-bar button.is-muted,
.call-controls-bar button.is-off {
  background-color: rgba(180, 83, 9, 0.85);
  border-color: rgba(251, 191, 36, 0.5);
}

.call-control-btn.is-active,
.call-controls-bar button.is-active {
  background-color: var(--accent);
  border-color: var(--accent);
}

.call-control-btn.btn-hangup,
#btn-hangup {
  background-color: #DC2626;
  border-color: #EF4444;
  color: #FFFFFF;
}

.call-control-btn.btn-hangup:hover,
#btn-hangup:hover {
  background-color: #B91C1C;
}

/* Call Room Sidebar */
.call-sidebar,
.room-sidebar {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.participant-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.participant-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background-color: var(--surface-muted);
  font-size: 0.875rem;
}

/* ==========================================================================
   9. Responsive Breakpoints (Mobile & Tablet)
   ========================================================================== */
@media (max-width: 900px) {
  .editor-workspace.mode-split {
    grid-template-columns: 1fr;
  }

  .editor-workspace.mode-split .editor-source-pane {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .call-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .site-header .header-inner {
    padding: 0.55rem 0.9rem;
  }

  .profile-hero {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem 1.25rem;
    gap: 1.15rem;
  }

  .hero-actions {
    justify-content: center;
  }

  .author-card {
    flex-direction: column;
    text-align: center;
  }

  .article-body,
  .post-content,
  .editor-preview-pane {
    font-size: 1.05rem;
    line-height: 1.7;
  }

  .local-video-pip {
    width: 120px;
    aspect-ratio: 3 / 4;
    bottom: 5.5rem;
    right: 0.75rem;
  }

  .call-controls-bar {
    width: 100%;
    border-radius: var(--radius-md);
    padding: 0.65rem;
    gap: 0.45rem;
  }

  .call-control-btn,
  .call-controls-bar button {
    padding: 0.55rem 0.8rem;
    font-size: 0.8rem;
  }

  .lightbox-stage {
    padding: 0.5rem 1rem;
  }
}

/* ==========================================================================
   10. Visitor Role Badge & SPA Async Toast Notifications
   ========================================================================== */
.badge-visitor {
  background-color: var(--surface-muted);
  color: var(--text-muted);
  border-color: var(--border-strong);
}

.vsite-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: 380px;
  pointer-events: none;
}

.vsite-toast {
  pointer-events: auto;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  animation: vsiteToastSlideIn 0.2s ease-out;
}

.vsite-toast-success {
  border-left: 4px solid #16A34A;
}

.vsite-toast-error {
  border-left: 4px solid #DC2626;
}

.vsite-toast-info {
  border-left: 4px solid var(--accent);
}

@keyframes vsiteToastSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   11. Recognizable Sun / Moon Theme Toggle & High-Contrast Lightbox Download
   ========================================================================== */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background-color: var(--surface-muted);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.theme-toggle-btn:hover {
  background-color: var(--surface);
  border-color: var(--accent);
}

.theme-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.theme-icon-sun {
  color: #D97706;
}

.theme-icon-moon {
  color: #4F46E5;
}

:root[data-theme="dark"] .theme-icon-sun {
  color: #FBBF24;
}

:root[data-theme="dark"] .theme-icon-moon {
  color: #93C5FD;
}

#lightbox-download,
.lightbox-download {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background-color: #F8FAFC !important;
  color: #0F172A !important;
  border: 2px solid #FFFFFF !important;
  border-radius: var(--radius-pill);
  padding: 0.42rem 1rem;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

#lightbox-download:hover,
.lightbox-download:hover {
  background-color: #FFFFFF !important;
  color: #1D4ED8 !important;
  transform: translateY(-1px);
  text-decoration: none;
}

/* ==========================================================================
   12. VSite v1.0 Enhancements: GFM Callouts, Tables, Checklists, TOC, Tags,
       Slash Command Palette, Zen Mode, Diff Viewer, Chat & Analytics
   ========================================================================== */

/* Role-Entitled Quick-Actions Bar on Root (/) */
.role-quick-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
  padding: 0.9rem 1.25rem;
  margin-bottom: 1.75rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.quick-actions-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.quick-actions-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Chronicle Search & Tag Filter Bar */
.chronicle-filter-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.chronicle-search-input {
  width: 240px !important;
  padding: 0.38rem 0.75rem !important;
  font-size: 0.85rem !important;
  border-radius: var(--radius-pill) !important;
}

.tag-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
}

.tag-filter-btn {
  padding: 0.28rem 0.72rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background-color: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tag-filter-btn:hover,
.tag-filter-btn.active {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 0.75rem;
}

.tag-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  background-color: var(--accent-subtle);
  color: var(--accent);
}

.reading-time {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Collapsible Article Table of Contents */
.article-toc {
  max-width: var(--max-width-reading);
  margin: 0 auto 1.75rem;
  padding: 1rem 1.25rem;
  background-color: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.article-toc-summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}

.article-toc-list {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.article-toc-list li.toc-level-2 {
  padding-left: 0.9rem;
}

.article-toc-list li.toc-level-3 {
  padding-left: 1.8rem;
  font-size: 0.88rem;
}

/* GitHub-Style Callout Alerts */
.callout {
  margin: 1.35rem 0;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent);
  background-color: var(--surface-muted);
}

.callout-title {
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.callout-body p:last-child {
  margin-bottom: 0;
}

.callout-note,
.callout-important {
  border-left-color: var(--accent);
  background-color: var(--accent-subtle);
}

.callout-tip {
  border-left-color: var(--success);
  background-color: var(--success-bg);
}

.callout-warning {
  border-left-color: var(--warning);
  background-color: var(--warning-bg);
}

.callout-caution {
  border-left-color: var(--danger);
  background-color: var(--danger-bg);
}

/* GFM Task Checklists & Tables */
.task-list-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.35rem 0;
}

.task-list-item.is-checked span {
  text-decoration: line-through;
  color: var(--text-muted);
}

.gfm-table-wrap {
  margin: 1.35rem 0;
}

/* Media Alignment Modifiers */
figure.media-align-center {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

figure.media-align-right {
  margin-left: auto;
}

/* Slash Command Palette & Zen Fullscreen Mode */
.slash-command-menu {
  position: absolute;
  top: 3.4rem;
  left: 1rem;
  z-index: 300;
  width: 310px;
  max-height: 320px;
  overflow-y: auto;
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.slash-command-menu[hidden] {
  display: none !important;
}

.slash-cmd-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.slash-cmd-item:hover {
  background-color: var(--accent-subtle);
}

.slash-cmd-item strong {
  font-size: 0.85rem;
}

.slash-cmd-item small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.editor-shell.is-zen-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1500 !important;
  border-radius: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

.editor-shell.is-zen-fullscreen .editor-workspace {
  flex: 1 !important;
  min-height: 0 !important;
}

/* Side-by-Side Revision Diff Viewer */
.revision-diff-panel {
  margin-bottom: 1.25rem;
}

.diff-viewer-box {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  overflow: hidden;
}

.diff-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1rem;
  background-color: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}

.diff-table td,
.diff-table th {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

.diff-line-num {
  width: 36px;
  color: var(--text-muted);
  text-align: right;
  user-select: none;
}

.diff-row-changed .diff-cell-old {
  background-color: rgba(185, 28, 28, 0.12);
}

.diff-row-changed .diff-cell-new {
  background-color: rgba(46, 111, 64, 0.14);
}

/* Multi-Photo Upload Thumbnail Preview Strip */
.upload-preview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.upload-preview-item {
  width: 86px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.upload-preview-item img {
  width: 86px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
}

.upload-preview-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* WebRTC In-Call Chat Drawer */
.call-chat-bubble {
  padding: 0.45rem 0.65rem;
  background-color: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
}

.call-chat-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.call-chat-text {
  word-break: break-word;
  color: var(--text);
}

/* Analytics Stat Bars */
.stat-bar-track {
  width: 100%;
  height: 8px;
  background-color: var(--surface-muted);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background-color: var(--accent);
  border-radius: var(--radius-pill);
}

/* ==========================================================================
   9. Chronicle Series Banner, Reader Comments & WebSocket Chat (/chat)
   ========================================================================== */
.series-banner {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background-color: var(--surface-muted);
}

.series-banner-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.series-list {
  margin: 0;
  padding-left: 1.35rem;
  font-size: 0.9rem;
}

.series-item {
  margin: 0.25rem 0;
}

.article-comments-section {
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
}

.comment-card {
  padding: 0.85rem 1rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.comment-body {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
}

/* Real-Time WebSocket Chat Layout (/chat) */
.ws-chat-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 860px) {
  .ws-chat-grid {
    grid-template-columns: 1fr;
  }
}

.ws-channel-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ws-channel-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.ws-channel-item:hover {
  background-color: var(--surface-muted);
}

.ws-channel-item.is-active {
  border-color: var(--accent);
  background-color: var(--accent-subtle);
  font-weight: 600;
}

.online-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #94a3b8;
  flex-shrink: 0;
}

.online-dot.is-online {
  background-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
}

.ws-chat-messages-box {
  height: 460px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem;
  background-color: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 0.85rem;
}

.ws-chat-msg {
  max-width: 82%;
  align-self: flex-start;
  padding: 0.6rem 0.85rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.ws-chat-msg.is-mine {
  align-self: flex-end;
  background-color: var(--accent-subtle);
  border-color: var(--accent);
}

.ws-chat-msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.ws-chat-msg-body {
  font-size: 0.92rem;
  line-height: 1.45;
  word-break: break-word;
  color: var(--text);
}

.btn-chat-delete {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0 0.2rem;
}

.btn-chat-delete:hover {
  color: var(--danger);
}

/* ==========================================================================
   10. Unified 3-Pane Full-Workspace Integrated Studio Editor
   ========================================================================== */
.integrated-studio-page {
  margin: -0.5rem 0 2rem;
}

.integrated-studio-shell {
  display: flex;
  flex-direction: column;
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  min-height: 780px;
}

.integrated-studio-shell.is-zen-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1600 !important;
  border-radius: 0 !important;
  height: 100vh !important;
}

/* Top Command Bar */
.studio-command-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 100%);
  border-bottom: 1px solid var(--border-strong);
}

.studio-cmd-left,
.studio-cmd-center,
.studio-cmd-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.studio-back-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background-color: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
}

.studio-back-pill:hover {
  background-color: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
}

.studio-crumb-sep {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.studio-doc-kind {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.studio-mode-seg {
  display: inline-flex;
  background-color: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 3px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.studio-seg-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.34rem 0.78rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.studio-seg-btn:hover {
  color: var(--text);
  background-color: var(--surface);
}

.studio-seg-btn.active {
  background-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(43, 91, 132, 0.28);
}

.studio-save-cta {
  font-weight: 600;
  padding: 0.42rem 1rem;
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 6px rgba(43, 91, 132, 0.25);
}

/* 3-Pane Workspace Grid */
.integrated-studio-grid {
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr) 320px;
  flex: 1;
  min-height: 660px;
}

.integrated-studio-grid.hide-left-rail {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.integrated-studio-grid.hide-left-rail .studio-left-rail {
  display: none !important;
}

.integrated-studio-grid.hide-right-inspector {
  grid-template-columns: 235px minmax(0, 1fr);
}

.integrated-studio-grid.hide-right-inspector .studio-right-inspector {
  display: none !important;
}

.integrated-studio-grid.hide-left-rail.hide-right-inspector {
  grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 1120px) {
  .integrated-studio-grid,
  .integrated-studio-grid.hide-left-rail,
  .integrated-studio-grid.hide-right-inspector,
  .integrated-studio-grid.hide-left-rail.hide-right-inspector {
    grid-template-columns: 1fr;
  }
  .studio-left-rail {
    border-right: none !important;
    border-bottom: 1px solid var(--border);
  }
  .studio-right-inspector {
    border-left: none !important;
    border-top: 1px solid var(--border);
  }
}

/* Left Outline & Context Rail */
.studio-left-rail {
  background-color: var(--bg);
  border-right: 1px solid var(--border);
  padding: 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  overflow-y: auto;
}

.studio-rail-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.studio-outline-list {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.studio-outline-item {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 0.82rem;
  padding: 0.34rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.studio-outline-item:hover {
  background-color: var(--accent-subtle);
  border-color: var(--border);
  color: var(--accent);
}

.studio-outline-h1 {
  font-weight: 700;
}

.studio-outline-h2 {
  padding-left: 1rem;
}

.studio-outline-h3 {
  padding-left: 1.6rem;
  color: var(--text-muted);
}

.studio-shortcut-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.studio-shortcut-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.45rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
}

/* Center Stage: Title Bar + Ribbon + Split Canvas */
.studio-center-stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--surface);
}

.studio-title-bar {
  padding: 1.25rem 1.6rem 0.95rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}

.studio-inline-title-input {
  width: 100%;
  border: none !important;
  background: transparent !important;
  font-family: var(--font-serif) !important;
  font-size: 1.75rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.015em;
  color: var(--text) !important;
  padding: 0.15rem 0 !important;
  margin-bottom: 0.55rem;
  outline: none !important;
  box-shadow: none !important;
}

.studio-inline-title-input::placeholder {
  color: var(--text-muted);
  opacity: 0.65;
}

.studio-subtitle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.studio-slug-prefix {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background-color: var(--accent-subtle);
  padding: 0.24rem 0.55rem;
  border-radius: 5px;
}

.studio-inline-slug-input {
  width: 220px;
  font-family: var(--font-mono);
  font-size: 0.8rem !important;
  padding: 0.3rem 0.6rem !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: 6px !important;
  background-color: var(--surface) !important;
  color: var(--text) !important;
}

.studio-inline-summary-input {
  flex: 1;
  min-width: 240px;
  font-size: 0.85rem !important;
  padding: 0.3rem 0.65rem !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: 6px !important;
  background-color: var(--surface) !important;
  color: var(--text) !important;
}

.studio-ribbon-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.55rem 1.25rem;
  background-color: var(--surface-muted);
  border-bottom: 1px solid var(--border-strong);
}

.studio-tool-group {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  padding: 0.16rem;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.studio-tool-group:last-child {
  border-right: 1px solid var(--border);
}

.studio-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  border: 1px solid transparent;
  background-color: var(--surface);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.32rem 0.62rem;
  border-radius: 5px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: all var(--transition-fast);
}

.studio-tool-btn:hover {
  border-color: var(--accent);
  background-color: var(--accent-subtle);
  color: var(--accent);
  transform: translateY(-1px);
}

.studio-tool-accent {
  background-color: var(--accent-subtle);
  color: var(--accent);
  border-color: rgba(43, 91, 132, 0.25);
}

.studio-tool-primary {
  background-color: var(--accent);
  color: #ffffff;
}

.studio-tool-primary:hover {
  background-color: var(--accent-hover);
  color: #ffffff;
}

.studio-pane-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 1.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
}

.studio-pane-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.studio-pane-dot-source {
  background-color: var(--accent);
}

.studio-pane-dot-preview {
  background-color: #10b981;
}

.integrated-studio-shell .editor-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 540px;
}

.integrated-studio-shell .editor-workspace.mode-source {
  grid-template-columns: 1fr;
}

.integrated-studio-shell .editor-workspace.mode-source .editor-preview-pane-wrap {
  display: none;
}

.integrated-studio-shell .editor-workspace.mode-visual {
  grid-template-columns: 1fr;
}

.integrated-studio-shell .editor-workspace.mode-visual .editor-source-pane {
  display: none;
}

.integrated-studio-shell .editor-source-pane {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-strong);
  background-color: var(--bg);
}

.integrated-studio-shell .editor-preview-pane-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--surface-muted);
}

.integrated-studio-shell .editor-textarea {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  min-height: 520px;
  padding: 1.35rem 1.5rem;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  font-family: var(--font-mono);
  font-size: 0.93rem;
  line-height: 1.72;
  background-color: var(--surface);
  color: var(--text);
  resize: none;
}

.integrated-studio-shell .editor-preview-pane {
  flex: 1;
  width: calc(100% - 1.7rem);
  max-width: 820px;
  margin: 0.85rem auto;
  padding: 1.6rem 2rem;
  overflow-y: auto;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.editor-empty-placeholder {
  color: var(--text-muted);
  font-style: italic;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: 1.25rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  text-align: center;
}

/* Series Opt-in Card in Publish & Meta Inspector */
.studio-series-toggle-card {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.studio-series-checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  margin: 0 !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  cursor: pointer;
  user-select: none;
}

.studio-series-checkbox-label input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  accent-color: var(--accent);
  cursor: pointer;
}

.studio-series-fields {
  padding-top: 0.55rem;
  border-top: 1px dashed var(--border);
}

/* Right Inspector Drawer */
.studio-right-inspector {
  background-color: var(--bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.studio-inspector-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--border);
  background-color: var(--surface-muted);
}

.studio-insp-tab {
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.65rem 0.35rem;
  cursor: pointer;
}

.studio-insp-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background-color: var(--surface);
}

.studio-insp-panel {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  flex: 1;
}

.studio-insp-panel[hidden] {
  display: none !important;
}

.studio-field label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.studio-field input,
.studio-field select {
  width: 100%;
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  color: var(--text);
}

.studio-field-row {
  display: flex;
  gap: 0.5rem;
}

.studio-field-row .studio-field {
  flex: 1;
}

.studio-rev-card,
.studio-asset-card {
  padding: 0.65rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
}

.studio-rev-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.studio-rev-note {
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.studio-rev-actions {
  display: flex;
  gap: 0.35rem;
}

.studio-asset-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.studio-asset-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.studio-asset-info code {
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-empty-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.studio-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 1.15rem;
  background-color: var(--surface-muted);
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   11. Wiki Books & WikiName Knowledge Base (/wiki)
   ========================================================================== */
.wiki-books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.25rem;
}

.wiki-book-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.wiki-book-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.wiki-book-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.wiki-book-title {
  margin: 0;
  font-size: 1.25rem;
}

.wiki-book-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.wiki-book-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.wiki-chip-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

.wiki-chip-link,
.wiki-link {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  border-radius: 4px;
  background-color: var(--accent-subtle);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.84em;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
}

.wiki-chip-link:hover,
.wiki-link:hover {
  border-color: var(--accent);
}

.wiki-link-missing {
  background-color: var(--warning-bg);
  color: var(--warning);
  border: 1px dashed var(--warning);
}

.wiki-book-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: auto;
  padding-top: 0.5rem;
}

.wiki-reader-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  width: 100%;
  max-width: var(--max-width-site);
  margin: 0 auto;
}

@media (max-width: 900px) {
  .wiki-reader-layout {
    grid-template-columns: 1fr;
  }
}

.wiki-sidebar {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  box-shadow: var(--shadow-sm);
}

.wiki-sidebar-book-title {
  margin: 0.35rem 0 0.25rem;
  font-size: 1.1rem;
}

.wiki-sidebar-book-desc {
  margin: 0 0 0.85rem;
  font-size: 0.83rem;
  color: var(--text-muted);
}

.wiki-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-height: 460px;
  overflow-y: auto;
}

.wiki-nav-item {
  display: flex;
  flex-direction: column;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 0.86rem;
}

.wiki-nav-item:hover {
  background-color: var(--surface-muted);
}

.wiki-nav-item.active {
  background-color: var(--accent-subtle);
  color: var(--accent);
  font-weight: 700;
}

.wiki-nav-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.wiki-article-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.75rem 2.25rem;
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.wiki-article-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1.15rem;
  margin: 0 auto 1.35rem;
  max-width: var(--max-width-reading);
  width: 100%;
  border-bottom: 1px solid var(--border);
}

.wiki-backlinks-box {
  margin: 2rem auto 0;
  padding-top: 1rem;
  max-width: var(--max-width-reading);
  width: 100%;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
}

.studio-wiki-peer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.28rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}

.studio-wiki-syntax-card {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.78rem;
}

.studio-wiki-syntax-card p {
  margin: 0.3rem 0 0;
  color: var(--text-muted);
}

/* ==========================================================================
   12. Personal eBook Library, Collections & Multi-Format Reader (/library)
   ========================================================================== */
.elevated-drawer {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.15rem;
  box-shadow: var(--shadow-sm);
}

.elevated-drawer summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
}

.drawer-form-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  align-items: end;
}

.drawer-form-grid label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.drawer-form-grid input,
.drawer-form-grid select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  color: var(--text);
}

.library-collections-bar,
.library-tags-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 0.85rem;
}

.collections-bar-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.collections-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.collection-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background-color: var(--bg);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.collection-pill.active,
.collection-pill:hover {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.pill-count {
  font-size: 0.72rem;
  opacity: 0.85;
}

.ebook-shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1.25rem;
  margin-top: 1.15rem;
}

.ebook-card {
  display: flex;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.ebook-spine {
  width: 54px;
  background: linear-gradient(180deg, var(--accent), var(--accent-hover));
  color: #ffffff;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 0.9rem;
  flex-shrink: 0;
}

.ebook-format-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.18rem 0.4rem;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.2);
  color: inherit;
}

.ebook-card-body {
  padding: 1.15rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.ebook-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.ebook-title {
  margin: 0;
  font-size: 1.12rem;
}

.ebook-author {
  font-size: 0.83rem;
  color: var(--text-muted);
}

.ebook-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.ebook-collections-row,
.ebook-tags-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.ebook-meta-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.ebook-collection-badge {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  background-color: var(--accent-subtle);
  color: var(--accent);
  text-decoration: none;
}

.ebook-tag-chip {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-pill);
  background-color: var(--surface-muted);
  color: var(--text-muted);
  text-decoration: none;
}

.ebook-actions-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.ebook-manage-details {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
}

.ebook-manage-details summary {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 600;
}

.ebook-edit-form {
  margin-top: 0.65rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.ebook-edit-form label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.ebook-edit-form input {
  width: 100%;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background-color: var(--bg);
  color: var(--text);
}

/* Built-In eBook & Newsreader Workspace Themes (Paper, Sepia, Night) & Fonts */
.ebook-reader-workspace {
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: background-color 180ms ease, color 180ms ease;
}

.ebook-reader-workspace[data-reader-theme="paper"] {
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --bg: #f1f5f9;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  background-color: #f1f5f9;
  color: #0f172a;
}

.ebook-reader-workspace[data-reader-theme="paper"] .ebook-reader-stage,
.ebook-reader-workspace[data-reader-theme="paper"] .newsreader-article-card {
  background-color: #ffffff;
  color: #0f172a;
  border-color: #e2e8f0;
}

.ebook-reader-workspace[data-reader-theme="sepia"] {
  --surface: #fbf5e6;
  --surface-muted: #f3e9d2;
  --bg: #efe3c6;
  --text: #3b2f1e;
  --text-muted: #6e5a3f;
  --border: #decfae;
  --border-strong: #cbb894;
  --accent: #9a4a17;
  background-color: #efe3c6;
  color: #3b2f1e;
}

.ebook-reader-workspace[data-reader-theme="sepia"] .ebook-reader-stage,
.ebook-reader-workspace[data-reader-theme="sepia"] .newsreader-article-card {
  background-color: #fbf5e6;
  color: #3b2f1e;
  border-color: #decfae;
}

.ebook-reader-workspace[data-reader-theme="night"] {
  --surface: #111827;
  --surface-muted: #1e293b;
  --bg: #0b0f19;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #334155;
  --border-strong: #475569;
  --accent: #38bdf8;
  background-color: #0b0f19;
  color: #e2e8f0;
}

.ebook-reader-workspace[data-reader-theme="night"] .ebook-reader-stage,
.ebook-reader-workspace[data-reader-theme="night"] .newsreader-article-card {
  background-color: #111827;
  color: #e2e8f0;
  border-color: #334155;
}

.ebook-reader-workspace[data-reader-theme] .newsreader-article-card h1,
.ebook-reader-workspace[data-reader-theme] .newsreader-article-card h2,
.ebook-reader-workspace[data-reader-theme] .newsreader-article-card h3,
.ebook-reader-workspace[data-reader-theme] .newsreader-article-card h4,
.ebook-reader-workspace[data-reader-theme] .newsreader-article-card p,
.ebook-reader-workspace[data-reader-theme] .newsreader-article-card li,
.ebook-reader-workspace[data-reader-theme] .newsreader-article-card blockquote,
.ebook-reader-workspace[data-reader-theme] .ebook-reader-stage h1,
.ebook-reader-workspace[data-reader-theme] .ebook-reader-stage h2,
.ebook-reader-workspace[data-reader-theme] .ebook-reader-stage h3,
.ebook-reader-workspace[data-reader-theme] .ebook-reader-stage h4,
.ebook-reader-workspace[data-reader-theme] .ebook-reader-stage p,
.ebook-reader-workspace[data-reader-theme] .ebook-reader-stage li,
.ebook-reader-workspace[data-reader-theme] .ebook-reader-stage blockquote {
  color: var(--text);
}

.ebook-reader-workspace[data-reader-font="serif"] .ebook-reader-canvas,
.ebook-reader-workspace[data-reader-font="serif"] .newsreader-article-prose,
.ebook-reader-workspace[data-reader-font="serif"] .newsreader-article-card .article-title {
  font-family: var(--font-serif);
}

.ebook-reader-workspace[data-reader-font="sans"] .ebook-reader-canvas,
.ebook-reader-workspace[data-reader-font="sans"] .newsreader-article-prose,
.ebook-reader-workspace[data-reader-font="sans"] .newsreader-article-card .article-title {
  font-family: var(--font-sans);
}

.ebook-reader-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.65rem 1.15rem;
  background-color: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}

.ebook-reader-topbar-left,
.ebook-reader-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.ebook-reader-author {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-left: 0.35rem;
}

.ebook-reader-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 680px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

@media (max-width: 880px) {
  .ebook-reader-grid {
    grid-template-columns: 1fr;
  }
}

.ebook-reader-sidebar {
  background-color: var(--bg);
  border-right: 1px solid var(--border);
  padding: 1rem;
}

.ebook-toc-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ebook-toc-item {
  display: flex;
  gap: 0.4rem;
  padding: 0.4rem 0.55rem;
  border-radius: 4px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.84rem;
}

.ebook-toc-item.active {
  background-color: var(--accent-subtle);
  color: var(--accent);
  font-weight: 700;
}

.ebook-reader-stage {
  padding: 1.75rem 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 100%;
}

.ebook-reader-stage > * {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.ebook-reader-canvas {
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
  line-height: 1.78;
}

#ebook-reader-workspace .ebook-reader-canvas,
#ebook-reader-workspace .ebook-reader-footer-nav,
.pdf-reader-container {
  max-width: 100% !important;
  width: 100% !important;
}

.ebook-chapter-kicker {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.ebook-reader-footer-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 100%;
  width: 100%;
  margin: 2.5rem auto 0;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
}

.ebook-pdf-iframe {
  width: 100%;
  max-width: 100%;
  height: calc(100vh - 200px);
  min-height: 740px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   20. Top-Right Account, Theme & Settings Icon Menu
   ========================================================================== */

.header-account-menu {
  position: relative;
  display: inline-block;
}

.header-account-menu > summary {
  list-style: none;
}

.header-account-menu > summary::-webkit-details-marker {
  display: none;
}

.header-icon-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background-color: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  user-select: none;
}

.header-icon-trigger:hover,
.header-account-menu[open] > .header-icon-trigger {
  border-color: var(--accent);
  background-color: var(--accent-subtle);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.header-status-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #10b981;
  border: 2px solid var(--surface);
}

.header-account-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 225px;
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.45rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.header-account-identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
}

.header-account-identity .user-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-dropdown-divider {
  height: 1px;
  background-color: var(--border);
  margin: 0.2rem 0;
}

.header-dropdown-section {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.header-menu-item,
.header-account-dropdown .theme-toggle-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0.6rem !important;
  width: 100% !important;
  padding: 0.48rem 0.65rem !important;
  border: none !important;
  border-radius: var(--radius-sm) !important;
  background: transparent !important;
  color: var(--text) !important;
  font-family: var(--font-sans) !important;
  font-size: 0.84rem !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  text-align: left !important;
  cursor: pointer !important;
  box-shadow: none !important;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.header-menu-item:hover,
.header-account-dropdown .theme-toggle-btn:hover {
  background-color: var(--surface-muted) !important;
  color: var(--accent) !important;
}

.header-menu-danger {
  color: var(--danger) !important;
}

.header-menu-danger:hover {
  background-color: var(--danger-bg) !important;
  color: var(--danger) !important;
}

/* =========================================================================
   Unified Module Action Menu Bar (Sub-Navbar Strip & Left Collapsible Menu)
   ========================================================================= */
.module-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  margin-bottom: 1.35rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  position: relative;
  z-index: 90;
}

.module-action-bar-head,
.module-action-bar-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.module-action-bar-titles,
.module-action-context {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.module-action-kicker,
.module-context-pill {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background-color: var(--accent-subtle);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
}

.module-action-subtitle,
.module-context-sub {
  font-size: 0.83rem;
  color: var(--text-muted);
}

.module-action-collapse-btn,
.module-sidebar-collapse-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background-color: var(--surface-muted);
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
}

.module-action-collapse-btn:hover,
.module-sidebar-collapse-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.module-action-bar-items {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.module-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.4rem 0.78rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background-color: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.module-action-btn:hover {
  border-color: var(--accent);
  background-color: var(--accent-subtle);
  color: var(--accent);
  text-decoration: none;
}

.module-action-btn.is-primary {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.module-action-btn.is-primary:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #ffffff;
}

.module-action-btn.is-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.module-action-btn.is-danger:hover {
  background-color: var(--danger-bg);
  color: var(--danger);
}

.module-action-icon {
  font-size: 0.92rem;
  line-height: 1;
}

/* Module Actions Dropdown Menu */
.module-actions-dropdown {
  position: relative;
}

.module-actions-dropdown > summary {
  list-style: none;
}

.module-actions-dropdown > summary::-webkit-details-marker {
  display: none;
}

.module-actions-dropdown-trigger,
.module-dropdown-trigger {
  background-color: var(--surface-muted);
}

.module-dropdown-header {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.35rem 0.65rem 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.2rem;
}

.module-action-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  background-color: var(--accent-subtle);
  color: var(--accent);
}

.module-action-btn.is-primary .module-action-badge {
  background-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.module-actions-dropdown-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 240px;
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.4rem;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.module-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.48rem 0.65rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.module-dropdown-item:hover {
  background-color: var(--accent-subtle);
  color: var(--accent);
  text-decoration: none;
}

.module-action-bar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: auto;
}

.module-action-extra {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.module-action-layout-btn,
.module-layout-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  background-color: var(--bg);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.module-action-layout-btn:hover,
.module-layout-switch-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background-color: var(--accent-subtle);
}

/* Left Collapsible Action Menu Mode (`html[data-action-layout="sidebar"]`) */
@media (min-width: 960px) {
  html[data-action-layout="sidebar"] body {
    padding-left: 250px;
    transition: padding-left 180ms ease;
  }

  html[data-action-layout="sidebar"][data-action-sidebar-collapsed="true"] body {
    padding-left: 64px;
  }

  html[data-action-layout="sidebar"] .module-action-bar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 240px;
    margin-bottom: 0;
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-left: none;
    border-right: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 1rem 0.75rem;
    gap: 0.85rem;
    overflow-y: auto;
    z-index: 950;
    box-shadow: var(--shadow-sm);
    transition: width 180ms ease, padding 180ms ease;
  }

  html[data-action-layout="sidebar"] .module-action-collapse-btn,
  html[data-action-layout="sidebar"] .module-sidebar-collapse-btn {
    display: inline-flex;
    flex-shrink: 0;
  }

  html[data-action-layout="sidebar"] .module-action-bar-head,
  html[data-action-layout="sidebar"] .module-action-bar-left {
    justify-content: space-between;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border);
  }

  html[data-action-layout="sidebar"] .module-action-bar-titles,
  html[data-action-layout="sidebar"] .module-action-context {
    flex-direction: column;
    gap: 0.2rem;
  }

  html[data-action-layout="sidebar"] .module-action-bar-items {
    flex-direction: column;
    align-items: stretch;
    gap: 0.38rem;
  }

  html[data-action-layout="sidebar"] .module-action-btn {
    width: 100%;
    justify-content: flex-start;
  }

  html[data-action-layout="sidebar"] .module-actions-dropdown {
    display: none;
  }

  html[data-action-layout="sidebar"] .module-action-bar-right {
    margin-left: 0;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
  }

  html[data-action-layout="sidebar"] .module-action-layout-btn,
  html[data-action-layout="sidebar"] .module-layout-switch-btn {
    width: 100%;
    justify-content: center;
  }

  /* Collapsed state for Left Action Menu */
  html[data-action-layout="sidebar"][data-action-sidebar-collapsed="true"] .module-action-bar {
    width: 54px;
    padding: 0.75rem 0.4rem;
    align-items: center;
  }

  html[data-action-layout="sidebar"][data-action-sidebar-collapsed="true"] .module-action-bar-titles,
  html[data-action-layout="sidebar"][data-action-sidebar-collapsed="true"] .module-action-context,
  html[data-action-layout="sidebar"][data-action-sidebar-collapsed="true"] .module-action-label,
  html[data-action-layout="sidebar"][data-action-sidebar-collapsed="true"] .module-action-text,
  html[data-action-layout="sidebar"][data-action-sidebar-collapsed="true"] .module-action-badge,
  html[data-action-layout="sidebar"][data-action-sidebar-collapsed="true"] .module-action-extra,
  html[data-action-layout="sidebar"][data-action-sidebar-collapsed="true"] .action-layout-label,
  html[data-action-layout="sidebar"][data-action-sidebar-collapsed="true"] .layout-switch-label {
    display: none !important;
  }

  html[data-action-layout="sidebar"][data-action-sidebar-collapsed="true"] .module-action-btn {
    justify-content: center;
    padding: 0.45rem;
  }
}

/* =========================================================================
   Modal Overlay Dialog System (`.vsite-modal-overlay`)
   ========================================================================= */
body.has-open-modal {
  overflow: hidden;
}

.vsite-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.vsite-modal-overlay[hidden] {
  display: none !important;
}

.vsite-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.vsite-modal-dialog {
  position: relative;
  z-index: 3001;
  width: 100%;
  max-width: 580px;
  max-height: calc(100vh - 2.5rem);
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: vsiteModalPop 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.vsite-modal-sm {
  max-width: 440px;
}

.vsite-modal-md {
  max-width: 600px;
}

.vsite-modal-lg {
  max-width: 820px;
}

.vsite-modal-xl {
  max-width: 1120px;
}

@keyframes vsiteModalPop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.vsite-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.35rem;
  background-color: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}

.vsite-modal-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
}

.vsite-modal-subtitle {
  margin: 0.22rem 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.vsite-modal-close,
.vsite-modal-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--surface);
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.vsite-modal-close:hover,
.vsite-modal-close-btn:hover {
  border-color: var(--danger);
  background-color: var(--danger-bg);
  color: var(--danger);
}

.vsite-modal-body {
  padding: 1.35rem;
  overflow-y: auto;
  flex: 1;
}

.vsite-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  padding-top: 1rem;
  margin-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.modal-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}

.modal-form-grid label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

mark.ebook-search-hit {
  background-color: rgba(245, 158, 11, 0.28);
  color: var(--text);
  padding: 0.08rem 0.25rem;
  border-radius: 3px;
  font-weight: 600;
}

/* ==========================================================================
   Full-Screen Workspaces (eBook Reader, Wiki Reader, Authoring Studio, Journal)
   ========================================================================== */
body.has-fullscreen-workspace {
  overflow: hidden;
  padding-left: 0 !important;
}

.vsite-workspace-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  margin: 0 auto !important;
  padding: 1rem 2rem !important;
  border-radius: 0 !important;
  z-index: 1050 !important;
  overflow-y: auto !important;
  background-color: var(--bg-body, var(--bg)) !important;
  box-sizing: border-box !important;
}

.vsite-workspace-fullscreen > .ebook-reader-topbar,
.vsite-workspace-fullscreen > .ebook-reader-grid,
.vsite-workspace-fullscreen > .studio-command-bar,
.vsite-workspace-fullscreen > .integrated-studio-grid,
.vsite-workspace-fullscreen > .studio-status-bar {
  max-width: 100%;
  width: 100%;
  margin-left: auto !important;
  margin-right: auto !important;
}

.vsite-workspace-fullscreen .ebook-pdf-iframe {
  height: calc(100vh - 135px) !important;
}

.vsite-workspace-fullscreen > .newsreader-article-card,
.vsite-workspace-fullscreen > .wiki-article-card {
  max-width: 920px !important;
  width: 100% !important;
  margin: 1.5rem auto !important;
}

.blog-article.vsite-workspace-fullscreen {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  padding: 2rem 1.5rem 4rem !important;
}

.blog-article.vsite-workspace-fullscreen > * {
  max-width: var(--max-width-reading) !important;
  width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

#wiki-reader-workspace.vsite-workspace-fullscreen {
  justify-content: center !important;
  grid-template-columns: 280px minmax(0, 960px) !important;
  align-content: start !important;
}

#ebook-reader-workspace.vsite-workspace-fullscreen[data-reader-theme="paper"] {
  background-color: #faf8f5 !important;
}

#ebook-reader-workspace.vsite-workspace-fullscreen[data-reader-theme="sepia"] {
  background-color: #f4ecd8 !important;
}

#ebook-reader-workspace.vsite-workspace-fullscreen[data-reader-theme="night"] {
  background-color: #121316 !important;
}

#ebook-reader-workspace.sidebar-collapsed .ebook-reader-grid,
#newsreader-workspace.sidebar-collapsed .ebook-reader-grid {
  grid-template-columns: 1fr !important;
  width: 100% !important;
  max-width: 100% !important;
}

#ebook-reader-workspace.sidebar-collapsed .ebook-reader-sidebar,
#newsreader-workspace.sidebar-collapsed .ebook-reader-sidebar {
  display: none !important;
}

#newsreader-workspace.vsite-workspace-fullscreen[data-reader-theme="paper"] {
  background-color: #faf8f5 !important;
}

#newsreader-workspace.vsite-workspace-fullscreen[data-reader-theme="sepia"] {
  background-color: #f4ecd8 !important;
}

#newsreader-workspace.vsite-workspace-fullscreen[data-reader-theme="night"] {
  background-color: #121316 !important;
}

.newsreader-feed-item {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 0.45rem;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.newsreader-feed-item:hover,
.newsreader-feed-item.active {
  border-color: var(--accent);
  background: var(--surface-muted);
}

.newsreader-feed-link {
  text-decoration: none;
  color: var(--text);
  display: block;
}

.newsreader-article-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 0.85rem 0;
}

#wiki-reader-workspace.sidebar-collapsed,
#wiki-reader-workspace.vsite-workspace-fullscreen.sidebar-collapsed {
  grid-template-columns: minmax(0, 960px) !important;
  justify-content: center !important;
}

#wiki-reader-workspace.sidebar-collapsed .wiki-sidebar {
  display: none !important;
}

/* ==========================================================================
   Universal Pagination Bar (Centered Page Count & Numbers, Right-Aligned Prev/Next)
   ========================================================================== */
.vsite-pagination-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding: 0.65rem 1rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  font-size: 0.85rem;
}

.vsite-pagination-left {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 0.5rem;
}

.vsite-page-size-label {
  display: inline-flex !important;
  align-items: center;
  gap: 0.45rem;
  margin: 0 !important;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.vsite-page-size-select,
.vsite-pagination-bar select {
  width: auto !important;
  min-width: 68px;
  max-width: 220px;
  display: inline-block !important;
  padding: 0.24rem 0.55rem !important;
  font-size: 0.82rem !important;
  margin: 0 !important;
}

.vsite-pagination-center {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  text-align: center;
}

.vsite-pagination-info {
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
}

.vsite-page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
}

.vsite-page-num-btn {
  width: auto !important;
  min-width: 28px;
  padding: 0.2rem 0.55rem !important;
  font-size: 0.8rem !important;
  line-height: 1.2;
}

.vsite-pagination-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-left: auto;
}

.vsite-pagination-right .btn,
.vsite-pagination-bar button.btn {
  width: auto !important;
  flex: 0 0 auto !important;
  white-space: nowrap;
}

/* Compact layout when pagination bar is inside a narrow sidebar (e.g. Wiki / eBook TOC sidebar) */
.wiki-sidebar .vsite-pagination-bar,
.ebook-reader-sidebar .vsite-pagination-bar {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 0.5rem 0.65rem;
  gap: 0.45rem;
}

.wiki-sidebar .vsite-pagination-left,
.ebook-reader-sidebar .vsite-pagination-left {
  display: none;
}

.wiki-sidebar .vsite-pagination-right,
.ebook-reader-sidebar .vsite-pagination-right {
  justify-self: end;
  width: 100%;
  justify-content: flex-end;
}

@media (max-width: 680px) {
  .vsite-pagination-bar {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }
  .vsite-pagination-left {
    justify-self: center;
  }
  .vsite-pagination-center {
    justify-self: center;
  }
  .vsite-pagination-right {
    justify-self: end;
    width: 100%;
    justify-content: flex-end;
  }
}

/* ==========================================================================
   Print / Save-to-PDF Stylesheet (`@media print`)
   ========================================================================== */
@media print {
  :root,
  html,
  html[data-theme="dark"],
  body {
    --bg: #ffffff !important;
    --surface: #ffffff !important;
    --surface-muted: #f8fafc !important;
    --text: #111827 !important;
    --text-muted: #4b5563 !important;
    --border: #d1d5db !important;
    --border-strong: #9ca3af !important;
    background: #ffffff !important;
    color: #111827 !important;
    padding-left: 0 !important;
    overflow: visible !important;
  }

  .site-header,
  .site-footer,
  .module-action-bar,
  .article-header-actions,
  .back-link,
  .article-comments-section,
  .comment-form,
  .vsite-pagination-bar,
  .vsite-entry-section-pager,
  .wiki-sidebar,
  .ebook-reader-topbar,
  .ebook-reader-sidebar,
  .ebook-reader-footer-nav,
  .vsite-modal-overlay,
  .vsite-toast-container,
  .no-print,
  [data-print-article],
  [data-fullscreen-target] {
    display: none !important;
  }

  .container,
  .main-content,
  .blog-article,
  .wiki-reader-layout,
  .wiki-main-stage,
  .wiki-article-card,
  .ebook-reader-workspace,
  .ebook-reader-grid,
  .ebook-reader-stage,
  .ebook-reader-canvas,
  .article-body,
  .prose {
    display: block !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
    color: #111827 !important;
  }

  .blog-article .article-body.prose > *,
  #wiki-entry-prose > *,
  #ebook-reader-canvas > *,
  #newsreader-article-canvas > * {
    display: block !important;
  }

  .vsite-workspace-fullscreen {
    position: static !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  pre,
  blockquote,
  figure,
  table,
  .callout,
  .author-card {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  h1,
  h2,
  h3 {
    page-break-after: avoid;
    break-after: avoid;
  }
}

/* ==========================================================================
   Reading Polish, Code Copy/Syntax, Studio Auto-Save & Ctrl+K Command Palette
   ========================================================================== */
.vsite-reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #38bdf8);
  z-index: 9999;
  transition: width 0.08s ease-out;
  pointer-events: none;
}

.prose pre[data-code-enhanced="1"] {
  padding-top: 0;
  overflow: hidden;
}

.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.85rem;
  margin: 0 -1rem 0.75rem -1rem;
  background: rgba(15, 23, 42, 0.35);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  font-family: var(--font-sans);
  font-size: 0.74rem;
}

.code-lang-badge {
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #94a3b8;
  text-transform: uppercase;
}

.code-copy-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 5px;
  padding: 0.18rem 0.55rem;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.code-copy-btn.is-copied {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.55);
  color: #6ee7b7;
}

.tok-kw {
  color: #c084fc;
  font-weight: 600;
}

.tok-str {
  color: #86efac;
}

.tok-com {
  color: #64748b;
  font-style: italic;
}

.tok-num {
  color: #fbbf24;
}

.heading-anchor-link {
  margin-left: 0.45rem;
  font-size: 0.85em;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.prose h2:hover .heading-anchor-link,
.prose h3:hover .heading-anchor-link,
.heading-anchor-link:focus {
  opacity: 0.85;
}

.heading-anchor-link:hover {
  color: var(--accent);
  opacity: 1 !important;
}

.article-body img,
#wiki-entry-prose img,
#ebook-reader-canvas img,
#newsreader-article-canvas img {
  cursor: zoom-in;
}

.vsite-article-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(6px);
  z-index: 9998;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.vsite-article-lightbox.is-open {
  display: flex;
}

.vsite-lightbox-img {
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.vsite-lightbox-caption {
  margin-top: 0.85rem;
  color: #f1f5f9;
  font-size: 0.92rem;
  max-width: 72ch;
  text-align: center;
}

.vsite-lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  width: 38px;
  height: 38px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.studio-autosave-status {
  font-size: 0.76rem;
  color: var(--text-muted);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
  white-space: nowrap;
}

.studio-autosave-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.65rem 1.15rem;
  background: rgba(37, 99, 235, 0.08);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.studio-tag-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
  margin-top: 0.42rem;
}

.studio-tag-chip {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.16rem 0.52rem;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.studio-tag-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.studio-tag-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.header-cmdk-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface-muted);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.header-cmdk-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.header-cmdk-btn kbd {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.08rem 0.35rem;
}

@media (max-width: 680px) {
  .header-cmdk-label,
  .header-cmdk-btn kbd {
    display: none;
  }
}

.vsite-cmd-palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 9995;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 1rem 2rem;
}

.vsite-cmd-palette-overlay[hidden] {
  display: none !important;
}

.vsite-cmd-palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
}

.vsite-cmd-palette-dialog {
  position: relative;
  width: 100%;
  max-width: 620px;
  background: var(--surface);
  border: 1px solid var(--border-strong, var(--border));
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.35);
  overflow: hidden;
  z-index: 1;
}

.vsite-cmd-palette-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.vsite-cmd-palette-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  font-size: 0.98rem !important;
  color: var(--text) !important;
  padding: 0.2rem 0 !important;
  box-shadow: none !important;
}

.vsite-cmd-palette-input:focus {
  outline: none !important;
}

.vsite-cmd-esc-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  color: var(--text-muted);
  cursor: pointer;
}

.vsite-cmd-palette-body {
  max-height: 62vh;
  overflow-y: auto;
  padding: 0.5rem;
}

.vsite-cmd-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.45rem 0.65rem 0.25rem;
}

.vsite-cmd-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease;
}

.vsite-cmd-item:hover {
  background: var(--surface-muted);
  text-decoration: none;
}

.vsite-cmd-item-icon {
  font-size: 1.1rem;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.vsite-cmd-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.vsite-cmd-item-main strong {
  font-size: 0.9rem;
  color: var(--text);
}

.vsite-cmd-item-main small {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.vsite-cmd-item-Hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ==========================================================================
   Web Push Notifications, Header Bell, Toasts & First-Login Onboarding
   ========================================================================== */
.header-push-bell {
  position: relative;
}

.header-push-bell.has-unread-push {
  border-color: var(--accent);
  color: var(--accent);
}

.header-push-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background-color: var(--danger, #dc2626);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
}

.header-push-badge.hidden,
.push-channel-unread-badge.hidden {
  display: none !important;
}

.push-channel-unread-badge {
  background-color: var(--danger, #dc2626);
  color: #ffffff;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  font-size: 0.72rem;
}

.push-status-granted {
  background-color: rgba(22, 163, 74, 0.15);
  color: #15803d;
  border: 1px solid rgba(22, 163, 74, 0.35);
}

.push-status-denied {
  background-color: rgba(220, 38, 38, 0.14);
  color: #b91c1c;
  border: 1px solid rgba(220, 38, 38, 0.35);
}

.push-status-default {
  background-color: var(--surface-muted);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.push-notif-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--surface);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.push-notif-item.unread {
  border-left: 4px solid var(--accent);
  background-color: var(--surface-muted);
}

.push-notif-item.push-notif-cat-call.unread {
  border-left-color: #16a34a;
}

.push-notif-item-main {
  flex: 1;
  min-width: 0;
}

.push-notif-item-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.push-notif-item-title {
  font-size: 0.9rem;
  color: var(--text);
}

.push-notif-item-body {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  word-break: break-word;
}

.vsite-push-toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 2200;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: 370px;
  width: calc(100vw - 2.5rem);
  pointer-events: none;
}

.vsite-push-toast {
  pointer-events: auto;
  background-color: var(--surface);
  border: 1px solid var(--border-strong, var(--border));
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
}

.vsite-push-toast-call {
  border-left-color: #16a34a;
}

.vsite-push-onboarding-card {
  border-left-color: var(--accent);
}

.vsite-push-toast-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.vsite-push-toast-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}

.vsite-push-toast-title {
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.vsite-push-toast-body {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.55rem;
}

.vsite-push-toast-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
}

/* ==========================================================================
   Brand Emblem, Multi-Select Chip Controls, Focused Sub-Tabs & Toast Stack
   ========================================================================== */

.brand-logo {
  width: 76px;
  height: 76px;
  border-radius: 14px;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 8px rgba(15, 23, 42, 0.18));
}

@media (max-width: 768px) {
  .brand-logo {
    width: 54px;
    height: 54px;
    border-radius: 10px;
  }

  .brand-avatar {
    width: 54px;
    height: 54px;
    min-width: 54px;
  }
}

.auth-hero-emblem {
  width: 104px;
  height: 104px;
  border-radius: 20px;
  filter: drop-shadow(0 8px 20px rgba(15, 23, 42, 0.24));
}

.ui-svg-icon {
  display: inline-block;
  vertical-align: -2px;
  flex-shrink: 0;
}

.workspace-subtabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem;
  margin-bottom: 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.workspace-subtab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.9rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.workspace-subtab-btn:hover {
  color: var(--text-primary);
  background: rgba(148, 163, 184, 0.12);
}

.workspace-subtab-btn.is-active {
  background: var(--bg-surface);
  color: var(--accent-primary);
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.workspace-subtab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.2rem;
  padding: 0 0.38rem;
  border-radius: 999px;
  background: var(--accent-subtle);
  color: var(--accent-primary);
  font-size: 0.72rem;
  font-weight: 700;
}

.multi-select-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.multi-select-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.multi-select-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.52rem;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid var(--border-focus);
}

.multi-select-chip button {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font-size: 0.88rem;
  line-height: 1;
}

.select-ctrl.multi-select-box {
  width: 100%;
  min-height: 86px;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 0.84rem;
}

.select-ctrl.multi-select-box option {
  padding: 0.28rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}

.multi-select-add-row {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.toast-stack {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 380px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-primary);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-card);
  font-size: 0.86rem;
}

/* ==========================================================================
   Clean Separated Newsreader Stream, Sidebar Navigation & Reader View
   ========================================================================== */

.newsreader-status-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem;
}

.newsreader-status-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.32rem 0.4rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.newsreader-status-pill:hover {
  border-color: var(--accent);
  color: var(--text);
  text-decoration: none;
}

.newsreader-status-pill.active {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
}

.newsreader-status-pill span {
  font-size: 0.7rem;
  opacity: 0.85;
}

.newsreader-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.38rem 0.55rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.83rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.newsreader-nav-row:hover {
  background-color: var(--surface);
  border-color: var(--border);
  color: var(--accent);
  text-decoration: none;
}

.newsreader-nav-row.active {
  background-color: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.newsreader-stream-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.newsreader-stream-item {
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.newsreader-stream-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.newsreader-stream-thumb-link {
  display: block;
  flex-shrink: 0;
  width: 124px;
  height: 84px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background-color: var(--surface-muted);
}

.newsreader-stream-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--transition-fast);
}

.newsreader-stream-thumb-link:hover .newsreader-stream-thumb {
  transform: scale(1.03);
}

.newsreader-lead-figure {
  margin: 0 0 1.35rem 0;
  padding: 0;
  text-align: center;
}

.newsreader-article-img,
.newsreader-article-prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: block;
  margin: 1rem auto;
}









