:root {
  --bg: #efe2c8;
  --bg-deep: #d9c39a;
  --panel: rgba(252, 247, 237, 0.92);
  --panel-strong: rgba(255, 250, 242, 0.98);
  --panel-dark: rgba(57, 24, 19, 0.9);
  --text: #2d1f18;
  --muted: #6e5a48;
  --line: rgba(90, 59, 33, 0.16);
  --line-strong: rgba(141, 103, 35, 0.34);
  --accent: #7b1e1c;
  --accent-deep: #4e100f;
  --gold: #b48a36;
  --gold-soft: #d6bc79;
  --olive: #556245;
  --success: #2d6f4a;
  --shadow: 0 26px 56px rgba(61, 35, 17, 0.16);
  --shadow-strong: 0 34px 70px rgba(50, 23, 14, 0.22);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(180, 138, 54, 0.2), transparent 24%),
    radial-gradient(circle at top right, rgba(123, 30, 28, 0.16), transparent 20%),
    linear-gradient(180deg, #f5ebd7 0%, #efe2c8 43%, #e0cbab 100%);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    repeating-linear-gradient(
      120deg,
      rgba(101, 72, 42, 0.035) 0,
      rgba(101, 72, 42, 0.035) 2px,
      transparent 2px,
      transparent 22px
    );
  opacity: 0.45;
}

body::after {
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 248, 233, 0.65), transparent 22%),
    radial-gradient(circle at 80% 12%, rgba(212, 187, 128, 0.16), transparent 22%);
}

button,
input,
a {
  font: inherit;
}

a {
  color: var(--accent);
}

.page-shell {
  width: min(1880px, calc(100vw - 44px));
  margin: 24px auto 40px;
  position: relative;
  z-index: 1;
}

.panel {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 252, 245, 0.95), rgba(248, 241, 229, 0.92)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 249, 237, 0.55);
  pointer-events: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 420px);
  gap: 30px;
  padding: 34px;
  margin-bottom: 24px;
  color: #f8ecda;
  background:
    linear-gradient(135deg, rgba(91, 20, 19, 0.98) 0%, rgba(58, 19, 16, 0.98) 58%, rgba(135, 95, 31, 0.88) 120%);
  border: 1px solid rgba(195, 155, 73, 0.28);
  box-shadow: var(--shadow-strong);
}

.hero::before {
  content: "SPQR";
  position: absolute;
  top: 24px;
  right: 28px;
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(4rem, 8vw, 8.8rem);
  letter-spacing: 0.16em;
  color: rgba(246, 228, 184, 0.08);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -52% auto;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(214, 188, 121, 0.22), transparent 54%),
    radial-gradient(circle, rgba(255, 245, 219, 0.12), transparent 68%);
  pointer-events: none;
}

.hero-copy,
.hero-card {
  position: relative;
  z-index: 1;
}

.eyebrow,
.detail-kicker {
  margin: 0 0 12px;
  color: rgba(247, 232, 204, 0.82);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  font-weight: 700;
}

.hero h1,
.hero-card h2,
.section-heading h2,
.detail-panel h2,
.detail-body-wrapper h3,
.detail-snippet-section h3,
.stats-card strong {
  font-family: "Cinzel", Georgia, serif;
}

.hero h1 {
  margin: 0;
  max-width: 11ch;
  font-size: clamp(2.6rem, 5vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: 0.02em;
}

.hero-text {
  margin: 18px 0 0;
  max-width: 68ch;
  line-height: 1.75;
  color: rgba(247, 237, 219, 0.86);
  font-size: 1rem;
}

.hero-quote {
  margin: 18px 0 0;
  max-width: 40rem;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  font-style: italic;
  color: rgba(245, 229, 191, 0.88);
  line-height: 1.4;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
}

.hero-card {
  align-self: stretch;
  padding: 22px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 248, 234, 0.98), rgba(246, 234, 212, 0.92));
  border: 1px solid rgba(195, 155, 73, 0.32);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 252, 246, 0.75);
}

.hero-card h2 {
  margin: 0;
  font-size: 2rem;
  color: var(--accent-deep);
}

.hero-card-copy {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.chip-button,
.quick-view-button,
.ghost-button,
.primary-button,
.list-button,
.result-card {
  appearance: none;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.chip-button,
.quick-view-button,
.ghost-button,
.list-button,
.result-card {
  background: rgba(255, 251, 244, 0.94);
  color: var(--text);
}

.chip-button:hover,
.quick-view-button:hover,
.ghost-button:hover,
.primary-button:hover,
.list-button:hover,
.result-card:hover {
  transform: translateY(-2px);
}

.chip-button,
.quick-view-button {
  padding: 13px 14px;
  border: 1px solid rgba(122, 87, 48, 0.14);
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
  font-weight: 600;
}

.chip-button {
  background:
    linear-gradient(180deg, rgba(255, 250, 243, 0.96), rgba(244, 232, 208, 0.96));
}

.chip-button.is-active,
.quick-view-button.is-active,
.list-button.is-active {
  background:
    linear-gradient(180deg, rgba(123, 30, 28, 0.98), rgba(78, 16, 15, 0.98));
  color: #fff2df;
  border-color: rgba(214, 188, 121, 0.3);
  box-shadow: 0 14px 28px rgba(78, 16, 15, 0.24);
}

.primary-button,
.ghost-button {
  border-radius: 999px;
  padding: 11px 17px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
}

.primary-button {
  background:
    linear-gradient(180deg, #d3ac58 0%, #a87924 100%);
  color: #2f1e0d;
  border-color: rgba(99, 69, 24, 0.36);
  box-shadow: 0 10px 20px rgba(90, 59, 33, 0.18);
}

.ghost-button {
  background: rgba(255, 249, 239, 0.88);
  border-color: rgba(90, 59, 33, 0.14);
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  border-radius: 999px;
  background: rgba(255, 245, 223, 0.12);
  border: 1px solid rgba(214, 188, 121, 0.26);
  color: #f8eddc;
  font-size: 0.94rem;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

.sync-pill::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold-soft);
  box-shadow: 0 0 0 0 rgba(214, 188, 121, 0.35);
}

.sync-pill.is-loading::before {
  animation: pulse 1.5s infinite;
}

.sync-pill.is-ready::before {
  background: #6fc38c;
}

.sync-pill.is-error::before {
  background: #ef8277;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(214, 188, 121, 0.4);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(214, 188, 121, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(214, 188, 121, 0);
  }
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 332px) minmax(0, 1fr) minmax(330px, 450px);
  gap: 20px;
  align-items: start;
}

.sidebar,
.main-column,
.detail-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.detail-column {
  position: relative;
}

.control-panel,
.quick-view-panel,
.source-panel,
.stats-panel,
.handbook-panel,
.source-index-panel,
.detail-panel {
  padding: 20px;
}

.detail-panel {
  position: sticky;
  top: 20px;
}

.field-label,
.section-heading p,
.muted,
.result-submeta,
.result-snippet,
.detail-empty p,
.snippet-card p,
.stats-card p,
.hero-card-copy {
  color: var(--muted);
}

.field-label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.search-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(122, 87, 48, 0.18);
  border-radius: 16px;
  background: rgba(255, 251, 244, 0.98);
  color: var(--text);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.search-input:focus {
  border-color: rgba(123, 30, 28, 0.36);
  box-shadow:
    0 0 0 4px rgba(123, 30, 28, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.toggle-stack {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.toggle-row {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.95rem;
}

.toggle-row input {
  accent-color: var(--accent);
}

.quick-view-list {
  display: grid;
  gap: 10px;
}

.quick-view-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quick-view-button small {
  color: inherit;
  opacity: 0.7;
  text-align: right;
}

.board-nav {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 280px);
  overflow: auto;
  padding-right: 4px;
}

.board-nav::-webkit-scrollbar,
.detail-body::-webkit-scrollbar {
  width: 10px;
}

.board-nav::-webkit-scrollbar-thumb,
.detail-body::-webkit-scrollbar-thumb {
  background: rgba(122, 87, 48, 0.24);
  border-radius: 999px;
}

.board-group {
  border: 1px solid rgba(122, 87, 48, 0.12);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.96), rgba(245, 236, 220, 0.96));
  overflow: hidden;
}

.board-group summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 15px 16px;
  font-weight: 700;
}

.board-group summary::-webkit-details-marker {
  display: none;
}

.board-group summary span:first-child {
  font-family: "Cinzel", Georgia, serif;
  color: var(--accent-deep);
}

.board-group summary span:last-child {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
}

.list-stack {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.list-button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(122, 87, 48, 0.1);
  border-radius: 14px;
  padding: 11px 12px;
  cursor: pointer;
  text-align: left;
}

.list-button small {
  color: inherit;
  opacity: 0.72;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stats-card {
  padding: 18px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 249, 240, 0.98), rgba(244, 232, 208, 0.94));
  border: 1px solid rgba(122, 87, 48, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.stats-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.stats-card strong {
  display: block;
  font-size: clamp(1.7rem, 2vw, 2.35rem);
  line-height: 1;
  color: var(--accent-deep);
}

.stats-card p {
  margin: 10px 0 0;
  font-size: 0.94rem;
  line-height: 1.58;
}

.results-topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.results-topbar h2,
.detail-panel h2 {
  margin: 0;
  font-size: clamp(2rem, 2.7vw, 2.7rem);
  line-height: 1;
  color: var(--accent-deep);
}

.result-list {
  display: grid;
  gap: 12px;
}

.result-card {
  width: 100%;
  padding: 17px 18px 18px;
  border: 1px solid rgba(122, 87, 48, 0.12);
  border-left: 4px solid rgba(180, 138, 54, 0.4);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 251, 244, 0.98), rgba(246, 237, 223, 0.96));
  cursor: pointer;
  text-align: left;
  box-shadow: 0 8px 20px rgba(79, 49, 22, 0.05);
}

.result-card.is-selected {
  border-color: rgba(123, 30, 28, 0.26);
  border-left-color: var(--accent);
  box-shadow: 0 18px 34px rgba(95, 35, 19, 0.14);
}

.result-headline {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.result-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.45;
}

.result-submeta {
  margin-top: 8px;
  font-size: 0.9rem;
}

.badge-row,
.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(123, 30, 28, 0.09);
  color: var(--accent-deep);
  font-size: 0.81rem;
  font-weight: 700;
  border: 1px solid rgba(123, 30, 28, 0.08);
}

.badge.is-soft {
  background: rgba(122, 87, 48, 0.08);
  color: var(--muted);
  border-color: rgba(122, 87, 48, 0.08);
}

.badge.is-live {
  background: rgba(85, 98, 69, 0.12);
  color: #31482a;
  border: 1px solid rgba(85, 98, 69, 0.12);
}

.result-snippet {
  margin: 12px 0 0;
  line-height: 1.62;
  font-size: 0.96rem;
}

.result-footer {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.detail-empty {
  padding: 28px 12px;
  text-align: center;
}

.detail-empty p {
  line-height: 1.7;
}

.detail-card {
  display: grid;
  gap: 18px;
}

.detail-header {
  display: grid;
  gap: 14px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-snippet-section,
.detail-body-wrapper {
  display: grid;
  gap: 12px;
}

.snippet-list {
  display: grid;
  gap: 10px;
}

.snippet-card {
  padding: 14px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(251, 243, 227, 0.98), rgba(243, 232, 211, 0.96));
  border: 1px solid rgba(122, 87, 48, 0.12);
}

.snippet-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.snippet-card p {
  margin: 0;
  line-height: 1.65;
}

.detail-body {
  padding: 18px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 251, 245, 0.98), rgba(244, 236, 223, 0.96));
  border: 1px solid rgba(122, 87, 48, 0.12);
  max-height: calc(100vh - 290px);
  overflow: auto;
  line-height: 1.74;
}

.detail-body h1,
.detail-body h2,
.detail-body h3,
.detail-body h4 {
  margin: 1.2em 0 0.42em;
  line-height: 1.08;
  font-family: "Cinzel", Georgia, serif;
  color: var(--accent-deep);
}

.detail-body h1 {
  font-size: 2rem;
}

.detail-body h2 {
  font-size: 1.62rem;
}

.detail-body h3 {
  font-size: 1.32rem;
}

.detail-body p,
.detail-body li,
.detail-body blockquote {
  color: var(--text);
}

.detail-body p {
  margin: 0 0 0.9em;
}

.detail-body ul,
.detail-body ol {
  margin: 0.6em 0 1em 1.3em;
  padding: 0;
}

.detail-body li {
  margin: 0.28em 0;
}

.detail-body hr {
  border: none;
  height: 1px;
  background: rgba(122, 87, 48, 0.18);
  margin: 1.2em 0;
}

.detail-body blockquote {
  margin: 1em 0;
  padding: 0.25em 0 0.25em 1em;
  border-left: 3px solid rgba(180, 138, 54, 0.52);
  color: var(--muted);
  background: rgba(180, 138, 54, 0.06);
}

.detail-body code {
  font-family: "IBM Plex Sans", monospace;
  background: rgba(122, 87, 48, 0.08);
  padding: 0.12em 0.38em;
  border-radius: 6px;
}

.detail-body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.7rem;
  color: var(--accent-deep);
}

.section-heading p {
  margin: 6px 0 0;
  line-height: 1.58;
}

.hero-card-kicker,
.guide-kicker,
.source-board-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  font-weight: 700;
}

.source-board-list {
  display: grid;
  gap: 14px;
}

.source-board-card {
  padding: 16px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(245, 236, 220, 0.96));
  border: 1px solid rgba(122, 87, 48, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  border-left: 5px solid rgba(180, 138, 54, 0.65);
}

.source-board-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.source-board-head h3 {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.3rem;
  color: var(--accent-deep);
}

.source-board-copy {
  margin: 10px 0 0;
  line-height: 1.62;
  color: var(--muted);
}

.source-board-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.source-board-metrics div {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 248, 236, 0.92);
  border: 1px solid rgba(122, 87, 48, 0.08);
}

.source-board-metrics strong {
  display: block;
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.15rem;
  color: var(--accent-deep);
}

.source-board-metrics span {
  display: block;
  margin-top: 4px;
  font-size: 0.84rem;
  color: var(--muted);
}

.source-board-link {
  padding: 9px 14px;
  white-space: nowrap;
}

.guide-sections {
  display: grid;
  gap: 18px;
}

.guide-empty {
  padding: 24px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 251, 244, 0.98), rgba(246, 237, 223, 0.96));
  border: 1px solid rgba(122, 87, 48, 0.12);
}

.guide-empty h3 {
  margin: 0 0 10px;
  font-family: "Cinzel", Georgia, serif;
  color: var(--accent-deep);
}

.guide-empty p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.guide-section {
  padding: 20px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 251, 244, 0.98), rgba(244, 234, 216, 0.96));
  border: 1px solid rgba(122, 87, 48, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.guide-section-brief {
  background:
    linear-gradient(135deg, rgba(92, 22, 20, 0.98), rgba(62, 18, 17, 0.96) 58%, rgba(133, 92, 30, 0.92));
  border-color: rgba(195, 155, 73, 0.24);
  color: #f7ecd6;
}

.guide-section-brief .guide-kicker,
.guide-section-brief .guide-section-copy p:last-child {
  color: rgba(245, 229, 193, 0.85);
}

.guide-section-brief .guide-section-copy h3 {
  color: #fff3df;
}

.guide-section-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.guide-section-copy h3 {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(1.5rem, 2vw, 1.95rem);
  color: var(--accent-deep);
}

.guide-section-copy p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.guide-count {
  min-width: 140px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 246, 225, 0.96);
  border: 1px solid rgba(180, 138, 54, 0.18);
  text-align: center;
}

.guide-count strong {
  display: block;
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.6rem;
  color: var(--accent-deep);
}

.guide-count span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.guide-article-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.brief-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.brief-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 247, 228, 0.08);
  border: 1px solid rgba(214, 188, 121, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 248, 230, 0.12);
}

.brief-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  margin-bottom: 12px;
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  color: #fff2dc;
  background: rgba(214, 188, 121, 0.18);
  border: 1px solid rgba(214, 188, 121, 0.26);
}

.brief-card p {
  margin: 0;
  line-height: 1.72;
  color: #f5e8d1;
}

.manual-card {
  padding: 18px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 249, 238, 0.98), rgba(243, 231, 208, 0.96));
  border: 1px solid rgba(122, 87, 48, 0.12);
  box-shadow: 0 10px 22px rgba(79, 49, 22, 0.06);
}

.manual-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.manual-card-type {
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.manual-card h4 {
  margin: 14px 0 10px;
  font-size: 1.1rem;
  line-height: 1.4;
}

.manual-card-intro {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.manual-step-list {
  margin: 14px 0 0 1.25rem;
  padding: 0;
  color: var(--text);
  line-height: 1.7;
}

.manual-step-list li {
  margin: 0.4rem 0;
}

.manual-source-list {
  margin-top: 16px;
}

.manual-source-list strong {
  display: block;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.manual-source-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.manual-source-button {
  appearance: none;
  border: 1px solid rgba(122, 87, 48, 0.14);
  border-radius: 999px;
  background: rgba(255, 251, 244, 0.98);
  color: var(--accent-deep);
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.manual-source-button:hover {
  transform: translateY(-2px);
  border-color: rgba(123, 30, 28, 0.22);
}

.guide-article-card,
.source-row {
  width: 100%;
  border: 1px solid rgba(122, 87, 48, 0.12);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 251, 244, 0.98), rgba(246, 237, 223, 0.96));
  cursor: pointer;
  text-align: left;
  box-shadow: 0 8px 20px rgba(79, 49, 22, 0.05);
}

.guide-article-card {
  padding: 18px 18px 20px;
  border-left: 5px solid rgba(180, 138, 54, 0.58);
}

.guide-article-card.is-selected,
.source-row.is-selected {
  border-color: rgba(123, 30, 28, 0.26);
  box-shadow: 0 18px 34px rgba(95, 35, 19, 0.14);
}

.guide-article-top,
.source-row-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.guide-article-type {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(180, 138, 54, 0.14);
  color: #6b4c14;
  font-size: 0.8rem;
  font-weight: 700;
}

.guide-article-meta,
.source-row-meta {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.guide-article-card h4 {
  margin: 14px 0 10px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.42rem;
  line-height: 1.15;
  color: var(--accent-deep);
}

.guide-article-summary,
.source-row-snippet {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.95rem;
}

.guide-article-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(122, 87, 48, 0.12);
}

.guide-article-footer .badge-row {
  margin-top: 0;
}

.guide-article-action {
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.guide-section-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.source-list {
  display: grid;
  gap: 10px;
}

.source-row {
  padding: 15px 16px;
}

.source-row-empty {
  cursor: default;
}

.source-row-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.45;
}

.source-row-snippet {
  margin-top: 10px;
}

@media (max-width: 1380px) {
  .workspace {
    grid-template-columns: minmax(260px, 310px) minmax(0, 1fr);
  }

  .detail-column {
    grid-column: 1 / -1;
  }

  .detail-panel {
    position: static;
  }

  .detail-body {
    max-height: none;
  }
}

@media (max-width: 1024px) {
  .page-shell {
    width: min(100vw - 22px, 100%);
    margin: 12px auto 30px;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 24px;
  }

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

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .guide-article-grid,
  .manual-grid,
  .source-board-metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .chip-grid,
  .stats-grid,
  .brief-grid,
  .guide-article-grid,
  .manual-grid,
  .source-board-metrics {
    grid-template-columns: 1fr;
  }

  .results-topbar,
  .hero-actions,
  .detail-actions,
  .guide-section-header,
  .guide-article-footer,
  .source-row-top {
    flex-direction: column;
    align-items: stretch;
  }
}
