:root {
  color-scheme: light;
  --bg: #f7f6f3;
  --bg-soft: #fbfaf8;
  --panel: rgba(255, 255, 255, 0.84);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --panel-tint: rgba(243, 244, 255, 0.72);
  --border: rgba(24, 28, 39, 0.1);
  --border-strong: rgba(24, 28, 39, 0.16);
  --text: #181c27;
  --muted: #676d7c;
  --accent: #5c61f0;
  --accent-strong: #474dd9;
  --accent-soft: rgba(92, 97, 240, 0.12);
  --teal: #1aa187;
  --teal-soft: rgba(26, 161, 135, 0.14);
  --gold: #e4a62c;
  --gold-soft: rgba(228, 166, 44, 0.14);
  --rose: #ef6a87;
  --rose-soft: rgba(239, 106, 135, 0.14);
  --danger: #b34b59;
  --shadow-sm: 0 10px 24px rgba(16, 22, 34, 0.06);
  --shadow: 0 18px 48px rgba(16, 22, 34, 0.08);
  --shadow-lg: 0 32px 80px rgba(16, 22, 34, 0.12);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  margin: 0;
  height: 100%;
  min-height: 100%;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: auto;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(92, 97, 240, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(26, 161, 135, 0.11), transparent 24%),
    radial-gradient(circle at bottom left, rgba(228, 166, 44, 0.08), transparent 22%),
    linear-gradient(180deg, #fbfbfd 0%, var(--bg) 52%, #f4f2ee 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.3)),
    radial-gradient(circle at 1px 1px, rgba(24, 28, 39, 0.05) 1px, transparent 0);
  background-size: auto, 24px 24px;
  opacity: 0.22;
}

body,
button,
input,
select,
textarea {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.92rem 1rem;
  border: 1px solid rgba(24, 28, 39, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

input::placeholder,
textarea::placeholder {
  color: #9ba1af;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(92, 97, 240, 0.42);
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 0 0 4px rgba(92, 97, 240, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.rich-text-field {
  position: relative;
  display: grid;
  gap: 0.55rem;
}

.rich-text-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.rich-text-label-row > label {
  margin: 0;
}

.rich-text-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.18rem;
  border: 1px solid rgba(24, 28, 39, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.rich-text-tool {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #4c5366;
  transition:
    background 160ms ease,
    color 160ms ease;
}

.rich-text-tool:hover,
.rich-text-tool:focus-visible {
  background: rgba(92, 97, 240, 0.12);
  color: var(--accent);
  outline: none;
}

.rich-text-editor {
  width: 100%;
  padding: 0.92rem 1rem;
  overflow: auto;
  border: 1px solid rgba(24, 28, 39, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  line-height: 1.65;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.rich-text-editor:focus {
  outline: none;
  border-color: rgba(92, 97, 240, 0.42);
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 0 0 4px rgba(92, 97, 240, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.rich-text-editor:empty::before {
  content: attr(data-placeholder);
  color: #9ba1af;
  pointer-events: none;
}

.rich-text-editor p,
.rich-text-editor h3,
.rich-text-editor blockquote,
.rich-text-rendered p,
.rich-text-rendered h3,
.rich-text-rendered blockquote {
  margin: 0 0 0.75rem;
}

.rich-text-editor p:last-child,
.rich-text-editor h3:last-child,
.rich-text-editor blockquote:last-child,
.rich-text-rendered p:last-child,
.rich-text-rendered h3:last-child,
.rich-text-rendered blockquote:last-child {
  margin-bottom: 0;
}

.rich-text-editor h3,
.rich-text-rendered h3 {
  font-size: 1.05rem;
  line-height: 1.35;
}

.rich-text-editor blockquote,
.rich-text-rendered blockquote {
  padding-left: 0.85rem;
  border-left: 3px solid rgba(92, 97, 240, 0.28);
  color: #3d4456;
}

.rich-text-editor ul,
.rich-text-editor ol,
.rich-text-rendered ul,
.rich-text-rendered ol {
  margin: 0 0 0.75rem;
  padding-left: 1.35rem;
}

.rich-text-required-proxy {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #6f7687 50%),
    linear-gradient(135deg, #6f7687 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
  background-position:
    calc(100% - 18px) calc(1.08rem + 1px),
    calc(100% - 12px) calc(1.08rem + 1px),
    100% 0;
  background-size: 6px 6px, 6px 6px, 2.5rem 100%;
  background-repeat: no-repeat;
  padding-right: 2.8rem;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

label {
  display: grid;
  gap: 0.48rem;
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--muted);
}

code {
  padding: 0.15rem 0.42rem;
  border-radius: 10px;
  background: rgba(92, 97, 240, 0.08);
}

::selection {
  background: rgba(92, 97, 240, 0.18);
}

h1,
h2,
h3 {
  font-family: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  letter-spacing: -0.02em;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow: visible;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-y: auto;
  padding: 1.5rem;
  border-right: 1px solid rgba(24, 28, 39, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.38));
  backdrop-filter: blur(20px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  padding: 0.25rem;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent) 0%, #7b56f5 48%, var(--teal) 100%);
  color: white;
  font-weight: 800;
  box-shadow: 0 18px 34px rgba(92, 97, 240, 0.28);
}

.brand-mark::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.26);
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
}

.sidebar-nav {
  display: grid;
  gap: 0.5rem;
}

.nav-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 0.94rem 1rem;
  border: 1px solid transparent;
  border-radius: 20px;
  background: transparent;
  color: var(--text);
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease;
}

.nav-button::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--teal) 100%);
  opacity: 0;
  transform: scaleY(0.5);
  transition: opacity 160ms ease, transform 160ms ease;
}

.nav-button:hover,
.nav-button.active {
  transform: translateY(-1px);
  border-color: rgba(24, 28, 39, 0.08);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-sm);
}

.nav-button.active {
  color: #111522;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(245, 247, 255, 0.86));
}

.nav-button.active::before {
  opacity: 1;
  transform: scaleY(1);
}

.nav-main {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  font-weight: 600;
}

.nav-pill,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9rem;
  padding: 0.14rem 0.56rem;
  border-radius: 999px;
  border: 1px solid rgba(92, 97, 240, 0.12);
  background: rgba(92, 97, 240, 0.1);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.2;
}

.pill.subtle {
  background: rgba(24, 28, 39, 0.05);
  color: var(--muted);
  border-color: rgba(24, 28, 39, 0.07);
}

.sidebar-footnote {
  position: relative;
  margin-top: auto;
  padding: 1.1rem 1.1rem 1.15rem;
  border: 1px solid rgba(24, 28, 39, 0.08);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(247, 248, 252, 0.78));
  color: var(--muted);
  line-height: 1.58;
  box-shadow: var(--shadow-sm);
}

.sidebar-footnote::before {
  content: 'today';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.7rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #996f11;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-footnote p {
  margin: 0;
}


.desktop-nav {
  display: grid;
}

.desktop-sidebar-bottom {
  display: grid;
  gap: 1rem;
}

.mobile-account-dock,
.mobile-tabbar {
  display: none;
}

.account-panel {
  padding: 0.9rem;
  border: 1px solid rgba(24, 28, 39, 0.08);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 247, 255, 0.88));
  box-shadow: 0 10px 30px rgba(18, 32, 73, 0.08);
  backdrop-filter: blur(12px);
}

.account-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.8rem;
}

.account-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: #1f2a44;
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.24), rgba(45, 212, 191, 0.22));
  border: 1px solid rgba(99, 102, 241, 0.14);
}

.account-meta {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}

.account-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.account-email {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.sidebar-signout {
  width: 100%;
  justify-content: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(24, 28, 39, 0.08);
}

.sidebar-signout:hover {
  background: rgba(255, 255, 255, 0.96);
  transform: translateY(-1px);
}

.workspace-shell {
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: visible;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem 0;
  backdrop-filter: blur(8px);
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 720px;
  padding: 0 1rem;
  border: 1px solid rgba(24, 28, 39, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
}

.search-bar:focus-within {
  border-color: rgba(92, 97, 240, 0.24);
  box-shadow: 0 0 0 4px rgba(92, 97, 240, 0.1), var(--shadow-sm);
}

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

.search-bar input {
  border: 0;
  background: transparent;
  padding: 1rem 0;
  font-size: 1rem;
  box-shadow: none;
}

.search-bar input:focus {
  box-shadow: none;
}

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

.user-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(24, 28, 39, 0.08);
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace {
  min-width: 0;
  min-height: 0;
  padding: 1.6rem;
  overflow: visible;
}

.workspace-scroll-inner {
  min-height: 0;
}

.workspace-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.6rem 1.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.workspace-footer-copy {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
}

.footer-label {
  white-space: nowrap;
}

.footer-email {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 600;
}

.footer-signout {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.2rem 0;
  color: var(--muted);
}

.footer-signout:hover {
  color: var(--text);
}

.panel-stack {
  display: grid;
  gap: 1.2rem;
}

.panel-card,
.metric-card,
.entry-card,
.project-card,
.source-card,
.auth-card {
  border: 1px solid rgba(24, 28, 39, 0.08);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.panel-card {
  position: relative;
  padding: 1.35rem;
  overflow: hidden;
}

.panel-card::after,
.hero-panel::after,
.auth-copy::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 150px;
  height: 150px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(92, 97, 240, 0.14), transparent 70%);
  pointer-events: none;
}

.hero-panel,
.intro-card {
  display: grid;
  grid-template-columns: 1.2fr minmax(220px, 0.8fr);
  gap: 1.1rem;
  align-items: stretch;
}

.compact-title {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.hero-panel {
  position: relative;
  padding: 1.65rem;
  border: 1px solid rgba(24, 28, 39, 0.08);
  border-radius: 36px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(246, 248, 255, 0.86)),
    radial-gradient(circle at top right, rgba(92, 97, 240, 0.09), transparent 30%);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.hero-panel-compact {
  grid-template-columns: 1fr;
}

.hero-panel > *,
.intro-card > * {
  position: relative;
  z-index: 1;
}

.hero-panel h1,
.intro-card h1,
.auth-copy h1 {
  margin: 0.12rem 0 0.72rem;
  font-size: clamp(2.15rem, 3.2vw, 3.25rem);
  line-height: 0.98;
  max-width: 14ch;
}

.intro-card h1 {
  max-width: 16ch;
  font-size: clamp(1.85rem, 2.7vw, 2.65rem);
}

.hero-panel p,
.intro-card p,
.auth-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.68;
  max-width: 62ch;
}

.hero-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0 0;
}

.hero-process-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(24, 28, 39, 0.06);
  background: rgba(255, 255, 255, 0.82);
  color: #48506a;
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(16, 22, 34, 0.05);
}

.hero-aside {
  display: flex;
  justify-content: stretch;
}

.hero-quote-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(92, 97, 240, 0.12), rgba(255, 255, 255, 0.74)),
    linear-gradient(135deg, rgba(26, 161, 135, 0.05), transparent 60%);
  color: var(--text);
  border: 1px solid rgba(92, 97, 240, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.hero-quote-card svg {
  color: var(--accent);
}

.hero-quote-card p {
  font-size: 1.05rem;
  line-height: 1.72;
  color: inherit;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.73rem;
  font-weight: 800;
  color: var(--accent);
}

.eyebrow.small {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

.metrics-grid,
.card-grid,
.source-grid,
.split-grid,
.home-list,
.home-source-list {
  display: grid;
  gap: 1rem;
}

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

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

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

.home-list {
  gap: 0.7rem;
}

.home-list-item {
  display: grid;
  gap: 0.25rem;
  width: 100%;
  padding: 0.85rem 0;
  border: 0;
  border-bottom: 1px solid rgba(24, 28, 39, 0.08);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.home-list-item:last-child {
  border-bottom: 0;
}

.home-list-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.home-list-item small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-source-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-source-list .source-card {
  padding: 0.75rem;
}

.home-source-list .source-cover-shell {
  height: 120px;
}

.home-source-list .source-card-foot {
  display: none;
}

.metric-card {
  position: relative;
  padding: 1.1rem 1.2rem;
  overflow: hidden;
}


.metric-card-button {
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.metric-card-button .metric-card {
  height: 100%;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.metric-card-button:hover .metric-card,
.metric-card-button:focus-visible .metric-card {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(92, 97, 240, 0.18);
}

.metric-card-button:focus-visible {
  outline: none;
}

.nav-button:focus-visible,
.mobile-nav-button:focus-visible,
.section-tab:focus-visible,
.text-button:focus-visible,
.ghost-button:focus-visible,
.primary-button:focus-visible,
.icon-button:focus-visible,
.entry-card-main:focus-visible,
.source-card-main:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(92, 97, 240, 0.16);
}

.metric-card::before {
  content: '';
  position: absolute;
  left: 1rem;
  right: 1rem;
  top: 0;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--teal), var(--gold));
}

.metric-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.metric-value {
  margin-top: 0.38rem;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.metric-detail {
  margin: 0.5rem 0 0;
  color: var(--muted);
  line-height: 1.56;
}

.section-head,
.selector-panel-head,
.source-title-row,
.project-card-head,
.detail-meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.section-head h2,
.project-card-head h3,
.source-card h3,
.modal-header h2,
.source-detail-copy h2 {
  margin: 0.18rem 0 0;
}

.section-head h2,
.modal-header h2,
.source-detail-copy h2 {
  font-size: clamp(1.35rem, 2vw, 1.8rem);
}

.section-inline-note {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.stack-list {
  display: grid;
  gap: 0.9rem;
}

.entry-card,
.project-card,
.source-card {
  position: relative;
  overflow: hidden;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.entry-card:hover,
.project-card:hover,
.source-card:hover,
.entry-card:focus-within,
.project-card:focus-within,
.source-card:focus-within {
  transform: translateY(-2px);
  border-color: rgba(92, 97, 240, 0.14);
  box-shadow: var(--shadow-lg);
}

.entry-card,
.project-card {
  padding: 1rem;
}

.entry-card::before,
.project-card::before,
.source-card::before {
  content: '';
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, rgba(92, 97, 240, 0.26), rgba(26, 161, 135, 0.16), transparent);
}

.entry-card-main,
.project-card-main {
  all: unset;
  display: grid;
  gap: 0.8rem;
  width: 100%;
  cursor: pointer;
}

.entry-card-meta-row,
.entry-card-foot,
.project-card-foot,
.source-card-foot,
.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 0.95rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.entry-card-foot span,
.project-card-foot span,
.source-card-foot span,
.detail-meta-row span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.entry-meta-inline {
  font-size: 0.86rem;
  color: var(--muted);
}

.entry-card-title {
  margin: -0.1rem 0 -0.2rem;
  font-size: 0.94rem;
  font-weight: 700;
  color: #43495a;
}

.entry-quote {
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.72;
  color: #202532;
}

.entry-note,
.project-card p,
.source-card p,
.source-detail-notes,
.empty-state p,
.loading-panel p,
.notice,
.auth-features > div,
.source-detail-copy > p,
.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.entry-card-filter-row,
.filter-pill-row,
.entry-view-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.entry-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.entry-card-action-menu-wrap {
  display: none;
}

.entry-card-action-menu {
  display: grid;
  width: min(240px, 100%);
  padding: 0.35rem;
  border: 1px solid rgba(24, 28, 39, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 44px rgba(16, 22, 34, 0.16);
}

.entry-card-action-menu button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.78rem 0.85rem;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.entry-card-action-menu button:hover {
  background: rgba(92, 97, 240, 0.08);
}

.entry-card-filter-row {
  margin-top: 0.8rem;
}

.source-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.95rem;
  padding: 0.95rem;
}

.source-card-main {
  all: unset;
  display: grid;
  gap: 0.95rem;
  width: 100%;
  cursor: pointer;
  border-radius: inherit;
}

.source-cover-shell {
  width: 100%;
  height: 208px;
  border-radius: 22px;
  background:
    linear-gradient(165deg, rgba(92, 97, 240, 0.18), rgba(255, 255, 255, 0.7)),
    linear-gradient(180deg, rgba(26, 161, 135, 0.12), rgba(255, 255, 255, 0.2));
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34);
}

.source-cover-shell.large {
  width: 116px;
  height: 162px;
}

.source-cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.source-cover-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--accent);
  font-weight: 800;
  font-size: 2rem;
}

.source-card-body {
  display: grid;
  gap: 0.7rem;
}

.source-title-row > div {
  min-width: 0;
}

.source-card h3,
.project-card h3 {
  font-size: 1.08rem;
  line-height: 1.18;
}

.source-card-foot {
  margin-top: 0.1rem;
}

.project-card {
  display: grid;
  gap: 0.8rem;
}

.text-button,
.ghost-button,
.primary-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 16px;
  border: 1px solid transparent;
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    color 0.16s ease;
}

.text-button:hover,
.ghost-button:hover,
.primary-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  padding: 0.9rem 1.15rem;
  background: linear-gradient(135deg, var(--accent) 0%, #6f56f2 55%, var(--teal) 100%);
  color: #fff;
  box-shadow: 0 16px 30px rgba(92, 97, 240, 0.22);
}

.primary-button:hover {
  box-shadow: 0 22px 34px rgba(92, 97, 240, 0.28);
}

.primary-button:disabled,
.ghost-button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

.ghost-button {
  padding: 0.8rem 1rem;
  border-color: rgba(24, 28, 39, 0.08);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  box-shadow: 0 8px 20px rgba(16, 22, 34, 0.04);
}

.ghost-button.small {
  padding: 0.58rem 0.8rem;
  border-radius: 14px;
  font-size: 0.88rem;
}

.ghost-button.danger,
.notice.error,
.form-error {
  color: var(--danger);
}

.inline-confirmation {
  display: grid;
  gap: 0.65rem;
  max-width: 360px;
  padding: 0.95rem 1rem;
  border-radius: 20px;
  border: 1px solid rgba(179, 75, 89, 0.16);
  background: rgba(255, 244, 246, 0.88);
}

.inline-confirmation-title {
  margin: 0;
  font-weight: 800;
  color: var(--text);
}

.inline-confirmation-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.inline-confirmation-actions {
  align-items: stretch;
}

.text-button {
  padding: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

.pill-button,
.filter-pill-button {
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.pill-button:hover,
.filter-pill-button:hover {
  transform: translateY(-1px);
}

.pill-button.active,
.filter-pill-button.active {
  border-color: rgba(92, 97, 240, 0.2);
  background: rgba(92, 97, 240, 0.14);
  color: var(--accent-strong);
  box-shadow: 0 10px 18px rgba(92, 97, 240, 0.12);
}

.icon-button {
  width: 2.6rem;
  height: 2.6rem;
  border-color: rgba(24, 28, 39, 0.08);
  background: rgba(255, 255, 255, 0.82);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

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

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

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

.form-grid.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.inline-source-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: end;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
}

.checkbox-row input {
  width: 1rem;
  height: 1rem;
}

.filters-card .section-head {
  align-items: center;
}

.filters-toggle-row {
  justify-content: flex-end;
}

.entry-view-stack {
  display: grid;
  gap: 1rem;
}

.entry-view-mobile-actions {
  display: none;
}

.entry-view-menu-button {
  min-width: 2.75rem;
  min-height: 2.75rem;
}

.entry-view-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 4;
  display: grid;
  width: min(230px, calc(100vw - 2rem));
  padding: 0.35rem;
  border: 1px solid rgba(24, 28, 39, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 44px rgba(16, 22, 34, 0.16);
}

.entry-view-menu button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.78rem 0.85rem;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.entry-view-menu button:hover {
  background: rgba(92, 97, 240, 0.08);
}

.entry-view-menu button:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.entry-view-block {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 22px;
  border: 1px solid rgba(24, 28, 39, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 248, 255, 0.84));
}

.entry-view-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.entry-view-copy {
  margin: 0;
  line-height: 1.68;
  color: var(--text);
  white-space: pre-wrap;
}

.rich-text-rendered.entry-view-copy {
  white-space: normal;
}

.empty-state,
.loading-panel,
.notice {
  display: grid;
  place-items: center;
  gap: 0.55rem;
  min-height: 180px;
  text-align: center;
  color: var(--muted);
}

.empty-state.compact,
.loading-panel {
  min-height: 120px;
}

.notice {
  min-height: unset;
  margin-bottom: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 20px;
  border: 1px solid rgba(179, 75, 89, 0.18);
  background: rgba(179, 75, 89, 0.08);
}

.form-error,
.form-success {
  font-size: 0.92rem;
}

.form-success {
  color: #287763;
}

.capture-success-panel {
  display: grid;
  gap: 0.7rem;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(26, 161, 135, 0.18);
  border-radius: 18px;
  background: rgba(26, 161, 135, 0.09);
}

.auth-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 430px);
  gap: 1.5rem;
  min-height: 100vh;
  padding: 2rem;
  align-items: center;
}

.auth-card {
  position: relative;
  padding: 1.5rem;
  overflow: hidden;
}

.auth-copy {
  min-height: 460px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(245, 247, 255, 0.88)),
    radial-gradient(circle at top right, rgba(92, 97, 240, 0.08), transparent 30%);
}

.auth-features {
  display: grid;
  gap: 1rem;
  margin-top: 1.6rem;
}

.auth-features > div {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem 0.95rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(24, 28, 39, 0.06);
}

.auth-form-card {
  background: rgba(255, 255, 255, 0.9);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 1rem;
  padding: 0.28rem;
  border-radius: 18px;
  background: rgba(92, 97, 240, 0.08);
}

.auth-tabs button {
  padding: 0.8rem;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.auth-tabs button.active {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(16, 22, 34, 0.06);
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(18, 22, 34, 0.28);
  backdrop-filter: blur(14px);
}

.modal-panel {
  width: min(760px, 100%);
  max-height: min(88vh, 920px);
  overflow: auto;
  border-radius: 32px;
  border: 1px solid rgba(24, 28, 39, 0.08);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 28px 80px rgba(16, 22, 34, 0.2);
}

.modal-panel.wide {
  width: min(1020px, 100%);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(24, 28, 39, 0.08);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}

.modal-body {
  padding: 1.25rem;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.selector-panel {
  padding: 1rem;
  border-radius: 24px;
  border: 1px solid rgba(24, 28, 39, 0.08);
  background: linear-gradient(180deg, rgba(92, 97, 240, 0.05), rgba(255, 255, 255, 0.72));
}

.selector-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.9rem;
  max-height: 260px;
  overflow: auto;
}

.selector-item {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.8rem 0.85rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(24, 28, 39, 0.05);
}

.selector-item input {
  width: 1rem;
  height: 1rem;
  margin-top: 0.15rem;
}

.selector-item span {
  display: grid;
  gap: 0.2rem;
}

.selector-item small {
  color: var(--muted);
  line-height: 1.5;
}

.source-detail-stack {
  display: grid;
  gap: 1.15rem;
}

.source-detail-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
}

.source-detail-copy {
  display: grid;
  align-content: start;
  gap: 0.8rem;
}

.loading-panel {
  border: 1px dashed rgba(24, 28, 39, 0.12);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.5);
}


.garden-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 80;
  width: min(420px, calc(100vw - 2rem));
  padding: 0.95rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(24, 28, 39, 0.08);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 48px rgba(16, 22, 34, 0.18);
  backdrop-filter: blur(16px);
}

.garden-toast.success {
  border-color: rgba(26, 161, 135, 0.18);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(236, 252, 248, 0.96));
}

.garden-toast.error {
  border-color: rgba(179, 75, 89, 0.18);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255, 243, 245, 0.96));
}

.garden-toast-title {
  margin: 0 0 0.2rem;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
}

.garden-toast-message {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.garden-toast-close {
  margin-top: 0.7rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 1240px) {
  .source-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  .sidebar {
    position: static;
    min-height: unset;
    border-right: 0;
    border-bottom: 1px solid rgba(24, 28, 39, 0.08);
  }

  .sidebar-footnote {
    margin-top: 0;
  }

  .metrics-grid,
  .form-grid.four-up,
  .source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-screen {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  :root {
    --mobile-bottom-clearance: calc(7.5rem + env(safe-area-inset-bottom, 0px));
  }

  body::before {
    display: none;
  }

  .workspace,
  .topbar,
  .sidebar,
  .auth-screen {
    padding: 1rem;
  }

  .app-shell {
    height: 100vh;
    height: 100dvh;
  }

  .topbar,
  .hero-panel,
  .intro-card,
  .compact-title,
  .inline-source-row,
  .split-grid,
  .card-grid.two-columns,
  .metrics-grid,
  .form-grid.two-up,
  .form-grid.three-up,
  .form-grid.four-up {
    grid-template-columns: 1fr;
  }

  .sidebar {
    gap: 0.75rem;
    padding: 0.9rem 1rem 0.2rem;
    background: transparent;
    backdrop-filter: none;
  }

  .brand-block {
    padding: 0;
  }

  .brand-mark {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 16px;
  }

  .brand-title {
    font-size: 0.98rem;
  }

  .brand-subtitle {
    font-size: 0.78rem;
  }

  .desktop-nav,
  .desktop-sidebar-bottom,
  .sidebar-footnote {
    display: none;
  }

  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
    padding-top: 0;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .user-chip {
    max-width: none;
    flex: 1 1 auto;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .search-bar {
    border-radius: 16px;
    padding: 0 0.85rem;
  }

  .search-bar input {
    padding: 0.88rem 0;
    font-size: 0.96rem;
  }

  .workspace {
    padding-top: 0.35rem;
    padding-bottom: var(--mobile-bottom-clearance);
    scroll-padding-bottom: var(--mobile-bottom-clearance);
  }

  .workspace-scroll-inner {
    padding-bottom: 0.75rem;
  }

  .garden-toast {
    left: 1rem;
    right: 1rem;
    bottom: calc(5.6rem + env(safe-area-inset-bottom, 0px));
    width: auto;
  }

  .panel-stack {
    gap: 0.95rem;
  }

  .panel-card,
  .metric-card,
  .entry-card,
  .project-card,
  .source-card,
  .hero-panel,
  .intro-card,
  .auth-copy {
    border-radius: 22px;
  }

  .panel-card,
  .hero-panel,
  .intro-card {
    padding: 1rem;
  }

  .button-row,
  .section-head,
  .project-card-head,
  .source-title-row,
  .detail-meta-row {
    gap: 0.75rem;
  }

  .button-row {
    flex-direction: column;
    align-items: stretch;
  }

  .button-row > * {
    width: 100%;
  }

  .metric-value {
    font-size: 1.7rem;
  }

  .workspace-footer {
    flex-wrap: wrap;
    align-items: center;
    padding: 0 1rem calc(6.85rem + env(safe-area-inset-bottom, 0px));
  }

  .workspace-footer-copy {
    width: 100%;
  }

  .mobile-tabbar {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(0.7rem + env(safe-area-inset-bottom, 0px));
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
    padding: 0.4rem;
    border: 1px solid rgba(24, 28, 39, 0.08);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 18px 40px rgba(16, 22, 34, 0.16);
    backdrop-filter: blur(18px);
  }

  .mobile-nav-button {
    display: grid;
    justify-items: center;
    gap: 0.22rem;
    padding: 0.58rem 0.25rem 0.5rem;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
  }

  .mobile-nav-button.active {
    background: linear-gradient(180deg, rgba(92, 97, 240, 0.12), rgba(26, 161, 135, 0.1));
    color: var(--text);
  }

  .mobile-nav-button svg {
    width: 18px;
    height: 18px;
  }

  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-actions .button-row {
    justify-content: stretch;
  }
}

/* --- vNext workflow refinements --- */
.topbar-account-actions {
  margin-left: auto;
}

.topbar-signout {
  white-space: nowrap;
}

.section-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.3rem;
  border-radius: 18px;
  background: rgba(92, 97, 240, 0.08);
}

.section-tab {
  padding: 0.8rem 1rem;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.section-tab.active {
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(16, 22, 34, 0.06);
}

.capture-mode-card,
.review-entry-preview {
  display: grid;
  gap: 1rem;
}

.capture-actions {
  align-items: stretch;
}

.review-entry-preview {
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid rgba(24, 28, 39, 0.08);
  background: linear-gradient(180deg, rgba(92, 97, 240, 0.05), rgba(255, 255, 255, 0.75));
}

.review-entry-preview p {
  margin: 0;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
}

.library-hero-actions {
  justify-content: flex-end;
}

.section-intro-copy {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.6;
}

.workflow-preview-list {
  display: grid;
  gap: 0.8rem;
}

.workflow-preview-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(24, 28, 39, 0.06);
  background: rgba(255, 255, 255, 0.72);
}

.workflow-preview-copy {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.workflow-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.workflow-preview-title,
.workflow-preview-item p {
  margin: 0;
}

.workflow-preview-title {
  font-weight: 700;
  color: var(--text);
}

.compact-entry-card .entry-card-main {
  gap: 0.75rem;
}

.compact-meta-row {
  gap: 0.55rem;
}

.compact-entry-card .entry-quote {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
}

.compact-entry-card .entry-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.compact-tag-row {
  margin-top: 0.2rem;
}

.compact-foot-row {
  row-gap: 0.5rem;
}

.compact-entry-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-entry-actions-library {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.project-next-move {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: 16px;
  background: rgba(92, 97, 240, 0.08);
  color: var(--text);
}

.line-clamp-2,
.line-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  -webkit-line-clamp: 2;
}

.line-clamp-3 {
  -webkit-line-clamp: 3;
}

.selector-panel-head-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 1rem;
  align-items: end;
}

.selector-search-label span {
  display: block;
  margin-bottom: 0.4rem;
}

.selector-list-rich {
  max-height: 340px;
}

.rich-selector-item {
  display: grid;
  gap: 0.8rem;
}

.rich-selector-item.selected {
  border-color: rgba(92, 97, 240, 0.16);
  background: rgba(255, 255, 255, 0.92);
}

.selector-check-row {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
}

.selector-check-row input {
  width: 1rem;
  height: 1rem;
  margin-top: 0.18rem;
}

.is-strongest {
  border-color: rgba(228, 166, 44, 0.24);
  background: rgba(228, 166, 44, 0.12);
}

@media (max-width: 980px) {
  .selector-panel-head-wrap {
    grid-template-columns: 1fr;
  }

  .workflow-preview-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

.notice.success {
  background: rgba(26, 161, 135, 0.12);
  border-color: rgba(26, 161, 135, 0.22);
  color: #155e52;
}

.compact-entry-actions-wide {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
    min-height: 100svh;
    min-height: 100dvh;
  }

  .sidebar {
    position: relative;
    top: auto;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .workspace-shell {
    display: block;
    min-height: 0;
  }

  .workspace {
    overflow: visible;
  }

  .entry-card {
    overflow: visible;
  }

  .entry-card-main {
    padding-right: 3.1rem;
    width: calc(100% - 3.1rem);
  }

  .entry-card-action-menu-wrap {
    z-index: 3;
    display: grid;
    justify-items: end;
    gap: 0.45rem;
    max-width: 100%;
    margin-top: 0.75rem;
  }

  .entry-card-menu-button {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    min-width: 2.75rem;
    min-height: 2.75rem;
  }

  .entry-card-action-menu {
    position: relative;
    z-index: 3;
    width: min(240px, calc(100vw - 2.6rem));
  }

  .compact-entry-actions {
    display: none;
  }

  .modal-backdrop {
    padding: 0;
    align-items: stretch;
    z-index: 50;
  }

  .modal-panel:not(.source-detail-modal),
  .modal-panel.wide:not(.source-detail-modal) {
    width: 100%;
    max-height: 100svh;
    max-height: 100dvh;
    min-height: 100svh;
    min-height: 100dvh;
    border-radius: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-body {
    padding: 1rem;
    padding-bottom: var(--mobile-bottom-clearance);
  }

  .entry-view-mobile-actions {
    position: sticky;
    top: 0.4rem;
    z-index: 3;
    display: flex;
    justify-content: flex-end;
    justify-self: end;
    width: max-content;
  }

  .entry-view-desktop-actions {
    display: none;
  }

  .source-detail-modal {
    width: min(680px, calc(100% - 1rem));
    max-height: calc(100svh - 1rem);
    max-height: calc(100dvh - 1rem);
    min-height: 0;
    align-self: center;
    border-radius: 24px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .source-detail-modal .modal-header {
    padding: 0.9rem 1rem;
  }

  .source-detail-modal .modal-header h2 {
    overflow-wrap: anywhere;
  }

  .source-detail-modal .modal-body {
    padding: 0.95rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  }

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

  .home-source-list .source-cover-shell {
    height: clamp(118px, 36vw, 148px);
  }

  .home-list-item span,
  .home-list-item small {
    white-space: normal;
  }

  #library-panel-sources .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  #library-panel-sources .source-grid {
    grid-template-columns: 1fr;
  }

  #library-panel-sources .section-inline-note {
    white-space: normal;
  }

  #library-panel-sources .source-card {
    padding: 0.8rem;
  }

  #library-panel-sources .source-card-main {
    gap: 0.75rem;
  }

  #library-panel-sources .source-cover-shell {
    height: clamp(124px, 38vw, 148px);
  }

  #library-panel-sources .source-card-body,
  .source-detail-copy {
    gap: 0.55rem;
  }

  .source-detail-copy {
    min-width: 0;
  }

  #library-panel-sources .source-card h3 {
    font-size: 0.98rem;
  }

  #library-panel-sources .source-card-foot {
    font-size: 0.82rem;
  }

  .source-detail-head {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 0.75rem;
    align-items: start;
  }

  .source-cover-shell.large {
    width: 88px;
    height: 124px;
  }

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

  .capture-mode-card {
    gap: 0.85rem;
  }

  .capture-mode-card .section-tabs {
    width: 100%;
  }

  .capture-mode-card .section-tab {
    min-height: 3rem;
    padding: 0.72rem 0.85rem;
  }

  .capture-mode-card .stack-form,
  .capture-actions,
  .filters-toggle-row {
    gap: 0.65rem;
  }

  .entry-card-filter-row,
  .filter-pill-row {
    gap: 0.45rem;
  }
}
html {
  font-size: 16px;
}

body {
  margin: 0;
}
