:root {
  --bg: #efe5d6;
  --panel: #dbc9b3;
  --paper: #fffaf2;
  --ink: #2f241b;
  --muted: #6e6253;
  --accent: #365b48;
  --accent-soft: #7ea18d;
  --border: rgba(92, 64, 38, 0.18);
  --shadow: rgba(65, 41, 20, 0.16);
  --ember: #8b3c24;
  --forest: #365b48;
  --navy: #314d67;
  --shell-page-width: 980px;
  --shell-surface-bg: rgba(255, 250, 242, 0.92);
  --shell-surface-border: 1px solid rgba(92, 64, 38, 0.14);
  --shell-surface-radius: 1.25rem;
  --shell-surface-shadow: 0 18px 45px var(--shadow);
  --shell-admin-card-bg: rgba(255, 250, 242, 0.92);
  --shell-admin-card-border: 1px solid rgba(92, 64, 38, 0.14);
  --shell-admin-card-shadow: 0 18px 45px var(--shadow);
  --shell-hero-kicker-color: var(--forest);
  --shell-page-header-border: 1px solid rgba(92, 64, 38, 0.14);
  --shell-action-bg: rgba(54, 91, 72, 0.12);
  --shell-action-bg-hover: rgba(54, 91, 72, 0.18);
  --shell-action-border: 1px solid rgba(54, 91, 72, 0.18);
  --shell-status-bg: rgba(126, 161, 141, 0.2);
  --shell-status-border: 1px solid rgba(54, 91, 72, 0.24);
  --shell-status-color: var(--forest);
  --shell-button-bg: rgba(47, 36, 27, 0.92);
  --shell-button-bg-hover: rgba(47, 36, 27, 0.98);
  --shell-button-color: #fffaf2;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-summary {
  margin-bottom: 0.9rem;
  font-size: 1rem;
}

.layout.sidebar-empty .sidebar {
  padding-top: 1.6rem;
}

.layout.sidebar-empty .sidebar-intro,
.layout.sidebar-empty .tree,
.layout.sidebar-empty .search,
.layout.sidebar-empty .search-results,
.layout.sidebar-empty .logout-link,
.layout.sidebar-empty .identity-panel {
  display: none;
}

.layout.sidebar-empty.sidebar-show-intro .sidebar-intro {
  display: block;
}

.layout.sidebar-empty .mobile-nav-toggle {
  display: none !important;
}

.standalone-card-wrap {
  max-width: var(--shell-page-width);
}

.standalone-card-wrap-narrow {
  display: flex;
  justify-content: center;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

.field-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-weight: 700;
}

.text-input,
.text-area {
  width: 100%;
  padding: 0.8rem 0.9rem;
  font: inherit;
}

.text-area {
  min-height: 11rem;
  resize: vertical;
}

.text-area.code {
  font-family: "Courier New", monospace;
  font-size: 0.95rem;
  line-height: 1.5;
}

.read-only {
  background: rgba(219, 201, 179, 0.48);
}

.help-text {
  margin-top: 0;
  color: var(--muted);
}

.warning-text {
  padding: 0.8rem 0.95rem;
  border-radius: 0.8rem;
  background: rgba(168, 54, 38, 0.09);
  border: 1px solid rgba(168, 54, 38, 0.2);
  color: #6c2a1d;
}

.quiet-link {
  color: var(--muted);
}

.form-actions form {
  margin: 0;
}

.search-results-heading,
.search-empty {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-card-featured {
  border-color: rgba(54, 91, 72, 0.28);
  background: rgba(255, 250, 242, 0.98);
}

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

.search-card p {
  margin: 0.3rem 0 0;
}

.search-detail {
  line-height: 1.45;
}

.search-meta {
  font-size: 0.84rem;
}

.search-badge {
  flex: 0 0 auto;
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(126, 161, 141, 0.22);
  color: #355821;
}

.search-badge-exact-title,
.search-badge-title {
  background: rgba(54, 91, 72, 0.18);
  color: #2f5140;
}

.search-badge-exact-alias,
.search-badge-alias {
  background: rgba(139, 60, 36, 0.14);
  color: #7a2d1d;
}

.search-badge-path {
  background: rgba(49, 77, 103, 0.14);
  color: #284253;
}

.search-badge-mention {
  background: rgba(92, 64, 38, 0.12);
  color: #5b4533;
}

.pending-link {
  margin-top: 0.35rem;
  margin-left: 1rem;
  font-size: 0.92rem;
  background: rgba(126, 161, 141, 0.16);
  border: 1px dashed rgba(54, 91, 72, 0.28);
}

.pending-edit-link {
  margin-top: 0.2rem;
  background: rgba(76, 123, 51, 0.1);
  border-color: rgba(76, 123, 51, 0.24);
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
  color: var(--muted);
}

.breadcrumbs a::after {
  content: "/";
  margin-left: 0.5rem;
  color: rgba(54, 91, 72, 0.45);
}

.breadcrumbs a:last-child::after {
  content: "";
}

.meta {
  margin: 0 0 0.5rem;
  color: var(--muted);
}

.aliases {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.aliases strong {
  font-size: 0.92rem;
}

.aliases span,
.tags span,
.task-tag {
  display: inline-block;
  margin-right: 0.4rem;
  margin-bottom: 0.4rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: rgba(126, 161, 141, 0.2);
}

.form-page {
  max-width: var(--shell-page-width);
}

.sidebar-filters {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.select-input {
  appearance: none;
}

.status-link-count {
  float: right;
  color: var(--muted);
}

.notice-card,
.workspace-card,
.empty-card {
  margin-bottom: 1rem;
}

.workspace-card p,
.admin-card p:last-child {
  margin-bottom: 0;
}

.task-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
}

.task-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.22rem;
}

.task-card p {
  margin: 0 0 0.6rem;
}

.task-meta,
.task-submeta {
  color: var(--muted);
  font-size: 0.94rem;
}

.task-submeta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.task-status {
  display: inline-block;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.task-status-open {
  background: rgba(54, 91, 72, 0.14);
  color: #2f5c47;
}

.task-status-waiting {
  background: rgba(190, 146, 49, 0.16);
  color: #7b5a12;
}

.task-status-on_hold {
  background: rgba(119, 97, 77, 0.16);
  color: #644a35;
}

.task-status-done {
  background: rgba(92, 64, 38, 0.14);
  color: #4a3424;
}

.task-tags {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.task-snippet {
  color: var(--muted);
  line-height: 1.55;
}

.task-form {
  display: grid;
  gap: 1rem;
}

.field {
  display: block;
}

.field span {
  display: block;
  margin-bottom: 0.38rem;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.field-note {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.task-text-area {
  min-height: 14rem;
  border-radius: 1rem;
}

.preview-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  margin-top: 1.2rem;
}

.preview-grid h3 {
  margin-top: 0;
}

.admin-section + .admin-section {
  margin-top: 1.3rem;
}

.admin-section h2 {
  margin: 0 0 0.55rem;
  font-size: 1.1rem;
}

.diff-shell {
  margin-top: 1.25rem;
}

.diff-header {
  margin-bottom: 0.75rem;
}

.diff-table {
  overflow: hidden;
  border: 1px solid rgba(92, 64, 38, 0.14);
  border-radius: 1rem;
  background: rgba(255, 250, 242, 0.96);
}

.diff-table-head,
.diff-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.diff-head-cell {
  padding: 0.8rem 0.95rem;
  background: rgba(92, 64, 38, 0.07);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.diff-head-cell + .diff-head-cell,
.diff-line-right {
  border-left: 1px solid rgba(92, 64, 38, 0.1);
}

.diff-line {
  margin: 0;
  padding: 0.75rem 0.95rem;
  border-top: 1px solid rgba(92, 64, 38, 0.1);
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 3rem;
}

.diff-row-delete .diff-line-left {
  background: rgba(245, 194, 188, 0.42);
}

.diff-row-add .diff-line-right {
  background: rgba(190, 226, 189, 0.42);
}

.diff-row-context .diff-line {
  background: rgba(255, 250, 242, 0.7);
}

.diff-editors {
  margin-top: 1rem;
}

.page-body {
  line-height: 1.7;
}

.page-body h1,
.page-body h2,
.page-body h3 {
  line-height: 1.15;
  margin-top: 1.45em;
}

.page-body p,
.page-body li,
.page-body blockquote {
  font-size: 1.02rem;
  line-height: 1.65;
}

.page-body ul,
.page-body ol {
  padding-left: 1.3rem;
}

.page-body blockquote {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 4px solid var(--accent-soft);
  color: var(--muted);
}

.page-body pre,
.page-body code {
  font-family: "Courier New", monospace;
}

.page-body pre:not(.raw-doc-view) {
  overflow-x: auto;
  padding: 1rem;
  border-radius: 0.8rem;
  background: #2b2119;
  color: #f8efdf;
}

.page-body hr {
  border: 0;
  border-top: 1px solid rgba(92, 64, 38, 0.14);
  margin: 1.5rem 0;
}

.page-body img {
  max-width: 100%;
  border-radius: 0.6rem;
}

.page-body p > img:only-child,
.page-body p > img:last-child {
  display: block;
  max-width: 66.666%;
  height: auto;
  margin-top: 0.75rem;
  padding: 0.45rem;
  background: rgba(228, 214, 190, 0.92);
  border: 1px solid rgba(156, 129, 91, 0.9);
  border-radius: 0.9rem;
  box-shadow:
    0 10px 24px rgba(66, 38, 16, 0.16),
    inset 0 0 0 1px rgba(255, 248, 235, 0.35);
}

.page-media {
  margin: 1.5rem 0;
  padding: 1rem;
  width: 100%;
  border: 1px solid rgba(92, 64, 38, 0.14);
  border-radius: 1rem;
  background: rgba(255, 250, 242, 0.96);
}

.page-media-inline {
  width: auto;
}

.page-media img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.75rem;
  box-shadow: 0 12px 28px var(--shadow);
}

.page-media-title {
  margin-bottom: 0.8rem;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.image-mode-contain img {
  object-fit: contain;
}

.image-mode-full {
  max-width: 100% !important;
}

.image-fallback {
  margin-top: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

.image-fallback[hidden] {
  display: none;
}

.image-fallback:empty {
  display: none;
}

.action-link-primary {
  background: rgba(47, 36, 27, 0.94);
  border-color: rgba(47, 36, 27, 0.94);
  color: #fffaf2;
}

.action-link-primary:hover {
  background: rgba(47, 36, 27, 1);
}

.sidebar-intro-html {
  margin-bottom: 1rem;
}

.sidebar-intro-html .site-bridge-compact {
  width: 100%;
}

.homepage-hero-media {
  position: relative;
  width: 100% !important;
  max-width: 100% !important;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(92, 64, 38, 0.16);
  background:
    radial-gradient(circle at top left, rgba(126, 161, 141, 0.18), transparent 42%),
    linear-gradient(135deg, rgba(27, 20, 15, 0.92), rgba(58, 42, 30, 0.58));
}

.homepage-hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(16, 12, 8, 0.64), rgba(16, 12, 8, 0.08) 54%, rgba(16, 12, 8, 0.58)),
    linear-gradient(0deg, rgba(17, 12, 8, 0.78), transparent 44%);
  pointer-events: none;
}

.homepage-hero-media .page-media-title {
  display: none;
}

.homepage-hero-media img {
  width: 100%;
  height: clamp(20rem, 52vw, 37rem);
  object-fit: cover;
  border-radius: 0;
  box-shadow: none;
  opacity: 0.88;
}

.site-bridge {
  border: 1px solid rgba(92, 64, 38, 0.18);
  border-radius: 1.25rem;
  box-shadow: 0 18px 45px rgba(41, 25, 12, 0.24);
}

.site-bridge-compact {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem;
  border-radius: 999px;
  background: rgba(92, 64, 38, 0.12);
  box-shadow: none;
}

.site-bridge-link {
  display: inline-block;
  padding: 0.48rem 0.9rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1;
}

.site-bridge-link:hover {
  text-decoration: none;
  color: var(--ink);
}

.site-bridge-link.is-active {
  background: rgba(255, 250, 242, 0.98);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(41, 25, 12, 0.12);
}

.site-bridge-card {
  padding: 1rem;
  background: rgba(255, 250, 242, 0.96);
}

.site-bridge-overlay {
  position: absolute;
  left: 1.25rem;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 2;
  width: min(31rem, calc(100% - 2.5rem));
  padding: 1rem;
  background: rgba(31, 24, 17, 0.72);
  border-color: rgba(255, 250, 242, 0.22);
  color: #fffaf2;
  backdrop-filter: blur(12px);
}

.site-bridge-switch {
  display: inline-flex;
  gap: 0.4rem;
  padding: 0.28rem;
  border-radius: 999px;
  background: rgba(92, 64, 38, 0.1);
}

.site-bridge-tab {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.5rem 0.95rem;
}

.site-bridge-tab.is-active {
  background: rgba(47, 36, 27, 0.92);
  color: #fffaf2;
}

.site-bridge-panel {
  margin-top: 0.95rem;
}

.site-bridge-panel[hidden] {
  display: none;
}

.site-bridge-panel h2 {
  margin: 0.2rem 0 0.5rem;
  font-size: clamp(1.45rem, 2vw, 1.9rem);
  line-height: 1.05;
}

.site-bridge-panel p {
  margin: 0;
  line-height: 1.55;
}

.site-bridge-eyebrow,
.companion-feature-kicker {
  margin: 0;
  color: var(--ember);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-bridge-overlay .site-bridge-eyebrow {
  color: rgba(255, 250, 242, 0.74);
}

.site-bridge-actions,
.companion-reference-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.95rem;
}

.site-bridge-overlay .site-bridge-switch {
  background: rgba(255, 250, 242, 0.08);
}

.site-bridge-overlay .site-bridge-tab.is-active {
  background: rgba(255, 250, 242, 0.92);
  color: var(--ink);
}

.site-bridge-overlay .action-link {
  background: rgba(255, 250, 242, 0.1);
  border-color: rgba(255, 250, 242, 0.2);
  color: #fffaf2;
}

.site-bridge-overlay .action-link-primary {
  background: rgba(255, 250, 242, 0.96);
  border-color: rgba(255, 250, 242, 0.96);
  color: var(--ink);
}

.site-bridge-overlay .action-link:hover {
  background: rgba(255, 250, 242, 0.18);
}

.site-bridge-overlay .action-link-primary:hover {
  background: rgba(255, 250, 242, 1);
}

.companion-page {
  display: grid;
  gap: 1.25rem;
}

.companion-bridge-shell {
  display: block;
}

.companion-feature-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.companion-feature {
  height: 100%;
}

.companion-feature-link {
  display: block;
  color: inherit;
}

.companion-feature-link:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.companion-feature h2,
.companion-reference h2 {
  margin: 0.35rem 0 0.55rem;
}

.companion-feature p {
  line-height: 1.58;
}

.companion-feature-primary {
  background:
    linear-gradient(145deg, rgba(255, 248, 235, 0.98), rgba(240, 231, 215, 0.95));
  border-color: rgba(54, 91, 72, 0.22);
}

.companion-feature-status {
  color: var(--muted);
  font-size: 0.95rem;
}

.companion-feature-cta {
  display: inline-flex;
  align-items: center;
  margin-top: 1rem;
  margin-bottom: 0;
  color: var(--forest);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.companion-feature-cta::after {
  content: ">";
  margin-left: 0.5rem;
  font-size: 0.9em;
}

.companion-reference,
.companion-reference-page {
  display: grid;
  gap: 0.9rem;
  scroll-margin-top: 1rem;
}

.companion-reference-reader-page.page {
  width: 100%;
  max-width: none;
  min-height: min(78vh, 60rem);
  padding: 1.2rem 1.35rem;
  display: flex;
  flex-direction: column;
}

.companion-reference-reader-page .companion-reference-detail-header {
  margin-bottom: 1.25rem;
}

.companion-reference-page .search,
.companion-reference-sidebar-search {
  margin-bottom: 0;
}

.companion-reference-sidebar-shell {
  display: grid;
  gap: 0.9rem;
}

.companion-reference-sidebar-links {
  display: grid;
  gap: 0.55rem;
}

.companion-reference-sidebar-links .action-link {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

.companion-reference-sidebar-status {
  font-size: 0.92rem;
}

.companion-reference-sidebar-head {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  justify-content: space-between;
}

.companion-reference-sidebar-heading {
  margin: 0;
}

.companion-reference-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.companion-reference-page-toolbar,
.companion-reference-toolbar {
  display: flex;
  gap: 1rem;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
}

.companion-reference-search-wrap {
  flex: 1 1 22rem;
}

.companion-reference-search {
  width: 100%;
}

.companion-reference-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.companion-reference-reader-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(17rem, 22rem) minmax(0, 1fr);
  align-items: stretch;
}

.companion-reference-layout {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: minmax(14rem, 0.95fr) minmax(16rem, 1.1fr) minmax(0, 1.85fr);
  align-items: start;
}

.companion-reference-panel {
  min-width: 0;
  padding: 1rem;
  border: 1px solid rgba(92, 64, 38, 0.12);
  border-radius: 1rem;
  background: rgba(255, 250, 242, 0.82);
}

.companion-reference-reader-sidebar,
.companion-reference-reader-main {
  display: flex;
  flex-direction: column;
  min-height: min(72vh, 54rem);
  max-height: min(72vh, 54rem);
}

.companion-reference-reader-main {
  overflow: hidden;
}

.companion-reference-panel h2,
.companion-reference-panel h3,
.companion-reference-detail-header h3,
.companion-reference-detail-body h4 {
  margin: 0;
  font-size: 1.1rem;
}

.companion-reference-panel-head {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.companion-reference-panel-meta,
.companion-reference-meta,
.companion-reference-snippet,
.companion-reference-empty-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.companion-reference-list {
  display: grid;
  gap: 0.55rem;
  max-height: 34rem;
  overflow: auto;
  padding-right: 0.15rem;
}

.companion-reference-sidebar-list {
  gap: 0.12rem;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.companion-reference-reader-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.companion-reference-item {
  display: block;
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(92, 64, 38, 0.12);
  border-radius: 0.9rem;
  background: rgba(255, 250, 242, 0.94);
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.companion-reference-item:hover {
  background: rgba(248, 241, 229, 0.98);
}

.companion-reference-item:focus-visible {
  outline: 2px solid rgba(54, 91, 72, 0.36);
  outline-offset: 2px;
}

.companion-reference-item.is-active {
  border-color: rgba(54, 91, 72, 0.24);
  background: rgba(232, 240, 234, 0.88);
  box-shadow: inset 0 0 0 1px rgba(54, 91, 72, 0.08);
}

.sidebar .companion-reference-item {
  padding: 0.48rem 0.2rem 0.48rem 0.7rem;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.sidebar .companion-reference-item:hover,
.sidebar .companion-reference-item.is-active {
  background: rgba(139, 60, 36, 0.08);
  border-left-color: rgba(54, 91, 72, 0.4);
  color: var(--ink);
  box-shadow: none;
}

.companion-reference-item-title {
  display: block;
  font-weight: 700;
  line-height: 1.35;
}

.sidebar .companion-reference-item-title {
  font-size: 0.95rem;
}

.companion-reference-item-subtitle {
  display: -webkit-box;
  margin-top: 0.22rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.sidebar .companion-reference-item-subtitle {
  color: inherit;
  font-size: 0.84rem;
  opacity: 0.86;
  -webkit-line-clamp: 2;
}

.companion-reference-item-count {
  display: inline-block;
  margin-top: 0.45rem;
  color: var(--forest);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar .companion-reference-item-count {
  margin-top: 0.22rem;
  color: inherit;
  font-size: 0.72rem;
  opacity: 0.72;
}

.companion-reference-section {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.24rem 0.62rem;
  border-radius: 999px;
  background: rgba(54, 91, 72, 0.12);
  color: var(--forest);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.companion-reference-detail {
  min-height: 34rem;
}

.companion-reference-detail-header {
  display: grid;
  gap: 0.55rem;
  padding-bottom: 0.95rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(92, 64, 38, 0.12);
}

.companion-reference-reader-tabs {
  display: flex;
  gap: 0.45rem;
  align-items: end;
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(92, 64, 38, 0.12);
}

.companion-reference-reader-tab {
  display: inline-block;
  padding: 0.42rem 0.8rem;
  border-radius: 0.75rem 0.75rem 0 0;
  background: rgba(92, 64, 38, 0.12);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
}

.companion-reference-reader-tab.is-active {
  background: rgba(47, 36, 27, 0.92);
  color: #fffaf2;
}

.companion-reference-detail-body {
  display: grid;
  gap: 1.1rem;
}

.companion-reference-reader-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 0.25rem;
  align-content: start;
}

.companion-reference-detail-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.companion-reference-detail-section {
  display: grid;
  gap: 0.5rem;
}

.companion-reference-detail-section + .companion-reference-detail-section {
  padding-top: 1rem;
  border-top: 1px solid rgba(92, 64, 38, 0.1);
}

.companion-reference-detail-copy {
  color: var(--ink);
  line-height: 1.65;
}

.companion-reference-detail-copy p {
  margin: 0 0 0.85rem;
}

.companion-reference-detail-copy p:last-child {
  margin-bottom: 0;
}

.companion-reference-empty {
  margin: 0;
  padding: 1rem;
  border: 1px dashed rgba(92, 64, 38, 0.18);
  border-radius: 0.9rem;
  background: rgba(255, 250, 242, 0.52);
}

.sidebar .companion-reference-empty {
  padding: 0.75rem 0.8rem;
  background: rgba(255, 250, 242, 0.38);
}

.companion-reference-empty h4 {
  margin: 0 0 0.35rem;
}

.companion-reference-anchor-reset {
  color: inherit;
  text-decoration: none;
}

.companion-reference-anchor-reset:hover {
  text-decoration: none;
}

.jpenotes-page {
  display: grid;
  gap: 1.2rem;
}

.jpenotes-panel {
  padding: 1rem;
  border: 1px solid rgba(92, 64, 38, 0.14);
  border-radius: 0.75rem;
  background: rgba(255, 250, 242, 0.9);
}

.jpenotes-section-heading {
  margin-bottom: 1rem;
}

.jpenotes-section-heading h2 {
  margin: 0.25rem 0 0;
  font-size: 1.35rem;
}

.jpenotes-source-note {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.jpenotes-form {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.jpenotes-score-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.jpenotes-wide-field {
  grid-column: 1 / -1;
}

.jpenotes-compact-area {
  min-height: 5.5rem;
}

.jpenotes-stat-grid,
.jpenotes-chart-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.jpenotes-stat,
.jpenotes-chart-card,
.jpenotes-entry {
  border: 1px solid rgba(92, 64, 38, 0.14);
  border-radius: 0.65rem;
  background: rgba(255, 250, 242, 0.94);
}

.jpenotes-stat {
  padding: 0.85rem;
}

.jpenotes-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.jpenotes-stat strong {
  display: block;
  margin-top: 0.35rem;
  color: var(--navy);
  font-size: 1.45rem;
  line-height: 1.1;
}

.jpenotes-chart-grid {
  margin-top: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
}

.jpenotes-chart-card {
  padding: 0.9rem;
  overflow: hidden;
}

.jpenotes-chart-card h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.jpenotes-chart {
  display: block;
  width: 100%;
  height: auto;
}

.jpenotes-chart-axis {
  stroke: rgba(92, 64, 38, 0.24);
  stroke-width: 1.5;
}

.jpenotes-chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.jpenotes-chart-line-derek {
  stroke: #b23a2f;
}

.jpenotes-chart-line-justin {
  stroke: #1f5d91;
}

.jpenotes-chart-legend-derek,
.jpenotes-chart-legend-justin {
  stroke-linecap: round;
  stroke-width: 4;
}

.jpenotes-chart-legend-derek {
  stroke: #b23a2f;
}

.jpenotes-chart-legend-justin {
  stroke: #1f5d91;
}

.jpenotes-chart-points circle {
  stroke: var(--paper);
  stroke-width: 2;
}

.jpenotes-chart-points-derek circle {
  fill: #b23a2f;
}

.jpenotes-chart-points-justin circle {
  fill: #1f5d91;
}

.jpenotes-chart-bar {
  fill: rgba(49, 77, 103, 0.76);
}

.jpenotes-chart-label,
.jpenotes-chart-title {
  fill: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.82rem;
}

.jpenotes-chart-title {
  fill: var(--ink);
  font-weight: 700;
}

.jpenotes-chart-label-inbar {
  fill: var(--paper);
  font-weight: 700;
}

.jpenotes-chart-label-end {
  text-anchor: end;
}

.jpenotes-chart-empty {
  padding: 1rem;
  color: var(--muted);
  line-height: 1.5;
}

.jpenotes-insights {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
}

.jpenotes-insights p {
  margin: 0;
  padding: 0.7rem 0.8rem;
  border-left: 4px solid var(--accent-soft);
  border-radius: 0.45rem;
  background: rgba(126, 161, 141, 0.12);
  line-height: 1.45;
}

.jpenotes-entry-list {
  display: grid;
  gap: 0.85rem;
}

.jpenotes-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(92, 64, 38, 0.14);
  border-radius: 0.65rem;
  background: rgba(255, 250, 242, 0.94);
}

.jpenotes-data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 48rem;
}

.jpenotes-data-table th,
.jpenotes-data-table td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid rgba(92, 64, 38, 0.12);
  text-align: left;
  vertical-align: top;
}

.jpenotes-data-table th {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.jpenotes-data-table td {
  font-size: 0.95rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.jpenotes-data-table tr:last-child td {
  border-bottom: 0;
}

.jpenotes-entry {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 0.95rem;
  overflow-wrap: anywhere;
}

.jpenotes-entry h3 {
  margin: 0.2rem 0 0.35rem;
  font-size: 1.15rem;
}

.jpenotes-entry-date,
.jpenotes-entry-meta,
.jpenotes-entry-value,
.jpenotes-entry-notes {
  margin: 0 0 0.55rem;
}

.jpenotes-entry-date,
.jpenotes-entry-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.jpenotes-entry-meta span::before {
  content: "/";
  margin: 0 0.35rem;
  color: rgba(92, 64, 38, 0.36);
}

.jpenotes-entry-notes {
  line-height: 1.55;
  white-space: pre-wrap;
}

.jpenotes-source-row {
  margin: 0.7rem 0 0;
  max-height: 12rem;
  overflow: auto;
  padding: 0.75rem;
  border-radius: 0.55rem;
  background: rgba(47, 36, 27, 0.08);
  color: var(--ink);
  font-family: "Courier New", monospace;
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}

.jpenotes-delete-form {
  align-self: start;
  margin: 0;
}

.jpenotes-delete-button {
  background: rgba(139, 60, 36, 0.92);
}

.jpenotes-delete-button:hover {
  background: rgba(139, 60, 36, 1);
}

@media (max-width: 900px) {
  .breadcrumbs {
    padding-right: 5rem;
  }

  .page-body p > img:only-child,
  .page-body p > img:last-child {
    max-width: 100%;
  }

  .homepage-hero-media img {
    height: clamp(21rem, 68vw, 30rem);
  }

  .site-bridge-overlay {
    width: auto;
  }

  .companion-reference-reader-page.page {
    padding: 1rem;
  }

  .companion-reference-reader-layout {
    grid-template-columns: 1fr;
  }

  .companion-reference-reader-sidebar,
  .companion-reference-reader-main {
    min-height: 0;
    max-height: none;
  }

  .companion-reference-reader-list {
    max-height: 20rem;
  }

  .companion-reference-reader-body {
    overflow: visible;
    padding-right: 0;
  }

  .companion-reference-layout {
    grid-template-columns: 1fr;
  }

  .companion-reference-list,
  .companion-reference-detail {
    max-height: none;
    min-height: 0;
  }

  .jpenotes-form,
  .jpenotes-score-form,
  .jpenotes-entry {
    grid-template-columns: 1fr;
  }

  .jpenotes-delete-form {
    justify-self: start;
  }
}

@media (max-width: 680px) {
  .homepage-hero-media img {
    height: 25rem;
  }

  .site-bridge-overlay {
    left: 0.85rem;
    right: 0.85rem;
    bottom: 0.85rem;
    padding: 0.9rem;
    width: auto;
  }

  .site-bridge-switch {
    width: 100%;
  }

  .site-bridge-tab {
    flex: 1 1 50%;
  }
}
