/* JetBrains Mono (self-hosted). Keep in sync with Google Fonts subsets. */
/* cyrillic */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-400-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* cyrillic-ext */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-400-cyrillic-ext.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* greek */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-400-greek.woff2') format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* latin */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* vietnamese */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-400-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* cyrillic */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-500-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* cyrillic-ext */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-500-cyrillic-ext.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* greek */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-500-greek.woff2') format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* latin */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-500-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* vietnamese */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-500-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* cyrillic */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-600-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* cyrillic-ext */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-600-cyrillic-ext.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* greek */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-600-greek.woff2') format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* latin */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-600-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* vietnamese */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('./vendor/fonts/jetbrains-mono/JetBrainsMono-600-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

:root {
  --bg: #0a0c12;
  --panel: #10131c;
  --muted: #7a8ba8;
  --text: #e5ecff;
  --accent: #6cf5d8;
  --accent-2: #6ca8ff;
  --border: #1a2033;
  --error: #ff5566;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --radius: 3px;
}

* {
  box-sizing: border-box;
}

/* Custom selection */
::selection {
  background: rgba(108, 245, 216, 0.3);
  color: var(--text);
}

.mobile-terminal-view ::selection,
.mobile-terminal-view span::selection {
  background: rgba(190, 190, 190, 0.6);
  color: #0a0c12;
}

/* Focus visible for keyboard nav */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

:focus:not(:focus-visible) {
  outline: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "JetBrains Mono", "SF Mono", "Consolas", monospace;
  font-size: 13px;
  line-height: 1.5;
  /* Firefox scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.hidden {
  display: none !important;
}

.app-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px;
}

/* Combined nav bar: brand + tabs in one row */
.nav-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  /* Ensure tabs remain clickable (avoid overlays stealing clicks). */
  position: relative;
  z-index: 1500;
}

.nav-brand {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.05em;
  padding: 0 8px;
  flex-shrink: 0;
  user-select: none;
}

.nav-repo-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  padding: 0 8px;
  flex-shrink: 0;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hub-back-btn {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  flex-shrink: 0;
  transition: all 0.1s ease;
}

.hub-back-btn:hover {
  color: var(--text);
  border-color: var(--muted);
  background: #161b28;
}

/* Tabs - compact horizontal bar */
.tabs {
  display: flex;
  flex: 1;
  gap: 2px;
  background: var(--panel);
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  z-index: 1501;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tab {
  flex: 1;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.1s ease;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.tab:hover:not(.active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.tab.active {
  color: var(--bg);
  background: var(--accent);
}

main {
  display: block;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

/* Cards grid */
.cards {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 8px;
}

.card {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 10px;
}

/* ===== Compact Per-Repo Usage Card ===== */
.usage-card-compact {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
}

.usage-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.usage-total-badge {
  background: linear-gradient(135deg, rgba(108, 245, 216, 0.15), rgba(108, 168, 255, 0.1));
  border: 1px solid rgba(108, 245, 216, 0.3);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  padding: 2px 8px;
  border-radius: var(--radius);
  letter-spacing: -0.02em;
}

.usage-events-badge {
  color: var(--muted);
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.usage-breakdown {
  display: flex;
  gap: 3px;
  margin-bottom: 6px;
}

.usage-chart {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 6px;
}

.usage-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.usage-chart-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.usage-chart-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.usage-chart-label {
  font-size: 9px;
  color: var(--muted);
}

.usage-chart-select {
  font-size: 10px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px 6px;
  min-width: 44px;
}

.usage-chart-canvas {
  height: 88px;
  width: 100%;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(108, 245, 216, 0.06), rgba(0, 0, 0, 0));
  border: 1px dashed rgba(108, 245, 216, 0.2);
  position: relative;
  overflow: hidden;
}

.usage-chart-canvas svg {
  width: 100%;
  height: 100%;
  display: block;
}

.usage-chart-canvas.loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.usage-chart-canvas.loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 18, 0.25);
  pointer-events: none;
}

.usage-chart-focus {
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: rgba(108, 245, 216, 0.5);
  pointer-events: none;
  opacity: 0;
}

.usage-chart-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6cf5d8;
  box-shadow: 0 0 6px rgba(108, 245, 216, 0.6);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
}

.usage-chart-tooltip {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 6px 8px;
  background: rgba(9, 13, 20, 0.95);
  border: 1px solid rgba(108, 245, 216, 0.2);
  border-radius: var(--radius);
  font-size: 10px;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  max-width: 180px;
}

.usage-chart-tooltip-title {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 2px;
}

.usage-chart-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
}

.usage-chart-empty {
  font-size: 10px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.hub-usage-chart {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 10px;
}

.hub-usage-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.hub-usage-chart-canvas {
  height: 160px;
  border-style: solid;
}

@media (max-width: 720px) {
  .usage-chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .hub-usage-chart-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .usage-chart-controls {
    width: 100%;
    justify-content: flex-start;
  }
}

.usage-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}

.usage-stat-cached {
  background: rgba(108, 245, 216, 0.05);
  border-color: rgba(108, 245, 216, 0.2);
}

.usage-stat-cached .usage-stat-val {
  color: var(--accent);
}

.usage-stat-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.usage-stat-lbl {
  font-size: 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.usage-footer {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--muted);
  opacity: 0.7;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
}

/* Usage Progress Bars */
.usage-rates-visual {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 2px;
}

.usage-rate-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.usage-rate-label {
  font-size: 9px;
  color: var(--muted);
  width: 45px;
  flex-shrink: 0;
}

.usage-rate-bar-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.usage-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}

.usage-progress-bar-empty {
  opacity: 0.5;
}

.usage-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.usage-bar-ok {
  background: var(--accent);
}

.usage-bar-warning {
  background: #ffcc00;
}

.usage-bar-critical {
  background: #ff5566;
}

.usage-progress-label {
  font-size: 9px;
  color: var(--text);
  font-family: monospace;
  min-width: 50px;
  text-align: right;
}

/* ===== Compact Hub Usage Section ===== */
.hub-usage-compact {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin: 8px 0;
}

.hub-usage-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.hub-usage-path {
  flex: 1;
  font-size: 9px;
  color: var(--muted);
  opacity: 0.6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.hub-usage-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.hub-usage-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 10px;
  min-width: 0;
  flex: 0 0 auto;
}

.hub-usage-chip:hover {
  border-color: var(--accent);
  background: rgba(108, 245, 216, 0.04);
}

.hub-usage-chip-unmatched {
  opacity: 0.6;
}

.hub-usage-chip-name {
  font-weight: 600;
  color: var(--text);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hub-usage-chip-total {
  font-weight: 700;
  color: var(--accent);
  font-size: 11px;
}

.hub-usage-chip-meta {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

/* Hub shell */
.hub-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px;
}

.hub-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: linear-gradient(120deg, rgba(108, 245, 216, 0.08), rgba(108, 168, 255, 0.05));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.hub-hero h1 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.hub-hero p {
  margin: 0;
  font-size: 11px;
}

.hub-hero-text {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hub-hero-text > .muted.small {
  display: none;
}

.hub-hero-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.hub-hero-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.hub-stats {
  display: flex;
  gap: 6px;
  margin: 8px 0;
}

.hub-stat {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hub-stat p {
  margin: 0;
  font-size: 10px;
}

.hub-stat-value {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.hub-repo-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
}

.hub-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.hub-panel-header p {
  margin: 0;
  font-size: 10px;
}

.hub-panel-actions {
  display: flex;
  gap: 4px;
}

.hub-repo-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Hub worktrees (worktree repos grouped under a base repo) */
.hub-worktree-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: 14px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  margin-top: 4px;
  margin-bottom: 6px;
}

.hub-worktree-row-inner {
  display: block;
}

.hub-worktree-card {
  padding-left: 8px;
}

.hub-worktree-orphans {
  margin: 8px 0 4px;
}

/* Legacy hub-usage-list styles removed - using hub-usage-grid now */

/* Repo card - compact single-row layout */
.hub-repo-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  background: var(--bg);
  transition: all 0.1s ease;
}

.hub-repo-card.hub-repo-clickable {
  cursor: pointer;
}

.hub-repo-card.hub-repo-clickable:hover {
  border-color: var(--accent);
  background: rgba(108, 245, 216, 0.04);
}

.hub-repo-card.hub-repo-clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* New compact row layout */
.hub-repo-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.hub-repo-left {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.hub-repo-center {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  overflow: hidden;
}

.hub-repo-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.hub-repo-title {
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.hub-repo-clickable:hover .hub-repo-title {
  color: var(--accent);
}

.hub-repo-info-line {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hub-repo-subline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

a.hub-pr-pill {
  text-decoration: none;
  border-color: rgba(108, 245, 216, 0.35);
  color: var(--accent);
}

a.hub-pr-pill:hover {
  border-color: var(--accent);
}

.hub-repo-open-indicator {
  color: var(--muted);
  font-size: 14px;
  margin-left: 2px;
  opacity: 0.5;
  transition: all 0.1s ease;
}

.hub-repo-clickable:hover .hub-repo-open-indicator {
  color: var(--accent);
  opacity: 1;
  transform: translateX(2px);
}

.hub-repo-note {
  margin-top: 4px;
  color: #ff8899;
  font-size: 10px;
  padding-left: 4px;
}

/* Legacy support - keep for backwards compat */
.hub-repo-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.hub-repo-info {
  flex: 1;
  min-width: 0;
}

.hub-repo-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.hub-repo-path {
  color: var(--muted);
  font-size: 10px;
  opacity: 0.7;
}

.hub-repo-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
  flex-wrap: wrap;
}

.hub-repo-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.hub-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 10px;
  font-size: 11px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.card-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.label {
  color: var(--muted);
  letter-spacing: 0.06em;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 500;
  user-select: none;
}

.hub-version,
.version-label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* Status pills */
.pill {
  padding: 2px 6px;
  border-radius: var(--radius);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  border: 1px solid transparent;
}

.pill-idle {
  border-color: var(--border);
  background: var(--bg);
  color: var(--muted);
}

.pill-running {
  border-color: var(--accent);
  background: rgba(108, 245, 216, 0.12);
  color: var(--accent);
  animation: pulse-running 1.5s ease-in-out infinite;
}

@keyframes pulse-running {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.pill-error {
  border-color: #ff5566;
  background: rgba(255, 85, 102, 0.12);
  color: #ff8899;
}

.pill-warn {
  border-color: var(--accent-2);
  background: rgba(108, 168, 255, 0.12);
  color: var(--accent-2);
}

.pill-small {
  padding: 1px 5px;
  font-size: 9px;
}

/* Compact status pill for repo cards */
.hub-repo-left .pill-small {
  padding: 2px 6px;
  font-size: 9px;
  min-width: 42px;
  text-align: center;
}

/* Metrics grid */
.grid-two {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.grid-two > div {
  padding: 4px 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.grid-two .muted {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}

.metric {
  font-size: 13px;
  font-weight: 600;
  margin: 1px 0 0;
  color: var(--text);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 11px;
}

.runner-config {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.runner-config-label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-transform: uppercase;
  opacity: 0.75;
}

.runner-config-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}


/* Actions */
.actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* Buttons */
button {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.1s ease;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:hover:not(:disabled) {
  border-color: var(--muted);
  background: #161b28;
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

button.primary {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  border: none;
}

button.primary:hover:not(:disabled) {
  background: #5de6c9;
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

button.ghost:hover:not(:disabled) {
  background: rgba(108, 168, 255, 0.08);
  color: var(--text);
  border-color: var(--border);
}

button.danger {
  background: rgba(255, 85, 102, 0.1);
  border-color: #ff5566;
  color: #ff8899;
}

button.danger:hover:not(:disabled) {
  background: rgba(255, 85, 102, 0.2);
}

button.sm {
  padding: 4px 8px;
  font-size: 10px;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Icon-only buttons (e.g. ↻) */
button.icon-btn {
  padding: 0;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

/* TODO checklist */
.todo-preview .checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.checklist li {
  display: grid;
  grid-template-columns: 14px 1fr;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 11px;
}

.checklist .box {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: var(--bg);
  position: relative;
  flex-shrink: 0;
}

.checklist .box.done {
  border-color: var(--accent);
  background: var(--accent);
}

.checklist .box.done::after {
  content: "✓";
  position: absolute;
  top: -1px;
  left: 1px;
  font-size: 10px;
  color: var(--bg);
  font-weight: 700;
}

/* GitHub card */
.github-card .github-grid {
  display: grid;
  gap: 8px;
  margin: 10px 0 6px;
}

.github-card .github-row {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 8px;
  align-items: center;
}

.github-card .github-link {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.github-card .github-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 12px;
}

.github-card .github-pr-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.github-card .icon-btn-inline {
  padding: 2px 4px;
  min-width: unset;
  font-size: 12px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.github-card .icon-btn-inline:hover:not(:disabled) {
  opacity: 1;
}

.github-card .icon-btn-inline:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.github-card .github-actions {
  margin-top: 10px;
}

/* Docs nav */
.doc-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.spec-issue-import {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
  flex-wrap: wrap;
}

.spec-issue-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.spec-issue-input-row.hidden {
  display: none;
}

.spec-issue-import input {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  min-width: 200px;
}

.doc-editor {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chip {
  padding: 5px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

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

.chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(108, 245, 216, 0.08);
}

/* Editor textarea */
.doc-editor textarea {
  width: 100%;
  min-height: calc(100vh - 140px);
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.doc-editor textarea::-webkit-scrollbar {
  width: 6px;
}

.doc-editor textarea::-webkit-scrollbar-track {
  background: transparent;
}

.doc-editor textarea::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.doc-editor textarea::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.doc-editor textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Removed .snapshot-editor - snapshot now uses shared doc editor */

.doc-patch-main {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 10px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-patch-main.hidden {
  display: none;
}

.doc-patch-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.doc-patch-info {
  flex: 1;
  min-width: 0;
}

.doc-patch-legend {
  display: flex;
  gap: 12px;
  font-size: 9px;
  color: var(--muted);
  margin-top: 6px;
}

.doc-patch-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.doc-patch-legend-add::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  background: rgba(46, 160, 67, 0.15);
  color: #3fb950;
  border-radius: 2px;
  font-weight: 600;
  font-size: 10px;
}

.doc-patch-legend-del::before {
  content: "−";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  background: rgba(248, 81, 73, 0.15);
  color: #f85149;
  border-radius: 2px;
  font-weight: 600;
  font-size: 10px;
}

.doc-patch-summary {
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
}

.doc-patch-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.doc-patch-body {
  background: #0d1117;
  color: #d6dbe0;
  border-radius: var(--radius);
  padding: 0;
  max-height: 320px;
  overflow: auto;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  line-height: 1;
  border: 1px solid #21262d;
}

/* Diff syntax highlighting - line-by-line with gutters */
.diff-view {
  display: flex;
  flex-direction: column;
}

.diff-line {
  display: flex;
  align-items: stretch;
  min-height: 1.5em;
  line-height: 1.5;
}

.diff-gutter {
  flex: 0 0 36px;
  text-align: right;
  padding-right: 8px;
  color: #6e7681;
  font-size: 10px;
  user-select: none;
  border-right: 1px solid #21262d;
  background: #161b22;
}

.diff-gutter-add {
  background: rgba(46, 160, 67, 0.2);
  color: #7ee787;
}

.diff-gutter-del {
  background: rgba(248, 81, 73, 0.2);
  color: #f97583;
}

.diff-gutter-ctx {
  background: #161b22;
}

.diff-gutter-hunk {
  background: rgba(56, 139, 253, 0.1);
  color: #58a6ff;
  text-align: center;
  padding-right: 0;
}

.diff-sign {
  flex: 0 0 16px;
  text-align: center;
  font-weight: 600;
  user-select: none;
}

.diff-add .diff-sign {
  color: #3fb950;
  background: rgba(46, 160, 67, 0.15);
}

.diff-del .diff-sign {
  color: #f85149;
  background: rgba(248, 81, 73, 0.15);
}

.diff-ctx .diff-sign {
  color: transparent;
}

.diff-content {
  flex: 1;
  padding-left: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Line type backgrounds */
.diff-line.diff-add {
  background: rgba(46, 160, 67, 0.12);
}

.diff-line.diff-add .diff-content {
  color: #aff5b4;
}

.diff-line.diff-del {
  background: rgba(248, 81, 73, 0.12);
}

.diff-line.diff-del .diff-content {
  color: #ffc1c8;
}

.diff-line.diff-hunk {
  background: rgba(56, 139, 253, 0.08);
  border-top: 1px solid rgba(56, 139, 253, 0.3);
  border-bottom: 1px solid rgba(56, 139, 253, 0.3);
  margin-top: 4px;
}

.diff-line.diff-hunk:first-child {
  margin-top: 0;
}

.diff-line.diff-hunk .diff-content {
  color: #a5d6ff;
  font-weight: 600;
  padding-left: 8px;
}

.diff-line.diff-file {
  background: transparent;
}

.diff-line.diff-file .diff-content {
  color: #d2a8ff;
  font-weight: 500;
}

.diff-line.diff-ctx .diff-content {
  color: #8b949e;
}

.diff-line.diff-meta .diff-content {
  color: #6e7681;
  font-style: italic;
  padding-left: 60px; /* Align with content after gutter + sign */
}

/* Empty line marker - visible symbol for blank lines */
.diff-empty-marker {
  color: #6e7681;
  background: rgba(110, 118, 129, 0.15);
  padding: 0 4px;
  border-radius: 2px;
  font-size: 10px;
  font-style: italic;
}

.diff-add .diff-empty-marker {
  color: #56d364;
  background: rgba(46, 160, 67, 0.25);
}

.diff-del .diff-empty-marker {
  color: #f97583;
  background: rgba(248, 81, 73, 0.25);
}

.doc-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.doc-actions.hidden {
  display: none;
}

/* Shared compose panel styling (terminal + doc chat) */
.compose-panel {
  margin-top: 4px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.compose-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.compose-row textarea {
  flex: 1 1 auto;
  width: 100%;
  min-height: 56px;
  max-height: 160px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 6px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.3;
  resize: vertical;
  overflow-y: auto;
}

.compose-row textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.compose-row textarea::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.compose-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
}

.compose-buttons button {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: 10px;
}

.compose-buttons .voice-button svg {
  width: 14px;
  height: 14px;
  min-width: 14px;
  min-height: 14px;
  fill: none;
}

/* Doc chat panel - compact inline design */
.doc-chat-panel {
  flex-shrink: 0;
}

.doc-chat-compose {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.voice-button {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.voice-button svg {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  stroke: currentColor;
  flex-shrink: 0;
}

.voice-button.voice-recording {
  background: #b3261e;
  color: #fff;
  border-color: #b3261e;
  box-shadow: 0 0 0 2px rgba(179, 38, 30, 0.2);
}

.voice-button.voice-sending {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.voice-button.voice-sending .voice-spinner {
  animation: voice-spin 0.8s linear infinite;
}

@keyframes voice-spin {
  to {
    transform: rotate(360deg);
  }
}

.voice-button.voice-sending svg {
  opacity: 0.35;
}

.voice-button.voice-sending::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: voice-spin 0.8s linear infinite;
  pointer-events: none;
}

@keyframes voice-spin {
  to {
    transform: rotate(360deg);
  }
}

.voice-button.voice-error {
  border-color: #d35400;
  color: #d35400;
}

.voice-button.voice-retry {
  background: #fff7e6;
  border-color: #e0c080;
  color: #8c5b00;
}

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

.voice-button.voice-disconnected {
  opacity: 0.65;
}

.voice-status {
  color: var(--muted);
}

/* Audio level meter visualization - positioned relative to parent */
.voice-level-meter {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 20px;
  padding: 0 4px;
  vertical-align: middle;
  flex-shrink: 0;
}

.voice-level-meter.voice-level-stop {
  cursor: pointer;
}

.voice-level-bar {
  width: 3px;
  min-height: 3px;
  height: 15%;
  background: var(--accent);
  border-radius: 1px;
  transition: height 0.05s ease-out;
  opacity: 0.4;
}

.voice-level-bar.active {
  opacity: 1;
  background: #4ade80;
}

.doc-chat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0;
  font-size: 10px;
}

.doc-chat-meta .loading {
  color: var(--accent);
}

.doc-chat-meta .loading::before {
  content: "●";
  display: inline-block;
  margin-right: 4px;
  animation: pulse-dot 1s ease-in-out infinite;
}

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

/* Response wrapper - only visible when there's content */
.doc-chat-response-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 4px 6px;
  max-height: 120px;
  overflow-y: auto;
  font-size: 11px;
}

.doc-chat-response-wrapper.hidden {
  display: none;
}

.doc-chat-response {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.5;
}

.doc-chat-response.streaming {
  color: var(--accent);
  border-left: 2px solid var(--accent);
  padding-left: 8px;
  margin-left: -2px;
}

.doc-chat-patch-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 8px;
  max-height: 240px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.doc-chat-patch-wrapper.hidden {
  display: none;
}

.doc-chat-patch-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.spacer {
  flex: 1;
}

.doc-chat-patch {
  background: #0f1116;
  color: #d6dbe0;
  border-radius: var(--radius);
  padding: 8px;
  overflow: auto;
  max-height: 160px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  line-height: 1.4;
}

.doc-chat-error {
  margin-top: 6px;
  color: var(--error);
  font-size: 11px;
}

/* Collapsible history */
.doc-chat-history-details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.doc-chat-history-details[open] {
  background: var(--panel);
}

.doc-chat-history-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 6px;
  cursor: pointer;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  user-select: none;
  list-style: none;
}

.doc-chat-history-toggle::-webkit-details-marker {
  display: none;
}

.doc-chat-history-toggle::before {
  content: "▶";
  font-size: 8px;
  margin-right: 6px;
  transition: transform 0.15s ease;
}

.doc-chat-history-details[open] .doc-chat-history-toggle::before {
  transform: rotate(90deg);
}

.doc-chat-history-count {
  background: var(--border);
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 9px;
  min-width: 18px;
  text-align: center;
}

.doc-chat-history {
  max-height: 100px;
  overflow-y: auto;
  padding: 0 6px 4px;
}

.doc-chat-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0 4px;
  border-bottom: 1px solid var(--border);
  padding: 3px 0;
  align-items: baseline;
}

.doc-chat-entry-detail {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.doc-chat-entry-detail pre {
  background: #0f1116;
  color: #d6dbe0;
  padding: 6px;
  border-radius: var(--radius);
  overflow: auto;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
}

.doc-chat-entry-patch {
  border-left: 2px solid var(--accent);
}

.doc-chat-entry:last-child {
  border-bottom: none;
}

.doc-chat-entry .prompt-row {
  display: flex;
  align-items: center;
  gap: 4px;
  grid-column: 1;
  min-width: 0;
}

.doc-chat-entry .prompt {
  font-weight: 500;
  font-size: 10px;
  color: var(--accent-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.doc-chat-entry .copy-prompt-btn {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: all 0.1s ease;
}

.doc-chat-entry:hover .copy-prompt-btn {
  opacity: 0.7;
}

.doc-chat-entry .copy-prompt-btn:hover {
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(108, 245, 216, 0.1);
}

.doc-chat-entry .response {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  grid-column: 1 / -1;
}

.doc-chat-entry .meta {
  font-size: 9px;
  color: var(--muted);
  display: flex;
  gap: 3px;
  align-items: center;
  opacity: 0.6;
  grid-column: 2;
  grid-row: 1;
}

.doc-chat-entry .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

.doc-chat-entry.running .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(108, 245, 216, 0.2);
}

.doc-chat-entry.error .status-dot {
  background: var(--error);
}

.doc-chat-empty {
  padding: 8px 0;
  text-align: center;
}

/* Entry details (View details) */
.doc-chat-entry-detail {
  margin-top: 2px;
  font-size: 10px;
}

.doc-chat-entry-detail summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 9px;
  padding: 2px 0;
}

.doc-chat-entry-detail summary:hover {
  color: var(--text);
}

.doc-chat-entry-body {
  margin-top: 4px;
  max-height: 100px;
  overflow-y: auto;
}

.doc-chat-entry-body pre {
  margin: 0;
  padding: 4px;
  font-size: 9px;
  background: var(--bg);
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-break: break-word;
}

.doc-chat-entry-patch {
  border-left: 2px solid var(--accent);
  margin-top: 4px;
}

.card .row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Inputs */
input[type="number"],
input[type="text"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 4px 6px;
  font-size: 11px;
  font-family: inherit;
  width: 60px;
}

input[type="number"]::placeholder,
input[type="text"]::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

input[type="number"]:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--muted);
  user-select: none;
}

/* Inline toolbar for Logs/Terminal - super compact */
.inline-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
}

.inline-toolbar .terminal-voice {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.inline-toolbar .terminal-voice .voice-button {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  flex-shrink: 0;
}

.inline-toolbar .terminal-voice .voice-button svg {
  width: 14px;
  height: 14px;
  min-width: 14px;
  min-height: 14px;
}

.inline-toolbar .terminal-voice .voice-status {
  white-space: nowrap;
}

/* Log viewer - maximize height (accounts for nav + toolbar + legend) */
.log-viewer {
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 8px;
  color: #b0c0d8;
  height: calc(100vh - 130px);
  overflow: auto;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.4;
  margin: 0;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.log-viewer:empty::before,
.log-viewer.empty::before {
  content: "(no logs)";
  color: var(--muted);
  font-style: italic;
}

.log-viewer::-webkit-scrollbar {
  width: 6px;
}

.log-viewer::-webkit-scrollbar-track {
  background: transparent;
}

.log-viewer::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.log-viewer::-webkit-scrollbar-thumb:hover {
  background: #2a3450;
}

/* ========== LOG LINE TYPES ========== */

.log-line {
  padding: 1px 4px;
  border-radius: 2px;
  margin: 1px 0;
  position: relative;
}

/* Icons before certain line types */
.log-line[data-icon]::before {
  content: attr(data-icon);
  display: inline-block;
  margin-right: 6px;
  font-size: 10px;
  opacity: 0.8;
}

/* Run boundaries - prominent separators */
.log-line.log-run-start,
.log-line.log-run-end {
  background: linear-gradient(90deg, rgba(108, 245, 216, 0.15) 0%, transparent 100%);
  border-left: 3px solid var(--accent);
  color: var(--accent);
  font-weight: 600;
  padding: 6px 8px;
  margin: 12px 0 8px 0;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.log-line.log-run-end {
  background: linear-gradient(90deg, rgba(108, 168, 255, 0.12) 0%, transparent 100%);
  border-left-color: var(--accent-2);
  color: var(--accent-2);
  margin: 8px 0 12px 0;
}

/* Thinking/reasoning - italicized, muted */
.log-line.log-thinking-label {
  color: #9b7aff;
  font-style: italic;
  opacity: 0.7;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 6px;
}

.log-line.log-thinking {
  color: #b8a3ff;
  font-style: italic;
  padding-left: 20px;
  border-left: 2px solid rgba(155, 122, 255, 0.3);
  background: rgba(155, 122, 255, 0.05);
}

/* Tool execution - highlighted */
.log-line.log-exec-label {
  color: #ffa64d;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
  margin-top: 6px;
}

.log-line.log-exec-command {
  color: #ffcc80;
  background: rgba(255, 166, 77, 0.08);
  border-left: 2px solid rgba(255, 166, 77, 0.4);
  padding-left: 20px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* File updates */
.log-line.log-file-update-label {
  color: #4dc9ff;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
  margin-top: 6px;
}

.log-line.log-file-modified {
  color: #80d4ff;
  background: rgba(77, 201, 255, 0.08);
  border-left: 2px solid rgba(77, 201, 255, 0.4);
  padding-left: 20px;
}

/* Diff styling */
.log-line.log-diff-header {
  color: #d2a8ff;
  font-size: 10px;
  opacity: 0.7;
}

.log-line.log-diff-hunk {
  color: #58a6ff;
  background: rgba(56, 139, 253, 0.08);
  font-weight: 500;
}

.log-line.log-diff-add {
  color: #7ee787;
  background: rgba(46, 160, 67, 0.12);
  border-left: 2px solid #3fb950;
  padding-left: 20px;
}

.log-line.log-diff-del {
  color: #f97583;
  background: rgba(248, 81, 73, 0.12);
  border-left: 2px solid #f85149;
  padding-left: 20px;
}

/* Prompt/context markers - dimmed, collapsible appearance */
.log-line.log-prompt-marker,
.log-line.log-prompt-marker-end {
  color: #6e7681;
  font-size: 10px;
  opacity: 0.5;
  font-style: italic;
}

.log-line.log-prompt-context {
  color: #6e7681;
  opacity: 0.4;
  font-size: 10px;
  padding-left: 12px;
  border-left: 1px dashed rgba(110, 118, 129, 0.3);
}

/* System messages */
.log-line.log-system {
  color: #6e7681;
  font-size: 10px;
  opacity: 0.6;
}

.log-line.log-tokens {
  color: #a371f7;
  font-size: 10px;
  background: rgba(163, 113, 247, 0.08);
  border-radius: 3px;
  padding: 2px 6px;
  display: inline-block;
  margin: 4px 0;
}

/* Success/exit status */
.log-line.log-success {
  color: #56d364;
}

.log-line.log-exit-code {
  color: #8b949e;
  font-size: 10px;
}

/* Agent output - most prominent! This is the final answer */
.log-line.log-agent-output {
  color: var(--text);
  background: linear-gradient(90deg, rgba(108, 245, 216, 0.12) 0%, rgba(108, 168, 255, 0.08) 100%);
  border: 1px solid rgba(108, 245, 216, 0.3);
  border-radius: 4px;
  padding: 8px 12px;
  margin: 8px 0;
  font-weight: 500;
  font-size: 12px;
  line-height: 1.5;
}

/* Regular output */
.log-line.log-output {
  color: #b0c0d8;
}

/* Test output */
.log-line.log-test-output {
  color: #58a6ff;
  font-size: 10px;
}

/* Error/traceback output */
.log-line.log-error-output {
  color: #f97583;
  background: rgba(248, 81, 73, 0.08);
  border-left: 2px solid #f85149;
  padding-left: 20px;
}

/* Blank lines */
.log-line.log-blank {
  height: 8px;
}

/* ========== LOG LEGEND ========== */
.log-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  font-size: 9px;
  align-items: center;
}

.log-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
}

.log-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.log-legend-dot.thinking { background: #9b7aff; }
.log-legend-dot.exec { background: #ffa64d; }
.log-legend-dot.file { background: #4dc9ff; }
.log-legend-dot.diff-add { background: #3fb950; }
.log-legend-dot.diff-del { background: #f85149; }
.log-legend-dot.output { background: var(--accent); }
.log-legend-dot.context { background: #6e7681; opacity: 0.5; }

/* ========== COLLAPSIBLE CONTEXT BLOCKS ========== */
.log-context-block {
  margin: 4px 0;
  border: 1px solid rgba(110, 118, 129, 0.2);
  border-radius: 4px;
  background: rgba(110, 118, 129, 0.05);
}

.log-context-block[open] {
  background: rgba(110, 118, 129, 0.08);
}

.log-context-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 10px;
  color: #6e7681;
  user-select: none;
  list-style: none;
}

.log-context-summary::-webkit-details-marker {
  display: none;
}

.log-context-summary:hover {
  color: #8b949e;
  background: rgba(110, 118, 129, 0.1);
}

.log-context-icon {
  font-size: 8px;
  transition: transform 0.15s ease;
}

.log-context-block[open] .log-context-icon {
  transform: rotate(90deg);
}

.log-context-count {
  opacity: 0.6;
  font-size: 9px;
}

.log-context-content {
  padding: 4px 8px 8px;
  border-top: 1px solid rgba(110, 118, 129, 0.15);
  max-height: 200px;
  overflow-y: auto;
  font-size: 10px;
}

.log-context-content .log-line {
  margin: 0;
  padding: 1px 4px;
}

/* ========== RUN SECTION STYLING ========== */
.log-run-section {
  margin: 8px 0;
  border-left: 2px solid var(--border);
  padding-left: 8px;
}

/* ========== LOG CONTAINER WITH JUMP BUTTON ========== */
.log-container {
  position: relative;
  height: calc(100vh - 130px);
}

.log-container .log-viewer {
  height: 100%;
}

.log-load-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  z-index: 10;
  transition: all 0.15s ease;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

.log-load-btn:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.log-load-btn:hover {
  border-color: rgba(108, 245, 216, 0.5);
  color: var(--accent);
}

.log-jump-btn {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 10;
  transition: all 0.15s ease;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.log-jump-btn:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.log-jump-btn:hover {
  background: #5de6c9;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.log-jump-btn:active {
  transform: translateY(0);
}

/* Terminal - maximize space */
.terminal-container {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  height: calc(100vh - 100px);
  height: calc(100dvh - 100px);
  overflow: hidden;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

/* ===== MOBILE TERMINAL CONTROLS ===== */
/* Hidden by default - only shown on touch devices */
.terminal-mobile-controls {
  display: none;
}

.terminal-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(10, 12, 18, 0.95);
  color: var(--muted);
  z-index: 2;
  padding: 20px;
}

.terminal-container .xterm {
  padding: 6px;
}

.terminal-container .xterm-viewport {
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.terminal-jump-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(108, 245, 216, 0.12);
  border: 1px solid rgba(108, 245, 216, 0.3);
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 0.15s ease, opacity 0.15s ease;
  z-index: 4;
}

.terminal-jump-btn:hover {
  background: rgba(108, 245, 216, 0.2);
  transform: translateY(-1px);
}

.terminal-jump-btn:active {
  transform: translateY(0);
}

/* ===== TERMINAL TEXT INPUT (optional panel) ===== */
#terminal-text-input-toggle[aria-expanded="true"] {
  background: rgba(108, 245, 216, 0.12);
  border-color: rgba(108, 245, 216, 0.3);
  color: var(--accent);
}

#terminal.composer-sticky .terminal-text-input {
  position: sticky;
  bottom: calc(env(safe-area-inset-bottom) + var(--vv-bottom, 0px));
  z-index: 8;
  box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.45);
}

.terminal-text-input-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  display: none; /* Hide on mobile, show on desktop */
}

.terminal-text-input-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.terminal-text-input-hint {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 10px;
}

.terminal-text-input-buttons .voice-button,
.terminal-text-input-buttons .terminal-text-image,
.terminal-text-send-icon {
  padding: 0;
}

.terminal-text-input-buttons .terminal-text-image {
  font-size: 11px;
  letter-spacing: 0.2px;
}

button.terminal-text-send-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0b0f14;
  background: var(--accent);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
}

button.terminal-text-send-icon.disconnected {
  opacity: 0.55;
}

.terminal-text-input-buttons .voice-level-meter {
  width: 34px;
  height: 34px;
  padding: 4px 2px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: rgba(108, 245, 216, 0.12);
  cursor: pointer;
}

/* When the panel is open, shrink xterm height to keep controls visible (JS toggles the class). */
#terminal.text-input-open .terminal-container {
  height: max(180px, calc(100vh - 260px));
  height: max(180px, calc(100dvh - 260px));
}

/* Toast */
.toast {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top, 0px) + var(--vv-top, 0px));
  right: 8px;
  bottom: auto;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  transform: translateY(8px);
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-color: var(--error);
  color: #ffaab5;
}

/* Screen reader only */
.sr-only {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  white-space: nowrap;
}

/* Confirmation Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

#confirm-modal,
#input-modal {
  z-index: 3000;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-dialog {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.modal-dialog p {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-actions button {
  min-width: 80px;
}

/* Input modal */
.modal-input {
  max-width: 420px;
}

.modal-input p {
  margin: 0 0 12px;
}

.modal-input input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  margin-bottom: 16px;
  box-sizing: border-box;
}

.modal-input input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-input input[type="text"]::placeholder {
  color: var(--muted);
}

/* Create repo modal */
.modal-create-repo {
  max-width: 440px;
}

.modal-header {
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.modal-header .label {
  font-size: 12px;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 11px;
  color: var(--text);
  font-weight: 500;
}

.form-group .required {
  color: var(--error);
}

.form-group .optional {
  color: var(--muted);
  font-weight: 400;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.form-group input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group select {
  width: 100%;
  padding: 8px 10px;
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

.form-hint {
  font-size: 10px;
  color: var(--muted);
}

.form-checkbox {
  flex-direction: row;
  align-items: center;
}

.form-checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Loading button state */
button.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

button.loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid var(--muted);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Runner pid info */
#runner-pid {
  margin: 6px 0 0;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 10px;
}

/* ===== RESPONSIVE ===== */
  @media (max-width: 900px) {
    .cards {
      grid-template-columns: 1fr;
    }
    
    .grid-two {
      grid-template-columns: repeat(2, 1fr);
    }

    .hub-hero {
      flex-direction: row;
      align-items: center;
      gap: 8px;
    }

    .hub-hero-text {
      flex: 1;
      flex-direction: row;
      align-items: center;
      gap: 8px;
    }

    .hub-hero-actions {
      justify-content: flex-end;
    }

    .hub-stats {
      flex-wrap: wrap;
    }

    .hub-stat {
      min-width: 80px;
    }

    /* Compact repo cards on tablet */
    .hub-repo-row {
      flex-wrap: wrap;
      gap: 6px;
    }

    .hub-repo-center {
      flex-direction: column;
      align-items: flex-start;
      gap: 2px;
    }

    .hub-repo-open-indicator {
      display: none;
    }
  }

/* Mobile: 640px and below */
@media (max-width: 640px) {
  :root {
    --mobile-top-pad: max(4px, env(safe-area-inset-top));
    --mobile-bottom-nav: calc(52px + env(safe-area-inset-bottom, 0px));
    --mobile-input-font-size: 16px;
  }

  html.mobile-chrome-hidden {
    --mobile-bottom-nav: env(safe-area-inset-bottom, 0px);
  }

  /* Safe area support for notches */
  .app-shell {
    padding: 4px;
    padding-top: var(--mobile-top-pad);
    padding-bottom: var(--mobile-bottom-nav);
    min-height: 100vh;
    min-height: 100dvh;
  }

  /* Hub mobile styles - compact layout */
  .hub-shell {
    padding: 4px;
    padding-top: max(4px, env(safe-area-inset-top));
  }

  .hub-hero {
    padding: 8px 10px;
    gap: 8px;
  }

  .hub-hero h1 {
    font-size: 13px;
  }

  .hub-hero-text {
    gap: 8px;
  }
  
  .hub-hero-actions {
    gap: 4px;
  }
  
  .hub-hero-actions button {
    padding: 6px 10px;
  }

  .hub-stats {
    gap: 4px;
    margin: 6px 0;
  }

  .hub-stat {
    padding: 6px 10px;
    gap: 6px;
  }

  .hub-stat-value {
    font-size: 16px;
  }

  .hub-stat p {
    font-size: 9px;
  }

  .hub-repo-panel {
    padding: 8px;
  }

  .hub-panel-header {
    padding-bottom: 6px;
    margin-bottom: 6px;
  }

  .hub-repo-list {
    gap: 4px;
  }

  .hub-repo-card {
    padding: 8px 10px;
  }

  .hub-repo-row {
    gap: 6px;
  }

  .hub-repo-left {
    gap: 3px;
  }

  .hub-repo-center {
    flex-direction: row;
    gap: 6px;
  }

  .hub-repo-title {
    font-size: 11px;
  }

  .hub-repo-info-line {
    font-size: 9px;
  }

  .hub-repo-right {
    gap: 3px;
  }

  .hub-repo-right button {
    padding: 5px 8px;
    font-size: 9px;
  }

  .hub-repo-note {
    font-size: 9px;
    margin-top: 3px;
  }

  /* Compact usage on mobile */
  .hub-usage-compact {
    padding: 6px 8px;
    margin: 6px 0;
  }

  .hub-usage-header {
    gap: 6px;
    margin-bottom: 4px;
  }

  .hub-usage-path {
    font-size: 8px;
  }

  .hub-usage-grid {
    gap: 3px;
  }

  .hub-usage-chip {
    padding: 3px 6px;
    font-size: 9px;
    gap: 4px;
  }

  .hub-usage-chip-name {
    max-width: 70px;
  }

  .hub-usage-chip-total {
    font-size: 10px;
  }

  .hub-usage-chip-meta {
    font-size: 8px;
  }

  /* Per-repo usage compact on mobile */
  .usage-card-compact {
    padding: 6px 8px;
  }

  .usage-header {
    gap: 6px;
    margin-bottom: 4px;
  }

  .usage-total-badge {
    font-size: 11px;
    padding: 2px 6px;
  }

  .usage-events-badge {
    font-size: 9px;
    padding: 1px 4px;
  }

  .usage-breakdown {
    gap: 2px;
    margin-bottom: 4px;
  }

  .usage-stat {
    padding: 3px 1px;
  }

  .usage-stat-val {
    font-size: 10px;
  }

  .usage-stat-lbl {
    font-size: 7px;
  }

  .usage-footer {
    font-size: 8px;
    padding-top: 3px;
  }

  /* Modal on mobile */
  .modal-create-repo {
    max-width: 100%;
    margin: 8px;
  }

  .modal-body {
    gap: 12px;
  }

  .form-group input[type="text"] {
    font-size: 14px;
    padding: 10px 12px;
  }
  
  /* Hide brand and repo name on mobile */
  .nav-brand,
  .nav-repo-name {
    display: none;
  }

  /* Show back button on mobile */
  .hub-back-btn {
    padding: 10px 12px;
    font-size: 10px;
    min-height: 44px;
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border);
    background: var(--panel);
  }
  
  /* Bottom navigation - thumb friendly */
  .nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: linear-gradient(to top, var(--panel) 0%, rgba(16, 19, 28, 0.98) 100%);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
    z-index: 100;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform 0.18s ease;
  }

  html.mobile-chrome-hidden .nav-bar {
    transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px)));
  }

  html.mobile-chrome-hidden #terminal .terminal-mobile-controls,
  html.mobile-chrome-hidden #terminal .terminal-text-input-actions {
    display: none;
  }

  html.mobile-chrome-hidden #docs #doc-chat-voice,
  html.mobile-chrome-hidden #docs #doc-chat-cancel,
  html.mobile-chrome-hidden #docs .doc-chat-meta {
    display: none;
  }

  html.mobile-compose-fixed #terminal .terminal-text-input,
  html.mobile-compose-fixed #docs .doc-chat-panel {
    position: fixed;
    left: 4px;
    right: 4px;
    bottom: max(var(--mobile-bottom-nav), var(--vv-bottom, 0px));
    margin: 0;
    z-index: 120;
  }

  /* Also fix-position mobile controls above the text input when compose is open */
  html.mobile-compose-fixed #terminal .terminal-mobile-controls {
    position: fixed;
    left: 4px;
    right: 4px;
    /* Position above the text input using dynamically measured height */
    bottom: calc(var(--compose-input-height, 100px) + max(var(--mobile-bottom-nav), var(--vv-bottom, 0px)));
    margin: 0;
    z-index: 119;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 4px;
  }

  /* When compose is fixed, shrink terminal container so it stops above the fixed elements */
  html.mobile-compose-fixed #terminal .terminal-container {
    margin-bottom: var(--compose-total-height, 180px);
  }

  html.mobile-compose-fixed #docs.panel.active {
    padding-bottom: calc(var(--doc-compose-height, 100px) + max(var(--mobile-bottom-nav), var(--vv-bottom, 0px)));
  }
  
  .tabs {
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 0;
    gap: 0;
  }
  
  /* Larger touch targets - min 44px */
  .tab {
    padding: 14px 8px;
    min-height: 48px;
    font-size: 10px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: color 0.15s ease, background 0.15s ease;
  }
  
  /* Subtle divider between tabs */
  .tab:not(:last-child)::after {
    content: "";
    position: absolute;
    right: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background: var(--border);
    opacity: 0.5;
  }
  
  .tab:active:not(.active) {
    background: rgba(108, 245, 216, 0.08);
  }
  
  .tab.active {
    color: var(--accent);
    background: rgba(108, 245, 216, 0.12);
    border-top: 2px solid var(--accent);
    font-weight: 600;
  }
  
  /* Hide divider next to active tab */
  .tab.active::after,
  .tab.active + .tab::before {
    opacity: 0;
  }
  
  /* Inactive tabs on mobile - ensure readable */
  .tab:not(.active) {
    color: var(--muted);
  }
  
  .tab:not(.active):hover {
    color: var(--text);
  }
  
  /* Content area */
  main {
    padding-bottom: 8px;
  }
  
  .grid-two {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  
  .grid-two > div {
    padding: 8px;
  }
  
  .metric {
    font-size: 14px;
  }
  
  /* Larger action buttons - min 44px touch targets */
  .actions {
    gap: 6px;
    margin-top: 12px;
  }
  
  .actions button {
    flex: 1 1 auto;
    min-width: 60px;
    min-height: 44px;
    padding: 12px 8px;
    font-size: 11px;
  }
  
  .actions button:active {
    transform: scale(0.95);
    opacity: 0.8;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .actions button {
    min-width: 0;
  }
  
  .card {
    padding: 10px;
  }
  
  .card-header {
    padding-bottom: 8px;
    margin-bottom: 10px;
  }
  
  /* Compact inline toolbar for mobile - flex row */
  .inline-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px;
    margin: 0 -4px 4px;
    border-radius: 0;
    align-items: center;
  }
  
  .inline-toolbar label {
    font-size: 9px;
    gap: 2px;
    flex-shrink: 0;
  }
  
  .inline-toolbar label:has(input[type="number"]) {
    display: none; /* Hide Run/Tail labels on mobile, show just inputs */
  }
  
  .inline-toolbar input[type="number"] {
    width: 50px;
    min-height: 32px;
    padding: 4px 6px;
    font-size: var(--mobile-input-font-size);
    flex-shrink: 0;
  }
  
  .inline-toolbar button {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 10px;
    flex-shrink: 0;
  }
  
  /* Checkbox toggles - fixed width */
  .inline-toolbar .chip {
    padding: 4px 8px;
    font-size: 9px;
    min-height: 28px;
    flex-shrink: 0;
    flex-grow: 0;
  }
  
  .inline-toolbar .chip span {
    display: none; /* Hide label text, show just checkbox */
  }
  
  .inline-toolbar .chip::after {
    content: attr(data-short);
    font-size: 9px;
  }
  
  /* Logs/Terminal - account for bottom nav and compact toolbar */
  .log-container {
    height: calc(100vh - 130px);
    height: calc(100dvh - 130px);
  }
  
  .log-viewer {
    font-size: 10px;
    padding: 4px;
  }
  
  /* Hide log legend on mobile - too cluttered */
  .log-legend {
    display: none;
  }
  
  /* Simplified log line styling on mobile */
  .log-line {
    padding: 1px 2px;
    font-size: 10px;
  }
  
  .log-line[data-icon]::before {
    display: none;
  }
  
  .log-line.log-run-start,
  .log-line.log-run-end {
    padding: 3px 6px;
    margin: 6px 0 3px 0;
    font-size: 10px;
  }
  
  .log-line.log-agent-output {
    padding: 4px 6px;
    margin: 4px 0;
    font-size: 10px;
  }
  
  .log-line.log-thinking,
  .log-line.log-exec-command {
    padding-left: 8px;
  }
  
  /* Collapsible blocks more compact */
  .log-context-block {
    margin: 2px 0;
  }
  
  .log-context-summary {
    padding: 2px 4px;
    font-size: 9px;
  }
  
  .log-context-content {
    padding: 2px 4px;
    max-height: 100px;
    font-size: 9px;
  }
  
  /* Jump button on mobile */
  .log-jump-btn {
    bottom: 10px;
    right: 10px;
    padding: 6px 10px;
    font-size: 9px;
  }
  
  #terminal.panel.active {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - var(--mobile-top-pad) - var(--mobile-bottom-nav));
    overflow: hidden;
  }

  #terminal .terminal-container {
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
  }

  #terminal .inline-toolbar {
    flex-wrap: wrap;
    gap: 6px;
  }

  #terminal-status {
    flex: 1 0 100%;
  }

  #terminal .inline-toolbar button {
    min-height: 36px;
    padding: 8px 10px;
  }

  #terminal.text-input-open .terminal-container {
    height: auto;
  }

  #terminal .terminal-mobile-controls,
  #terminal .terminal-text-input {
    flex: 0 0 auto;
  }

  .compose-row textarea {
    min-height: 52px;
    max-height: 100px;
    font-size: 16px;
    line-height: 1.3;
    resize: none;
  }

  .compose-row {
    gap: 4px;
  }

  .compose-buttons {
    gap: 4px;
  }

  .compose-buttons button {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    border-radius: 8px;
  }

  .terminal-text-input-buttons .terminal-text-image {
    font-size: 10px;
  }

  .compose-buttons .voice-button svg {
    width: 12px;
    height: 12px;
    min-width: 12px;
    min-height: 12px;
  }

  .terminal-text-input-buttons .voice-level-meter {
    width: 30px;
    height: 30px;
    padding: 3px 2px;
    border-radius: 8px;
  }

  .terminal-text-input-actions {
    gap: 6px;
  }

  html.mobile-compose-fixed #terminal .terminal-text-input {
    position: fixed;
    bottom: max(var(--mobile-bottom-nav), var(--vv-bottom, 0px));
  }

  html.mobile-compose-fixed #terminal .terminal-mobile-controls {
    position: fixed;
    left: 4px;
    right: 4px;
    bottom: calc(var(--compose-input-height, 100px) + max(var(--mobile-bottom-nav), var(--vv-bottom, 0px)));
    z-index: 119;
    margin: 0;
  }

  html.mobile-compose-fixed #terminal .terminal-container {
    margin-bottom: var(--compose-total-height, 180px);
  }

  /* Mobile terminal control bar */
  .terminal-mobile-controls {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 4px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 4px;
  }
  
  .tmb-row {
    display: flex;
    gap: 3px;
    align-items: center;
  }
  
  .tmb-key {
    flex: 1;
    min-height: 34px;
    padding: 6px 5px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: all 0.08s ease;
    text-transform: none;
    letter-spacing: 0;
  }
  
  .tmb-key:active {
    background: rgba(108, 245, 216, 0.2);
    border-color: var(--accent);
    transform: scale(0.94);
  }
  
  /* Modifier keys (Ctrl/Alt) - toggle state */
  .tmb-mod {
    flex: 1;
    background: var(--bg);
    color: var(--muted);
  }
  
  .tmb-mod.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    font-weight: 600;
  }
  
  /* Arrow keys - fixed width, larger icon */
  .tmb-arrow {
    flex: 0 0 32px;
    font-size: 14px;
    padding: 5px 3px;
    order: 3;
  }
  
  /* Enter key - primary action */
  .tmb-primary {
    background: rgba(108, 245, 216, 0.12);
    border-color: rgba(108, 245, 216, 0.3);
    color: var(--accent);
    font-weight: 600;
  }
  
  .tmb-primary:active {
    background: rgba(108, 245, 216, 0.3);
    border-color: var(--accent);
  }
  
  /* Ctrl combos - danger styled for interrupt signals */
  .tmb-ctrl-combo {
    flex: 0 0 auto;
    min-width: 32px;
    order: 1;
    background: rgba(255, 85, 102, 0.08);
    border-color: rgba(255, 85, 102, 0.25);
    color: #ff8899;
    font-weight: 600;
  }

  .tmb-bksp {
    order: 2;
  }
  
  .tmb-ctrl-combo:active {
    background: rgba(255, 85, 102, 0.25);
    border-color: #ff5566;
  }
  
  /* Hide terminal voice from toolbar on mobile - it's in the mobile controls */
  .inline-toolbar .terminal-voice {
    display: none;
  }
  
  /* Mobile terminal voice button - integrated into mobile controls */
  .tmb-voice {
    flex: 0 0 auto;
    min-width: 34px;
    background: var(--bg);
    border-color: var(--border);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 5px 6px;
  }
  
  .tmb-voice svg {
    width: 14px;
    height: 14px;
    min-width: 14px;
    min-height: 14px;
    flex-shrink: 0;
  }
  
  .tmb-voice.voice-recording {
    background: #b3261e;
    color: #fff;
    border-color: #b3261e;
    animation: tmb-voice-pulse 1s ease-in-out infinite;
  }
  
  @keyframes tmb-voice-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
  }
  
  .tmb-voice.voice-sending {
    background: rgba(108, 245, 216, 0.2);
    color: var(--accent);
    border-color: var(--accent);
  }
  
  .tmb-voice.voice-error {
    border-color: #d35400;
    color: #d35400;
  }
  
  .tmb-voice.disabled,
  .tmb-voice.voice-disconnected {
    opacity: 0.4;
  }
  
  /* Level meter in mobile controls - more compact */
  .tmb-row .voice-level-meter {
    height: 16px;
    padding: 0 2px;
    gap: 1px;
  }
  
  .tmb-row .voice-level-bar {
    width: 2px;
  }
  
  /* Docs nav - compact chips on mobile */
  .doc-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    margin-bottom: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .doc-nav .chip {
    padding: 8px 10px;
    min-height: 36px;
    font-size: 10px;
    flex-shrink: 0;
  }
  
  .doc-nav .chip:active {
    transform: scale(0.95);
  }

  #doc-status {
    display: none;
  }
  
  .doc-editor textarea {
    /* Let the editor consume usable vertical space (no arbitrary cap). */
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    font-size: var(--mobile-input-font-size);
    padding: 10px;
    resize: none;
  }

  /* Make Docs panel a fill-the-screen flex layout (avoids wasted space). */
  #docs.panel.active {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - var(--mobile-top-pad) - var(--mobile-bottom-nav));
    overflow: hidden;
  }

  #docs.panel.active .doc-editor {
    flex: 1 1 auto;
    min-height: 0;
  }

  #doc-content {
    flex: 1 1 auto;
    min-height: 0;
  }

  /* Patch view should also fill space when active. */
  .doc-patch-main {
    flex: 1 1 auto;
    min-height: 0;
  }

  .doc-patch-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }

  /* Larger tap targets for icon-only buttons (refresh, etc.) */
  button.icon-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    font-size: 18px;
  }
  
  .doc-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    margin-top: 6px;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .doc-actions button {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 8px 6px;
    font-size: 10px;
  }

  /* Use short labels on mobile */
  .doc-actions button[data-short] {
    font-size: 0;
  }

  .doc-actions button[data-short]::after {
    content: attr(data-short);
    font-size: 10px;
  }

  /* Chat panel - mobile meta/response sizing */
  .doc-chat-compose {
    gap: 2px;
  }

  .doc-chat-meta {
    font-size: 9px;
  }

  .doc-chat-response-wrapper {
    max-height: 80px;
    padding: 6px;
    font-size: 11px;
  }

  .doc-chat-history-details {
    margin-top: 2px;
  }

  .doc-chat-history-toggle {
    padding: 3px 6px;
    font-size: 8px;
  }

  .doc-chat-history {
    max-height: 60px;
    padding: 0 6px 4px;
  }

  .doc-chat-entry {
    padding: 2px 0;
  }

  .doc-chat-entry .prompt,
  .doc-chat-entry .response {
    font-size: 9px;
  }

  .doc-chat-entry .copy-prompt-btn {
    opacity: 0.7; /* Always visible on mobile for touch */
    width: 22px;
    height: 22px;
    font-size: 11px;
  }

  .doc-chat-entry-detail summary {
    font-size: 8px;
  }

  .doc-chat-entry-body pre {
    font-size: 8px;
  }

  .doc-chat-history-count {
    font-size: 8px;
    padding: 1px 4px;
    min-width: 14px;
  }

  /* Patch wrapper on mobile */
  .doc-chat-patch-wrapper {
    padding: 6px;
  }

  .doc-chat-patch {
    max-height: 60px;
    font-size: 10px;
  }

  .doc-chat-patch-actions {
    font-size: 9px;
    flex-wrap: wrap;
    gap: 4px;
  }

  .doc-chat-patch-actions button {
    font-size: 9px;
    padding: 6px 10px;
  }

  /* Main patch panel on mobile - stacked layout */
  .doc-patch-main {
    padding: 10px;
    gap: 10px;
  }

  .doc-patch-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .doc-patch-info {
    order: 1;
  }

  .doc-patch-summary {
    font-size: 12px;
    line-height: 1.4;
    padding: 8px;
    background: var(--bg);
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
  }

  .doc-patch-legend {
    display: none; /* Hide on mobile - the colors are self-explanatory */
  }

  .doc-patch-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    order: 2;
  }

  .doc-patch-actions button {
    min-height: 44px;
    padding: 12px 16px;
    font-size: 12px;
    justify-content: center;
    width: 100%;
  }

  .doc-patch-actions button.primary {
    order: -1; /* Move Apply button to top */
  }

  .doc-patch-body {
    max-height: 300px;
    padding: 0;
    font-size: 11px;
    line-height: 1.5;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    overflow: auto;
  }

  /* Diff line adjustments for mobile */
  .diff-gutter {
    flex: 0 0 28px;
    font-size: 9px;
    padding-right: 4px;
  }

  .diff-sign {
    flex: 0 0 14px;
    font-size: 10px;
  }

  .diff-content {
    padding-left: 6px;
    font-size: 11px;
  }

  .diff-line.diff-hunk .diff-content {
    font-size: 10px;
  }

  .diff-empty-marker {
    font-size: 9px;
    padding: 0 3px;
  }
  
  /* Toast below top safe area */
  .toast {
    left: 8px;
    right: 8px;
    top: calc(8px + var(--mobile-top-pad) + var(--vv-top, 0px));
    bottom: auto;
    text-align: center;
  }
  
  /* Checklist items - larger touch area */
  .checklist li {
    padding: 10px 12px;
    gap: 10px;
    min-height: 44px;
  }
  
  .checklist .box {
    width: 18px;
    height: 18px;
  }
  
  .checklist .box.done::after {
    font-size: 14px;
    top: 0;
    left: 2px;
  }
  
  /* ===== MOBILE TERMINAL TALL VIEW ===== */
  /* Mirrors the terminal buffer while the text input is focused on mobile.
     Keeps scrolling easy without sending keystrokes to the TUI. */
  .mobile-terminal-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 100; /* Below input (z-index 120) */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    padding-bottom: calc(
      var(--compose-total-height, 120px) + env(safe-area-inset-bottom) + var(--vv-bottom, 0px)
    );
    font-family: "JetBrains Mono", monospace;
    font-size: 10px;
    line-height: 1.15;
    letter-spacing: 0;
    font-variant-ligatures: none;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: var(--text);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
  }

  .mobile-terminal-view.hidden {
    display: none;
  }

  .mobile-terminal-view .ansi-bold {
    font-weight: 600;
  }

  .mobile-terminal-view .ansi-fg-30 { color: #000000; }
  .mobile-terminal-view .ansi-fg-31 { color: #ff5566; }
  .mobile-terminal-view .ansi-fg-32 { color: #6cf5d8; }
  .mobile-terminal-view .ansi-fg-33 { color: #f1fa8c; }
  .mobile-terminal-view .ansi-fg-34 { color: #6ca8ff; }
  .mobile-terminal-view .ansi-fg-35 { color: #bd93f9; }
  .mobile-terminal-view .ansi-fg-36 { color: #8be9fd; }
  .mobile-terminal-view .ansi-fg-37 { color: #e5ecff; }
  .mobile-terminal-view .ansi-fg-90 { color: #6272a4; }
  .mobile-terminal-view .ansi-fg-91 { color: #ff6e6e; }
  .mobile-terminal-view .ansi-fg-92 { color: #69ff94; }
  .mobile-terminal-view .ansi-fg-93 { color: #ffffa5; }
  .mobile-terminal-view .ansi-fg-94 { color: #d6acff; }
  .mobile-terminal-view .ansi-fg-95 { color: #ff92df; }
  .mobile-terminal-view .ansi-fg-96 { color: #a4ffff; }
  .mobile-terminal-view .ansi-fg-97 { color: #ffffff; }

  /* Match xterm's bold-bright mapping for base colors. */
  .mobile-terminal-view .ansi-bold.ansi-fg-30 { color: #6272a4; }
  .mobile-terminal-view .ansi-bold.ansi-fg-31 { color: #ff6e6e; }
  .mobile-terminal-view .ansi-bold.ansi-fg-32 { color: #69ff94; }
  .mobile-terminal-view .ansi-bold.ansi-fg-33 { color: #ffffa5; }
  .mobile-terminal-view .ansi-bold.ansi-fg-34 { color: #d6acff; }
  .mobile-terminal-view .ansi-bold.ansi-fg-35 { color: #ff92df; }
  .mobile-terminal-view .ansi-bold.ansi-fg-36 { color: #a4ffff; }
  .mobile-terminal-view .ansi-bold.ansi-fg-37 { color: #ffffff; }

  .mobile-terminal-view .ansi-bg-40 { background-color: #000000; }
  .mobile-terminal-view .ansi-bg-41 { background-color: #ff5566; }
  .mobile-terminal-view .ansi-bg-42 { background-color: #6cf5d8; }
  .mobile-terminal-view .ansi-bg-43 { background-color: #f1fa8c; }
  .mobile-terminal-view .ansi-bg-44 { background-color: #6ca8ff; }
  .mobile-terminal-view .ansi-bg-45 { background-color: #bd93f9; }
  .mobile-terminal-view .ansi-bg-46 { background-color: #8be9fd; }
  .mobile-terminal-view .ansi-bg-47 { background-color: #e5ecff; }
  .mobile-terminal-view .ansi-bg-100 { background-color: #6272a4; }
  .mobile-terminal-view .ansi-bg-101 { background-color: #ff6e6e; }
  .mobile-terminal-view .ansi-bg-102 { background-color: #69ff94; }
  .mobile-terminal-view .ansi-bg-103 { background-color: #ffffa5; }
  .mobile-terminal-view .ansi-bg-104 { background-color: #d6acff; }
  .mobile-terminal-view .ansi-bg-105 { background-color: #ff92df; }
  .mobile-terminal-view .ansi-bg-106 { background-color: #a4ffff; }
  .mobile-terminal-view .ansi-bg-107 { background-color: #ffffff; }

  input[type="text"],
  input[type="number"],
  input[type="password"],
  input[type="search"],
  input[type="email"],
  input[type="url"],
  textarea,
  select {
    font-size: var(--mobile-input-font-size);
  }
  
}

/* Ultra-small screens */
@media (max-width: 400px) {
  .terminal-container {
    height: calc(100vh - 200px);
    height: calc(100dvh - 200px);
  }

  #terminal.text-input-open .terminal-container {
    height: max(100px, calc(100vh - 340px));
    height: max(100px, calc(100dvh - 340px));
  }
  
  .terminal-mobile-controls {
    padding: 3px;
    gap: 2px;
  }
  
  .tmb-row {
    gap: 2px;
  }
  
  .tmb-key {
    min-height: 30px;
    padding: 4px 3px;
    font-size: 9px;
  }
  
  .tmb-arrow {
    flex: 0 0 26px;
    font-size: 12px;
  }
  
  .tmb-ctrl-combo {
    min-width: 28px;
    font-size: 9px;
  }
  
  .tmb-voice {
    min-width: 30px;
    padding: 3px 4px;
  }
  
  .tmb-voice svg {
    width: 11px;
    height: 11px;
    min-width: 11px;
    min-height: 11px;
  }

  .tab {
    padding: 12px 4px;
    font-size: 9px;
    letter-spacing: 0;
  }
  
  .tab.active {
    color: var(--accent);
    font-weight: 600;
  }
  
  .metric {
    font-size: 13px;
  }
  
  .actions button {
    font-size: 10px;
    min-height: 42px;
  }
  
  .grid-two {
    gap: 4px;
  }

  /* Ultra-compact logs toolbar */
  .inline-toolbar {
    gap: 3px;
    padding: 4px;
  }
  
  .inline-toolbar input[type="number"] {
    width: 45px;
    min-height: 28px;
    font-size: var(--mobile-input-font-size);
  }
  
  .inline-toolbar button {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 9px;
  }
  
  .inline-toolbar .chip {
    padding: 2px 6px;
    min-height: 24px;
  }
  
  .inline-toolbar .chip::after {
    font-size: 8px;
  }
  
  .log-container {
    height: calc(100vh - 110px);
    height: calc(100dvh - 110px);
  }
  
  .log-viewer {
    font-size: 9px;
    padding: 3px;
  }
  
  .log-line {
    font-size: 9px;
  }
  
  .log-line.log-run-start,
  .log-line.log-run-end {
    font-size: 9px;
    padding: 2px 4px;
    margin: 4px 0 2px 0;
  }
  
  .log-line.log-agent-output {
    font-size: 9px;
    padding: 3px 4px;
    margin: 3px 0;
  }
  
  .log-jump-btn {
    padding: 4px 8px;
    font-size: 8px;
    bottom: 8px;
    right: 8px;
  }

  .doc-nav .chip {
    padding: 6px 8px;
    min-height: 32px;
    font-size: 9px;
  }

  .doc-actions button {
    min-height: 32px;
    padding: 6px 4px;
  }

  .doc-actions button[data-short]::after {
    font-size: 9px;
  }

  .doc-chat-panel {
    padding: 4px;
  }


  /* Patch panel for ultra-small screens */
  .doc-patch-main {
    padding: 8px;
    gap: 8px;
  }

  .doc-patch-summary {
    font-size: 11px;
    padding: 6px;
  }

  .doc-patch-legend {
    display: none;
  }

  .doc-patch-actions button {
    min-height: 40px;
    padding: 10px 12px;
    font-size: 11px;
  }

  .doc-patch-body {
    max-height: 220px;
  }

  input[type="text"],
  input[type="number"],
  input[type="password"],
  input[type="search"],
  input[type="email"],
  input[type="url"],
  textarea,
  select {
    font-size: var(--mobile-input-font-size);
  }

  .diff-gutter {
    flex: 0 0 24px;
    font-size: 8px;
    padding-right: 3px;
  }

  .diff-sign {
    flex: 0 0 12px;
    font-size: 9px;
  }

  .diff-content {
    padding-left: 4px;
    font-size: 10px;
  }

  .diff-empty-marker {
    font-size: 8px;
    padding: 0 2px;
  }
}

/* Landscape phone - side-by-side layout */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  :root {
    --mobile-input-font-size: 16px;
  }

  .app-shell {
    padding-bottom: 4px;
  }
  
  .nav-bar {
    position: static;
    margin-bottom: 4px;
  }
  
  /* Compact logs for landscape */
  .inline-toolbar {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 4px;
    margin-bottom: 4px;
  }
  
  .inline-toolbar label:has(input[type="number"]) {
    display: flex;
  }
  
  .inline-toolbar input[type="number"] {
    width: 45px;
    min-height: 26px;
  }
  
  .inline-toolbar button {
    min-height: 26px;
    padding: 4px 8px;
  }
  
  .inline-toolbar .chip {
    padding: 2px 4px;
    min-height: 24px;
  }
  
  .inline-toolbar .chip span {
    display: inline;
  }
  
  .inline-toolbar .chip::after {
    content: none;
  }
  
  .log-legend {
    display: flex;
    padding: 2px 6px;
    margin-bottom: 4px;
    font-size: 7px;
  }
  
  .log-container {
    height: calc(100vh - 90px);
  }
  
  .log-viewer {
    font-size: 9px;
    padding: 4px;
  }
  
  .tabs {
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  
  .tab {
    min-height: 36px;
    padding: 8px;
    border-radius: var(--radius);
  }
  
  /* Landscape retains solid accent background with dark text for high contrast */
  .tab.active {
    border-top: none;
    background: var(--accent);
    color: var(--bg);
    font-weight: 600;
  }
  
  .tab:not(.active) {
    color: var(--muted);
  }
  
  .log-viewer {
    height: calc(100vh - 80px);
  }
  
  #terminal.panel.active {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 120px);
    overflow: hidden;
  }

  #terminal .terminal-container {
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
  }

  #terminal.text-input-open .terminal-container {
    height: auto;
  }

  .compose-panel {
    padding: 4px;
    gap: 3px;
  }

  .compose-row textarea {
    min-height: 52px;
    max-height: 70px;
    padding: 4px;
    font-size: 16px;
    line-height: 1.3;
    resize: none;
  }

  .compose-row {
    gap: 4px;
  }

  .compose-buttons {
    gap: 4px;
  }

  .compose-buttons button {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    border-radius: 8px;
  }

  .terminal-text-input-buttons .terminal-text-image {
    font-size: 9px;
  }

  .compose-buttons .voice-button svg {
    width: 11px;
    height: 11px;
    min-width: 11px;
    min-height: 11px;
  }

  .terminal-text-input-buttons .voice-level-meter {
    width: 28px;
    height: 28px;
    padding: 3px 2px;
    border-radius: 8px;
  }

  .terminal-text-input-actions {
    gap: 4px;
  }

  .terminal-text-input-hint {
    display: none;
  }

  .terminal-text-input #terminal-text-send {
    font-size: 14px;
  }

  /* Compact mobile controls in landscape - single row */
  .terminal-mobile-controls {
    display: flex;
    flex-direction: row;
    gap: 3px;
    padding: 3px 4px;
    margin-top: 3px;
  }
  
  .tmb-row {
    flex: 1;
    gap: 2px;
  }
  
  .tmb-key {
    min-height: 26px;
    padding: 3px 2px;
    font-size: 9px;
  }
  
  .tmb-arrow {
    flex: 0 0 24px;
    font-size: 11px;
  }
  
  .tmb-ctrl-combo {
    min-width: 24px;
    font-size: 9px;
  }
  
  .tmb-voice {
    min-width: 26px;
    padding: 3px;
  }
  
  .tmb-voice svg {
    width: 10px;
    height: 10px;
  }
  
  .doc-editor textarea {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }

  #docs.panel.active {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 90px);
    overflow: hidden;
  }

  #docs.panel.active .doc-editor {
    flex: 1 1 auto;
    min-height: 0;
  }

  #doc-content {
    flex: 1 1 auto;
    min-height: 0;
  }

  /* Compact chat for landscape */
  .doc-chat-panel {
    padding: 4px;
    gap: 2px;
  }


  .doc-chat-response-wrapper {
    max-height: 60px;
  }

  .doc-chat-history {
    max-height: 50px;
  }

  .doc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .doc-actions button {
    flex: 0 0 auto;
  }

  .doc-actions button[data-short] {
    font-size: 0;
  }

  .doc-actions button[data-short]::after {
    font-size: 9px;
  }

  /* Patch panel in landscape */
  .doc-patch-main {
    padding: 6px;
    gap: 6px;
  }

  .doc-patch-header {
    flex-direction: row;
    align-items: center;
  }

  .doc-patch-summary {
    font-size: 10px;
    padding: 4px 6px;
  }

  .doc-patch-legend {
    display: none;
  }

  .doc-patch-actions {
    flex-direction: row;
    gap: 4px;
  }

  .doc-patch-actions button {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 10px;
    width: auto;
  }

  .doc-patch-body {
    max-height: 140px;
  }

  input[type="text"],
  input[type="number"],
  input[type="password"],
  input[type="search"],
  input[type="email"],
  input[type="url"],
  textarea,
  select {
    font-size: var(--mobile-input-font-size);
  }

  .diff-gutter {
    flex: 0 0 28px;
    font-size: 9px;
  }

  .diff-content {
    font-size: 10px;
  }
}
