/* kthxbye-specific styles on top of TCP UI (web/tcp-ui/tcp-ui.css). Keep this small: anything
   reusable belongs in TCP UI itself. */

:root { --tone-tests: #17a589; --tone-jobs: #4f7cff; --tone-monitor: #8a5cf5; }

/* Sign-in */
.signin {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--cyan) 18%, transparent), transparent),
    radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--navy) 22%, transparent), transparent),
    var(--bg);
}
.signin-card { width: min(440px, 100%); padding: 32px; display: grid; gap: 14px; text-align: center; }
.signin-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 6px; }
.signin-brand img { height: 34px; padding: 4px 6px; background: #fff; border-radius: 8px; }
.signin-brand span { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.signin-card .callout { text-align: left; }

/* Top bar bits */
.menu-toggle { display: none; }
.user-button { padding: 0 6px; gap: 8px; }
.user-button .user-name { font-weight: 800; color: var(--text); }
@media (max-width: 760px) {
  .menu-toggle { display: inline-flex; }
  .user-button .user-name { display: none; }
}

/* Full-bleed panes (workbench, app pages) */
.frames { position: relative; flex: 1; display: flex; min-height: 0; }
/* Over the Claude frame while the workbench starts (or why it didn't) */
.frame-cover { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--bg); z-index: 2; }
.frame-cover[hidden] { display: none; }
.frames iframe { flex: 1; width: 100%; border: 0; background: var(--surface); }
.pane-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.pane-toolbar .title { display: flex; align-items: center; gap: 8px; font-weight: 800; }
/* An app page on production: the bar says so, in the colours of a warning */
.pane-toolbar.is-prod { background: var(--danger-soft); border-bottom: 2px solid var(--danger); }

/* Dashboard */
.greeting { font-size: 27px; }
.facts { display: grid; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); flex: 1; }
.fact { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 10px; font-size: 14px; min-width: 0; }
.fact .badge { justify-self: start; }
.fact-label { color: var(--muted); font-size: 13px; font-weight: 700; }
.fact-value { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; color: var(--text); }
.fact-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--faint); }
.fact-value.ok .fact-dot { background: var(--success); }
.fact-value.warn .fact-dot { background: var(--warning); }
.fact-value.bad .fact-dot { background: var(--danger); }
.fact-value.bad { color: var(--danger-text); }
.fact-value.busy .fact-dot { background: var(--cyan); animation: pulse 2s ease-in-out infinite; }
.fact-value.idle { color: var(--muted); font-weight: 600; }
.fact-note { color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
.home-tabs { margin: 4px 0 16px; }
.home-summary { margin: 0; color: var(--muted); font-weight: 600; }
.home-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.home-toolbar .input-with-icon { width: min(320px, 100%); }
/* Projects as compact rows, grouped by client */
.project-rows { overflow: hidden; }
.client-row { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--surface-2); border-top: 1px solid var(--border); font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.client-row:first-child { border-top: 0; }
.client-row .count { margin-left: auto; font-weight: 700; letter-spacing: 0; }
.project-row { display: grid; grid-template-columns: minmax(200px, 1.1fr) minmax(0, 2fr) minmax(170px, 1fr); align-items: center; gap: 8px 20px; padding: 10px 16px; border-top: 1px solid var(--border); color: inherit; text-decoration: none; min-width: 0; }
.project-row:hover { background: var(--surface-2); }
.project-rows > .project-row:first-child { border-top: 0; }
.project-row .pr-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.project-row .pr-name strong { display: block; font-size: 15px; }
.project-row .pr-name small { display: block; color: var(--muted); font-size: 12px; }
.project-row .pr-states { display: flex; flex-wrap: wrap; gap: 4px 16px; min-width: 0; }
.project-row .pr-states .fact-value { font-size: 13px; gap: 6px; }
.project-row .pr-last { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--muted); }
.project-row .pr-last .truncate { flex: 1; min-width: 0; }
.project-row .pr-last .when { flex: none; color: var(--faint); font-weight: 700; font-size: 12px; }
@media (max-width: 960px) {
  .project-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .project-row .pr-last { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .project-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}
.attention-item .main-text strong { font-size: 15px; }

/* Activity feed */
.feed-item { align-items: flex-start; }
.feed-item .main-text { overflow-wrap: anywhere; }
.feed-item pre.code { margin-top: 6px; padding: 6px 10px; font-size: 12px; }
.feed-item .when { flex: none; align-self: flex-start; color: var(--faint); font-size: 12px; font-weight: 700; white-space: nowrap; }

/* Logs */
.logs-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.logs-view pre.log { flex: 1; margin: 0; border-radius: 0; box-shadow: none; min-height: 0; }

/* Deploys and approvals */
.deploy-log-row td { padding: 0 14px 14px; }
.deploy-log-row pre.log { max-height: 360px; }
.request.pending { box-shadow: var(--shadow-1), 0 0 0 1px color-mix(in srgb, var(--cyan) 55%, var(--border)); }
.request pre.code { margin-top: 10px; }

/* Tests */
.latest-head { display: flex; align-items: center; gap: 16px; }
.latest-head h2 { margin: 0 0 4px; font-size: 22px; }
.latest-head .main-text { flex: 1; min-width: 0; }
.results-table .suite-row td { background: var(--surface-2); padding-top: 8px; padding-bottom: 8px; }
.results-table .result-fail .primary { color: var(--danger-text); }
.results-table .result-skip .primary { color: var(--muted); }
.running-card { box-shadow: 0 0 0 1px var(--cyan), var(--shadow, none); }
.readiness .list-item { align-items: flex-start; }

/* Jobs */
.job-card.problem { box-shadow: 0 0 0 1px var(--danger), var(--shadow, none); }
.job-card .card-header h3 .badge { font-size: 12px; }
.failures-row td { background: var(--surface-2); }
.failures { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; }

/* Monitoring */
.findings .list-item { padding-left: 0; padding-right: 0; }
.latest-run.problems { box-shadow: 0 0 0 1px var(--danger), var(--shadow, none); }

/* Empty placeholders (sections not drawn yet) take no space in stacks */
.stack > div:empty { display: none; }

/* Inbox */
.inbox-heading { font-size: 17px; margin: 6px 0 0; display: flex; align-items: center; gap: 8px; }
.option-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); box-shadow: 0 0 0 1px var(--border); cursor: pointer; background: var(--surface); }
.option-card:hover { box-shadow: 0 0 0 1px var(--border-strong); }
.option-card.selected { box-shadow: 0 0 0 2px var(--cyan); background: color-mix(in srgb, var(--cyan) 6%, var(--surface)); }
.option-card input { margin-top: 4px; accent-color: var(--cyan-strong); }
.option-card .option-text { display: grid; gap: 4px; flex: 1; min-width: 0; }
.option-card .who { color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.option-card .who .icon { width: 14px; height: 14px; }
.decision-card .context .prose { margin-top: 8px; font-size: 14px; }
.change-card .prose { font-size: 15px; }

/* Dashboard: attention and activity side by side, the same height */
.home-pair { align-items: stretch; }
.home-pair > div { display: flex; }
.home-pair > div > .card { flex: 1; display: flex; flex-direction: column; }
.home-pair > div > .card > .card-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.home-pair > div > .card > .card-body:has(> .list) { justify-content: flex-start; }

/* Connect your Claude account (servers) */
/* Projects' VS Code and app pages live beside main, in its place on the grid, so they stay loaded */
.frames-host { grid-area: main; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.frames-host[hidden], .frames-layer[hidden] { display: none; }
.frames-layer { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.connect-claude { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(3px); z-index: 2; }
.connect-card { width: min(520px, 100%); padding: 18px 8px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* Containers: long image names wrap inside the table instead of widening it */
.image-cell { max-width: 220px; overflow-wrap: anywhere; }

/* Inbox, Recently handled: each item opens to how it looked while it waited */
details.handled > summary { list-style: none; cursor: pointer; }
details.handled > summary::-webkit-details-marker { display: none; }
details.handled > summary:hover { background: var(--surface-2, color-mix(in srgb, var(--border) 25%, transparent)); }
details.handled > summary .chevron { margin-left: auto; color: var(--muted); transition: transform .15s; flex: none; }
details.handled[open] > summary .chevron { transform: rotate(90deg); }
details.handled + details.handled { border-top: 1px solid var(--border); }
.handled-body { padding: 4px 20px 18px 52px; display: grid; gap: 12px; }
.handled-body .option-card { cursor: default; }
.handled-body .option-card:hover { box-shadow: 0 0 0 1px var(--border); }
.handled-body .option-card.selected:hover { box-shadow: 0 0 0 2px var(--cyan); }
.handled-body .prose { font-size: 14px; }

/* Two-column forms (Deploys, Secrets): one column on a phone */
.form-grid-1-2 { grid-template-columns: minmax(160px, 1fr) minmax(220px, 2fr); }
.form-grid-2-1 { grid-template-columns: minmax(200px, 2fr) minmax(100px, 1fr); }
.form-grid-halves { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 760px; }
@media (max-width: 760px) {
  .form-grid-1-2, .form-grid-2-1, .form-grid-halves { grid-template-columns: minmax(0, 1fr); }
}

/* Overview */
.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; align-items: start; }
.overview-col { display: grid; min-width: 0; }
.overview-start { background: linear-gradient(135deg, color-mix(in srgb, var(--tone-claude) 9%, var(--surface)), var(--surface) 60%); }
.overview-start .card-body { padding: 22px 24px; }
.start-steps { list-style: none; margin: 4px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.start-steps li { display: flex; gap: 12px; align-items: flex-start; }
.start-steps p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.step-number { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 800; font-size: 14px;
  background: color-mix(in srgb, var(--tone-claude) 16%, transparent); color: var(--tone-claude); }
.overview-facts { border-bottom: 0; margin-top: 12px; }
.fact-link { color: inherit; text-decoration: none; margin: -4px -8px; padding: 4px 8px; border-radius: var(--r); }
.fact-link:hover { background: var(--surface-2); }
.ask-item { width: 100%; border: 0; border-top: 1px solid var(--border); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.ask-item:first-child { border-top: 0; }
.ask-item:hover { background: var(--surface-2); }
.ask-item .main-text span { display: block; }
.drop-zone { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 22px 16px; border: 2px dashed var(--border-strong); border-radius: var(--r); }
.drop-zone.is-over { border-color: var(--cyan); background: color-mix(in srgb, var(--cyan) 8%, transparent); }
.link-button { border: 0; background: none; padding: 0; font: inherit; color: var(--cyan); text-decoration: underline; cursor: pointer; }
.next-item { flex-wrap: wrap; }
.next-item .main-text { min-width: min(100%, 260px); }

/* Secrets: a visible value (a setting), shown in full on hover */
.secret-value { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; font-size: 13px; }

/* A page's own loading state (sections/common.js loadState): empty unless loading is slow or fails */
.load-state:empty { display: none; }
/* A page's first load: a spinner beside its title. Its space is always kept (hidden, not removed), so showing it
   never moves anything */
.load-indicator { display: inline-flex; visibility: hidden; }
.load-indicator.on { visibility: visible; }
/* Until a page's first load is done, its content is kept invisible (not its load errors), so it appears in one go */
.first-load > :not(.load-state) { visibility: hidden; }
/* Space kept for something still loading (a row's last commit), so the row doesn't grow when it arrives */
.skeleton { display: inline-block; height: 0.85em; width: 100%; max-width: 360px; vertical-align: middle; border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%;
  animation: skeleton 1.4s ease-in-out infinite; }
@keyframes skeleton { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* Alerts: each source, what makes it alert, and how it stands */
.alert-source { align-items: flex-start; }
.alert-source > .icon { margin-top: 2px; }
.alert-source .main-text > span { display: block; }
.alert-state { margin-top: 6px; font-size: 13px; flex-wrap: wrap; }
.alert-state b { font-weight: 700; }

/* Settings: removing the project */
.danger-zone { box-shadow: var(--shadow-1, none), inset 0 0 0 1px color-mix(in srgb, var(--danger) 35%, transparent); }
/* Nothing needs you: the card is as tall as what it says, not the activity list beside it */
.home-pair > div > .card.is-quiet { align-self: flex-start; }

/* Approvals: the reason is the headline; the exact request is folded under it */
.request-reason { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.45; }
.request-reason.muted { font-weight: 600; font-size: 14px; }
.request-exact > summary { cursor: pointer; color: var(--link); }
.request-exact > pre { margin-top: 8px; }

/* Activity: the line's own text size, so its icon centres on the first line (TCP UI's icon-text) */
.feed-item .icon-text { font-size: 13px; line-height: 1.5; }
.feed-item .feed-detail { margin: 4px 0 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.feed-item .icon-text pre.code { margin-top: 6px; }

/* Pick lists in dialogs (a repo to link, a GitLab group): rows that are buttons, the picked one marked */
button.list-item { width: 100%; background: transparent; border: 0; border-top: 1px solid var(--border); border-radius: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.list-item:first-child { border-top: 0; }
button.list-item:hover:not(:disabled) { background: var(--surface-2); }
button.list-item:disabled { cursor: default; opacity: .6; }
button.list-item.active { background: var(--info-soft); }
button.list-item.active .icon { color: var(--info-text); }
.dialog .pick-list { max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.dialog .pick-list:empty { display: none; }
.dialog .pick-list .list-item { padding: 8px 12px; }
/* The project's reservation, in the sidebar (shell.js reservationBlock) */
.sidebar-reservation { margin-top: 10px; font-size: 13px; color: var(--side-text); }
.sidebar-reservation .reserved { display: flex; align-items: center; gap: 6px; font-weight: 700; color: #ffd27a; }
.sidebar-reservation .reserved time { color: var(--side-muted); font-weight: 600; }
.sidebar-reservation .reserved-note { margin: 2px 0 0 22px; color: var(--side-text); }
.sidebar-reservation .row { margin: 4px 0 0 22px; }
.sidebar-reservation button { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--side-muted); cursor: pointer; }
.sidebar-reservation button:hover { color: #fff; text-decoration: underline; }
.sidebar-reservation .reserve-button { display: inline-flex; align-items: center; gap: 6px; }
/* Lists without bullets (the release dialog's checks and commits) */
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

/* Knowledge page: articles, read in place, and the wider editor */
dialog.dialog.dialog-wide { width: min(820px, calc(100vw - 32px)); }
.article-title { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.article-title:hover strong { text-decoration: underline; }
.article-body { margin-top: 8px; padding: 10px 14px; border-left: 3px solid var(--border-strong); background: var(--surface-2); border-radius: 8px; max-height: 480px; overflow: auto; }
.article-body .prose { max-width: none; }

/* Table columns that give way on narrow screens (the Scheduled jobs list and a job's run history) */
@media (max-width: 760px) {
  .table .narrow-hide { display: none; }
}
/* ...and what those columns showed, under the first one instead */
.table .narrow-only { display: none; }
@media (max-width: 760px) {
  .table .narrow-only { display: block; margin-top: 4px; }
}
/* The search box's key hint stays on one line when the top bar is tight */
.topbar kbd { white-space: nowrap; }

/* Breadcrumbs stay on one line: the earlier ones keep their width, only the current page's name is shortened
   (TCP UI only keeps .current from wrapping, so a long job name pushed "Scheduled jobs" onto two lines) */
.topbar .crumbs > * { flex-shrink: 0; white-space: nowrap; }
.topbar .crumbs > .current { flex-shrink: 1; min-width: 0; }
/* A grid item is at least as wide as its content by default: a long page name made the top bar, and the page with it,
   wider than a phone's screen */
.topbar { min-width: 0; }

/* The note beside a fact (the internet switch, Mail) wraps on a phone instead of running off the card */
@media (max-width: 760px) {
  .fact-note { white-space: normal; }
}

/* Services on a phone: the service, its state and its buttons; image, ports, CPU and memory give way */
@media (max-width: 760px) {
  .services-table th:nth-child(n+3):nth-child(-n+6), .services-table td:nth-child(n+3):nth-child(-n+6) { display: none; }
}

/* Phones: no keyboard shortcut to show, and a row of filter buttons scrolls rather than being cut off at the card */
@media (max-width: 760px) {
  .search-trigger kbd { display: none; }
  .segmented { max-width: 100%; overflow-x: auto; }
}
