/* web/jobs.css — running-jobs header pill, detail strip, foot bar, More drawer, and past-chats history. */

/* --- Header running-jobs pill & inline detail strip --- */

#chat-jobs {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 1.5rem;
  max-width: 100%;
  padding: 0 0.625rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--attn) 28%, transparent);
  background: var(--attn-soft);
  color: var(--attn);
  font-family: var(--font-ui);
  font-size: var(--text-sm, 0.78125rem);
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--t-fast, 110ms) var(--ease, ease),
              border-color var(--t-fast, 110ms) var(--ease, ease);
}

#chat-jobs::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--attn);
  flex: none;
}

#chat-jobs::after {
  content: "▾";
  font-size: 0.75em;
  opacity: 0.75;
  flex: none;
}

#chat-jobs[aria-expanded="true"]::after {
  content: "▴";
}

#chat-jobs:hover {
  background: color-mix(in srgb, var(--attn) 19%, transparent);
  border-color: color-mix(in srgb, var(--attn) 45%, transparent);
}

#chat-jobs[aria-expanded="true"] {
  background: color-mix(in srgb, var(--attn) 20%, transparent);
  border-color: color-mix(in srgb, var(--attn) 55%, transparent);
}

#chat-jobs:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 1px;
}

#chat-jobs-panel {
  display: flex;
  flex-direction: column;
  gap: 0.3125rem;
  margin-top: 0.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--r-md, 7px);
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
}

.jobs-panel-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm, 0.78125rem);
  line-height: 1.45;
}

.jobs-panel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--attn);
  flex: none;
}

.jobs-panel-id {
  color: var(--text-3);
  flex: none;
}

.jobs-panel-label {
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}

.jobs-panel-port {
  flex: none;
  padding: 0 0.375rem;
  border-radius: var(--r-sm, 5px);
  background: var(--info-soft);
  color: var(--info);
  font-size: var(--text-xs, 0.71875rem);
}

.jobs-panel-tag {
  flex: none;
  padding: 0 0.375rem;
  border-radius: var(--r-sm, 5px);
  background: var(--attn-soft);
  color: var(--attn);
  font-size: var(--text-xs, 0.71875rem);
}

.jobs-panel-elapsed {
  flex: none;
  margin-left: auto;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs, 0.71875rem);
}

/* --- Readout foot job strip (below .live-segment) --- */

.job-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 0.5rem;
  margin-top: 0.875rem;
  padding: 0.4375rem 0.75rem;
  border-radius: var(--r-md, 7px);
  background: color-mix(in srgb, var(--attn) 6%, var(--surface-1));
  border: 1px solid color-mix(in srgb, var(--attn) 22%, var(--line));
  font-family: var(--font-ui);
  font-size: var(--text-sm, 0.78125rem);
  line-height: 1.4;
}

.job-running {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  color: var(--attn);
  font-family: var(--font-ui);
  font-size: var(--text-sm, 0.78125rem);
  letter-spacing: normal;
  white-space: nowrap;
}

.job-running::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--attn);
  flex: none;
}

.job-item {
  display: inline-block;
  max-width: 28ch;
  padding: 0.0625rem 0.4375rem;
  border-radius: var(--r-sm, 5px);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs, 0.71875rem);
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-waiting {
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs, 0.71875rem);
}

.node-jobs {
  margin-left: 0.35rem;
  padding: 0 0.35rem;
  border-radius: var(--r-sm, 5px);
  background: var(--attn-soft);
  color: var(--attn);
  font-family: var(--font-ui);
  font-size: var(--text-xs, 0.71875rem);
}

/* --- Structured More drawer --- */

#actions-toggle[aria-expanded="true"] {
  background: var(--surface-3);
  color: var(--text);
}

#readout-more-drawer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--r-md, 7px);
  background: var(--surface-1);
  border: 1px solid var(--line);
}

#readout-more-drawer > #readout-actions {
  justify-content: flex-start;
  align-items: center;
  gap: 0.375rem;
}

#readout-more-drawer > #readout-actions::before {
  content: "Session";
  margin-right: 0.25rem;
  font-family: var(--font-ui);
  font-size: var(--text-xs, 0.71875rem);
  color: var(--text-3);
}

#readout-more-drawer > #readout-git {
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

#readout-more-drawer > #readout-git-links {
  padding: 0.125rem 0 0;
  gap: 0.25rem 0.875rem;
}

/* --- Past chats: viewing banner, 5-item inline row, bounded older disclosure --- */

#past-chats {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 0.5rem 0 0.25rem;
}

.past-viewing-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--r-md, 7px);
  background: var(--attn-soft);
  border: 1px solid color-mix(in srgb, var(--attn) 28%, transparent);
  font-family: var(--font-ui);
  font-size: var(--text-sm, 0.78125rem);
  color: var(--text);
}

.past-viewing-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.past-return-btn {
  flex: none;
  padding: 0.1875rem 0.625rem;
  border-radius: var(--r-sm, 5px);
  border: 1px solid var(--line-strong);
  background: var(--surface-1);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--text-xs, 0.71875rem);
  cursor: pointer;
  white-space: nowrap;
}

.past-return-btn:hover {
  background: var(--surface-2);
}

.past-chats-shelf {
  display: flex;
  flex-direction: column;
  gap: 0.4375rem;
  padding: 0.4375rem 0.75rem;
  border-radius: var(--r-md, 7px);
  background: var(--surface-1);
  border: 1px solid var(--line);
}

.past-chats-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.375rem;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.past-chats-label {
  flex: none;
  margin-right: 0.125rem;
  font-family: var(--font-ui);
  font-size: var(--text-xs, 0.71875rem);
  color: var(--text-3);
  white-space: nowrap;
}

#past-chats .past-chat {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  flex: none;
  padding: 0.1875rem 0.5625rem;
  border-radius: var(--r-sm, 5px);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--font-ui);
  font-size: var(--text-xs, 0.71875rem);
  letter-spacing: normal;
  line-height: 1.35;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast, 110ms) var(--ease, ease),
              border-color var(--t-fast, 110ms) var(--ease, ease),
              color var(--t-fast, 110ms) var(--ease, ease);
}

#past-chats .past-chat-time {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

#past-chats .past-chat-id {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

#past-chats .past-chat:hover {
  background: var(--surface-3);
  border-color: var(--line-strong);
  color: var(--text);
}

#past-chats .past-chat:hover .past-chat-time {
  color: var(--text);
}

#past-chats .past-chat[aria-current="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--text);
}

#past-chats .past-chat[aria-current="true"] .past-chat-time,
#past-chats .past-chat[aria-current="true"] .past-chat-id {
  color: var(--text);
}

.past-older-toggle {
  display: inline-flex;
  align-items: center;
  flex: none;
  margin-left: auto;
  padding: 0.1875rem 0.5625rem;
  border-radius: var(--r-sm, 5px);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-ui);
  font-size: var(--text-xs, 0.71875rem);
  line-height: 1.35;
  cursor: pointer;
  white-space: nowrap;
}

.past-older-toggle:hover,
.past-older-toggle[aria-expanded="true"] {
  background: var(--surface-3);
  color: var(--text);
}

.past-older-panel {
  display: flex;
  flex-direction: column;
  gap: 0.4375rem;
  padding-top: 0.4375rem;
  border-top: 1px solid var(--line);
}

.past-older-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.past-older-filter {
  flex: 1 1 auto;
  min-width: 0;
  height: 1.75rem;
  padding: 0 0.5rem;
  border-radius: var(--r-sm, 5px);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--text-xs, 0.71875rem);
}

.past-older-filter:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 0;
  border-color: var(--accent);
}

.past-older-count {
  flex: none;
  font-family: var(--font-ui);
  font-size: var(--text-xs, 0.71875rem);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.past-older-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.25rem;
  max-height: 14rem;
  overflow-y: auto;
  padding-right: 0.125rem;
}

#past-chats .past-chat-older {
  justify-content: space-between;
  width: 100%;
}

@media (max-width: 719px) {
  #chat-jobs {
    min-height: 2rem;
    padding: 0 0.4375rem;
    gap: 0.25rem;
    max-width: 7.5rem;
  }
  #chat-jobs .jobs-pill-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #chat-jobs[data-short] .jobs-pill-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  #chat-jobs[data-short]::after {
    content: attr(data-short) " ▾";
    font-size: var(--text-sm, 0.78125rem);
    font-variant-numeric: tabular-nums;
    opacity: 1;
  }
  #chat-jobs[data-short][aria-expanded="true"]::after {
    content: attr(data-short) " ▴";
  }
}
