:root {
  --canvas: #ffffff;
  --inset: #f6f8fa;
  --inset-2: #eaeef2;
  --border: #d0d7de;
  --fg: #1f2328;
  --fg-muted: #656d76;
  --accent: #0969da;
  --accent-hover: #0a5cc0;
  --primary: #1f883d;
  --primary-hover: #1a7f37;
  --primary-active: #197935;
  --danger: #cf222e;
  --btn-border: rgba(31, 35, 40, 0.15);
  --radius: 6px;
  --sidebar-width: 248px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

body {
  background: var(--canvas);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
/* Links styled as buttons keep button behaviour, not link underlining. */
a.btn:hover { text-decoration: none; }

.mono { font-family: var(--font-mono); }
.text-secondary, .text-muted { color: var(--fg-muted) !important; }

/* Anything click-to-copy says so: a pointer, and a dotted underline on the
   shortened values (an onion address, a hash) that aren't already buttons. */
[data-copy], [data-copy-target] { cursor: pointer; }
span[data-copy]:hover { text-decoration: underline dotted; }

.btn {
  --bs-btn-padding-y: 0.3125rem;
  --bs-btn-padding-x: 1rem;
  --bs-btn-font-size: 0.875rem;
  --bs-btn-font-weight: 500;
  --bs-btn-border-radius: var(--radius);
}
.btn-sm {
  --bs-btn-padding-y: 0.1875rem;
  --bs-btn-padding-x: 0.75rem;
  --bs-btn-font-size: 0.8125rem;
}
.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--btn-border);
  --bs-btn-color: #fff;
  --bs-btn-hover-bg: var(--primary-hover);
  --bs-btn-hover-border-color: var(--btn-border);
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--primary-active);
  --bs-btn-active-border-color: var(--btn-border);
  --bs-btn-active-color: #fff;
  --bs-btn-disabled-bg: var(--primary);
  --bs-btn-disabled-border-color: var(--btn-border);
  --bs-btn-disabled-color: #fff;
}
.btn-outline-secondary {
  --bs-btn-color: #24292f;
  --bs-btn-bg: var(--inset);
  --bs-btn-border-color: var(--btn-border);
  --bs-btn-hover-bg: var(--inset-2);
  --bs-btn-hover-color: #24292f;
  --bs-btn-hover-border-color: var(--btn-border);
  --bs-btn-active-bg: #e0e5ea;
  --bs-btn-active-color: #24292f;
  --bs-btn-active-border-color: var(--btn-border);
}

.form-label { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.35rem; }
.form-control, .form-select {
  font-size: 0.875rem;
  padding: 0.3rem 0.75rem;
  border-color: var(--border);
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.3);
}
.form-text { color: var(--fg-muted); }

.card {
  --bs-card-border-color: var(--border);
  --bs-card-border-radius: var(--radius);
  --bs-card-cap-bg: var(--inset);
  --bs-card-cap-padding-y: 0.6rem;
  --bs-card-spacer-y: 1rem;
  --bs-card-spacer-x: 1rem;
}
.card-header { font-weight: 600; font-size: 0.875rem; }
/* A flush list filling a padding-less card body (Actions/Variables) otherwise
   pokes square corners past the card; clip it to the card's bottom radius. */
.card > .card-body.p-0:last-child {
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  overflow: hidden;
}

.toast {
  width: 320px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--fg);
  box-shadow: 0 4px 12px rgba(31, 35, 40, 0.15);
  font-size: 0.875rem;
}
.toast .toast-body { padding: 0.6rem 0.75rem; }
.toast .flash-icon { margin-top: 1px; }
.toast .btn-close { font-size: 0.7rem; }
.flash-success { background: #dafbe1; border-color: rgba(31, 136, 61, 0.4); }
.flash-success .flash-icon { color: var(--primary); }
.flash-danger { background: #ffebe9; border-color: rgba(207, 34, 46, 0.4); }
.flash-danger .flash-icon { color: var(--danger); }
.flash-warning { background: #fff8c5; border-color: rgba(154, 103, 0, 0.4); }
.flash-warning .flash-icon { color: #9a6700; }
.flash-info { background: #ddf4ff; border-color: rgba(9, 105, 218, 0.4); }
.flash-info .flash-icon { color: var(--accent); }

.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
}
.app-content { flex: 1 1 auto; min-width: 0; }
.content-wrap { padding: 1.5rem 2rem; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius);
  background: #24292f;
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.9rem;
}
.brand-name { font-family: var(--font-mono); font-weight: 600; font-size: 1rem; color: var(--fg); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: 0.5rem; }
.sidebar-nav .nav-link,
.sidebar-bottom .nav-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.55rem;
  border-radius: var(--radius);
  color: var(--fg);
  font-weight: 500;
}
.sidebar-nav .nav-link .fa-fw,
.sidebar-bottom .nav-link .fa-fw { color: var(--fg-muted); }
.sidebar-nav .nav-link:hover,
.sidebar-bottom .nav-link:hover { background: var(--inset); text-decoration: none; }
.sidebar-nav .nav-link.active { background: var(--inset-2); font-weight: 600; }
.sidebar-nav .nav-link.active .fa-fw { color: var(--accent); }
.sidebar-bottom { border-top: 1px solid var(--border); padding: 0.5rem; }
.sidebar-bottom .nav-link { margin-bottom: 0.4rem; }
.sidebar-user .username { font-family: var(--font-mono); }
.nav-badge-slot { margin-left: auto; }
.nav-badge {
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.15rem 0.4rem;
  border-radius: 2rem;
}

.page-header {
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.page-title { font-size: 1.25rem; font-weight: 600; margin: 0; }
.page-subtitle { color: var(--fg-muted); margin: 0.2rem 0 0; }

.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--inset);
}
.auth-box { width: 100%; max-width: 340px; }
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  text-align: center;
}
.auth-brand .brand-mark { width: 42px; height: 42px; font-size: 1.3rem; border-radius: 8px; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--fg-muted); }
.empty-state .ic { font-size: 1.75rem; color: var(--border); margin-bottom: 0.5rem; }

html:not(.js-ready) .btn-async { pointer-events: none; opacity: 0.65; }
/* Label and spinner share one line — a button that wraps mid-action looks broken. */
.btn-async { white-space: nowrap; }
.btn-async .btn-spinner { display: none; margin-left: .35rem; vertical-align: -.125em; }
.btn-async.is-loading .btn-spinner { display: inline-block; }
.btn-async.is-loading .btn-label { opacity: 0.7; }

@media (max-width: 768px) {
  .app-shell { flex-direction: column; }
  .app-sidebar {
    width: 100%;
    flex-basis: auto;
    height: auto;
    position: static;
  }
  .sidebar-nav { display: flex; flex-wrap: wrap; }
  .content-wrap { padding: 1rem; }
}

.sidebar-section-label {
  padding: 0.7rem 0.55rem 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
}

.data-table {
  --bs-table-bg: transparent;
  font-size: 0.8125rem;
}
.data-table thead th {
  background: var(--inset);
  border-bottom: 1px solid var(--border);
  color: var(--fg-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.5rem 0.75rem;
  white-space: nowrap;
}
/* Nest the header fill inside the card's rounded top corners so the inset
   background doesn't square off the corner where the card border curves. */
.card > .table-responsive:first-child .data-table thead th:first-child {
  border-top-left-radius: calc(var(--radius) - 1px);
}
.card > .table-responsive:first-child .data-table thead th:last-child {
  border-top-right-radius: calc(var(--radius) - 1px);
}
.data-table tbody td {
  border-top: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
}
.data-table tbody tr:first-child td { border-top: 0; }
.data-table tbody tr:hover { background: var(--inset); }
.fp-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge.origin-badge,
.badge.type-badge {
  font-weight: 500;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 2rem;
  border: 1px solid var(--border);
  background: var(--inset);
  color: var(--fg-muted);
}
.badge.origin-badge { margin-left: 0.35rem; }
.badge.type-badge { color: var(--fg); }

.btn-icon {
  --bs-btn-padding-x: 0.4rem;
  --bs-btn-padding-y: 0.2rem;
  line-height: 1;
}
.btn-icon + .btn-icon { margin-left: 0.15rem; }
.btn-icon-danger { --bs-btn-color: var(--danger); --bs-btn-hover-color: var(--danger); }

.btn-danger {
  --bs-btn-bg: var(--danger);
  --bs-btn-border-color: var(--btn-border);
  --bs-btn-color: #fff;
  --bs-btn-hover-bg: #a40e26;
  --bs-btn-hover-border-color: var(--btn-border);
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #92091f;
  --bs-btn-active-border-color: var(--btn-border);
  --bs-btn-active-color: #fff;
  --bs-btn-disabled-bg: var(--danger);
  --bs-btn-disabled-border-color: var(--btn-border);
  --bs-btn-disabled-color: #fff;
}

.key-search { max-width: 460px; }
.input-group-text {
  background: var(--inset);
  border-color: var(--border);
  color: var(--fg-muted);
}

.pagination {
  --bs-pagination-color: var(--fg);
  --bs-pagination-bg: var(--canvas);
  --bs-pagination-border-color: var(--border);
  --bs-pagination-hover-color: var(--fg);
  --bs-pagination-hover-bg: var(--inset);
  --bs-pagination-hover-border-color: var(--border);
  --bs-pagination-focus-color: var(--fg);
  --bs-pagination-focus-bg: var(--inset);
  --bs-pagination-focus-box-shadow: 0 0 0 3px rgba(31, 35, 40, 0.12);
  --bs-pagination-disabled-color: var(--fg-muted);
  --bs-pagination-disabled-bg: var(--inset);
  --bs-pagination-disabled-border-color: var(--border);
  --bs-pagination-active-color: var(--canvas);
  --bs-pagination-active-bg: var(--fg);
  --bs-pagination-active-border-color: var(--fg);
  flex-wrap: wrap;
  row-gap: 0.25rem;
}
.pagination .page-link {
  cursor: pointer;
  min-width: 2rem;
  text-align: center;
}
.pagination .page-link:hover { text-decoration: none; }
.pagination .page-item.active .page-link { font-weight: 600; }

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}
.pagination-summary { font-size: 0.8125rem; color: var(--fg-muted); }
.pagination-bar .load-bar { flex: 0 0 100%; }

@media (max-width: 575.98px) {
  .pagination-bar { justify-content: center; }
}

/* A thin indeterminate progress line for anything that loads in place. Add
   `htmx-indicator` next to it and htmx shows it for the duration of the
   request (see the pagination bar of an htmx-swapped list). */
.load-bar { height: 3px; border-radius: 1rem; background: var(--inset-2); overflow: hidden; }
.load-bar > span {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: 1rem;
  background: var(--primary);
  animation: load-bar-indet 1.15s ease-in-out infinite;
}
@keyframes load-bar-indet { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .load-bar > span { animation: none; width: 100%; opacity: 0.6; }
}

.modal-content { border: 1px solid var(--border); border-radius: var(--radius); }
.modal-header, .modal-footer { border-color: var(--border); }
.modal-title { font-size: 1rem; font-weight: 600; }
.modal-body textarea.form-control { font-family: var(--font-mono); font-size: 0.8125rem; }

.nav-tabs {
  --bs-nav-tabs-border-color: var(--border);
  --bs-nav-tabs-link-active-color: var(--fg);
  --bs-nav-tabs-link-active-border-color: var(--border) var(--border) var(--canvas);
  font-size: 0.8125rem;
}
.nav-tabs .nav-link { color: var(--fg-muted); }
.nav-tabs .nav-link:hover { color: var(--fg); }

.domain-group + .domain-group { margin-top: 1rem; }
.domain-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--fg-muted);
  margin-bottom: 0.35rem;
}
.domain-list { list-style: none; margin: 0; padding: 0; }
.domain-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--border);
}
.domain-list li:first-child { border-top: 0; }
.domain-chain { color: var(--fg-muted); padding-left: 0.5rem; line-height: 1.6; word-break: break-all; }
.domain-cell { display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.domain-addr {
  display: inline-block;
  max-width: 26ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.notif-list .notif-item {
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
  border-left: 3px solid transparent;
}
.notif-list .notif-item:first-child { border-top: 0; }
.notif-item .notif-icon { width: 1rem; }
.notif-item.notif-error .notif-icon { color: var(--danger); }
.notif-item.notif-warning .notif-icon { color: #9a6700; }
.notif-item.notif-success .notif-icon { color: var(--primary); }
.notif-item.notif-info .notif-icon { color: var(--accent); }
.notif-item.notif-unread { background: var(--inset); }
.notif-item.notif-unread.notif-error { border-left-color: var(--danger); }
.notif-item.notif-unread.notif-warning { border-left-color: #9a6700; }
.notif-item.notif-unread.notif-success { border-left-color: var(--primary); }
.notif-item.notif-unread.notif-info { border-left-color: var(--accent); }
.min-w-0 { min-width: 0; }

@keyframes panel-refresh-spin { to { transform: rotate(360deg); } }
.js-refresh.is-spinning .fa-rotate-right { animation: panel-refresh-spin .6s linear; }

.skeleton-line, .skeleton-btn {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--inset) 25%, var(--inset-2) 50%, var(--inset) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.3s ease-in-out infinite;
}
.skeleton-line { display: block; height: 0.8rem; }
.skeleton-line + .skeleton-line { margin-top: 0.6rem; }
.skeleton-btn { display: inline-block; width: 5rem; height: 1.9rem; }
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-line, .skeleton-btn { animation: none; }
}

.nav-tabs-sm .nav-link { padding: .25rem .6rem; font-size: 13px; }

.agent-log-list {
  max-height: 24rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--inset);
}
.agent-log {
  display: flex;
  gap: .6rem;
  align-items: baseline;
  padding: .2rem .6rem;
  font-size: 12.5px;
  line-height: 1.5;
  border-bottom: 1px solid var(--border);
}
.agent-log:last-child { border-bottom: 0; }
.agent-log-time { color: var(--fg-muted); white-space: nowrap; flex-shrink: 0; }
.agent-log-level {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
  width: 3.2rem;
  flex-shrink: 0;
  text-transform: uppercase;
}
.agent-log-msg { color: var(--fg); white-space: pre-wrap; word-break: break-word; }
.agent-log-info .agent-log-level { color: var(--accent); }
.agent-log-debug .agent-log-level { color: var(--fg-muted); }
.agent-log-warn { background: #fff8c5; }
.agent-log-warn .agent-log-level { color: #9a6700; }
.agent-log-error, .agent-log-fatal { background: #ffebe9; }
.agent-log-error .agent-log-level, .agent-log-fatal .agent-log-level { color: var(--danger); }

.fi { vertical-align: -0.1em; border-radius: 2px; box-shadow: 0 0 0 1px rgba(27, 31, 36, 0.12); }

.data-table tbody tr.domain-row-group td { border-top: 2px solid var(--border); }

/* Active-backup tiles (dashboard Activity tab). Amber accent matches the in-card
   live-progress chip (.pbk-prog on the project card). */
.bk-tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .6rem; }
.bk-tile {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--border); border-left: 3px solid #d29922; border-radius: 8px;
  padding: .55rem .7rem; background: var(--inset); transition: box-shadow .15s ease;
}
.bk-tile:hover { color: inherit; box-shadow: 0 0 0 1px #d2992244; }
.bk-tile-top { display: flex; align-items: center; gap: .4rem; font-size: 13px; min-width: 0; }
.bk-tile-top > .text-truncate { min-width: 0; }
.bk-tile-dot {
  width: .5rem; height: .5rem; border-radius: 50%; background: #d29922; flex: 0 0 auto;
  animation: bk-pulse 1.2s ease-in-out infinite;
}
@keyframes bk-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.bk-tile-bar { height: .35rem; margin: .45rem 0 .3rem; border-radius: 1rem; background: var(--border); overflow: hidden; }
.bk-tile-bar > span { display: block; height: 100%; background: #d29922; border-radius: 1rem; transition: width .4s ease; }
.bk-tile-bar-indet > span { width: 40%; animation: bk-indet 1.15s ease-in-out infinite; }
@keyframes bk-indet { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.bk-tile-meta { display: flex; justify-content: space-between; gap: .5rem; font-size: 11.5px; line-height: 1.6; }
@media (prefers-reduced-motion: reduce) {
  .bk-tile-dot, .bk-tile-bar-indet > span { animation: none; }
}

.favicon-preview { border: 1px solid var(--border); border-radius: 4px; background: #fff; object-fit: contain; }

/* ── Web server tab: route lines ──────────────────────────────────────────
   One route per line inside the sites table: path → target, small inline flags,
   and edit/remove actions that appear on hover so the list stays quiet. */
.route-cell { min-width: 18rem; }
.route-line {
  display: flex; align-items: center; gap: .4rem;
  padding: .15rem 0; font-size: 12px; white-space: nowrap;
}
.route-line + .route-line { border-top: 1px solid var(--inset-2); }
.route-arrow { color: var(--fg-muted); font-size: 10px; }
.route-flag {
  font-size: 10px; line-height: 1.6; padding: 0 .35rem;
  color: var(--fg-muted); background: var(--inset); border: 1px solid var(--border);
  border-radius: 999px;
}
.route-actions { margin-left: auto; display: inline-flex; gap: .25rem; opacity: 0; transition: opacity .1s ease-in; }
.route-line:hover .route-actions, .route-actions:focus-within { opacity: 1; }

/* ── Restore modal: archive pickers ───────────────────────────────────────
   Every source (this project's snapshots, a bucket level, an inspect) loads over
   the network through the bucket's proxy, so each picker sits in a .rst-browser-wrap
   and gets a veil while its request is in flight: the box keeps its size, the wait
   is visible, and the list can't be clicked twice. The box is a plain block so the
   select above it lines up with its full width. */
.rst-browser-wrap { position: relative; }
.rst-browser-box { min-height: 7rem; }
.rst-browser-veil { display: none; }
.rst-browser-wrap.htmx-request .rst-browser-veil {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--canvas) 72%, transparent);
}

/* --- log watching (ADR 0045) --- */
.lw-live { background: var(--inset, #f6f8fa); border: 1px solid var(--border, #d0d7de); border-radius: 6px;
  padding: .5rem .65rem; height: 460px; overflow: auto; font-family: var(--font-mono); font-size: .74rem;
  line-height: 1.45; margin: 0; white-space: pre; }
.lw-l { white-space: pre-wrap; word-break: break-word; }
.lw-l-crit { color: var(--danger, #cf222e); font-weight: 600; }
.lw-l-err { color: var(--danger, #cf222e); }
.lw-l-warn { color: #9a6700; }
.lw-problem-line { background: var(--inset, #f6f8fa); border: 1px solid var(--border, #d0d7de);
  border-radius: 6px; padding: .35rem .5rem; font-family: var(--font-mono); font-size: .74rem;
  line-height: 1.45; white-space: pre-wrap; word-break: break-word; max-height: 9rem; overflow: auto;
  color: var(--fg, #1f2328); }
/* A problem the operator has read stays in the list but stops asking for attention. */
.lw-read td { opacity: .6; }
.lw-badge-critical { color: var(--danger, #cf222e); }
.lw-badge-high { color: #bc4c00; }
.lw-badge-medium { color: #9a6700; }
.lw-badge-low { color: var(--muted, #656d76); }
.lw-chart { display: flex; align-items: flex-end; gap: 2px; height: 90px; }
.lw-bar { position: relative; flex: 1 1 auto; height: 100%; min-width: 3px; }
.lw-bar-lines, .lw-bar-err { position: absolute; bottom: 0; left: 0; right: 0; border-radius: 1px; }
.lw-bar-lines { background: var(--inset-2, #eaeef2); }
.lw-bar-err { background: var(--danger, #cf222e); opacity: .75; }

/* --- local AI model sizing (ADR 0046) --- */
.ai-meter { height: 5px; border-radius: 3px; background: var(--inset-2, #eaeef2); overflow: hidden; margin: .25rem 0; }
.ai-meter-fill { display: block; height: 100%; }
.ai-meter-ok { background: var(--primary, #1f883d); }
.ai-meter-tight { background: #bf8700; }
.ai-meter-insufficient { background: var(--danger, #cf222e); }
.ai-meter-unknown { background: var(--muted, #656d76); }
.ai-meter-cpu { background: var(--accent, #0969da); }
.ai-badge-ok { color: var(--primary, #1f883d); }
.ai-badge-tight { color: #bf8700; }
.ai-badge-insufficient { color: var(--danger, #cf222e); }
.ai-badge-unknown { color: var(--muted, #656d76); }
.ai-row-current { background: var(--inset, #f6f8fa); }
.ai-fit-insufficient td { opacity: .75; }

.ai-progress { height: 8px; border-radius: 4px; background: var(--inset-2, #eaeef2); overflow: hidden; }
.ai-progress-fill { display: block; height: 100%; background: var(--primary, #1f883d); transition: width .4s ease; }

/* --- AI chat console --- */
.ai-chat-log { height: 56vh; min-height: 300px; overflow-y: auto; padding: .25rem; }
.ai-chat-note { font-size: .78rem; color: var(--muted, #656d76); background: var(--inset, #f6f8fa);
  border: 1px solid var(--border, #d0d7de); border-radius: 6px; padding: .5rem .65rem; margin-bottom: .75rem; }
.ai-chat-msg { margin-bottom: .75rem; }
.ai-chat-who { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted, #656d76); margin-bottom: .15rem; }
.ai-chat-text { white-space: pre-wrap; word-break: break-word; font-size: .82rem; line-height: 1.5;
  border: 1px solid var(--border, #d0d7de); border-radius: 6px; padding: .5rem .65rem; }
.ai-chat-user .ai-chat-text { background: var(--inset, #f6f8fa); }
.ai-chat-model .ai-chat-text { background: var(--canvas, #fff); }
#ai-chat-input { font-family: var(--font-mono); font-size: .8rem; resize: vertical; }

.ai-chat-typed { white-space: pre-wrap; }
#ai-chat-send { min-width: 6.5rem; }

/* Markdown in a model's answer. Blocks bring their own spacing, so the bubble's
   pre-wrap is off here — the renderer already decided where the lines break. */
.ai-chat-prose { white-space: normal; word-break: break-word; }
.ai-chat-prose > *:last-child { margin-bottom: 0; }
.ai-md-p { margin: 0 0 .5rem; }
.ai-md-h { font-size: .86rem; font-weight: 600; margin: .7rem 0 .3rem; }
h1.ai-md-h { font-size: .95rem; }
h2.ai-md-h { font-size: .9rem; }
.ai-chat-prose > .ai-md-h:first-child { margin-top: 0; }
.ai-md-list { margin: 0 0 .5rem; padding-left: 1.25rem; }
.ai-md-list li { margin-bottom: .15rem; }
.ai-md-list .ai-md-list { margin: .15rem 0 0; }
.ai-md-quote { margin: 0 0 .5rem; padding: .05rem .6rem; color: var(--muted, #656d76);
  border-left: 3px solid var(--border, #d0d7de); }
.ai-md-hr { margin: .6rem 0; border: 0; border-top: 1px solid var(--border, #d0d7de); }
.ai-md-table { font-size: .78rem; margin-bottom: .5rem; }
.ai-chat-prose a { word-break: break-all; }
.ai-think { margin: 0 0 .5rem; padding: .25rem .5rem; border: 1px dashed var(--border, #d0d7de);
  border-radius: 6px; background: var(--inset, #f6f8fa); }
.ai-think-head { cursor: pointer; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted, #656d76); }
.ai-think-body { margin-top: .35rem; color: var(--muted, #656d76); }
.ai-code { border: 1px solid var(--border, #d0d7de); border-radius: 6px; overflow: hidden; margin: .5rem 0; }
.ai-code-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  background: var(--inset, #f6f8fa); border-bottom: 1px solid var(--border, #d0d7de);
  padding: .2rem .5rem; }
.ai-code-lang { font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted, #656d76); }
.ai-code-copy { border: 0; background: transparent; color: var(--muted, #656d76);
  font-size: .7rem; padding: .1rem .3rem; border-radius: 4px; cursor: pointer; }
.ai-code-copy:hover { background: var(--inset-2, #eaeef2); color: var(--fg, #1f2328); }
.ai-code-body { margin: 0; padding: .5rem .65rem; overflow-x: auto; background: var(--canvas, #fff);
  font-family: var(--font-mono); font-size: .76rem; line-height: 1.5; white-space: pre; }
.ai-code-inline { font-family: var(--font-mono); font-size: .76rem; padding: .05rem .25rem;
  border-radius: 4px; background: var(--inset-2, #eaeef2); }

.action-cmd-popover { max-width: 34rem; }
.action-cmd-popover .popover-header { font-size: .78rem; font-weight: 600; }
.action-cmd-popover .popover-body { padding: .45rem .6rem; }
.action-cmd { font-family: var(--font-mono); font-size: .74rem; line-height: 1.5;
  white-space: pre-wrap; max-height: 18rem; overflow: auto; color: var(--fg, #1f2328); }


/* The project card's Actions block: two panes that have to read as one. A fixed
   heading height lines their tables up at the top, and side by side (`.act-split`,
   xl and up) the boxes take a fixed height so the bottoms line up too. Alone, a pane
   grows to its content and only starts scrolling at the same cap. */
.act-pane-head { min-height: 2.25rem; }
.act-table-scroll { max-height: 20rem; overflow: auto; }
@media (min-width: 1200px) {
  .act-split .act-table-scroll { height: 20rem; max-height: none; }
}
/* A table that refreshes on a timer is only usable if its header stays put with it.
   The hairline moves to an inset shadow because a collapsed-border table paints its
   borders at table level, where they scroll out from under a sticky header. */
.act-table-scroll .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 var(--border);
}
