@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-v20-latin-regular.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter-v20-latin-600.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/inter-v20-latin-700.woff2") format("woff2");
}
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/playfair-display-v40-latin-regular.woff2") format("woff2");
}
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/playfair-display-v40-latin-700.woff2") format("woff2");
}
@font-face {
  font-family: "Playfair Display";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/playfair-display-v40-latin-italic.woff2") format("woff2");
}

:root {
  --brand-matcha: #b4a64b;
  --brand-velvet: #591e2a;
  --brand-monarch: #d2682b;
  --brand-pink-silk: #d6a6b1;
  --brand-moss: #464719;
  --brand-cornflower: #98a8d9;

  --surface: #ffffff;
  --surface-muted: #faf8f5;
  --border-soft: #e8e4dd;
  --ink: #2f2c26;
  --ink-muted: #8a857a;
}

/* :root[data-theme] outranks Pico's :root:not([data-theme=dark]) token block */
:root[data-theme="light"] {
  --pico-font-family: "Inter", system-ui, sans-serif;
  --pico-primary: var(--brand-velvet);
  --pico-primary-background: var(--brand-velvet);
  --pico-primary-border: var(--brand-velvet);
  --pico-primary-hover: var(--brand-monarch);
  --pico-primary-hover-background: var(--brand-monarch);
  --pico-primary-hover-border: var(--brand-monarch);
  --pico-primary-underline: var(--brand-velvet);
  --pico-primary-focus: rgba(89, 30, 42, 0.25);
  --pico-border-radius: 0.5rem;
}

body {
  background: var(--surface-muted);
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Playfair Display", Georgia, serif;
}

.muted {
  color: var(--pico-muted-color);
}

/* ---------- Public pages ---------- */

.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
}

.public-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.public-main {
  max-width: 62rem;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--brand-velvet);
  white-space: nowrap;
}

.brand-name {
  font-weight: 600;
}

.hero {
  padding: 2rem 0 1rem;
}

.hero h1 {
  font-size: 2.75rem;
  line-height: 1.15;
  max-width: 30ch;
}

.hero-lead {
  max-width: 60ch;
  font-size: 1.1rem;
}

.login-card {
  max-width: 26rem;
  margin: 3rem auto;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 1rem;
  padding: 2rem;
}

/* ---------- App shell ---------- */

.app-shell {
  display: grid;
  grid-template-columns: 15rem 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar .brand {
  padding: 0.25rem 0.75rem 0.75rem;
}

.sidebar-heading {
  margin: 1rem 0 0.35rem;
  padding: 0 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* explicit resets: Pico's own nav spacing rules would skew the layout */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch; /* Pico's nav align-items:center would center the items */
}

.sidebar-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: stretch; /* Pico centers nav ul items */
  gap: 2px;
  margin: 0;
  padding: 0;
}

.sidebar-nav li {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  margin: 0;
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-radius: 0.6rem;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
}

.sidebar-nav li a:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.sidebar-nav li a.active {
  background: #f0eee0;
  color: var(--brand-moss);
  font-weight: 600;
}

.sidebar-nav li a[class*="module-"]::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
}

.sidebar-nav li a.module-collecting::before { background: var(--brand-matcha); }
.sidebar-nav li a.module-analyzing::before { background: var(--brand-cornflower); }
.sidebar-nav li a.module-storytelling::before { background: var(--brand-monarch); }
.sidebar-nav li a.module-futuring::before { background: var(--brand-velvet); }

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
}

.topbar-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-actions form {
  margin: 0;
}

.topbar-actions button {
  margin: 0;
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
  width: auto;
}

.topbar-user {
  font-weight: 600;
  font-size: 0.9rem;
}

.app-content {
  padding: 2rem;
  max-width: 72rem;
  width: 100%;
}

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .sidebar .brand {
    padding: 0 0.5rem 0 0;
  }
  .sidebar-heading {
    display: none;
  }
  .sidebar-nav,
  .sidebar-nav ul {
    flex-direction: row;
    align-items: center;
  }
  .sidebar-nav li a {
    white-space: nowrap;
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
  }
  .topbar {
    padding: 0.6rem 1rem;
  }
  .topbar-title {
    display: none;
  }
  .app-content {
    padding: 1rem;
  }
  .card {
    padding: 1rem;
    overflow-x: auto;
  }
  .public-header {
    padding: 0.75rem 1rem;
  }
  .public-main {
    padding: 1.5rem 1rem;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .page-title,
  .entry-header h1 {
    font-size: 1.5rem;
  }
  .meta-list {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .meta-list dt {
    margin-top: 0.5rem;
  }
  .filter-bar {
    grid-template-columns: 1fr;
  }
}

/* ---------- Cards, grids, tiles ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card h2 {
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.card h2 a {
  color: var(--ink);
  text-decoration: none;
}

.card h2 a:hover {
  color: var(--brand-velvet);
  text-decoration: underline;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.module-grid .card {
  margin-bottom: 0;
}

.module-card {
  border-top: 4px solid var(--border-soft);
}

.module-card h2 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.module-card.module-collecting { border-top-color: var(--brand-matcha); }
.module-card.module-analyzing { border-top-color: var(--brand-cornflower); }
.module-card.module-storytelling { border-top-color: var(--brand-monarch); }
.module-card.module-futuring { border-top-color: var(--brand-velvet); }

.module-card {
  display: flex;
  flex-direction: column;
}

.module-card p {
  flex: 1;
}

.module-card [role="button"] {
  width: auto;
  align-self: flex-start;
  margin-top: 0.5rem;
  margin-bottom: 0;
  --pico-background-color: transparent;
  --pico-color: var(--pico-contrast);
  --pico-border-color: var(--border-soft);
}

.module-card.module-collecting [role="button"] { --pico-color: var(--brand-moss); }
.module-card.module-analyzing [role="button"] { --pico-color: var(--brand-cornflower); }
.module-card.module-storytelling [role="button"] { --pico-color: var(--brand-monarch); }
.module-card.module-futuring [role="button"] { --pico-color: var(--brand-velvet); }

.module-card.module-collecting [role="button"]:hover { --pico-border-color: var(--brand-matcha); }
.module-card.module-analyzing [role="button"]:hover { --pico-border-color: var(--brand-cornflower); }
.module-card.module-storytelling [role="button"]:hover { --pico-border-color: var(--brand-monarch); }
.module-card.module-futuring [role="button"]:hover { --pico-border-color: var(--brand-velvet); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0;
}

.stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--pico-muted-color);
}

.stat-value {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
}

.stat-tile.module-collecting .stat-value { color: var(--brand-moss); }
.stat-tile.module-analyzing .stat-value { color: var(--brand-cornflower); }
.stat-tile.module-storytelling .stat-value { color: var(--brand-monarch); }
.stat-tile.module-futuring .stat-value { color: var(--brand-velvet); }

/* ---------- Page furniture ---------- */

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

.page-header [role="button"] {
  width: auto;
}

.page-title {
  font-size: 1.9rem;
  margin-bottom: 0.5rem;
}

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

.entry-header h1 {
  font-size: 1.9rem;
  margin-bottom: 0.35rem;
}

.entry-header [role="button"] {
  width: auto;
}

.entry-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0;
}

.module-nav {
  display: flex;
  justify-content: flex-start; /* Pico's nav default is space-between */
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-soft);
}

.module-nav a {
  padding: 0.5rem 0.9rem;
  text-decoration: none;
  color: var(--pico-muted-color);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.module-nav a:hover {
  color: var(--pico-color);
}

.module-nav a.active {
  color: var(--brand-velvet);
  border-bottom-color: var(--brand-velvet);
  font-weight: 600;
}

/* ---------- Badges & tags ---------- */

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.status-draft { background: #f0eee6; color: var(--brand-moss); }
.status-reviewed { background: #e7ecf9; color: #3d5087; }
.status-validated { background: #eef0da; color: var(--brand-moss); }
.status-archived { background: #eeeeee; color: #666666; }
.status-rejected { background: #f6e3d8; color: var(--brand-monarch); }

.tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: #f4e9ec;
  color: var(--brand-velvet);
}

/* ---------- Forms & misc ---------- */

.form-actions {
  display: flex;
  gap: 0.75rem;
}

.form-actions button,
.form-actions [role="button"] {
  width: auto;
}

.note {
  border-top: 1px solid var(--pico-muted-border-color);
  padding-top: 1rem;
  margin-top: 1rem;
}

.note-header {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  justify-content: space-between;
}

.note-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.note-actions form {
  margin: 0;
}

.note-actions button,
.note-actions [role="button"] {
  width: auto;
  margin: 0;
}

.filter-bar {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 0.75rem;
  align-items: start;
  margin-bottom: 1rem;
}

@media (max-width: 900px) {
  .filter-bar {
    grid-template-columns: 1fr 1fr;
  }
}

.filter-bar input,
.filter-bar select,
.filter-bar button {
  margin-bottom: 0;
}

.language-switcher {
  display: inline-flex;
  gap: 0.25rem;
  margin: 0;
}

.language-switcher .lang {
  width: auto;
  margin: 0;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--pico-muted-color);
}

.language-switcher .lang.current {
  background: var(--brand-velvet);
  border-color: var(--brand-velvet);
  color: #ffffff;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-soft);
  background: var(--surface);
}

.flash-success { border-color: var(--brand-matcha); background: #f7f5e8; }
.flash-error { border-color: var(--brand-monarch); background: #f9ede4; }

.comment {
  border-top: 1px solid var(--border-soft);
  padding: 0.75rem 0;
  margin: 0;
}

.comment header {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.25rem;
}

.comment p {
  margin: 0;
}

.meta-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1.5rem;
}

.meta-list dt {
  font-weight: 600;
}

.meta-list dd {
  margin: 0;
}

.pagination {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
}

textarea.markdown-editor {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.9rem;
}

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

.report-abstract {
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: 1.15rem;
}

/* ---------- Analyzing network ---------- */
.network-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
}

.network-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.9rem;
  cursor: pointer;
}

.network-legend-item input {
  width: auto;
  margin: 0;
}

.network-swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
}

.network-swatch-signal { background: var(--brand-matcha); }
.network-swatch-driver { background: var(--brand-pink-silk); }
.network-swatch-trend { background: var(--brand-moss); }
.network-swatch-topic { background: var(--brand-cornflower); }
.network-swatch-competency { background: var(--brand-velvet); }
.network-swatch-field { background: var(--brand-monarch); }

.network-canvas {
  height: 70vh;
  min-height: 420px;
  border: 1px solid var(--border-soft);
  border-radius: var(--pico-border-radius);
  background: var(--surface-muted);
}

.network-empty {
  padding: 2rem 0;
  text-align: center;
}

/* ---------- Trend board ---------- */

.kanban-board {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 1rem;
}

.kanban-column {
  flex: 0 0 17rem;
  display: flex;
  flex-direction: column;
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  border-top: 4px solid var(--border-soft);
  border-radius: var(--pico-border-radius);
}

.kanban-column.module-analyzing {
  border-top-color: var(--brand-cornflower);
}

.kanban-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border-soft);
}

.kanban-column-head h2 {
  font-size: 1rem;
  margin: 0;
}

.kanban-count {
  flex: none;
  min-width: 1.6rem;
  padding: 0.1rem 0.5rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--pico-muted-color);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
}

.kanban-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  min-height: 4rem;
  flex: 1;
}

.kanban-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.6rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--pico-border-radius);
  cursor: grab;
  box-shadow: 0 1px 2px rgba(47, 44, 38, 0.05);
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card-title {
  font-weight: 500;
  text-decoration: none;
  color: var(--pico-color);
}

.kanban-card-title:hover {
  text-decoration: underline;
}

.sortable-ghost {
  opacity: 0.4;
}

.sortable-drag {
  box-shadow: 0 6px 16px rgba(47, 44, 38, 0.18);
}

.strength-badge {
  align-self: flex-start;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.strength-weak { background: #f0eee6; color: var(--brand-moss); }
.strength-strong { background: #eef0da; color: var(--brand-moss); }
