:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-soft: #fbfbfa;
  --ink: #101010;
  --muted: #696969;
  --faint: #8d8d8d;
  --line: #e4e4df;
  --line-strong: #d0d0ca;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
  --small-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
  --radius: 8px;
  --sidebar: 248px;
  --detail: 328px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(247, 247, 245, 0.8)),
    var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

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

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

.sidebar,
.detail-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(18px);
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 18px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px 18px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border: 1px solid #111;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #111 0 4px, transparent 5px),
    #fff;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.1;
}

.brand span,
.sidebar-heading,
.eyebrow,
.counter-pill,
.capture-footer span,
.mini-item span,
.digest-preview p,
.metric span,
.item-meta,
.detail-kicker,
.small-panel p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.primary-action,
.dark-button {
  border: 0;
  background: #111;
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--small-shadow);
}

.primary-action {
  width: 100%;
  min-height: 42px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.button-icon {
  font-size: 20px;
  line-height: 0.8;
}

.nav-list,
.mini-list,
.item-list,
.library-grid,
.stack-list,
.theme-list {
  display: grid;
  gap: 8px;
}

.nav-item,
.text-button,
.filter-chip,
.capture-type,
.stack-list button {
  border: 1px solid transparent;
  background: transparent;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: #3b3b3b;
  text-align: left;
}

.nav-item:hover,
.nav-item.active,
.filter-chip.active,
.capture-type.active,
.prompt-chips button:hover,
.stack-list button:hover {
  background: #f0f0ed;
  border-color: var(--line);
}

.nav-icon {
  width: 22px;
  display: grid;
  place-items: center;
  color: #222;
}

.sidebar-group {
  margin-top: 26px;
}

.sidebar-heading {
  padding: 0 8px 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mini-item {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  padding: 10px;
}

.mini-item strong {
  display: block;
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 30px;
}

.topbar h1,
.ask-copy h2,
.mic-zone h2,
.section-head h2,
.digest-head h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 32px;
  line-height: 1.08;
  font-weight: 650;
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button,
.profile-button,
.send-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.icon-button,
.profile-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}

.profile-button {
  background: #111;
  color: #fff;
  border-color: #111;
  font-weight: 700;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.4fr);
  gap: 16px;
}

.ask-panel,
.mic-zone,
.capture-strip,
.digest-preview,
.item-card,
.library-card,
.conversation-shell,
.digest-main,
.small-panel,
.empty-state {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.ask-panel {
  min-height: 260px;
  padding: clamp(24px, 5vw, 48px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 34px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(246, 246, 242, 0.88)),
    var(--surface);
  box-shadow: var(--shadow);
}

.ask-copy h2 {
  max-width: 650px;
  font-size: clamp(38px, 5vw, 68px);
  line-height: 0.95;
  font-weight: 720;
}

.ask-bar,
.chat-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 22px;
  padding: 8px;
}

.ask-bar input,
.chat-input input,
.filter-search input,
.capture-box textarea {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.ask-bar input,
.chat-input input {
  min-height: 36px;
  padding: 0 10px;
  font-size: 15px;
}

.send-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #111;
  color: #fff;
  border-color: #111;
}

.mic-zone {
  padding: 24px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  gap: 18px;
}

.mic-button {
  position: relative;
  width: 134px;
  height: 134px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid #111;
  color: #fff;
  background: #111;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}

.mic-button svg {
  width: 42px;
  height: 42px;
}

.mic-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
}

.mic-button.recording .mic-ring {
  animation: pulse 1.1s ease-out infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    opacity: 1;
  }
  100% {
    transform: scale(1.14);
    opacity: 0;
  }
}

.mic-zone h2 {
  font-size: 24px;
}

.mic-zone p {
  margin: 6px 0 0;
  color: var(--muted);
}

.capture-strip,
.split-sections,
.library-toolbar,
.digest-head {
  margin-top: 16px;
}

.capture-strip {
  padding: 18px;
}

.section-head,
.digest-head,
.library-toolbar,
.capture-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-head.compact {
  margin-bottom: 10px;
}

.section-head h2,
.digest-head h2 {
  font-size: 22px;
  line-height: 1.2;
}

.counter-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.capture-types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 10px;
}

.capture-type {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: #333;
}

.capture-type span {
  width: 20px;
  display: grid;
  place-items: center;
  font-weight: 650;
}

.capture-type svg {
  width: 17px;
  height: 17px;
}

.capture-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.capture-box textarea {
  display: block;
  min-height: 96px;
  padding: 16px;
  resize: vertical;
  line-height: 1.5;
}

.capture-footer {
  min-height: 54px;
  border-top: 1px solid var(--line);
  padding: 10px 12px 10px 16px;
}

.dark-button {
  min-height: 36px;
  padding: 0 16px;
}

.split-sections {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 16px;
}

.text-button {
  color: #111;
  padding: 0;
}

.item-card,
.library-card {
  padding: 14px;
  text-align: left;
}

.item-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
}

.item-card button,
.library-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.item-card h3,
.library-card h3,
.digest-preview p,
.small-panel h3 {
  margin: 0;
}

.item-card h3,
.library-card h3 {
  font-size: 15px;
  line-height: 1.25;
}

.item-card p,
.library-card p {
  margin: 8px 0 0;
  color: #555;
  font-size: 13px;
  line-height: 1.45;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.type-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #555;
  font-size: 12px;
}

.digest-preview {
  padding: 18px;
}

.metric {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}

.metric strong {
  font-size: 42px;
  line-height: 1;
}

.theme-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.theme-list span {
  min-height: 74px;
  display: flex;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-size: 13px;
}

.library-toolbar {
  align-items: stretch;
}

.filter-search {
  min-width: 260px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 0 12px;
}

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

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.filter-chip {
  min-height: 42px;
  padding: 0 13px;
  border-radius: var(--radius);
  white-space: nowrap;
}

.library-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

.library-card {
  min-height: 184px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  cursor: pointer;
}

.library-card:hover,
.item-card:hover {
  border-color: #bcbcb6;
  box-shadow: var(--small-shadow);
}

.conversation-shell {
  min-height: calc(100vh - 128px);
  display: grid;
  grid-template-rows: minmax(320px, 1fr) auto auto;
  padding: 18px;
}

.conversation {
  overflow: auto;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  max-width: 760px;
}

.user-message {
  align-self: flex-end;
  grid-template-columns: minmax(0, 1fr) 34px;
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}

.user-message .avatar {
  grid-column: 2;
  grid-row: 1;
  background: #111;
  color: #fff;
  border-color: #111;
}

.bubble {
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
}

.user-message .bubble {
  background: #111;
  color: #fff;
  border-color: #111;
}

.bubble p,
.bubble ul {
  margin: 0;
}

.bubble ul {
  padding-left: 18px;
  margin-top: 8px;
}

.source-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.prompt-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 0 10px;
}

.prompt-chips button {
  min-height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0 12px;
  white-space: nowrap;
  font-size: 13px;
}

.digest-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  margin-top: 16px;
}

.segmented-control {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
}

.segmented-control button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 0 14px;
}

.segmented-control button.active {
  background: #111;
  color: #fff;
}

.digest-main,
.small-panel {
  padding: 18px;
}

.digest-main h3 {
  margin: 0 0 14px;
  font-size: 26px;
}

.digest-section {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.digest-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.digest-section h4 {
  margin: 0 0 10px;
  font-size: 15px;
}

.digest-section p,
.digest-section li {
  color: #4b4b4b;
  line-height: 1.55;
}

.digest-section p,
.digest-section ul {
  margin: 0;
}

.digest-section ul {
  padding-left: 18px;
}

.digest-aside {
  display: grid;
  align-content: start;
  gap: 16px;
}

.small-panel h3 {
  font-size: 14px;
  margin-bottom: 12px;
}

.stack-list button {
  width: 100%;
  min-height: 40px;
  border-color: var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
  padding: 0 10px;
  font-size: 13px;
}

.detail-panel {
  border-left: 1px solid var(--line);
  padding: 22px;
}

.detail-empty {
  min-height: calc(100vh - 44px);
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

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

.detail-hero {
  min-height: 150px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, #fff, #efefec);
  color: #111;
  font-size: 42px;
  font-weight: 720;
}

.detail-card h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.18;
}

.detail-card p {
  margin: 0;
  color: #4f4f4f;
  line-height: 1.55;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 16px);
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.92);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  box-shadow: var(--shadow);
  font-size: 13px;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .detail-panel {
    display: none;
  }

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

@media (max-width: 860px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    display: grid;
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    padding-bottom: 0;
  }

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

  .nav-item {
    justify-content: center;
  }

  .nav-item .nav-icon {
    display: none;
  }

  .sidebar-group {
    display: none;
  }

  .main {
    padding: 20px;
  }

  .home-grid,
  .split-sections,
  .digest-layout,
  .library-toolbar {
    grid-template-columns: 1fr;
    display: grid;
  }

  .ask-panel {
    min-height: 220px;
  }

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

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
  }

  .topbar h1 {
    font-size: 27px;
  }

  .ask-copy h2 {
    font-size: 40px;
  }

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

  .capture-footer,
  .section-head,
  .digest-head {
    align-items: flex-start;
    flex-direction: column;
  }

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