:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-soft: #f1f3f5;
  --panel-wash: #fafbfb;
  --sidebar-bg: #f6f7f8;
  --sidebar-active: #e5e9ee;
  --sidebar-hover: #eef1f5;
  --ink: #17202b;
  --muted: #596371;
  --faint: #818a96;
  --line: #e5e7eb;
  --line-strong: #cbd5e1;
  --accent: #1f2937;
  --accent-dark: #111827;
  --accent-soft: #eef1f5;
  --focus-ring: rgba(31, 41, 55, 0.16);
  --amber: #9a6a18;
  --rose: #a4495d;
  --blue: #366b9f;
  --green: #34735a;
  --shadow: 0 18px 42px rgba(31, 41, 55, 0.08);
  --shadow-soft: 0 1px 2px rgba(31, 41, 55, 0.05), 0 22px 54px rgba(31, 41, 55, 0.06);
  --radius: 14px;
  --sidebar-width: 248px;
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --mobile-dock-bottom: calc(30px + var(--safe-area-bottom));
  --mobile-home-dock-bottom: calc(22px + var(--safe-area-bottom));
  --mobile-dock-clearance: calc(132px + var(--safe-area-bottom));
  --mobile-workspace-dock-clearance: calc(118px + var(--safe-area-bottom));
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: ui-serif, Georgia, "Times New Roman", serif;
}


* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: 0;
  -webkit-text-size-adjust: 100%;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

@supports (min-height: 100dvh) {
  .app-shell {
    min-height: 100dvh;
  }
}

.sidebar {
  position: fixed;
  z-index: 10;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  height: 100vh;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  color: var(--ink);
  padding: 12px 8px;
  scrollbar-color: #b9bfbd transparent;
  scrollbar-width: thin;
}

.brand-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  padding: 0 3px;
}

.brand-home {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.brand-home:hover,
.brand-home:focus-visible {
  outline: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-weight: 820;
  font-size: 12px;
}

.brand-copy {
  min-width: 0;
}

.brand-row h1 {
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar .brand-row p {
  overflow: hidden;
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-icon-button {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.sidebar-icon-button:hover,
.sidebar-icon-button:focus-visible {
  background: var(--sidebar-hover);
  color: var(--ink);
  outline: 0;
}

.sidebar-icon-button svg,
.sidebar-search svg,
.nav-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.sidebar-search {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--muted);
  padding: 0 8px;
}

.sidebar-search:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.08);
}

.sidebar-search input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.sidebar-search input::placeholder {
  color: #7b817e;
  opacity: 1;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
  line-height: 1.2;
}

.hidden {
  display: none !important;
}

.brand-row p,
.reader-meta,
.reader-path,
.list-toolbar p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--line);
}

.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  background: var(--panel);
}

.stat strong {
  display: block;
  font-size: 20px;
  line-height: 1;
}

.stat span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.workspace-nav {
  display: grid;
  gap: 16px;
  padding: 14px 0 0;
  border-bottom: 0;
}

.nav-group {
  display: grid;
  gap: 3px;
}

.nav-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 9px;
  text-align: left;
}

.nav-item span {
  overflow: hidden;
  color: currentColor;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item small {
  display: none;
}

.nav-chevron {
  width: 15px;
  height: 15px;
  color: currentColor;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform 180ms ease;
}

.nav-icon {
  justify-self: center;
  color: currentColor;
  opacity: 0.88;
}

.nav-item.active,
.nav-item:hover {
  background: var(--sidebar-active);
  color: var(--ink);
}

.nav-item:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.25);
  outline-offset: 2px;
}

.nav-section-label {
  margin: 0 0 6px;
  padding: 0 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0;
  text-transform: none;
}

.nav-tree {
  display: grid;
  gap: 3px;
}

.nav-tree > .nav-item {
  grid-template-columns: 22px minmax(0, 1fr) 16px;
}

.nav-tree.expanded .nav-chevron {
  transform: rotate(90deg);
}

.nav-children {
  position: relative;
  display: grid;
  gap: 1px;
  margin: 1px 0 6px 20px;
  padding: 0 0 0 15px;
}

.nav-tree.collapsed .nav-children {
  display: none;
}

.nav-child-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  width: 100%;
  min-height: 27px;
  border-radius: 8px;
}

.nav-child-row:hover,
.nav-child-row.menu-open {
  background: var(--panel-soft);
}

.nav-child {
  display: block;
  min-width: 0;
  width: 100%;
  min-height: 27px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #66717f;
  cursor: pointer;
  padding: 0 8px 0 13px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 300;
  line-height: 27px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-child:hover {
  background: transparent;
  color: #566171;
}

.nav-child-row.active .nav-child {
  color: #566171;
  font-weight: 300;
}

.nav-child-create-row .nav-child {
  display: grid;
  grid-template-columns: 15px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  color: #66717f;
  font-weight: 300;
  line-height: 1;
}

.nav-child-create-row .nav-child-icon {
  width: 15px;
  height: 15px;
}

.nav-child-more {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #7a8492;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
}

.nav-child-row:hover .nav-child-more,
.nav-child-row.active .nav-child-more,
.nav-child-row.menu-open .nav-child-more {
  opacity: 1;
  pointer-events: auto;
}

.nav-child-more:hover,
.nav-child-more:focus-visible {
  background: #e5e7eb;
  color: var(--accent-dark);
}

.nav-child-more svg {
  width: 16px;
  height: 16px;
}

.nav-child-menu {
  position: absolute;
  z-index: 40;
  top: 27px;
  right: 0;
  display: grid;
  min-width: 112px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  padding: 4px;
  box-shadow: 0 14px 30px rgba(31, 41, 55, 0.12);
}

.nav-child-menu[hidden] {
  display: none;
}

.nav-child-menu button {
  min-height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
  padding: 0 8px;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

.nav-child-menu button:hover,
.nav-child-menu button:focus-visible {
  background: var(--panel-soft);
  color: var(--accent-dark);
}

.strong-nav-children {
  margin-left: 0;
  padding-left: 0;
}

.strong-nav-children .nav-child-row {
  min-height: 32px;
}

.strong-nav-children .nav-child {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 32px;
  color: var(--muted);
  padding: 0 9px;
  font-size: 13px;
  font-weight: 650;
  line-height: 32px;
}

.strong-nav-children .nav-child:hover,
.strong-nav-children .nav-child-row.active .nav-child {
  color: var(--accent-dark);
}

.nav-child-icon {
  justify-self: center;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  opacity: 0.88;
}

.mobile-system-parent {
  display: none;
}

.folder-tree {
  padding: 8px 0 18px;
}

.archive-folder-block {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.folder-node {
  margin: 1px 0;
}

.folder-button {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 5px 7px;
  text-align: left;
}

.folder-button:hover,
.folder-button.active {
  background: #e7efed;
}

.folder-button .chev {
  color: var(--faint);
  font-size: 12px;
}

.folder-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.folder-count {
  color: var(--faint);
  font-size: 11px;
}

.folder-children {
  margin-left: 15px;
  border-left: 1px solid var(--line);
  padding-left: 6px;
}

.workspace {
  grid-column: 2;
  min-width: 0;
  padding: 0;
}

.workbench-topbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  padding: 10px 16px;
  box-shadow: none;
}

.workbench-topbar h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.workbench-topbar p:last-child {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.system-label {
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.page-view {
  padding: 8px;
}

.planned-page-shell {
  display: grid;
  gap: 10px;
}

.planned-hero {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  padding: 22px 24px;
}

.planned-hero h2 {
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.18;
}

.planned-hero p:last-child {
  max-width: 760px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.planned-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 8px;
}

.planned-card {
  min-height: 146px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  padding: 17px 18px;
}

.planned-card span {
  display: block;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 720;
  line-height: 1.4;
}

.planned-card h3 {
  margin: 12px 0 8px;
  font-size: 17px;
  line-height: 1.25;
}

.planned-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.58;
}

.creation-queue-shell {
  display: grid;
  gap: 12px;
}

.creation-queue-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
  padding: 18px 20px;
}

.creation-queue-header h2 {
  margin-top: 3px;
  font-size: 24px;
  line-height: 1.15;
}

.creation-queue-header p:last-child {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.creation-queue-filters {
  border: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
  padding: 10px 14px 0;
}

.creation-queue-list {
  display: grid;
  gap: 8px;
}

.creation-queue-card {
  display: grid;
  gap: 7px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  cursor: pointer;
  padding: 14px 16px;
  text-align: left;
}

.creation-queue-card:hover,
.creation-queue-card.active {
  background: #f0f7f5;
}

.creation-queue-card strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.3;
}

.home-shell {
  display: grid;
  gap: 18px;
  min-height: calc(100vh - 56px);
}

.home-tabs {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--sidebar-bg);
  padding: 3px;
}

.home-tab {
  min-width: 92px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 650;
}

.home-tab:hover,
.home-tab:focus-visible {
  background: var(--panel-soft);
  color: var(--accent-dark);
}

.home-tab.active {
  background: var(--accent);
  color: #ffffff;
}

.home-today {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: calc(100vh - 116px);
}

.home-main-column {
  display: flex;
  min-width: 0;
  width: min(900px, 100%);
  min-height: auto;
  margin-inline: auto;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: 0 0 16px;
}

.home-live-feed {
  position: static;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 440px) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: min(900px, 100%);
  align-self: center;
  justify-self: center;
  padding: 0;
  color: var(--muted);
}

.home-live-feed-head {
  display: flex;
  align-items: center;
  gap: 7px;
  justify-self: end;
  margin-bottom: 0;
  white-space: nowrap;
}

.home-live-feed-head span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #2f6f57;
  box-shadow: 0 0 0 4px rgba(47, 111, 87, 0.12);
}

.home-live-feed-head p {
  margin: 0;
  color: #4b5563;
  font-size: 12px;
  font-weight: 720;
}

.home-live-feed-window {
  grid-column: 2;
  overflow: hidden;
  height: 32px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 28%, #000 72%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 28%, #000 72%, transparent 100%);
}

.home-live-feed ol {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  animation: homeActivityScroll 18s infinite;
}

.home-live-feed li {
  display: grid;
  height: 32px;
  grid-template-columns: 10px minmax(0, max-content);
  justify-content: center;
  gap: 8px;
  align-items: center;
}

.home-activity-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #9aa3af;
}

.home-live-feed p {
  overflow: hidden;
  margin: 0;
  color: #4f5a68;
  font-size: 13px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-live-feed time {
  display: none;
}

@keyframes homeActivityScroll {
  0%,
  14% {
    transform: translateY(0);
  }
  20%,
  34% {
    transform: translateY(-32px);
  }
  40%,
  54% {
    transform: translateY(-64px);
  }
  60%,
  74% {
    transform: translateY(-96px);
  }
  80%,
  94% {
    transform: translateY(-128px);
  }
  100% {
    transform: translateY(0);
  }
}

.home-continue {
  display: grid;
  gap: 14px;
}

.home-section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.home-section-title h2 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 16px;
  font-weight: 760;
}

.home-section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.home-work-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr)) minmax(76px, 88px);
  gap: 8px;
  overflow-x: auto;
  padding: 1px 1px 4px;
  scrollbar-color: #cbd5e1 transparent;
  scrollbar-width: thin;
}

.home-work-card {
  display: grid;
  min-height: 118px;
  align-content: space-between;
  gap: 12px;
  border: 1px solid rgba(203, 213, 225, 0.76);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  padding: 14px;
}

.home-work-card-top {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
}

.home-work-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #eef1f5;
  color: #1f2937;
}

.home-work-icon.document,
.home-work-icon.noetex {
  background: linear-gradient(145deg, #1f2937, #475569);
  color: #ffffff;
}

.home-work-icon.resonance {
  background: radial-gradient(circle at 45% 35%, #5f7c8f 0%, #17202b 54%, #070a0f 100%);
  color: #d9e3ee;
}

.home-work-icon.brain {
  background: #e8ecf1;
  color: #1f2937;
}

.home-work-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.home-work-icon span {
  font-size: 20px;
  font-weight: 560;
  line-height: 1;
}

.home-work-card h3 {
  overflow: hidden;
  margin: 0;
  color: #1f2937;
  font-size: 13px;
  font-weight: 720;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-work-card-top span {
  color: #596371;
  font-size: 13px;
}

.home-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  overflow: visible;
  height: auto;
  border-radius: 0;
  background: transparent;
}

.home-progress::before {
  content: "";
  grid-column: 1;
  grid-row: 1;
  height: 5px;
  border-radius: 999px;
  background: #e5e7eb;
}

.home-progress span {
  display: block;
  grid-column: 1;
  grid-row: 1;
  height: 5px;
  border-radius: 999px;
  background: #1f2937;
}

.home-progress strong {
  color: #5b6471;
  font-size: 13px;
  font-weight: 680;
  white-space: nowrap;
}

.home-work-card-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  color: #687385;
  font-size: 13px;
}

.home-work-card-foot strong {
  color: #374151;
  font-size: 11px;
}

.home-work-create {
  display: grid;
  min-height: 118px;
  place-items: center;
  align-content: center;
  gap: 14px;
  border: 0;
  border-radius: 12px;
  background: rgba(241, 243, 245, 0.72);
  color: #596371;
  cursor: pointer;
  padding: 16px 12px;
  text-align: center;
}

.home-work-create:hover,
.home-work-create:focus-visible {
  background: #ffffff;
  color: var(--accent-dark);
  box-shadow: inset 0 0 0 1px #d7dde5;
}

.home-work-create svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.home-work-create span {
  font-size: 13px;
  font-weight: 650;
}

/*
  Kept for older markup safety. Current progress uses a pseudo-track above.
*/
.home-progress.legacy {
  overflow: hidden;
  height: 4px;
  border-radius: 999px;
  background: #e5e7eb;
}

.home-progress.legacy span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #1f2937;
}

.home-intent-panel {
  display: grid;
  width: 100%;
  justify-self: center;
  gap: 14px;
  padding: 10px 0 0;
}

.home-intent-copy {
  display: grid;
  gap: 7px;
  text-align: center;
}

.home-intent-copy h1 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 27px;
  font-weight: 780;
  line-height: 1.2;
}

.home-intent-copy p {
  max-width: 560px;
  margin: 0 auto;
  color: #4f5a68;
  font-size: 14px;
  line-height: 1.55;
}

.home-intent-card {
  display: grid;
  width: 100%;
  gap: 8px;
  border: 1px solid rgba(203, 213, 225, 0.82);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  padding: 10px;
  box-shadow: 0 1px 2px rgba(31, 41, 55, 0.04);
}

.home-intent-card:focus-within {
  border-color: #c8d0da;
  box-shadow: 0 0 0 3px rgba(31, 41, 55, 0.055);
}

.home-intent-input {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
  justify-self: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  padding: 2px 3px 7px 8px;
}

.home-intent-input:focus-within {
  box-shadow: none;
}

.home-intent-input input {
  min-width: 0;
  min-height: 40px;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-size: 14px;
  background: transparent;
}

.home-intent-input input::placeholder {
  color: #596371;
}

.home-send-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
}

.home-send-button:hover,
.home-send-button:focus-visible {
  background: var(--accent-dark);
}

.home-send-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
}

.home-intent-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-top: 1px solid #edf0f3;
  padding-top: 8px;
}

.home-intent-tools {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
}

.home-tool-button,
.home-model-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  border: 1px solid #dfe4ea;
  border-radius: 10px;
  background: #ffffff;
  color: #445061;
  cursor: pointer;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 650;
}

.home-model-switch {
  border-color: transparent;
  background: #f1f3f5;
}

.home-tool-button:hover,
.home-tool-button:focus-visible,
.home-model-switch:hover,
.home-model-switch:focus-visible {
  border-color: #ccd4df;
  background: #ffffff;
  color: var(--accent-dark);
}

.home-tool-button svg,
.home-model-switch svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.home-action-chip,
.home-recent-intent {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #f6f7f8;
  color: #394453;
  cursor: pointer;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 650;
}

.home-action-chip svg,
.home-recent-intent svg,
.home-recent-next svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.home-action-chip:hover,
.home-action-chip:focus-visible,
.home-recent-intent:hover,
.home-recent-intent:focus-visible {
  border-color: #d1d7df;
  background: #ffffff;
  color: var(--accent-dark);
}

.home-recent {
  display: grid;
  gap: 8px;
  padding: 0 4px;
}

.home-recent > p {
  margin: 0;
  color: #596371;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
}

.home-recent > div {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-color: #cbd5e1 transparent;
  scrollbar-width: thin;
}

.home-recent-intent {
  flex: 0 0 auto;
  min-width: 188px;
  justify-content: flex-start;
  border-color: transparent;
  background: rgba(241, 243, 245, 0.86);
  color: #596371;
  font-weight: 620;
}

.home-recent-next {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #dfe4ea;
  border-radius: 999px;
  background: #ffffff;
  color: #596371;
  cursor: pointer;
}

.home-recent-next:hover,
.home-recent-next:focus-visible {
  color: var(--accent-dark);
  border-color: #cdd5df;
}

.home-discovery {
  display: grid;
  max-width: 840px;
  gap: 14px;
  padding: 36px 0 20px;
}

.home-discovery-head {
  display: grid;
  gap: 6px;
}

.home-discovery-head h1 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 24px;
  font-weight: 780;
}

.home-discovery-head p {
  max-width: 620px;
  margin: 0;
  color: #4f5a68;
  font-size: 14px;
  line-height: 1.55;
}

.home-discovery-list {
  display: grid;
  gap: 8px;
}

.home-discovery-item {
  display: grid;
  gap: 7px;
  border: 1px solid rgba(203, 213, 225, 0.72);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
  padding: 14px 16px;
}

.home-discovery-item > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #6b7280;
  font-size: 12px;
}

.home-discovery-item span {
  color: #374151;
  font-weight: 700;
}

.home-discovery-item h2 {
  margin: 0;
  color: #1f2937;
  font-size: 15px;
  font-weight: 760;
  line-height: 1.35;
}

.home-discovery-item p {
  margin: 0;
  color: #4f5a68;
  font-size: 13px;
  line-height: 1.55;
}

@media (max-width: 1500px) {
  .home-today {
    gap: 18px;
  }

  .home-main-column {
    width: min(900px, 100%);
    padding-top: 14px;
  }

  .home-live-feed {
    width: min(620px, 100%);
    padding-top: 4px;
  }
}

.article-topbar {
  min-height: 62px;
}

.article-topbar {
  flex-wrap: nowrap;
}

.top-identity-group {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.top-article-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.top-title-line {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
}

.top-title-line h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-path {
  flex: 0 1 auto;
  max-width: 260px;
  min-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-editable-title {
  flex: 0 1 auto;
  max-width: min(420px, 40vw);
  min-width: 180px;
  overflow: hidden;
  border-radius: 7px;
  padding: 3px 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-editable-title:hover,
.top-editable-title:focus-visible {
  background: var(--panel);
  outline: 1px solid var(--line-strong);
}

.top-editable-title:empty::before {
  color: var(--faint);
  content: "未命名草稿";
}

.top-article-subtitle {
  overflow: hidden;
  max-width: 760px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-state {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  padding: 0 8px;
  font-size: 12px;
  line-height: 24px;
  white-space: nowrap;
}

.saved-state:hover,
.saved-state:focus-visible {
  background: var(--panel-soft);
  color: var(--ink);
}

.article-actions {
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  flex: 0 0 auto;
}

.publish-menu-wrap {
  position: relative;
}

.publish-button {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 720;
}

.publish-button:hover,
.publish-button:focus-visible {
  background: #111827;
  outline: 0;
}

.publish-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.publish-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #ffffff;
  padding: 5px;
  box-shadow: 0 10px 26px rgba(31, 41, 55, 0.14);
}

.publish-menu.open {
  display: grid;
}

.publish-menu button {
  display: flex;
  align-items: center;
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 0 10px;
  text-align: left;
  font-size: 13px;
}

.publish-menu button:hover,
.publish-menu button:focus-visible {
  background: var(--panel-soft);
  outline: 0;
}

.header-icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.header-icon-button:hover,
.header-icon-button:focus-visible {
  background: #eef4f2;
  color: var(--ink);
}

.header-icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.article-actions .text-button:not(.primary) {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.article-actions .text-button:not(.primary):hover {
  border-color: transparent;
  background: #eef4f2;
  color: var(--ink);
}

.top-title-line .icon-button,
.editor-shell-header > .text-button,
.evidence-drawer .text-button {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.top-title-line .icon-button:hover,
.editor-shell-header > .text-button:hover,
.evidence-drawer .text-button:hover {
  border-color: transparent;
  background: #eef4f2;
  color: var(--ink);
}

.comment-count {
  min-width: 32px;
  padding: 0 8px;
}

.primary-icon {
  border-color: transparent;
  background: transparent;
  color: var(--accent-dark);
}

.primary-icon:hover {
  background: #eef4f2;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(294px, 314px);
  gap: 8px;
  align-items: start;
}

.workspace-left-panel {
  display: grid;
  min-width: 0;
}

.workspace-panel,
.workspace-editor-panel,
.workspace-inspector-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: none;
}

.workspace-panel {
  overflow: hidden;
}

.context-panel > .panel-header,
.workspace-inspector-panel > .inspector-header {
  display: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 12px 13px;
}

.panel-header h2 {
  margin-top: 3px;
  font-size: 16px;
  line-height: 1.2;
}

.compact {
  min-height: 30px;
  font-size: 12px;
}

.icon-button.compact {
  width: 32px;
  height: 30px;
}

.context-switch {
  display: flex;
  gap: 18px;
  align-items: flex-end;
  padding: 9px 12px 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.context-switch button {
  min-height: 29px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0 7px;
  font-size: 12px;
  font-weight: 650;
}

.context-switch button.active {
  border-bottom-color: var(--accent);
  background: transparent;
  color: var(--accent-dark);
}

.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
  padding: 9px 12px 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.segmented-control button {
  min-height: 27px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0 7px;
  font-size: 12px;
}

.segmented-control button.active {
  border-bottom-color: var(--accent);
  background: transparent;
  color: var(--accent-dark);
  font-weight: 700;
}

.workspace-draft-list,
.source-list {
  display: grid;
  max-height: calc(100vh - 230px);
  overflow: auto;
}

.workspace-draft-row,
.source-row {
  display: grid;
  gap: 6px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 10px 12px;
  text-align: left;
}

.workspace-draft-row:hover,
.workspace-draft-row.active,
.source-row:hover,
.source-row.active {
  background: #f0f7f5;
}

.draft-row-top,
.draft-row-meta,
.source-row-head,
.source-row-meta,
.evidence-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  color: var(--faint);
  font-size: 11px;
}

.workspace-draft-row strong,
.source-row strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.draft-subtitle,
.source-row > span:not(.source-row-head):not(.source-row-meta) {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.source-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
  padding: 9px 12px 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.source-toolbar .text-button {
  min-height: 27px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 0 7px;
  font-size: 12px;
}

.source-toolbar .text-button:hover {
  border-color: transparent;
  border-bottom-color: var(--line-strong);
}

.source-toolbar .text-button.selected {
  border-color: transparent;
  border-bottom-color: var(--accent);
  background: transparent;
  color: var(--accent-dark);
}

.source-toolbar #addSourceButton {
  margin-left: auto;
  color: var(--accent-dark);
}

.source-type {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 0 7px;
  background: #e7f0fb;
  color: var(--blue);
  font-size: 11px;
  font-weight: 750;
}

.source-type.paper {
  background: #e7f0fb;
  color: var(--blue);
}

.source-type.report {
  background: #fbefd9;
  color: var(--amber);
}

.source-type.podcast {
  background: #e3f1ea;
  color: var(--green);
}

.source-type.url,
.source-type.note {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.workspace-editor-panel {
  min-height: calc(100vh - 78px);
  overflow: hidden;
}

.editor-shell-header {
  display: none;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding: 11px 15px 10px;
}

.editor-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.editor-title-row h2 {
  font-size: 18px;
  line-height: 1.25;
}

.collab-stack {
  display: flex;
  align-items: center;
}

.collab-stack span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-left: -6px;
  border: 2px solid var(--panel);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 760;
}

.collab-stack span:nth-child(2) {
  background: var(--accent);
}

.collab-stack span:nth-child(3) {
  background: var(--blue);
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 4px 12px;
}

.editor-toolbar button {
  min-height: 28px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 8px;
  font-size: 12px;
}

.editor-toolbar button:hover {
  background: #eef4f2;
  color: var(--ink);
}

.editor-canvas {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 126px);
  overflow: auto;
  padding: 14px 32px 22px;
  background: #fff;
}

.editor-document {
  max-width: 880px;
  width: 100%;
  min-height: 488px;
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #1c2623;
  padding: 18px 8px 12px;
  box-shadow: none;
  outline: 0;
}

.editor-document h1 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 32px;
  line-height: 1.18;
}

.editor-document h2 {
  margin: 1.7em 0 0.55em;
  font-size: 22px;
}

.editor-document p {
  margin: 0.95em 0;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.8;
}

.editor-document .deck {
  color: var(--muted);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
}

.inline-source-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #e7f0fb;
  color: var(--blue);
  cursor: pointer;
  padding: 2px 8px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  vertical-align: 1px;
}

.editor-highlight {
  border-radius: 3px;
  background: rgba(255, 213, 97, 0.48);
  padding: 1px 2px;
}

.comment-marker {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 800;
  vertical-align: text-bottom;
}

.evidence-drawer {
  display: grid;
  gap: 9px;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: var(--radius);
  background: #fbfffe;
  padding: 13px 14px;
}

.evidence-drawer header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.evidence-drawer header strong {
  flex: 1;
  font-size: 13px;
}

.evidence-drawer p {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}

.workspace-inspector-panel {
  position: sticky;
  top: 8px;
  max-height: calc(100vh - 78px);
  overflow: auto;
  background: #fbfcfc;
}

.workspace-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 9px 12px 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.workspace-tab {
  min-height: 29px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0 7px;
  font-size: 12px;
  white-space: nowrap;
}

.workspace-tab:nth-child(5) {
  grid-column: auto;
}

.workspace-tab.active {
  border-bottom-color: var(--accent);
  background: transparent;
  color: var(--accent-dark);
  font-weight: 700;
}

.workspace-inspector-body {
  display: grid;
  gap: 8px;
  padding: 10px 10px 12px;
}

.inspector-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 10px;
}

.inspector-card h3 {
  margin: 0;
  font-size: 14px;
}

.inspector-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.task-grid.single {
  grid-template-columns: 1fr;
}

.quote-box {
  border: 1px solid #efd9ad;
  border-radius: 7px;
  background: #fff9ed;
  color: #5b4220;
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.55;
}

.comment-list,
.highlight-list,
.related-list {
  display: grid;
  gap: 8px;
}

.comment-card {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfc;
  padding: 10px;
}

.comment-card header,
.card-title-row,
.publish-preview-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.comment-card header strong,
.source-detail-title {
  font-size: 13px;
}

.comment-card header span,
.publish-preview-card header span {
  color: var(--amber);
  font-size: 11px;
  font-weight: 700;
}

.highlight-list button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfc;
  color: var(--ink);
  cursor: pointer;
  min-height: auto;
  padding: 8px 9px;
  text-align: left;
  line-height: 1.45;
}

.highlight-list button:hover {
  border-color: var(--line-strong);
}

.annotation-note {
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 7px;
  background: #f2f8f6;
  padding: 8px 9px;
}

.article-info-card label,
.inspector-card label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.article-info-card input,
.article-info-card textarea,
.inspector-card input,
.inspector-card textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfc;
  color: var(--ink);
  padding: 8px 9px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.article-info-card textarea,
.inspector-card textarea {
  min-height: 74px;
  resize: vertical;
}

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

.chip-block,
.related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.info-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
}

.info-chip.keyword,
.info-chip.muted {
  background: var(--panel-soft);
  color: var(--muted);
}

.status-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-flow span {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 11px;
}

.status-flow span.active {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
}

.publish-channel-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.publish-channel-tabs button {
  display: inline-grid;
  gap: 2px;
  height: auto;
  min-height: 37px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0 7px;
  text-align: left;
}

.publish-channel-tabs button.active {
  border-bottom-color: var(--accent);
  background: transparent;
  color: var(--accent-dark);
}

.publish-channel-tabs strong {
  color: var(--ink);
  font-size: 12px;
}

.publish-channel-tabs span {
  color: var(--faint);
  font-size: 11px;
}

.publish-preview-card {
  border-color: rgba(46, 110, 168, 0.28);
  background: #fbfdff;
}

.publish-preview-card h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.search-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
}

.search-box {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  background: var(--panel);
  padding: 0 12px;
  box-shadow: inset 0 0 0 1px rgba(31, 41, 55, 0.06);
}

.search-box:focus-within {
  box-shadow: inset 0 0 0 1px rgba(31, 41, 55, 0.14), 0 0 0 3px rgba(31, 41, 55, 0.055);
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-box svg {
  color: var(--muted);
}

.search-box input {
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-size: 15px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

select,
.text-button,
.icon-button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  min-height: 34px;
}

select {
  padding: 0 30px 0 10px;
  color: var(--muted);
}

.text-button {
  padding: 0 12px;
  cursor: pointer;
}

.text-button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.text-button:hover,
.icon-button:hover {
  border-color: var(--line-strong);
}

.text-button.selected {
  border-color: rgba(15, 118, 110, 0.35);
  background: #e4f2ef;
  color: var(--accent-dark);
}

.workbench-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 12px;
  margin-bottom: 16px;
}

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 8px;
}

.pipeline-card {
  min-width: 0;
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  padding: 10px;
  text-align: left;
}

.pipeline-card:hover {
  box-shadow: 0 8px 18px rgba(31, 41, 55, 0.07);
}

.pipeline-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.pipeline-card strong {
  display: block;
  margin: 4px 0 7px;
  font-size: 25px;
  line-height: 1;
}

.pipeline-card ul {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pipeline-card li {
  overflow: hidden;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-card.blue {
  border-color: rgba(46, 110, 168, 0.28);
  background: #f7fbff;
}

.pipeline-card.amber {
  border-color: rgba(183, 121, 31, 0.3);
  background: #fffbf3;
}

.pipeline-card.teal {
  border-color: rgba(15, 118, 110, 0.28);
  background: #f6fbfa;
}

.pipeline-card.rose {
  border-color: rgba(184, 74, 98, 0.28);
  background: #fff8fa;
}

.pipeline-card.green {
  border-color: rgba(49, 119, 91, 0.28);
  background: #f6fbf8;
}

.connector-strip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfc;
  padding: 12px;
}

.connector-strip h2 {
  font-size: 14px;
}

.connector-strip p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.connector-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.connector-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.connector-item strong {
  color: var(--amber);
  font-weight: 650;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 34px;
  cursor: pointer;
  text-decoration: none;
}

.icon-button.disabled {
  opacity: 0.36;
  pointer-events: none;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr) minmax(280px, 330px);
  gap: 16px;
  align-items: start;
}

.document-list-panel,
.reader-panel,
.inspector-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.document-list-panel {
  overflow: hidden;
}

.list-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.list-toolbar h2,
.reader-header h2 {
  font-size: 18px;
  line-height: 1.25;
}

.document-list {
  max-height: calc(100vh - 230px);
  overflow: auto;
}

.doc-row {
  display: grid;
  gap: 7px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 13px 16px;
  text-align: left;
  cursor: pointer;
}

.doc-row:hover,
.doc-row.active {
  background: #f0f7f5;
}

.doc-row h3 {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 680;
  line-height: 1.35;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 0 7px;
  background: var(--panel-soft);
  color: var(--muted);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.stage-badge.blue {
  background: #e7f0fb;
  color: var(--blue);
}

.stage-badge.amber {
  background: #fbefd9;
  color: var(--amber);
}

.stage-badge.teal {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.stage-badge.rose {
  background: #fae8ec;
  color: var(--rose);
}

.stage-badge.green {
  background: #e3f1ea;
  color: var(--green);
}

.doc-row p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.doc-path {
  overflow: hidden;
  color: var(--faint);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 0 7px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
}

.badge.annotation {
  background: #e4f2ef;
  color: var(--accent-dark);
}

.badge.deletion {
  background: #fae8ec;
  color: var(--rose);
}

.badge.media {
  background: #e7f0fb;
  color: var(--blue);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}

.reader-panel {
  min-height: calc(100vh - 96px);
  overflow: hidden;
}

.reader-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.reader-path {
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-meta {
  margin-top: 7px;
}

.reader-actions {
  display: flex;
  gap: 7px;
}

.reader-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfc;
  color: var(--muted);
  font-size: 13px;
}

.reader-controls label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.reader-body,
.marks-panel {
  height: calc(100vh - 352px);
  overflow: auto;
  padding: 24px 34px 48px;
}

.inspector-panel {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fbfcfc;
}

.inspector-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.inspector-header h2 {
  margin-top: 3px;
  font-size: 18px;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
}

.selected-doc-card {
  display: grid;
  gap: 8px;
  margin: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px;
}

.selected-doc-card strong {
  font-size: 14px;
  line-height: 1.35;
}

.selected-doc-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.selected-doc-title {
  display: grid;
  gap: 7px;
}

.doc-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.doc-metrics span {
  border-radius: 999px;
  background: var(--panel-soft);
  padding: 3px 7px;
}

.inspector-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 0 12px 12px;
}

.inspector-tab {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.inspector-tab.active {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 650;
}

.inspector-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 16px;
}

.empty-inspector,
.task-block,
.action-output {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px;
}

.empty-inspector strong,
.task-block h3,
.action-output strong {
  margin: 0;
  font-size: 14px;
}

.empty-inspector span,
.task-block p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.task-button {
  min-height: 34px;
  border: 1px solid rgba(15, 118, 110, 0.35);
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  cursor: pointer;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 650;
}

.task-button.muted {
  border-color: var(--line);
  background: #f3f5f5;
  color: var(--muted);
  cursor: default;
}

.checklist-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.checklist-row strong {
  color: var(--ink);
}

.action-output textarea {
  min-height: 160px;
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  line-height: 1.5;
  padding: 8px;
}

.reader-body .empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 360px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
  font-size: 18px;
}

.article-content {
  max-width: 820px;
  margin: 0 auto;
  color: #1d2623;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.article-content h1,
.article-content h2,
.article-content h3 {
  margin: 1.6em 0 0.55em;
  font-family: var(--font);
  line-height: 1.25;
}

.article-content h1 {
  font-size: 30px;
}

.article-content h2 {
  font-size: 24px;
}

.article-content h3 {
  font-size: 20px;
}

.article-content p {
  margin: 0.78em 0;
}

.article-content a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.article-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 18px auto;
  border-radius: 6px;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-family: var(--font);
  font-size: 14px;
}

.article-content td,
.article-content th {
  border: 1px solid var(--line);
  padding: 8px 10px;
  vertical-align: top;
}

.article-content annotation {
  border-bottom: 2px solid rgba(15, 118, 110, 0.4);
  background: rgba(15, 118, 110, 0.11);
  border-radius: 3px;
}

.article-content del {
  color: var(--rose);
  text-decoration-color: rgba(184, 74, 98, 0.65);
  background: rgba(184, 74, 98, 0.08);
}

.article-content .located-mark {
  outline: 3px solid rgba(183, 121, 31, 0.42);
  outline-offset: 3px;
  background: rgba(255, 214, 102, 0.32);
  transition: background 160ms ease, outline-color 160ms ease;
}

.article-content.hide-deleted del {
  display: none;
}

.article-content.hide-annotations annotation {
  border-bottom: 0;
  background: transparent;
}

.marks-panel {
  display: grid;
  align-content: start;
  gap: 10px;
}

.marks-panel.hidden,
.reader-body.hidden {
  display: none;
}

.mark-item {
  display: block;
  width: 100%;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 7px;
  background: #f6faf9;
  color: inherit;
  cursor: pointer;
  padding: 10px 12px;
  text-align: left;
}

.mark-item.deletion {
  border-color: rgba(184, 74, 98, 0.22);
  background: #fff7f9;
}

.mark-item:hover,
.mark-item:focus-visible {
  background: #edf7f4;
  outline: 2px solid rgba(15, 118, 110, 0.22);
  outline-offset: 0;
}

.mark-item.deletion:hover,
.mark-item.deletion:focus-visible {
  background: #fff0f4;
  outline-color: rgba(184, 74, 98, 0.2);
}

.mark-item strong {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.mark-item p {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}

.loading {
  padding: 18px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 10px 13px;
  box-shadow: var(--shadow);
  font-size: 13px;
}

/* Focus theme: quiet surfaces, light navigation, and a calmer writing stage. */
.sidebar {
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  color: var(--ink);
  padding: 18px 12px;
}

.brand-row {
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 10px;
  margin-bottom: 18px;
}

.brand-home {
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
}

.brand-row h1 {
  color: var(--ink);
  font-size: 16px;
}

.sidebar .brand-row p,
.sidebar .nav-section-label,
.folder-button .chev,
.folder-count {
  color: var(--faint);
}

.sidebar-icon-button,
.nav-item,
.folder-button {
  color: var(--muted);
}

.sidebar-icon-button:hover,
.sidebar-icon-button:focus-visible,
.nav-item.active,
.nav-item:hover,
.folder-button:hover,
.folder-button.active {
  background: var(--sidebar-hover);
  color: var(--ink);
}

.nav-item.active {
  background: var(--sidebar-active);
}

.sidebar-search {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--muted);
}

.sidebar-search:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(31, 41, 55, 0.08);
}

.sidebar-search input {
  color: var(--ink);
}

.sidebar-search input::placeholder {
  color: #7b817e;
}

.archive-folder-block,
.stat-strip,
.folder-children {
  border-color: var(--line);
}

.stat {
  border: 1px solid var(--line);
  background: var(--panel);
}

.stat strong {
  color: var(--ink);
}

.stat span {
  color: var(--muted);
}

.workspace {
  background: var(--bg);
}

.workbench-topbar {
  min-height: 76px;
  border-bottom: 0;
  background: #ffffff;
  padding: 16px 24px 12px;
}

.article-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
}

.workbench-topbar h2 {
  color: var(--accent-dark);
  font-size: 20px;
  font-weight: 760;
}

.workbench-topbar p:last-child,
.top-article-subtitle {
  color: var(--muted);
}

.system-label {
  color: #4b5563;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

.page-view {
  padding: 18px 24px 28px;
}

.workspace-grid {
  grid-template-columns: minmax(520px, 1fr) minmax(280px, 320px);
  gap: 18px;
}

.workspace-panel,
.workspace-editor-panel,
.workspace-inspector-panel,
.planned-hero,
.planned-card,
.document-list-panel,
.reader-panel,
.inspector-panel,
.connector-strip,
.pipeline-card,
.selected-doc-card,
.empty-inspector,
.task-block,
.action-output {
  border: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
}

.workspace-panel,
.workspace-inspector-panel {
  background: rgba(255, 255, 255, 0.82);
}

.workspace-editor-panel {
  min-height: calc(100vh - 112px);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(31, 41, 55, 0.04), 0 28px 70px rgba(31, 41, 55, 0.07);
}

.context-switch,
.segmented-control,
.source-toolbar,
.workspace-tabs,
.editor-toolbar {
  border-bottom: 0;
  background: transparent;
}

.context-switch,
.segmented-control,
.source-toolbar {
  padding-inline: 16px;
}

.workspace-tabs {
  gap: 6px;
  padding: 12px;
}

.workspace-tab,
.context-switch button,
.segmented-control button,
.source-toolbar .text-button {
  border-bottom: 0;
  border-radius: 999px;
  color: var(--muted);
  padding: 0 10px;
}

.workspace-tab {
  min-height: 32px;
}

.workspace-tab.active,
.context-switch button.active,
.segmented-control button.active,
.source-toolbar .text-button.selected {
  background: var(--accent);
  color: #ffffff;
}

.workspace-draft-list,
.source-list {
  gap: 5px;
  padding: 9px;
}

.workspace-draft-row,
.source-row,
.doc-row {
  border-bottom: 0;
  border-radius: 12px;
  padding: 12px 14px;
}

.workspace-draft-row:hover,
.workspace-draft-row.active,
.source-row:hover,
.source-row.active,
.doc-row:hover,
.doc-row.active {
  background: var(--accent-soft);
}

.workspace-draft-row.active,
.source-row.active,
.doc-row.active {
  box-shadow: inset 0 0 0 1px rgba(31, 41, 55, 0.08), 0 8px 16px rgba(31, 41, 55, 0.04);
}

.editor-toolbar {
  gap: 6px;
  padding: 10px 18px 0;
}

.editor-toolbar button,
.article-actions .text-button:not(.primary),
.header-icon-button,
.saved-state,
.top-title-line .icon-button,
.editor-shell-header > .text-button,
.evidence-drawer .text-button {
  border-radius: 10px;
}

.editor-toolbar button:hover,
.article-actions .text-button:not(.primary):hover,
.header-icon-button:hover,
.header-icon-button:focus-visible,
.saved-state:hover,
.saved-state:focus-visible,
.top-title-line .icon-button:hover,
.editor-shell-header > .text-button:hover,
.evidence-drawer .text-button:hover {
  background: var(--accent-soft);
}

.editor-canvas {
  gap: 18px;
  max-height: calc(100vh - 154px);
  padding: 28px 58px 42px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfd 72%, #f7f8fa 100%);
}

.editor-document {
  max-width: 780px;
  min-height: 560px;
  padding: 18px 8px 26px;
  color: var(--ink);
}

.editor-document h1 {
  margin-bottom: 18px;
  color: #111827;
  font-size: 34px;
  font-weight: 720;
  letter-spacing: 0;
  text-wrap: balance;
}

.editor-document h2 {
  color: #1f2937;
  font-size: 23px;
  text-wrap: balance;
}

.editor-document p {
  max-width: 70ch;
  color: #202a36;
  font-size: 18px;
  line-height: 1.86;
  text-wrap: pretty;
}

.editor-document .deck {
  max-width: 60ch;
  color: #4b5563;
  font-size: 17px;
}

.evidence-drawer {
  max-width: 780px;
  border: 0;
  border-radius: 14px;
  background: #f5f7f9;
  padding: 16px 18px;
  box-shadow: inset 0 0 0 1px rgba(31, 41, 55, 0.04);
}

.workspace-inspector-panel {
  top: 18px;
  max-height: calc(100vh - 112px);
}

.workspace-inspector-body {
  gap: 10px;
  padding: 0 12px 14px;
}

.inspector-card,
.comment-card,
.highlight-list button,
.annotation-note,
.quote-box {
  border: 0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(31, 41, 55, 0.05);
}

.quote-box {
  background: #f7f4ed;
  color: #4a3a20;
}

select,
.text-button,
.icon-button {
  border-color: transparent;
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
}

.text-button.primary {
  border-color: var(--accent);
  background: var(--accent);
}

.text-button:hover,
.icon-button:hover {
  border-color: transparent;
  background: var(--accent-soft);
}

.text-button.selected,
.inspector-tab.active,
.task-button,
.status-dot,
.stage-badge.teal,
.badge.annotation,
.info-chip,
.status-flow span.active {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.inline-source-chip,
.source-type,
.source-type.paper,
.stage-badge.blue,
.badge.media {
  background: #edf3f8;
  color: #315f8b;
}

.stage-badge.amber,
.source-type.report {
  background: #f6eddc;
  color: var(--amber);
}

.stage-badge.rose,
.badge.deletion {
  background: #f7e9ed;
  color: var(--rose);
}

.stage-badge.green,
.source-type.podcast {
  background: #e8f2ed;
  color: var(--green);
}

.article-content {
  max-width: 760px;
}

.article-content h1,
.article-content h2,
.article-content h3 {
  text-wrap: balance;
}

.article-content p {
  text-wrap: pretty;
}

button,
.text-button,
.icon-button,
.nav-item,
.folder-button,
.workspace-draft-row,
.source-row,
.doc-row {
  transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.workspace-draft-row:hover,
.source-row:hover,
.doc-row:hover,
.pipeline-card:hover {
  transform: translateY(-1px);
}

button:focus-visible,
select:focus-visible,
[contenteditable="true"]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }

  .home-live-feed ol {
    transform: translateY(0) !important;
  }
}

/* Light navigation shell. */
.app-shell.sidebar-collapsed {
  --sidebar-width: 72px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  inset: 10px auto 10px 8px;
  width: calc(var(--sidebar-width) - 16px);
  height: calc(100vh - 20px);
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, 0.72);
  border-radius: 18px;
  background: var(--sidebar-bg);
  color: var(--ink);
  box-shadow: none;
}

.brand-row {
  grid-template-columns: minmax(0, 1fr) 32px;
  margin-bottom: 18px;
  padding: 0 2px;
}

.brand-home {
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
}

.brand-home:hover,
.brand-home:focus-visible {
  color: var(--accent-dark);
}

.brand-mark {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(31, 41, 55, 0.14);
}

.brand-row h1 {
  color: var(--ink);
  font-weight: 760;
}

.sidebar .brand-row p,
.sidebar .nav-section-label,
.folder-button .chev,
.folder-count,
.sidebar-icon-button,
.nav-item,
.folder-button {
  color: var(--muted);
}

.sidebar-icon-button {
  border-radius: 10px;
  color: #8b95a3;
}

.sidebar-icon-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.7;
}

.sidebar-icon-button:hover,
.sidebar-icon-button:focus-visible,
.nav-item.active,
.nav-item:hover,
.folder-button:hover,
.folder-button.active {
  background: var(--panel-soft);
  color: var(--accent-dark);
}

.nav-item.active {
  font-weight: 720;
}

.sidebar-search {
  border: 0;
  background: #f3f5f7;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(31, 41, 55, 0.04);
}

.sidebar-search input {
  color: var(--ink);
}

.sidebar-search input::placeholder {
  color: #687385;
}

.sidebar-command-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
  margin-bottom: 2px;
}

.sidebar-create-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(31, 41, 55, 0.14);
}

.sidebar-create-button svg {
  width: 18px;
  height: 18px;
}

.sidebar-create-button:hover,
.sidebar-create-button:focus-visible {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.archive-folder-block,
.stat-strip,
.folder-children {
  border-color: var(--line);
}

.stat {
  background: var(--panel-soft);
}

.stat strong {
  color: var(--ink);
}

.stat span {
  color: var(--muted);
}

.workspace-nav {
  flex: 1;
  align-content: start;
  overflow: auto;
  scrollbar-color: #cbd5e1 transparent;
  scrollbar-width: thin;
}

.sidebar-user {
  position: relative;
  display: grid;
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 14px 2px 0;
}

.user-profile-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 22px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.user-profile-button:hover,
.user-profile-button:focus-visible,
.sidebar.profile-menu-open .user-profile-button {
  background: var(--panel-soft);
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 760;
  box-shadow: 0 8px 18px rgba(31, 41, 55, 0.12);
}

.user-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.user-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-profile-chevron {
  width: 16px;
  height: 16px;
  color: var(--muted);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform 160ms ease;
}

.sidebar.profile-menu-open .user-profile-chevron {
  transform: rotate(180deg);
}

.profile-menu {
  position: absolute;
  z-index: 60;
  left: 50%;
  bottom: calc(100% + 8px);
  display: grid;
  width: min(240px, calc(100% - 12px));
  min-width: 210px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  padding: 6px;
  box-shadow: 0 18px 42px rgba(31, 41, 55, 0.16);
}

.profile-menu[hidden] {
  display: none;
}

.profile-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  width: 100%;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
  padding: 0 10px;
  font-size: 13px;
  text-align: left;
}

.profile-menu button:hover,
.profile-menu button:focus-visible {
  background: var(--panel-soft);
  color: var(--accent-dark);
}

.profile-language-toggle strong {
  color: var(--muted);
  font-size: 12px;
}

.user-message-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.user-message-button:hover,
.user-message-button:focus-visible {
  background: var(--panel-soft);
  color: var(--accent-dark);
}

.user-message-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.app-shell.sidebar-collapsed .sidebar {
  padding-inline: 8px;
}

.app-shell.sidebar-collapsed .brand-row,
.app-shell.sidebar-collapsed .sidebar-user {
  grid-template-columns: 34px;
  justify-content: center;
}

.app-shell.sidebar-collapsed .brand-home {
  grid-template-columns: 34px;
  width: 34px;
  justify-content: center;
}

.app-shell.sidebar-collapsed .user-profile-button {
  grid-template-columns: 34px;
  width: 34px;
  justify-content: center;
}

.app-shell.sidebar-collapsed .sidebar-icon-button {
  justify-self: center;
  width: 34px;
  height: 34px;
}

.app-shell.sidebar-collapsed .brand-copy,
.app-shell.sidebar-collapsed .sidebar-search input,
.app-shell.sidebar-collapsed .nav-section-label,
.app-shell.sidebar-collapsed .nav-item span,
.app-shell.sidebar-collapsed .nav-item small,
.app-shell.sidebar-collapsed .nav-chevron,
.app-shell.sidebar-collapsed .nav-children,
.app-shell.sidebar-collapsed .archive-folder-block,
.app-shell.sidebar-collapsed .user-copy,
.app-shell.sidebar-collapsed .user-profile-chevron,
.app-shell.sidebar-collapsed .user-message-button {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-command-row {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 8px;
}

.app-shell.sidebar-collapsed .sidebar-search {
  grid-template-columns: 1fr;
  justify-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
}

.app-shell.sidebar-collapsed .sidebar-create-button {
  justify-self: center;
}

.app-shell.sidebar-collapsed .nav-item {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 0;
}

.app-shell.sidebar-collapsed .nav-tree > .nav-item {
  grid-template-columns: 1fr;
  width: 100%;
}

.app-shell.sidebar-collapsed .nav-tree > .nav-item .nav-icon,
.app-shell.sidebar-collapsed .nav-item .nav-icon {
  justify-self: center;
}

.app-shell.sidebar-collapsed .nav-tree.collapsed-flyout-open > .nav-children {
  position: fixed;
  z-index: 50;
  top: var(--flyout-top, 96px);
  left: calc(var(--sidebar-width) + 6px);
  display: grid;
  width: 166px;
  max-height: calc(100vh - var(--flyout-top, 96px) - 12px);
  gap: 2px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  padding: 6px;
  overflow: auto;
  box-shadow: 0 18px 36px rgba(31, 41, 55, 0.14);
}

.app-shell.sidebar-collapsed .nav-tree.collapsed-flyout-open > .nav-children .nav-child-row {
  grid-template-columns: minmax(0, 1fr);
  min-height: 34px;
}

.app-shell.sidebar-collapsed .nav-tree.collapsed-flyout-open > .nav-children .nav-child {
  min-height: 34px;
  border-radius: 8px;
  line-height: 34px;
}

.app-shell.sidebar-collapsed .nav-tree.collapsed-flyout-open > .nav-children .nav-child:hover,
.app-shell.sidebar-collapsed .nav-tree.collapsed-flyout-open > .nav-children .nav-child-row.active .nav-child {
  background: var(--panel-soft);
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    inset: auto;
    width: auto;
    height: auto;
    max-height: 330px;
    border-right: 1px solid rgba(203, 213, 225, 0.72);
    border-bottom: 1px solid rgba(203, 213, 225, 0.72);
    border-radius: 18px;
    margin: 8px;
    overflow: hidden;
  }

  .workspace {
    grid-column: auto;
  }

  .home-shell {
    min-height: auto;
  }

  .home-today {
    grid-template-columns: 1fr;
    grid-template-areas:
      "feed"
      "main";
    min-height: auto;
  }

  .home-main-column {
    grid-area: main;
    min-height: auto;
    padding: 12px 0 0;
  }

  .home-live-feed {
    grid-area: feed;
    order: 0;
    grid-template-columns: 1fr;
    gap: 4px;
    width: min(900px, 100%);
    justify-self: center;
    padding-top: 4px;
  }

  .home-live-feed-head {
    justify-self: center;
  }

  .home-live-feed-window {
    grid-column: 1;
    width: 100%;
  }

  .home-work-grid {
    grid-auto-columns: minmax(210px, 1fr);
    grid-auto-flow: column;
    grid-template-columns: none;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-color: #cbd5e1 transparent;
    scrollbar-width: thin;
  }

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

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

  .workspace-draft-list,
  .source-list,
  .editor-canvas {
    max-height: none;
  }

  .workbench-overview {
    grid-template-columns: 1fr;
  }

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

  .document-list,
  .reader-body,
  .marks-panel {
    max-height: none;
    height: auto;
  }

  .inspector-panel {
    position: relative;
    top: auto;
    max-height: none;
  }

  .workspace-inspector-panel {
    position: relative;
    top: auto;
    max-height: none;
  }
}

@media (max-width: 640px) {
  .sidebar {
    position: sticky;
    top: 8px;
    z-index: 30;
    width: calc(100% - 16px);
    max-width: 100vw;
    min-width: 0;
    max-height: none;
    margin: 8px;
    padding: 10px 12px 8px;
    overflow: hidden;
  }

  .brand-row {
    grid-template-columns: minmax(0, 1fr) 34px;
    margin-bottom: 0;
    min-width: 0;
    padding: 0;
  }

  .brand-home {
    grid-template-columns: 28px;
    width: 28px;
  }

  .brand-copy,
  .sidebar-command-row,
  .sidebar-user,
  .sidebar-create-button {
    display: none;
  }

  .sidebar-command-row,
  .sidebar-search {
    min-width: 0;
  }

  .sidebar-command-row {
    grid-template-columns: minmax(0, 1fr);
    margin: 8px 0 6px;
  }

  .sidebar.mobile-nav-open .sidebar-command-row,
  .sidebar.mobile-nav-open .sidebar-user {
    display: grid;
  }

  .sidebar-icon-button {
    width: 34px;
    height: 34px;
    justify-self: end;
  }

  .workspace-nav {
    display: none;
    gap: 3px;
    max-width: 100%;
    margin: 2px 0 0;
    padding: 7px 0 1px;
    overflow: visible;
    flex: none;
    border-top: 1px solid var(--line);
  }

  .sidebar.mobile-nav-open .workspace-nav {
    display: grid;
  }

  .nav-group,
  .nav-tree {
    display: grid;
    gap: 2px;
  }

  .nav-section-label,
  .nav-chevron,
  .nav-children,
  .archive-folder-block,
  .stat-strip {
    display: none !important;
  }

  .nav-item,
  .nav-tree > .nav-item {
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 9px;
    width: 100%;
    min-height: 34px;
    border-radius: 10px;
    padding: 0 10px;
    white-space: normal;
  }

  .nav-item span {
    max-width: 100%;
    font-size: 13px;
  }

  .mobile-system-parent {
    display: grid;
  }

  .nav-system > .nav-item:not(.mobile-system-parent) {
    display: none;
  }

  .profile-menu {
    width: min(384px, calc(100% - 28px));
    min-width: 0;
  }

  .sidebar-user {
    margin-top: 8px;
    padding-top: 10px;
  }

  .workspace {
    padding: 12px;
  }

  .page-view {
    padding: 12px 0 20px;
  }

  .home-tabs {
    width: 100%;
  }

  .home-tab {
    flex: 1;
    min-width: 0;
  }

  .home-today {
    gap: 16px;
  }

  .home-section-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .home-intent-panel {
    gap: 14px;
    padding: 6px 0 0;
  }

  .home-intent-card {
    border-radius: 12px;
    padding: 10px;
  }

  .home-intent-copy {
    text-align: left;
  }

  .home-intent-copy h1 {
    font-size: 22px;
  }

  .home-intent-copy p {
    margin: 0;
  }

  .home-intent-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .home-intent-tools,
  .home-actions,
  .home-recent > div {
    justify-content: flex-start;
  }

  .home-actions {
    gap: 7px;
  }

  .home-recent > p {
    text-align: left;
  }

  .home-live-feed li {
    grid-template-columns: 10px minmax(0, max-content);
  }

  .home-live-feed time {
    grid-column: 2;
  }

  .home-discovery {
    padding-top: 22px;
  }

  .home-discovery-item > div {
    flex-direction: column;
    gap: 2px;
  }

  .content-grid {
    gap: 12px;
  }

  .workbench-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .article-topbar {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .top-path {
    max-width: 100%;
    min-width: min(100%, 180px);
  }

  .top-editable-title {
    max-width: min(100%, 420px);
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions .text-button {
    flex: 1;
  }

  .article-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .top-title-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .article-actions .text-button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .header-icon-button {
    width: 36px;
    height: 36px;
  }

  .pipeline-board {
    grid-template-columns: 1fr;
  }

  .reader-header {
    grid-template-columns: 1fr;
  }

  .editor-shell-header {
    grid-template-columns: 1fr;
  }

  .editor-canvas {
    padding: 16px;
  }

  .editor-document {
    min-height: 420px;
    padding: 28px 22px;
  }

  .editor-document h1 {
    font-size: 26px;
  }

  .editor-document p {
    font-size: 16px;
  }

  .form-grid-two,
  .workspace-tabs {
    grid-template-columns: 1fr;
  }

  .workspace-tab:nth-child(5) {
    grid-column: auto;
  }

  .reader-body,
  .marks-panel {
    padding: 18px;
  }

  .article-content {
    font-size: 16px;
  }
}

/* Homepage final overrides, kept at EOF so old prototype rules cannot win. */
.home-today {
  align-content: start;
  gap: 34px;
  min-height: calc(100vh - 118px);
  padding: 4px 0 32px;
}

.home-live-feed {
  display: grid;
  width: min(980px, 100%);
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 0;
}

.home-live-feed-head {
  justify-self: auto;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.home-live-feed-window {
  grid-column: auto;
}

.home-live-feed li {
  grid-template-columns: 8px minmax(0, 1fr) auto;
  justify-content: stretch;
}

.home-live-feed time {
  display: inline;
}

.home-main-column {
  display: grid;
  width: min(920px, 100%);
  gap: 30px;
}

.home-work-grid {
  grid-auto-flow: column;
  grid-auto-columns: minmax(210px, 1fr);
  grid-template-columns: none;
}

.home-work-card {
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.home-work-card p {
  margin: 0;
  color: #4f5a68;
  font-size: 13px;
  line-height: 1.5;
}

.home-today-ai {
  min-height: calc(100vh - 118px);
  padding-bottom: 104px;
}

.home-today-ai .home-main-column {
  width: min(1040px, 100%);
  align-content: start;
  gap: 16px;
}

.home-ai-workspace {
  display: grid;
  gap: 14px;
}

.home-ai-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  border-bottom: 1px solid #e6eaf0;
  padding: 4px 0 14px;
}

.home-ai-header p {
  margin: 0 0 4px;
  color: #5f6b7a;
  font-size: 12px;
  font-weight: 720;
}

.home-ai-header h1 {
  margin: 0;
  color: #111827;
  font-size: 24px;
  font-weight: 780;
  line-height: 1.25;
}

.home-ai-header span {
  display: block;
  max-width: 68ch;
  margin-top: 7px;
  color: #4f5a68;
  font-size: 14px;
  line-height: 1.5;
}

.home-ai-run-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.home-ai-run-meta span {
  margin: 0;
  border: 1px solid #dfe4ea;
  border-radius: 999px;
  background: #ffffff;
  color: #445061;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 680;
  line-height: 1;
  white-space: nowrap;
}

.home-ai-notice {
  margin: -4px 0 0;
  border: 1px solid #ead7ac;
  border-radius: 9px;
  background: #fff8e8;
  color: #70521a;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.home-ai-body {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.home-ai-status {
  position: sticky;
  top: 72px;
  border: 1px solid #e1e6ed;
  border-radius: 12px;
  background: #ffffff;
  padding: 12px;
}

.home-ai-status ol {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.home-ai-step {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: #687385;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
}

.home-ai-step-mark {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid #d8dee7;
  border-radius: 999px;
  color: #ffffff;
}

.home-ai-step.running .home-ai-step-mark {
  border-color: #334155;
  background: #334155;
  box-shadow: inset 0 0 0 5px #ffffff;
}

.home-ai-step.done {
  color: #273446;
}

.home-ai-step.done .home-ai-step-mark {
  border-color: #2f6f57;
  background: #2f6f57;
}

.home-ai-step.done svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.home-ai-result {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.home-ai-answer,
.home-ai-references {
  display: grid;
  gap: 12px;
  border: 1px solid #e1e6ed;
  border-radius: 12px;
  background: #ffffff;
  padding: 14px;
}

.home-ai-answer.pending {
  min-height: 116px;
  align-content: center;
}

.home-ai-answer-block {
  display: grid;
  gap: 8px;
}

.home-ai-answer-block + .home-ai-answer-block {
  border-top: 1px solid #edf0f3;
  padding-top: 12px;
}

.home-ai-answer h2,
.home-ai-references h2 {
  margin: 0;
  color: #111827;
  font-size: 15px;
  font-weight: 760;
  line-height: 1.3;
}

.home-ai-answer h3 {
  margin: 0;
  color: #1f2937;
  font-size: 14px;
  font-weight: 740;
  line-height: 1.35;
}

.home-ai-answer ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
}

.home-ai-answer li,
.home-ai-answer p {
  margin: 0;
  color: #4f5a68;
  font-size: 13px;
  line-height: 1.58;
}

.home-ai-section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.home-ai-section-title span {
  color: #687385;
  font-size: 12px;
  font-weight: 680;
}

.home-ai-source-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.home-ai-source {
  display: grid;
  gap: 8px;
  border: 1px solid #e0e5ec;
  border-radius: 10px;
  background: #fafbfc;
  padding: 12px;
}

.home-ai-source.quoted {
  border-color: #acc8bb;
  background: #f2f8f5;
}

.home-ai-source-head,
.home-ai-source-meta,
.home-ai-source-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.home-ai-source-head span,
.home-ai-source-meta span {
  color: #687385;
  font-size: 12px;
  font-weight: 650;
}

.home-ai-source-head strong {
  color: #2f6f57;
  font-size: 12px;
  font-weight: 760;
}

.home-ai-source h3 {
  margin: 0;
  color: #17202b;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
}

.home-ai-source p {
  margin: 0;
  color: #4f5a68;
  font-size: 13px;
  line-height: 1.52;
}

.home-ai-source-actions {
  justify-content: flex-start;
  padding-top: 2px;
}

.home-ai-source-actions a,
.home-ai-source-actions button,
.home-ai-primary,
.home-ai-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  border: 1px solid #d7dee7;
  border-radius: 8px;
  background: #ffffff;
  color: #394453;
  cursor: pointer;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 680;
  text-decoration: none;
}

.home-ai-source-actions a:hover,
.home-ai-source-actions a:focus-visible,
.home-ai-source-actions button:hover,
.home-ai-source-actions button:focus-visible,
.home-ai-secondary:hover,
.home-ai-secondary:focus-visible {
  border-color: #bdc7d4;
  background: #ffffff;
  color: #111827;
}

.home-ai-source-actions svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.home-ai-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.home-ai-primary {
  border-color: #1f2937;
  background: #1f2937;
  color: #ffffff;
}

.home-ai-primary:hover,
.home-ai-primary:focus-visible {
  background: #111827;
}

.home-ai-primary:disabled,
.home-ai-secondary:disabled {
  border-color: #e4e8ee;
  background: #f3f5f7;
  color: #9aa3af;
  cursor: not-allowed;
}

.home-ai-skeleton {
  width: 78%;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #edf0f3, #f7f8fa, #edf0f3);
  background-size: 200% 100%;
  animation: homeSkeleton 1.2s ease-in-out infinite;
}

.home-ai-skeleton.wide {
  width: 94%;
}

.home-ai-skeleton.short {
  width: 52%;
}

@keyframes homeSkeleton {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.home-intent-panel.compact {
  position: sticky;
  z-index: 30;
  bottom: 88px;
  padding: 0;
}

.home-intent-panel.compact .home-intent-card {
  background: #ffffff;
}

.home-minimax-mark {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: #111827;
  color: #ffffff;
  font-size: 11px;
  font-weight: 760;
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  .home-ai-skeleton {
    animation: none;
  }
}

@media (max-width: 860px) {
  .home-ai-header {
    flex-direction: column;
  }

  .home-ai-run-meta {
    justify-content: flex-start;
  }

  .home-ai-body {
    grid-template-columns: 1fr;
  }

  .home-ai-status {
    position: static;
  }

  .home-ai-source-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .home-today-ai {
    padding-bottom: var(--mobile-dock-clearance);
  }

  .home-ai-header h1 {
    font-size: 21px;
  }

  .home-ai-answer,
  .home-ai-references,
  .home-ai-status {
    border-radius: 10px;
    padding: 12px;
  }

  .home-ai-actions {
    justify-content: stretch;
  }

  .home-ai-primary,
  .home-ai-secondary {
    flex: 1 1 140px;
    justify-content: center;
  }

  .home-intent-panel.compact {
    bottom: calc(var(--mobile-home-dock-bottom) + 48px);
  }

  .home-intent-tools {
    flex-wrap: wrap;
  }

  .home-model-switch,
  .home-tool-button {
    flex: 1 1 auto;
    justify-content: center;
  }
}

.home-discovery {
  max-width: 1180px;
}

.home-discovery-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.home-discovery-group {
  display: grid;
  align-content: start;
  gap: 10px;
}

.home-discovery-group h2 {
  margin: 0;
  color: #374151;
  font-size: 13px;
  font-weight: 760;
}

.home-discovery-item h3 {
  margin: 0;
  color: #1f2937;
  font-size: 14px;
  font-weight: 760;
  line-height: 1.35;
}

.home-discovery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 3px;
}

.home-discovery-actions a,
.home-discovery-actions button,
.home-quote-target {
  min-height: 30px;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  background: #ffffff;
  color: #394453;
  cursor: pointer;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

.home-discovery-actions a {
  display: inline-flex;
  align-items: center;
}

.home-overlay {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(17, 24, 39, 0.22);
  padding: 24px;
}

.home-activity-center,
.home-quote-modal {
  display: grid;
  width: min(640px, 100%);
  max-height: min(680px, calc(100vh - 48px));
  gap: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  padding: 18px;
}

.home-activity-center header,
.home-quote-modal header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.home-activity-center header p,
.home-quote-modal header p {
  margin: 0 0 4px;
  color: #596371;
  font-size: 12px;
  font-weight: 700;
}

.home-activity-center h2,
.home-quote-modal h2 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 18px;
  font-weight: 760;
  line-height: 1.35;
}

.home-modal-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  background: #ffffff;
  color: #596371;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.home-activity-list,
.home-quote-targets {
  display: grid;
  gap: 8px;
}

.home-activity-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  border-radius: 10px;
  background: #f8fafc;
  padding: 12px;
}

.home-activity-row strong {
  color: #1f2937;
  font-size: 13px;
}

.home-activity-row p {
  margin: 4px 0 0;
  color: #4f5a68;
  font-size: 13px;
  line-height: 1.5;
}

.home-activity-row span {
  color: #818a96;
  font-size: 12px;
  white-space: nowrap;
}

.home-quote-target {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-height: 38px;
  text-align: left;
}

/* Creation worktree: Workspace owns References, Draft, and Activity. */
.workspace-activity-card {
  gap: 12px;
}

.workspace-activity-card > p {
  margin: 0;
  color: #4f5a68;
  font-size: 13px;
  line-height: 1.5;
}

.workspace-activity-list {
  display: grid;
  gap: 8px;
}

.workspace-activity-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border-radius: 10px;
  background: #f8fafc;
  padding: 11px 12px;
}

.workspace-activity-item strong {
  color: #1f2937;
  font-size: 13px;
}

.workspace-activity-item p {
  margin: 4px 0 0;
  color: #4f5a68;
  font-size: 13px;
  line-height: 1.45;
}

.workspace-activity-item time {
  color: #818a96;
  font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .home-discovery-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .home-live-feed {
    grid-template-columns: 1fr;
  }

  .home-live-feed li {
    grid-template-columns: 8px minmax(0, 1fr);
  }

  .home-live-feed time {
    display: none;
  }
}

.workspace-draft-row .draft-row-meta span:first-child {
  color: #1f2937;
  font-weight: 760;
}

.workspace-empty-state {
  display: grid;
  gap: 5px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  padding: 14px;
}

.workspace-empty-state strong {
  color: #374151;
  font-size: 13px;
  font-weight: 650;
}

.workspace-empty-state span {
  color: #687385;
  font-size: 12px;
  line-height: 1.45;
}

.workspace-editor-panel .editor-document {
  scroll-margin-top: 80px;
}

@media (max-width: 720px) {
  .workspace-activity-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 720px) {
  .workspace,
  .page-view,
  .home-shell,
  .home-today,
  .home-main-column,
  .home-continue {
    max-width: 100%;
    overflow-x: hidden;
  }

  .home-today {
    gap: 22px;
    min-height: auto;
    padding: 0 0 var(--mobile-dock-clearance);
  }

  .home-live-feed {
    gap: 8px;
  }

  .home-main-column {
    gap: 22px;
  }

  .home-intent-panel {
    gap: 12px;
    padding-top: 0;
  }

  .home-continue {
    gap: 12px;
  }

  .home-work-grid {
    max-width: 100%;
    grid-auto-columns: minmax(236px, calc(100vw - 88px));
    gap: 10px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 1px 1px 14px;
    scroll-padding-inline: 1px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .home-work-grid::-webkit-scrollbar {
    display: none;
  }

  .home-work-card,
  .home-work-create {
    min-height: 104px;
    scroll-snap-align: start;
    padding: 12px;
  }

  .home-work-card {
    gap: 9px;
  }

  .home-work-card p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}

html:has(#workspaceView:not(.hidden)),
body:has(#workspaceView:not(.hidden)) {
  height: 100%;
  overflow: hidden;
}

.app-shell:has(#workspaceView:not(.hidden)) {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.workspace:has(#workspaceView:not(.hidden)) {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

@supports (height: 100dvh) {
  html:has(#workspaceView:not(.hidden)),
  body:has(#workspaceView:not(.hidden)),
  .app-shell:has(#workspaceView:not(.hidden)),
  .workspace:has(#workspaceView:not(.hidden)) {
    height: 100dvh;
  }
}

.workspace:has(#workspaceView:not(.hidden)) > .workbench-topbar {
  flex: 0 0 auto;
}

#workspaceView {
  position: relative;
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  overflow: hidden;
  padding: 14px 24px 10px;
}

.workspace-grid {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 14px;
  align-items: stretch;
  height: 100%;
  min-height: 0;
}

.workspace-grid[data-workspace-mode="sources"] {
  grid-template-columns: minmax(270px, 328px) minmax(0, 1fr) !important;
}

.workspace-grid[data-workspace-mode="review"] {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 344px) !important;
}

.workspace-reference-panel,
.workspace-review-panel {
  display: none;
  align-content: start;
  gap: 10px;
  position: relative;
  top: auto;
  height: 100%;
  max-height: none;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  background: #fbfcfd;
  padding: 10px;
  box-shadow: none;
}

.workspace-grid[data-workspace-mode="sources"] .workspace-reference-panel,
.workspace-grid[data-workspace-mode="review"] .workspace-review-panel {
  display: grid;
}

.workspace-side-header {
  display: flex !important;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  margin: -10px -10px 0;
  padding: 12px 12px 10px;
}

.workspace-side-header h2 {
  margin-top: 2px;
  color: #17202b;
  font-size: 15px;
  line-height: 1.25;
}

.workspace-reference-panel .source-list {
  max-height: none;
  overflow: visible;
  padding: 0;
}

.workspace-reference-panel .source-row {
  border: 1px solid transparent;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
}

.workspace-reference-panel .source-row + .source-row {
  margin-top: 6px;
}

.workspace-reference-panel .source-row:hover,
.workspace-reference-panel .source-row.active {
  border-color: #d8dee6;
  background: #f4f7f8;
  box-shadow: none;
}

.workspace-source-detail {
  display: grid;
  gap: 8px;
}

.source-detail-card {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 11px;
}

.source-detail-card h3 {
  margin: 0;
  color: #17202b;
  font-size: 14px;
  line-height: 1.35;
}

.source-detail-origin,
.source-detail-summary p {
  color: #596371;
  font-size: 12px;
  line-height: 1.5;
}

.source-detail-link {
  width: fit-content;
  color: #273446;
  font-size: 12px;
  font-weight: 680;
  text-decoration: none;
}

.source-detail-link:hover,
.source-detail-link:focus-visible {
  color: #111827;
  text-decoration: underline;
}

.source-detail-summary {
  display: grid;
  gap: 4px;
}

.source-detail-summary strong {
  color: #374151;
  font-size: 12px;
}

.source-detail-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.source-detail-metrics span,
.review-kind {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: #596371;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 700;
}

.workspace-review-panel .workspace-inspector-body {
  gap: 9px;
  padding: 0;
}

.workspace-review-panel .inspector-card {
  border-radius: 8px;
  box-shadow: none;
}

.workspace-activity-item {
  border: 1px solid var(--line);
  background: #ffffff;
}

.workspace-activity-item > div {
  display: grid;
  gap: 4px;
}

.review-trace-list {
  display: grid;
  gap: 7px;
}

.review-trace-list p {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  border-radius: 7px;
  background: #f8fafc;
  padding: 8px 9px;
}

.review-trace-list strong {
  color: #374151;
  font-size: 12px;
}

.review-trace-list span {
  color: #596371;
  font-size: 12px;
  line-height: 1.45;
}

.workspace-editor-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: #ffffff;
}

.editor-canvas {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  background: #ffffff;
  padding-bottom: 104px;
}

.editor-document {
  background: #ffffff;
}

.editor-document:focus,
.editor-document:focus-visible,
#workspaceEditor:focus,
#workspaceEditor:focus-visible {
  outline: 0 !important;
  box-shadow: none !important;
}

.workspace-mode-tabs {
  position: absolute;
  z-index: 45;
  bottom: 34px;
  left: var(--workspace-tabs-left, 50%);
  display: inline-flex;
  gap: 3px;
  align-items: center;
  border: 1px solid rgba(203, 213, 225, 0.52);
  border-radius: 12px;
  background: rgba(246, 247, 248, 0.68);
  padding: 4px;
  box-shadow: none;
  transform: translateX(-50%);
  backdrop-filter: blur(14px) saturate(1.08);
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
}

.workspace-mode-tab {
  min-width: 72px;
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #596371;
  cursor: pointer;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 680;
}

.workspace-mode-tab:hover,
.workspace-mode-tab:focus-visible {
  background: var(--panel-soft);
  color: #17202b;
  outline: 0;
}

.workspace-mode-tab.active {
  background: rgba(31, 41, 55, 0.96);
  color: #ffffff;
}

.workspace-mode-status {
  position: absolute;
  z-index: 44;
  right: var(--workspace-status-right, 34px);
  bottom: var(--workspace-status-bottom, 34px);
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-end;
  width: max-content;
  max-width: min(180px, calc(100% - 48px));
  border: 0;
  background: transparent;
  color: #858c96;
  padding: 0;
  pointer-events: none;
  box-shadow: none;
}

.workspace-status-toggle {
  display: inline-grid;
  place-items: center end;
  width: 30px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #8d949e;
  cursor: pointer;
  padding: 0;
  pointer-events: auto;
}

.workspace-status-toggle:hover,
.workspace-status-toggle:focus-visible {
  background: transparent;
  color: #17202b;
  outline: 0;
}

.workspace-status-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.workspace-status-lines {
  display: grid;
  gap: 4px;
  justify-items: end;
  max-width: 140px;
  text-align: right;
  pointer-events: none;
}

.workspace-status-lines[hidden] {
  display: none;
}

.workspace-status-lines span {
  display: block;
  color: #858c96;
  font-size: 11px;
  font-weight: 450;
  line-height: 1.25;
  white-space: nowrap;
}

.workspace-mode-status.collapsed {
  gap: 0;
}

@media (max-width: 1080px) {
  .workspace-mode-tabs {
    left: var(--workspace-tabs-left, 50%);
  }
}

@media (max-width: 820px) {
  .app-shell:has(#workspaceView:not(.hidden)) {
    display: flex;
    flex-direction: column;
    height: 100vh;
  }

  .app-shell:has(#workspaceView:not(.hidden)) .sidebar {
    flex: 0 0 auto;
  }

  .workspace:has(#workspaceView:not(.hidden)) {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
  }

  #workspaceView {
    padding: 12px 12px 18px;
  }

  .workspace-grid,
  .workspace-grid[data-workspace-mode="sources"],
  .workspace-grid[data-workspace-mode="review"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .workspace-reference-panel,
  .workspace-review-panel {
    position: relative;
    top: auto;
    max-height: none;
  }

  .workspace-grid[data-workspace-mode="sources"] .workspace-editor-panel,
  .workspace-grid[data-workspace-mode="review"] .workspace-editor-panel {
    display: none;
  }

  .workspace-grid[data-workspace-mode="focus"] .workspace-reference-panel,
  .workspace-grid[data-workspace-mode="focus"] .workspace-review-panel,
  .workspace-grid[data-workspace-mode="sources"] .workspace-review-panel,
  .workspace-grid[data-workspace-mode="review"] .workspace-reference-panel {
    display: none;
  }

  .workspace-mode-tabs {
    position: fixed;
    right: auto;
    bottom: var(--mobile-home-dock-bottom);
    left: 50% !important;
    width: max-content;
    max-width: calc(100% - 28px);
    justify-content: center;
    gap: 2px;
    border-radius: 12px;
    padding: 4px;
    transform: translateX(-50%);
  }

  .workspace-mode-tab {
    flex: 0 0 auto;
    min-width: 66px;
    min-height: 34px;
    border-radius: 7px;
    padding: 0 13px;
    font-size: 13px;
  }

  .workspace-mode-status {
    position: fixed;
    right: 36px;
    bottom: calc(var(--mobile-home-dock-bottom) + 56px);
    width: max-content;
    max-width: calc(100% - 28px);
  }

  .workspace-mode-status:not(.collapsed) {
    border: 1px solid rgba(203, 213, 225, 0.72);
    border-radius: 10px;
    background: rgba(246, 247, 248, 0.94);
    padding: 8px 9px 7px;
  }

  .top-identity-group {
    flex-wrap: wrap;
    width: 100%;
  }

  .top-editable-title {
    flex: 1 1 min(100%, 220px);
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .app-shell:has(#workspaceView:not(.hidden)) .sidebar {
    position: relative;
    top: auto;
    min-height: 52px;
  }

  .app-shell:has(#workspaceView:not(.hidden)) .brand-row {
    min-height: 34px;
  }

  .app-shell:has(#workspaceView:not(.hidden)) .editor-canvas,
  .app-shell:has(#workspaceView:not(.hidden)) .workspace-reference-panel,
  .app-shell:has(#workspaceView:not(.hidden)) .workspace-review-panel {
    padding-bottom: var(--mobile-workspace-dock-clearance);
  }
}

/* Home tabs share the floating workspace tab treatment. */
.home-shell {
  padding-bottom: 76px;
}

.home-shell > .home-tabs {
  position: fixed;
  z-index: 45;
  bottom: 30px;
  left: calc(var(--sidebar-width) + ((100vw - var(--sidebar-width)) / 2));
  display: inline-flex !important;
  width: max-content !important;
  max-width: calc(100vw - 28px);
  height: auto !important;
  min-height: 0 !important;
  align-items: center;
  gap: 3px;
  border: 1px solid rgba(203, 213, 225, 0.52);
  border-radius: 12px;
  background: rgba(246, 247, 248, 0.68);
  padding: 4px;
  box-shadow: none;
  transform: translateX(-50%);
  backdrop-filter: blur(14px) saturate(1.08);
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
}

.home-shell > .home-tabs .home-tab {
  display: inline-flex;
  flex: 0 0 auto !important;
  justify-content: center;
  align-items: center;
  min-width: 72px;
  height: 32px !important;
  min-height: 32px !important;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #596371;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 680;
  line-height: 1;
}

.home-shell > .home-tabs .home-tab-mobile-only {
  display: none;
}

.creation-queue-tabs {
  display: none !important;
}

.home-shell > .home-tabs .home-tab:hover,
.home-shell > .home-tabs .home-tab:focus-visible,
.creation-queue-tabs .home-tab:hover,
.creation-queue-tabs .home-tab:focus-visible {
  background: var(--panel-soft);
  color: #17202b;
  outline: 0;
}

.home-shell > .home-tabs .home-tab.active,
.creation-queue-tabs .home-tab.active {
  background: rgba(31, 41, 55, 0.96);
  color: #ffffff;
}

@media (max-width: 1080px) {
  .home-shell > .home-tabs {
    left: 50%;
  }
}

@media (max-width: 720px) {
  .home-shell,
  .creation-queue-shell {
    padding-bottom: var(--mobile-dock-clearance);
  }

  .home-shell > .home-tabs,
  .creation-queue-tabs {
    position: fixed;
    z-index: 45;
    bottom: var(--mobile-home-dock-bottom);
    left: 50%;
    display: inline-flex !important;
    width: max-content !important;
    max-width: calc(100% - 28px);
    height: auto !important;
    min-height: 0 !important;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 1px solid rgba(203, 213, 225, 0.52);
    border-radius: 12px;
    background: rgba(246, 247, 248, 0.68);
    padding: 4px;
    box-shadow: none;
    transform: translateX(-50%);
    backdrop-filter: blur(14px) saturate(1.08);
    -webkit-backdrop-filter: blur(14px) saturate(1.08);
  }

  .home-shell > .home-tabs .home-tab,
  .creation-queue-tabs .home-tab {
    display: inline-flex;
    flex: 0 0 auto !important;
    justify-content: center;
    align-items: center;
    min-width: 66px;
    height: 34px !important;
    min-height: 34px !important;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #596371;
    padding: 0 13px;
    font-size: 13px;
    font-weight: 680;
    line-height: 1;
  }

  .home-shell > .home-tabs .home-tab-mobile-only,
  .creation-queue-tabs .home-tab-mobile-only {
    display: inline-flex;
  }

  .home-shell > .home-tabs .home-tab.active,
  .creation-queue-tabs .home-tab.active {
    background: rgba(31, 41, 55, 0.96);
    color: #ffffff;
  }
}

.sidebar,
.app-shell.sidebar-collapsed .sidebar,
.app-shell:has(#workspaceView:not(.hidden)) .sidebar {
  background: var(--sidebar-bg);
  box-shadow: none;
}
