:root {
  --bg: #f6f0e5;
  --bg-strong: #efe0c2;
  --surface: rgba(255, 252, 246, 0.88);
  --surface-strong: #fffaf0;
  --ink: #172230;
  --muted: #556271;
  --line: rgba(23, 34, 48, 0.12);
  --accent: #115d7a;
  --accent-soft: #d7eef7;
  --signal: #d97b2d;
  --success: #3f7e4d;
  --shadow: 0 18px 60px rgba(23, 34, 48, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Manrope', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(217, 123, 45, 0.2), transparent 28%),
    radial-gradient(circle at top right, rgba(17, 93, 122, 0.17), transparent 26%),
    linear-gradient(180deg, #f7f3ea 0%, #efe5cf 100%);
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(23, 34, 48, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 34, 48, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85), transparent);
}

#app {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100vw - 32px));
  margin: 24px auto 48px;
}

.shell {
  display: grid;
  gap: 20px;
}

.hero,
.card,
.panel,
.workspace,
.feed-card,
.entry-card {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero {
  border-radius: 36px;
  padding: 28px;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
}

.hero h1,
.workspace-title,
.section-title {
  margin: 0;
  font-family: 'Fraunces', serif;
  line-height: 1.02;
}

.hero h1 {
  font-size: clamp(2.8rem, 6vw, 4.8rem);
  letter-spacing: -0.05em;
}

.hero p {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 58ch;
}

.badge-row,
.stats,
.pill-row,
.presence-list,
.section-pills,
.team-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge,
.pill,
.presence-pill,
.template-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
}

.badge,
.template-pill {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(23, 34, 48, 0.08);
}

.template-pill.is-active {
  background: var(--ink);
  color: white;
  border-color: transparent;
}

.pill {
  background: var(--accent-soft);
  color: var(--accent);
}

.presence-pill {
  background: rgba(17, 93, 122, 0.08);
  border: 1px solid rgba(17, 93, 122, 0.1);
}

.panel-grid,
.workspace-grid {
  display: grid;
  gap: 20px;
}

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

.workspace-grid {
  grid-template-columns: 320px minmax(0, 1fr);
}

.notebook-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.45fr) 320px;
}

.card,
.panel,
.workspace,
.feed-card,
.entry-card {
  border-radius: var(--radius-lg);
  padding: 20px;
}

.workspace {
  padding: 24px;
}

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

.notebook-header {
  gap: 24px;
  margin-bottom: 24px;
}

.notebook-heading {
  flex: 1;
}

.notebook-title-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}

.notebook-subtitle {
  max-width: 56ch;
}

.notebook-stats {
  justify-content: end;
}

.notebook-actions {
  justify-content: end;
}

.workspace-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.94rem;
  font-weight: 600;
}

.field-group {
  display: grid;
  gap: 8px;
  font-size: 0.94rem;
  font-weight: 600;
}

.field-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field-label {
  display: inline-flex;
  align-items: center;
}

.field-inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

.field-inline-toggle input {
  width: auto;
  margin: 0;
}

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

input,
select,
textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(23, 34, 48, 0.14);
  background: var(--surface-strong);
  color: var(--ink);
  padding: 13px 14px;
}

textarea {
  min-height: 130px;
  resize: vertical;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 150ms ease, filter 150ms ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

button.template-pill {
  padding: 9px 14px;
  border: 1px solid rgba(23, 34, 48, 0.08);
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
}

.btn-primary {
  background: var(--ink);
  color: white;
}

.btn-accent {
  background: var(--signal);
  color: white;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  border: 1px solid rgba(23, 34, 48, 0.08);
}

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

.composer-actions button {
  flex: 1 1 180px;
}

.composer-submit-actions button {
  flex: 1 1 220px;
}

#ai-summary-slot:empty {
  display: none;
}

.note {
  font-size: 0.92rem;
  color: var(--muted);
}

.success {
  color: var(--success);
  font-weight: 700;
}

.warning {
  color: var(--signal);
  font-weight: 700;
}

.error {
  color: #b43535;
  font-weight: 700;
}

.feed-card,
.entry-card {
  display: grid;
  gap: 10px;
}

.team-card-stats,
.collaborator-stat-list,
.collaborator-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.collaborator-stat-list {
  align-items: center;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(23, 34, 48, 0.06);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
}

.stat-chip-muted {
  background: rgba(180, 53, 53, 0.08);
  color: #8f2d2d;
}

.capture-meta,
.timeline-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.capture-stamp {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(17, 93, 122, 0.08);
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
}

.entry-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.entry-title {
  margin: 0;
  font-size: 1.08rem;
}

.entry-heading {
  gap: 6px;
}

.entry-summary {
  list-style: none;
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  cursor: pointer;
}

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

.entry-summary-main {
  display: grid;
  gap: 10px;
}

.entry-date-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(17, 93, 122, 0.12), rgba(217, 123, 45, 0.14));
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
}

.entry-takeaway {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.entry-summary-assets {
  padding-top: 2px;
}

.entry-body {
  display: grid;
  gap: 14px;
  padding-top: 8px;
  border-top: 1px solid rgba(23, 34, 48, 0.08);
}

.entry-block {
  display: grid;
  gap: 8px;
}

.entry-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.asset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.asset-row-compact {
  gap: 10px;
}

.asset-card {
  margin: 0;
}

.asset-card-compact {
  margin: 0;
}

.asset-row img {
  width: 132px;
  height: 100px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  display: block;
}

.asset-row-compact img {
  width: 86px;
  height: 64px;
}

.timeline-stack,
.timeline-day-list {
  display: grid;
  gap: 16px;
}

.timeline-day {
  display: grid;
  gap: 12px;
}

.timeline-day-label {
  font-family: 'Fraunces', serif;
  font-size: 1.1rem;
  color: var(--ink);
}

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

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

.ai-box {
  background: linear-gradient(135deg, rgba(17, 93, 122, 0.08), rgba(217, 123, 45, 0.08));
  border-radius: var(--radius-md);
  border: 1px solid rgba(23, 34, 48, 0.08);
  padding: 16px;
}

.empty {
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.56);
  border: 1px dashed rgba(23, 34, 48, 0.16);
  color: var(--muted);
}

.collaborator-panel {
  display: grid;
}

.collaborator-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(23, 34, 48, 0.08);
}

.collaborator-row.is-blocked {
  background: rgba(180, 53, 53, 0.06);
  border-color: rgba(180, 53, 53, 0.12);
}

.collaborator-meta {
  min-width: 0;
}

@media (max-width: 960px) {
  .hero,
  .panel-grid,
  .workspace-grid,
  .notebook-layout,
  .split,
  .split-3 {
    grid-template-columns: 1fr;
  }

  #app {
    width: min(100vw - 20px, 1240px);
    margin: 12px auto 28px;
  }

  .hero {
    padding: 22px;
  }

  .workspace {
    padding: 18px;
  }

  .workspace-header,
  .notebook-title-row {
    flex-direction: column;
    align-items: stretch;
  }

  .notebook-actions,
  .notebook-stats {
    justify-content: start;
  }

  .entry-summary {
    grid-template-columns: 1fr;
  }

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