.execution-log {
  --log-border: hsl(0, 0%, 86%);
  --log-dot: hsl(217, 71%, 53%);
  --log-dot-size: 12px;
  --log-line-left: 5px;

  position: relative;
  padding-left: 2rem;

  &::before {
    content: "";
    position: absolute;
    left: var(--log-line-left);
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--log-border);
  }

  .log-entry {
    position: relative;
    margin-bottom: 1.25rem;

    &::before {
      content: "";
      position: absolute;
      left: calc(-2rem + var(--log-line-left) - var(--log-dot-size) / 2 + 1px);
      top: 0.35rem;
      width: var(--log-dot-size);
      height: var(--log-dot-size);
      border-radius: 50%;
      background: var(--log-dot);
      border: 2px solid white;
    }
  }

  .log-time {
    font-size: 0.75rem;
    color: hsl(0, 0%, 48%);
  }

  .log-message {
    font-weight: 600;
  }

  .log-detail {
    margin-top: 0.5rem;

    summary {
      cursor: pointer;
      font-size: 0.875rem;
      color: hsl(217, 71%, 53%);
    }

    pre {
      margin-top: 0.5rem;
      font-size: 0.8rem;
      max-height: 400px;
      overflow: auto;
    }
  }
}

.claude-session-layout {
  --cs-line: hsl(0, 0%, 88%);
  --cs-muted: hsl(0, 0%, 45%);
  --cs-agent: hsl(16, 85%, 55%);
  --cs-code-bg: hsl(0, 0%, 96%);

  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 1.5rem;
  align-items: start;

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

/* ---------- transcript ---------- */

.cs-transcript {
  font-size: 0.9rem;
  padding: 1.25rem 1.5rem;
}

.cs-entry {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr);
  column-gap: 0.5rem;
  position: relative;
  padding: 0.1rem 0;

  &::before {
    content: "";
    position: absolute;
    left: calc(0.875rem - 1px);
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--cs-line);
  }
}

#claude_session_entries > .cs-entry:first-child::before { top: 0.9rem; }
#claude_session_entries > .cs-entry:last-child::before { bottom: calc(100% - 0.9rem); }

.cs-marker {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 1.6rem;
  color: var(--cs-muted);

  .material-symbols-outlined {
    font-size: 18px;
    padding: 2px;
    background: white;
    border-radius: 50%;
  }
}

.cs-marker-agent .material-symbols-outlined {
  color: var(--cs-agent);
  font-weight: 700;
}

.cs-marker-done .material-symbols-outlined { color: hsl(141, 53%, 43%); }

.cs-body {
  min-width: 0;
  padding: 0.15rem 0 0.4rem;
}

/* ---------- markdown responses ---------- */

.cs-markdown {
  line-height: 1.55;

  > *:first-child { margin-top: 0; }
  > *:last-child { margin-bottom: 0; }

  h1, h2, h3, h4 { font-weight: 700; line-height: 1.3; margin: 1.1em 0 0.4em; }
  h1 { font-size: 1.15rem; }
  h2 { font-size: 1.05rem; }
  h3 { font-size: 0.98rem; }
  p { margin: 0.5em 0; }
  ul, ol { margin: 0.5em 0; padding-left: 1.4em; }
  li { margin: 0.2em 0; }

  code {
    background: var(--cs-code-bg);
    padding: 0.1em 0.35em;
    border-radius: 4px;
    font-size: 0.85em;
  }

  pre {
    background: var(--cs-code-bg);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    overflow: auto;
    max-height: 420px;

    code { background: none; padding: 0; }
  }

  a { color: hsl(217, 71%, 45%); text-decoration: underline; }

  blockquote {
    border-left: 3px solid var(--cs-line);
    margin: 0.5em 0;
    padding-left: 0.8em;
    color: var(--cs-muted);
  }

  table { border-collapse: collapse; margin: 0.5em 0; }
  th, td { border: 1px solid var(--cs-line); padding: 0.3em 0.6em; }
}

/* ---------- collapsible tool / result / thinking rows ---------- */

.cs-collapsible {
  min-width: 0;

  summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    list-style: none;
    padding: 0.3rem 0;

    &::-webkit-details-marker { display: none; }
    &:hover .cs-tool-name { color: black; }
  }

  .cs-chevron {
    margin-left: auto;
    font-size: 18px;
    color: hsl(0, 0%, 65%);
    transition: transform 0.15s ease;
  }

  &[open] .cs-chevron { transform: rotate(180deg); }

  .cs-collapsible-body {
    margin: 0.15rem 0 0.6rem;
    font-size: 0.8rem;
  }

  pre {
    background: var(--cs-code-bg);
    padding: 0.7rem 0.9rem;
    border-radius: 6px;
    margin: 0;
    max-height: 420px;
    overflow: auto;
  }
}

.cs-static-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
}

.cs-empty { font-style: italic; color: hsl(0, 0%, 70%); }

.cs-tool-name { font-weight: 600; color: hsl(0, 0%, 20%); white-space: nowrap; }

.cs-tool-arg {
  flex: 1 1 auto;
  min-width: 0;
  font-family: monospace;
  font-size: 0.82rem;
  color: var(--cs-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-tool-glyph { color: hsl(0, 0%, 40%); }

.cs-kind-label {
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--cs-muted);
  white-space: nowrap;
}

.cs-preview {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.82rem;
  color: var(--cs-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-meta { font-size: 0.72rem; color: hsl(0, 0%, 65%); white-space: nowrap; }

.cs-result-error {
  .cs-kind-label,
  .cs-marker .material-symbols-outlined { color: hsl(348, 86%, 53%); }
}

.cs-thinking-text {
  font-style: italic;
  color: var(--cs-muted);
  white-space: pre-wrap;
  font-size: 0.85rem;
}

/* ---------- task chips ---------- */

.cs-task-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-top: 0.3rem;
}

.cs-task-verb { font-weight: 600; color: hsl(0, 0%, 25%); }
.cs-task-glyph { color: hsl(141, 53%, 43%); }

.cs-status {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.1em 0.55em;
  border-radius: 999px;
  background: hsl(0, 0%, 93%);
  color: var(--cs-muted);
}

.cs-status-completed { background: hsl(141, 70%, 92%); color: hsl(141, 60%, 30%); }
.cs-status-in_progress { background: hsl(217, 90%, 93%); color: hsl(217, 71%, 40%); }

.cs-done {
  margin-top: 0.5rem;

  .cs-done-label {
    display: inline-block;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: hsl(141, 53%, 38%);
    margin-bottom: 0.3rem;
  }
}

/* ---------- sidebar ---------- */

.cs-sidebar {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;

  @media (max-width: 900px) {
    position: static;
    max-height: none;
  }
}

.cs-panel {
  border: 1px solid var(--cs-line);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.cs-panel-title {
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cs-muted);
  margin-bottom: 0.5rem;
}

.cs-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0;
  cursor: pointer;
  font-size: 0.88rem;

  .cs-filter-label { flex: 1 1 auto; }
  .cs-filter-count { color: hsl(0, 0%, 60%); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
  .cs-filter-box { accent-color: var(--cs-agent); }
}

.cs-filter-sub {
  padding-left: 1.4rem;
  font-size: 0.83rem;

  .cs-filter-label { color: var(--cs-muted); }
}

/* ---------- filter visibility toggles ---------- */

.cs-hide-response [data-cs-kind="response"],
.cs-hide-thinking [data-cs-kind="thinking"],
.cs-hide-tool [data-cs-kind="tool"],
.cs-hide-result [data-cs-kind="result"],
.cs-hide-response-text [data-cs-response="text"],
.cs-hide-response-done [data-cs-response="done"],
.cs-hide-tool-read [data-cs-tool="read"],
.cs-hide-tool-bash [data-cs-tool="bash"],
.cs-hide-tool-edit [data-cs-tool="edit"],
.cs-hide-tool-other [data-cs-tool="other"] {
  display: none;
}

.cs-filter-box:disabled {
  cursor: not-allowed;
}

.cs-filter:has(.cs-filter-box:disabled) {
  cursor: not-allowed;
  opacity: 0.5;
}

.todo-nav {
  .todo-item {
    padding: 0;
    border-radius: 4px;

    a, a:hover, a:focus {
      display: flex;
      align-items: flex-start;
      gap: 0.5rem;
      color: inherit;
      text-decoration: none;
      padding: 0.25rem 0.5rem;
      width: 100%;
      border-radius: 4px;
    }

    span:not(.material-symbols-outlined) {
      min-width: 0;
      word-break: break-word;
    }

    &:hover a {
      background: hsl(0, 0%, 93%);
    }

    &.is-active > a,
    &.is-active {
      background: hsl(217, 71%, 93%);
    }

    &.todo-completed span:not(.material-symbols-outlined) {
      text-decoration: none;
      color: inherit;
    }
  }
}

.status-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
  animation: status-pulse 1.5s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.todo-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;

  .todo-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.15rem 0;

    &.todo-completed span:not(.material-symbols-outlined) {
      text-decoration: line-through;
      color: hsl(0, 0%, 48%);
    }

    &.todo-in_progress span:not(.material-symbols-outlined) {
      font-weight: 600;
    }

    .material-symbols-outlined.has-text-info {
      animation: status-pulse 1.5s ease-in-out infinite;
    }
  }
}
