:root {
    --color-bg: #0f1117;
    --color-surface: #1a1d27;
    --color-border: #2a2d3a;
    --color-text: #e1e4ed;
    --color-text-muted: #8b8fa3;
    --color-idle: #6b7280;
    --color-working: #3b82f6;
    --color-pending: #f59e0b;
    --color-done: #22c55e;
    --color-claude: #d97757;
    --color-dsh: #4d6bfe;
    --color-connected: #22c55e;
    --color-disconnected: #ef4444;
    --color-danger: #ef4444;
    --color-warning: #d97706;
    --color-warning-bg: rgba(217, 119, 6, 0.12);
    --color-warning-border: rgba(217, 119, 6, 0.35);
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
}

/* ---- Header ---- */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.header__title {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header__icon {
    flex-shrink: 0;
}

.header__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header__status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.connection-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-disconnected);
    transition: background 0.3s;
}

.connection-indicator.connected {
    background: var(--color-connected);
}

/* ---- Hooks Banner ---- */

.hooks-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px;
    border-radius: var(--radius);
    background: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
}

.hooks-banner.hidden {
    display: none;
}

.hooks-banner__badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-warning);
    white-space: nowrap;
}

/* ---- Buttons ---- */

.btn {
    padding: 6px 14px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.btn:hover {
    background: color-mix(in srgb, var(--color-working) 15%, var(--color-surface));
    border-color: var(--color-working);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn--warning {
    border-color: var(--color-warning);
    color: var(--color-warning);
    background: transparent;
}

.btn--warning:hover {
    background: var(--color-warning-bg);
}

.btn--icon {
    position: relative;
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 6px;
    font-family: "DejaVu Sans", "Segoe UI Symbol", system-ui, sans-serif;
}

.btn--icon:hover {
    background: color-mix(in srgb, var(--color-text-muted) 15%, transparent);
    border-color: var(--color-border);
}

.btn--primary {
    border-color: var(--color-working);
    background: color-mix(in srgb, var(--color-working) 20%, transparent);
    color: var(--color-working);
}

.btn--primary:hover {
    background: color-mix(in srgb, var(--color-working) 35%, transparent);
}

.btn--danger {
    border-color: var(--color-danger);
    color: var(--color-danger);
    background: transparent;
}

.btn--danger:hover {
    background: color-mix(in srgb, var(--color-danger) 15%, transparent);
}

.btn--check {
    border-color: var(--color-warning);
    color: var(--color-warning);
    background: transparent;
}

.btn--check:hover {
    background: color-mix(in srgb, var(--color-warning) 15%, transparent);
}

.btn--small {
    padding: 3px 10px;
    font-size: 12px;
}

/* ---- Feedback text ---- */

.install-feedback {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.install-feedback.success {
    color: var(--color-done);
}

.install-feedback.error {
    color: var(--color-disconnected);
}

/* ---- Settings Panel ---- */

.settings-panel {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 20px 24px;
}

.settings-panel.hidden {
    display: none;
}

.settings-panel__content {
    width: 100%;
}

.settings-panel__title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.settings-panel__docker-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    vertical-align: middle;
}
.settings-panel__docker-badge.docker {
    background: #1b3a5c;
    color: #58a6ff;
}
.settings-panel__docker-badge.native {
    background: #1a3a1a;
    color: #3fb950;
}

.settings-panel__fields {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.settings-panel__label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--color-text-muted);
    flex: 1;
}

.settings-panel__input {
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 13px;
    font-family: "SF Mono", "Fira Code", monospace;
}

.settings-panel__input--short {
    max-width: 100px;
    flex: 1;
}

.settings-panel__hint {
    font-size: 11px;
    color: var(--color-text-muted);
}

.settings-panel__hint code {
    font-family: "SF Mono", "Fira Code", monospace;
    background: var(--color-bg);
    padding: 1px 4px;
    border-radius: 3px;
}

.settings-panel__divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 16px 0;
}

.settings-panel__row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.settings-panel__label-text {
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.settings-panel__hook-status {
    font-size: 12px;
    font-weight: 600;
}

.settings-panel__hook-status.installed {
    color: var(--color-done);
}

.settings-panel__hook-status.not-installed {
    color: var(--color-warning);
}

.settings-panel__feedback {
    display: block;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 500;
}

.settings-panel__feedback.success {
    color: var(--color-done);
}

.settings-panel__feedback.error {
    color: var(--color-disconnected);
}

/* ---- Sections ---- */

.main {
    padding: 24px;
}

.section {
    margin-bottom: 24px;
}

.section__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 12px;
}

.section__header:hover .section__title {
    color: var(--color-text);
}

.section__toggle {
    font-size: 11px;
    color: var(--color-text-muted);
    width: 16px;
    text-align: center;
    transition: transform 0.15s;
}

.section__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section__count {
    font-size: 12px;
    color: var(--color-text-muted);
    background: var(--color-bg);
    padding: 1px 8px;
    border-radius: 10px;
}

.section__breakdown {
    display: flex;
    gap: 4px;
    margin-left: 8px;
    flex-wrap: wrap;
}

.breakdown-badge {
    font-size: 10px !important;
    padding: 1px 6px !important;
}

.section__body.hidden {
    display: none;
}

/* ---- Session Grid ---- */

.session-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    align-items: stretch;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--color-text-muted);
    padding: 48px 0;
    font-size: 15px;
}

/* ---- Session Card ---- */

.session-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    transition: border-color 0.2s;
    display: flex;
    flex-direction: column;
}

.session-card:hover {
    border-color: var(--color-text-muted);
}

/* Card state borders */
.session-card.card--working {
    border-color: var(--color-working);
    animation: card-pulse-blue 3s ease-in-out infinite;
}

.session-card.card--pending_approval {
    border-color: var(--color-pending);
    animation: card-pulse-yellow 1.5s ease-in-out infinite;
}

.session-card.card--pending_review,
.session-card.card--all_done {
    border-color: var(--color-done);
}

.session-card.card--archived {
    opacity: 0.65;
}

@keyframes card-pulse-blue {
    0%, 100% { border-color: var(--color-working); }
    50% { border-color: color-mix(in srgb, var(--color-working) 40%, transparent); }
}

@keyframes card-pulse-yellow {
    0%, 100% { border-color: var(--color-pending); }
    50% { border-color: color-mix(in srgb, var(--color-pending) 40%, transparent); }
}

.session-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.session-card__identity {
    min-width: 0;
    flex: 1;
}

.session-card__title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.session-card__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

.session-card__agent {
    flex-shrink: 0;
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 5px;
    border-radius: 4px;
    letter-spacing: 0.03em;
}

.agent-claude {
    background: color-mix(in srgb, var(--color-claude) 18%, transparent);
    color: var(--color-claude);
    border: 1px solid color-mix(in srgb, var(--color-claude) 45%, transparent);
}

.agent-dsh {
    background: color-mix(in srgb, var(--color-dsh) 18%, transparent);
    color: var(--color-dsh);
    border: 1px solid color-mix(in srgb, var(--color-dsh) 45%, transparent);
}

.session-card__subtitle {
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 11px;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-card__badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.badge-idle {
    background: color-mix(in srgb, var(--color-idle) 20%, transparent);
    color: var(--color-idle);
}

.badge-working {
    background: color-mix(in srgb, var(--color-working) 20%, transparent);
    color: var(--color-working);
    animation: pulse 2s ease-in-out infinite;
}

.badge-pending_approval {
    background: color-mix(in srgb, var(--color-pending) 20%, transparent);
    color: var(--color-pending);
    animation: pulse 1s ease-in-out infinite;
}

.badge-all_done,
.badge-pending_review {
    background: color-mix(in srgb, var(--color-done) 20%, transparent);
    color: var(--color-done);
}

.badge-archived {
    background: color-mix(in srgb, var(--color-text-muted) 15%, transparent);
    color: var(--color-text-muted);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.session-card__summary {
    font-size: 13px;
    color: var(--color-text);
    line-height: 1.4;
    margin-bottom: 8px;
    padding: 6px 8px;
    background: color-mix(in srgb, var(--color-text-muted) 8%, transparent);
    border-radius: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-card__detail {
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.session-card__detail strong {
    color: var(--color-text);
    font-weight: 500;
}

.session-card__body {
    flex: 1;
}

.session-card__time {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 8px;
}

.session-card__actions {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
}

.btn--card {
    padding: 3px 10px;
    font-size: 11px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn--card:hover {
    color: var(--color-text);
    border-color: var(--color-text-muted);
}

.btn--card-archive:hover {
    border-color: var(--color-text-muted);
}

.btn--card-complete:hover {
    border-color: var(--color-done);
    color: var(--color-done);
}

.btn--card-unarchive:hover {
    border-color: var(--color-working);
    color: var(--color-working);
}

/* ---- Install Modal ---- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 24px;
    max-width: 580px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal__title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.modal__warning {
    font-size: 13px;
    color: var(--color-warning);
    background: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.modal__warning a {
    color: var(--color-working);
    text-decoration: underline;
}

.modal__warning code {
    font-family: "SF Mono", "Fira Code", monospace;
    background: rgba(0,0,0,0.2);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 12px;
}

.modal__desc {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 12px;
}

.modal__cmd {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 14px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.modal__cmd code {
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 13px;
    color: var(--color-done);
    word-break: break-all;
    white-space: pre-wrap;
}

.modal__actions {
    display: flex;
    gap: 8px;
}

.modal__feedback {
    display: block;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 500;
}

.modal__feedback.success {
    color: var(--color-done);
}

.modal__log {
    margin-top: 16px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 12px;
    max-height: 200px;
    overflow-y: auto;
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 12px;
    line-height: 1.6;
}

.modal__log-entry {
    color: var(--color-text-muted);
}

.modal__log-entry.success {
    color: var(--color-done);
}

.modal__log-entry.error {
    color: var(--color-disconnected);
}

/* ---- Footer ---- */

.footer {
    text-align: center;
    padding: 16px 24px 24px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.footer__version {
    opacity: 0.6;
}

/* ---- Pairing panel ---- */
.pairing-panel {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 20px 24px;
}
.pairing-panel.hidden {
    display: none;
}
.pairing-panel__content {
    width: 100%;
}
.pairing-panel__title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}
.pairing-panel__row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.pairing-panel__left {
    text-align: center;
    flex-shrink: 0;
}
.pairing-panel__col-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-bottom: 12px;
}
.pairing-panel__left canvas,
.pairing-panel__left img {
    border-radius: var(--radius);
    border: 2px solid var(--color-border);
}
.pairing-panel__sep {
    width: 1px;
    align-self: stretch;
    background: var(--color-border);
    flex-shrink: 0;
}
.pairing-panel__right {
    flex: 1;
    min-width: 0;
}
.btn--small {
    font-size: 0.85rem;
    padding: 2px 6px;
    line-height: 1;
}
.pairing-hint {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    margin-top: 8px;
}
.pairing-error {
    color: var(--color-danger);
    font-size: 0.85rem;
    padding: 12px;
}
.pairing-requests__title {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}
.pairing-request {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--color-bg);
    border-radius: var(--radius);
    margin-bottom: 4px;
}
.pairing-request__name {
    font-size: 0.85rem;
}
.pairing-request__actions {
    display: flex;
    gap: 4px;
}
.pairing-empty {
    color: var(--color-text-muted);
    font-size: 0.8rem;
}
.btn--tiny {
    padding: 2px 8px;
    font-size: 0.8rem;
    line-height: 1;
}
.btn--success {
    background: var(--color-done);
    color: #000;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

/* ---- Language Switch ---- */

.lang-switch {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 13px;
  cursor: pointer;
  margin: 0 4px;
}

.lang-switch:focus-visible {
  outline: 1px solid var(--color-accent);
}

/* ---- Pairing indicator dot ---- */

.pair-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  border: 1.5px solid var(--color-bg);
}

.pair-dot.hidden {
  display: none;
}

/* ---- Settings cert note ---- */

.settings-panel__cert-note {
  display: none;
  font-size: 12px;
  color: var(--color-text-muted);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 8px;
  line-height: 1.5;
}

/* ---- Session Card: clickable ---- */

.session-card {
  cursor: pointer;
}

/* ---- Card delete button ---- */

.btn--card-delete {
  margin-left: auto;
  position: relative;
  overflow: hidden;
}

.btn--card-delete:hover {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.btn--card-delete.counting {
  border-color: var(--color-danger);
  color: var(--color-danger);
  pointer-events: none;
}

.btn--card-delete.counting::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(239, 68, 68, 0.2);
  animation: delete-sweep 5s linear forwards;
  z-index: 0;
}

.btn--card-delete.counting .btn--card-label {
  position: relative;
  z-index: 1;
}

@keyframes delete-sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

.btn--card-undo {
  margin-left: auto;
  border-color: var(--color-danger);
  color: var(--color-danger);
  position: relative;
  overflow: hidden;
}

.btn--card-undo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(239, 68, 68, 0.2);
  z-index: 0;
}

.btn--card-undo .btn--card-label {
  position: relative;
  z-index: 1;
}

/* ---- Detail Modal ---- */

.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: overlay-in 0.15s ease;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.detail-modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  max-width: 760px;
  width: 92%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: modal-slide-up 0.2s ease;
}

@keyframes modal-slide-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.detail-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px 12px;
  flex-shrink: 0;
}

.detail-modal__title-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.detail-modal__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
}

.detail-modal__title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-modal__subtitle {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 11px;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.detail-modal__close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.detail-modal__close:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

/* ---- Detail Modal: Stats ---- */

.detail-modal__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 24px 12px;
  flex-shrink: 0;
}

.detail-stat {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.detail-stat__value {
  color: var(--color-text);
  font-weight: 600;
}

/* ---- Detail Modal: Tool Breakdown ---- */

.detail-modal__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 24px 12px;
  flex-shrink: 0;
}

.detail-tool-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--color-working) 12%, transparent);
  color: var(--color-working);
  border: 1px solid color-mix(in srgb, var(--color-working) 20%, transparent);
  white-space: nowrap;
}

/* ---- Detail Modal: Timeline ---- */

.detail-modal__timeline {
  flex: 1;
  overflow-y: auto;
  padding: 8px 24px 16px;
  min-height: 0;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.detail-modal__timeline::-webkit-scrollbar {
  width: 6px;
}

.detail-modal__timeline::-webkit-scrollbar-track {
  background: transparent;
}

.detail-modal__timeline::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

.detail-modal__timeline::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

.detail-modal__timeline-load {
  text-align: center;
  padding: 8px 0 12px;
}

.detail-modal__timeline-load button {
  font-size: 12px;
  padding: 4px 16px;
}

/* Message row: [meta 80px] [gutter 32px] [card flex-1] */
.tl-msg {
  display: flex;
  align-items: flex-start;
}

/* Time + type card left of the dot */
.tl-msg__meta {
  width: 80px;
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  padding: 1px 8px 0 0;
}

.tl-msg__meta-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 4px 7px;
  text-align: center;
  display: inline-block;
}

.tl-msg__meta-time {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  line-height: 1.3;
}

.tl-msg__meta-type {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 8px;
  font-weight: 600;
  line-height: 1.3;
}

.tl-msg__meta-type--prompt { color: var(--color-pending); }
.tl-msg__meta-type--response { color: var(--color-done); }
.tl-msg__meta-type--tool { color: var(--color-working); }
.tl-msg__meta-type--thinking { color: var(--color-text-muted); }

.tl-msg__meta-token {
  display: block;
  font-size: 7px;
  color: var(--color-text-muted);
  margin-top: 1px;
}

/* Skeleton messages */
.tl-msg--skeleton .tl-msg__meta-card--skeleton,
.tl-msg--preliminary .tl-msg__meta-card--preliminary {
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.tl-msg--skeleton .tl-msg__card,
.tl-msg--preliminary .tl-msg__card {
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Gutter: dot + vertical line filling remaining height */
.tl-msg__gutter {
  width: 32px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: stretch;
}

/* Dot */
.tl-msg__dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 3px;
}

/* Vertical connector line — fills remaining gutter height below dot */
.tl-msg__line {
  width: 2px;
  flex: 1;
  min-height: 6px;
  background: var(--color-border);
  border-radius: 1px;
  margin-top: 4px;
}

.tl-msg:last-child .tl-msg__line {
  visibility: hidden;
}

.tl-msg__dot--prompt { border-color: var(--color-pending); }
.tl-msg__dot--response { border-color: var(--color-done); }
.tl-msg__dot--tool { border-color: var(--color-working); }
.tl-msg__dot--thinking { border-color: var(--color-text-muted); }

/* Thinking row */
.tl-msg--thinking .tl-msg__meta-card {
  opacity: 0.7;
}

/* Card — full width on the right, colored bg by type */
.tl-msg__card {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  margin-bottom: 12px;
}

.tl-msg__card--prompt {
  background: color-mix(in srgb, var(--color-pending) 6%, var(--color-bg));
  border-color: color-mix(in srgb, var(--color-pending) 22%, transparent);
}

.tl-msg__card--response {
  background: color-mix(in srgb, var(--color-done) 6%, var(--color-bg));
  border-color: color-mix(in srgb, var(--color-done) 20%, transparent);
}

.tl-msg__card--tool {
  background: color-mix(in srgb, var(--color-working) 5%, var(--color-bg));
  border-color: color-mix(in srgb, var(--color-working) 16%, transparent);
}

.tl-msg__card--approval {
  background: color-mix(in srgb, var(--color-pending) 6%, var(--color-bg));
  border-color: color-mix(in srgb, var(--color-pending) 22%, transparent);
}

.tl-msg__meta-type--approval { color: var(--color-pending); }

.tl-msg__dot--approval { border-color: var(--color-pending); }

/* Source footer */
.tl-msg__footer {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid color-mix(in srgb, var(--color-border) 50%, transparent);
  font-size: 10px;
  color: var(--color-text-muted);
  letter-spacing: 0.03em;
}

.tl-msg__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}

.tl-msg__text {
  font-size: 13px;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.tl-msg__text--dim {
  color: var(--color-text-muted);
  font-size: 12px;
  margin-top: 2px;
}

/* Empty state */
.tl-empty {
  text-align: center;
  color: var(--color-text-muted);
  padding: 32px 0;
  font-size: 14px;
}

/* ---- Section header actions ---- */

.section__actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.section__actions .btn--card {
  font-size: 10px;
  padding: 2px 8px;
}

.section__actions .btn--card-delete {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.section__actions .btn--card-delete:hover {
  background: color-mix(in srgb, var(--color-danger) 12%, transparent);
}

/* ---- Delete popup ---- */

.delete-popup {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--color-text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  z-index: 3000;
  animation: toast-in 0.2s ease;
}

.delete-popup--fadeout {
  animation: toast-out 0.3s ease forwards;
}

/* ---- Detail Modal: Footer ---- */

.detail-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 24px 20px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

/* ---- Toast (removed) ---- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: var(--color-text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  z-index: 2000;
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from { transform: translateX(-50%) translateY(16px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.toast--fadeout {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
  from { transform: translateX(-50%) translateY(0); opacity: 1; }
  to { transform: translateX(-50%) translateY(16px); opacity: 0; }
}

.toast__undo {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-working);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}

.toast__undo:hover {
  background: color-mix(in srgb, var(--color-working) 15%, transparent);
}
