@import url('components.css?v=20260406d');

/* OpenClaw Operator Console — minimal CSS */

/* Mobile console-drawer (settings): hidden on desktop, off-canvas on mobile.
   Uses its own body class (console-drawer-open) so it's independent of
   the primary-nav sidebar. */
.console-drawer { display: none; }
#drawer-backdrop { display: none; position: fixed; inset: 0; z-index: 65; background: rgba(0,0,0,0.45); }

/* Mobile sidebar toggle (primary nav) */
.hamburger {
  display: none;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  line-height: 0;
  box-shadow: 0 0 4px rgba(0,0,0,0.4);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font-size: 0; /* hide any text/icon glyph to avoid empty box rendering */
}
.hamburger:focus,
.hamburger:hover {
  outline: none;
  background: var(--hover);
  border-color: var(--accent);
  color: var(--text);
}

/* Console-local hamburger for settings drawer */
.console-hamburger {
  display: none;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  line-height: 0;
  box-shadow: 0 0 4px rgba(0,0,0,0.4);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font-size: 0;
}
.console-hamburger:focus,
.console-hamburger:hover { outline: none; background: var(--hover); border-color: var(--accent); color: var(--text); }

/* Hamburger icon built from spans for better control/animation */
.hamburger > span,
.console-hamburger > span {
  display: block;
  width: 24px;
  height: 3px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.hamburger > span + span,
.console-hamburger > span + span { margin-top: 5px; }
/* Animate to X when open (targets the 3 visible bars) */
body.sidebar-open .hamburger > span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
body.sidebar-open .hamburger > span:nth-child(2) { opacity: 0; }
body.sidebar-open .hamburger > span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

body.sidebar-open .console-hamburger > span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
body.sidebar-open .console-hamburger > span:nth-child(2) { opacity: 0; }
body.sidebar-open .console-hamburger > span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* Full-screen backdrop for mobile sidebar */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(1px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 40;
}

/* Show when sidebar open */
body.sidebar-open .backdrop {
  opacity: 1;
  visibility: visible;
}

/* Scroll-to-bottom floating action button */
.scroll-bottom-btn {
  position: fixed;
  right: calc(env(safe-area-inset-right, 0px) + 0.75rem);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 4.5rem);
  z-index: 60;
  width: 42px;
  height: 42px;
  border-radius: 21px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}
.scroll-bottom-btn:hover { opacity: 0.92; }
@media (min-width: 768px) {
  .scroll-bottom-btn { display: none !important; }
}

/* Mobile off-canvas behavior */
@media (max-width: 767.98px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
  }

  body {
    display: block;
    min-height: 100vh;
  }

  .hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 0.5rem);
    right: calc(env(safe-area-inset-right, 0px) + 0.5rem);
    left: auto;
    z-index: 100;
  }

  .console-drawer {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 300px;
    max-width: 85vw;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 70;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: calc(env(safe-area-inset-top, 0px) + 0.35rem);
  }
  body.console-drawer-open .console-drawer { transform: translateX(0); }
  body.console-drawer-open #drawer-backdrop { display: block; opacity: 1; visibility: visible; }
  body.console-drawer-open { overflow: hidden; }

  /* Console header hamburger for settings — positioned RIGHT to avoid title overlap */
  .console-hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 0.5rem);
    right: calc(env(safe-area-inset-right, 0px) + 0.5rem);
    left: auto;
    z-index: 95;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 60;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  /* Prevent background scroll when menu open */
  body.sidebar-open {
    overflow: hidden;
  }

  /* Main content padding on mobile */
  .main {
    display: block;
    padding: 1rem;
    padding-top: calc(env(safe-area-inset-top, 0px) + 3rem); /* create space under fixed hamburger so it doesn't cover header */
    overflow: visible;
  }
}

:root {
  --bg: #1a1a2e;
  --bg-card: #16213e;
  --bg-sidebar: #0f3460;
  --text: #e0e0e0;
  --text-muted: #a8bbc8;
  --accent: #29bde0;
  --green: #3dd68c;
  --red: #f15f50;
  --orange: #f39c12;
  --yellow: #f1c40f;
  --gray: #9badb0;
  --border: #2c3e50;
  --hover: #1a3a5c;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 220px;
  background: linear-gradient(180deg, var(--bg-sidebar) 0%, rgba(15, 52, 96, 0.85) 100%);
  padding: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}
.sidebar .brand {
  padding: 1rem 1.2rem 0.8rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(41, 189, 224, 0.15);
  margin-bottom: 0.4rem;
}
.sidebar nav {
  flex: 1;
  padding: 0.3rem 0;
  overflow-y: auto;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 1.2rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 400;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  min-height: 38px;
  letter-spacing: 0.2px;
}
.sidebar nav a .nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.7;
  line-height: 1;
}
.sidebar nav a:hover {
  background: rgba(41, 189, 224, 0.08);
  color: var(--text);
  border-left-color: rgba(41, 189, 224, 0.4);
}
.sidebar nav a.active {
  background: rgba(41, 189, 224, 0.12);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}
.sidebar nav a.active .nav-icon { opacity: 1; }

/* Nav section dividers */
.sidebar nav .nav-divider {
  height: 1px;
  background: rgba(44, 62, 80, 0.6);
  margin: 0.4rem 1.2rem;
}
/* Nav collapse toggle — slim chevron at bottom of sidebar */
.nav-collapse-toggle {
  display: block;
  width: calc(100% - 2.4rem);
  margin: 0.3rem 1.2rem 0.5rem;
  padding: 2px 0;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border);
  color: #39ff14;
  font-size: 1rem;
  cursor: pointer;
  text-align: center;
  opacity: 0.6;
  transition: opacity 0.15s, color 0.15s;
}
.nav-collapse-toggle:hover { opacity: 1; color: #39ff14; }

/* Expand tab shown when sidebar is collapsed */
.nav-expand-toggle {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: 100;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 4px 4px 0;
  color: #39ff14;
  font-size: 1rem;
  padding: 14px 5px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s, color 0.15s;
}
.nav-expand-toggle:hover { opacity: 1; color: #39ff14; }

/* Sidebar transition for smooth collapse */
.sidebar { transition: width 0.2s ease, padding 0.2s ease; }

/* Hide collapse toggle on mobile (hamburger handles it) */
@media (max-width: 767.98px) {
  .nav-collapse-toggle { display: none; }
  .nav-expand-toggle { display: none !important; }
}

.sidebar .sidebar-footer {
  margin-top: auto;
  padding: 0.8rem 1.2rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(44, 62, 80, 0.6);
  background: rgba(0, 0, 0, 0.1);
}
.sidebar .sidebar-footer a {
  color: var(--text-muted);
  text-decoration: none;
}
.sidebar .sidebar-footer a:hover { color: var(--text); }
.logout-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 0.75rem; padding: 0; text-decoration: none;

  display: inline-flex;
  align-items: center;
  min-height: 44px;}
.logout-btn:hover { color: var(--text); text-decoration: underline; }

/* Main content */
.main {
  flex: 1;
  padding: 1.5rem 2rem;
  overflow-y: auto;
}

h1 { font-size: 1.5rem; margin-bottom: 1.2rem; font-weight: 600; }
h2 { font-size: 1.15rem; margin-bottom: 0.8rem; font-weight: 600; color: var(--text-muted); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
}
.card .label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.3rem; }
.card .value { font-size: 1.6rem; font-weight: 700; }
.card .sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }

/* Tables */
.table-wrap { overflow-x: auto; margin-bottom: 1.5rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { text-align: left; padding: 0.6rem 0.8rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.5px; border-bottom: 2px solid var(--border); }
td { padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--border); }
tr:hover td { background: rgba(255,255,255,0.02); }
td a { color: var(--accent); text-decoration: none; }
td a:hover { text-decoration: underline; }

/* Badges */
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 3px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-ok, .badge-active, .badge-read { background: rgba(46,204,113,0.15); color: var(--green); }
.badge-limited { background: rgba(243,156,18,0.15); color: var(--orange); }
.badge-error, .badge-denied, .badge-expired { background: rgba(231,76,60,0.15); color: var(--red); }
.badge-write { background: rgba(243,156,18,0.15); color: var(--orange); }
.badge-revoked, .badge-inactive, .badge-none { background: rgba(127,140,141,0.15); color: var(--gray); }
.badge-unreachable { background: rgba(231,76,60,0.15); color: var(--red); }
.badge-low { background: rgba(46,204,113,0.1); color: var(--green); }
.badge-medium { background: rgba(241,196,15,0.1); color: var(--yellow); }
.badge-high { background: rgba(243,156,18,0.15); color: var(--orange); }
.badge-critical { background: rgba(231,76,60,0.15); color: var(--red); }
.badge-warn { background: rgba(243,156,18,0.15); color: var(--orange); }

/* Monitor status tags (hosts list) */
.monitor-checks { white-space: nowrap; }
.monitor-tag {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 600;
  margin-right: 2px;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  vertical-align: middle;
  cursor: default;
}
.monitor-tag--ok { background: rgba(46,204,113,0.15); color: var(--green); }
.monitor-tag--warn { background: rgba(243,156,18,0.2); color: var(--orange); }
.monitor-tag--critical { background: rgba(231,76,60,0.2); color: var(--red); }
.monitor-tag--error { background: rgba(127,140,141,0.15); color: var(--gray); }

/* Sections */
.section { margin-bottom: 2rem; }

/* Detail grid */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.detail-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: 0.8rem 1rem; }
.detail-item .label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.detail-item .val { font-size: 1rem; margin-top: 0.2rem; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;

  min-height: 44px;}
.btn:hover { background: var(--hover); border-color: var(--accent); }
.btn-exec { border-color: var(--orange); color: var(--orange); }
.btn-exec:hover { background: rgba(243,156,18,0.1); }
.btn-sm { padding: 0.55rem 0.7rem; font-size: 0.75rem; 
  min-height: 44px;}

/* Messages */
.messages { margin-bottom: 1rem; }
.msg { padding: 0.6rem 1rem; border-radius: 4px; margin-bottom: 0.5rem; font-size: 0.85rem; }
.msg-success { background: rgba(46,204,113,0.1); border: 1px solid var(--green); color: var(--green); }
.msg-error { background: rgba(231,76,60,0.1); border: 1px solid var(--red); color: var(--red); }
.msg-warning { background: rgba(243,156,18,0.1); border: 1px solid var(--orange); color: var(--orange); }
.msg-info { background: rgba(0,180,216,0.1); border: 1px solid var(--accent); color: var(--accent); }

/* Provider grid */
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.8rem; margin-bottom: 1.5rem; }
.provider-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: 0.8rem; text-align: center; }
.provider-card .name { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }
.provider-card .status { font-size: 1.1rem; font-weight: 700; margin-top: 0.3rem; }

/* Utility */
.text-muted { color: var(--text-muted); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-orange { color: var(--orange); }
.mt-1 { margin-top: 0.5rem; }
.mb-1 { margin-bottom: 0.5rem; }

/* ==========================================================================
   Engine Console — terminal-like layout (Phase 2)
   ========================================================================== */

/* When .main-console is on the .main container, fill viewport height */
.main-console {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  min-height: 100vh;
  height: 100vh;
}

/* Runtime lives inside the global page-body + desktop site-header shell.
   Keep the document fixed to the viewport and let only the trace/response
   panes scroll. */
.page-body.runtime-page-body {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.runtime-page-body .site-header {
  position: static;
  flex: 0 0 44px;
}
.page-body.runtime-page-body > .main.main-console {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  height: auto;
  overflow: hidden;
}

/* Console header bar */
.console-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
  flex-wrap: wrap;
  min-height: 40px;
}
.runtime-page-body .console-header {
  flex-wrap: nowrap;
  gap: 0.6rem;
  min-height: 42px;
  padding: 0.42rem 0.75rem;
}
.console-header .console-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
}
.runtime-page-body .console-header .console-title {
  flex: 0 0 auto;
}
.runtime-page-body .console-header .advanced-controls {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.runtime-page-body .console-header .advanced-controls > * {
  flex: 0 0 auto;
}
.runtime-page-body .console-header .advanced-controls label {
  margin-left: 0.2rem !important;
}
.runtime-page-body .console-header .advanced-controls select {
  max-height: 30px;
}
.console-header select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
}
.console-header .spacer { flex: 1; }

/* Compact header on small screens */
.runtime-mobile-controls {
  display: none;
}

@media (max-width: 767.98px) {
  .console-header .advanced-controls { display: none; }
  .runtime-page-body .console-header .advanced-controls { display: none; }
  #ws-status.badge { font-size: 0; padding: 0; width: 10px; height: 10px; border-radius: 50%; }
  #ws-status.badge-ok { background: var(--green); }
  #ws-status.badge-error, #ws-status.badge-unreachable { background: var(--red); }
  #ws-status.badge-limited, #ws-status.badge-medium, #ws-status.badge-high, #ws-status.badge-critical { background: var(--orange); }
  /* Reduce header height and ensure brand + status remain visible */
  .console-header { position: relative; top: auto; z-index: auto; }
  /* Reserve space for the fixed hamburger and center title */
  .header-title { margin: 0 56px; text-align: center; }
  /* Ensure primary navbar hamburger at top-right doesn't overlap the console one */
  #hamburger { right: calc(env(safe-area-inset-right, 0px) + 0.5rem); }

  .runtime-mobile-controls {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.75rem 0.35rem;
    background: var(--bg);
    border-bottom: 1px solid rgba(44, 62, 80, 0.45);
  }

  .runtime-controls-toggle,
  .runtime-controls-new {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    padding: 0.5rem 0.7rem;
  }

  .runtime-controls-toggle {
    flex: 1 1 auto;
    cursor: pointer;
  }

  .runtime-controls-toggle:hover,
  .runtime-controls-toggle:focus,
  .runtime-controls-new:hover,
  .runtime-controls-new:focus {
    border-color: var(--accent);
    color: var(--accent);
    outline: none;
  }

  .runtime-controls-toggle[aria-expanded="true"] {
    border-color: var(--accent);
    color: var(--accent);
  }

  .runtime-controls-new {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

/* Runtime split layout */
.runtime-layout {
  flex: 1 1 0;
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
.runtime-main {
  flex: 1 1 0;
  min-height: 0;
  max-height: 100%;
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.55fr);
  gap: 0.65rem;
  padding: 0.65rem 0.65rem 0;
  overflow: hidden;
}
.runtime-pane {
  min-height: 0;
  min-width: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(22, 33, 62, 0.66);
  border: 1px solid rgba(93, 126, 154, 0.24);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,0.16);
}
.runtime-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.48rem 0.72rem;
  border-bottom: 1px solid rgba(93, 126, 154, 0.22);
  background: rgba(15, 52, 96, 0.26);
}
.runtime-pane-header h2 {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.runtime-pane-status {
  display: inline-flex;
  align-items: center;
  max-width: 52%;
  min-height: 22px;
  padding: 0.15rem 0.48rem;
  border: 1px solid rgba(168, 187, 200, 0.18);
  border-radius: 999px;
  color: var(--text-muted);
  background: rgba(15, 24, 38, 0.34);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.runtime-pane-status.is-active {
  color: var(--accent);
  border-color: rgba(41, 189, 224, 0.36);
  background: rgba(41, 189, 224, 0.08);
}
.runtime-pane-status.is-warn {
  color: var(--orange);
  border-color: rgba(243, 156, 18, 0.34);
  background: rgba(243, 156, 18, 0.08);
}
.runtime-pane-status.is-ok {
  color: var(--green);
  border-color: rgba(61, 214, 140, 0.34);
  background: rgba(61, 214, 140, 0.08);
}
.runtime-pane-status.is-error {
  color: var(--red);
  border-color: rgba(241, 95, 80, 0.34);
  background: rgba(241, 95, 80, 0.08);
}

/* Stream output area */
.console-stream {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0.62rem 0.78rem;
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', 'Fira Code', monospace;
  font-size: 0.79rem;
  line-height: 1.48;
  scroll-behavior: smooth;
}
.console-trace {
  background: linear-gradient(180deg, rgba(15, 52, 96, 0.14) 0%, rgba(26, 26, 46, 0.12) 100%);
}
.console-response {
  background: linear-gradient(180deg, rgba(22, 33, 62, 0.14) 0%, rgba(26, 26, 46, 0.04) 100%);
}
.runtime-page-body .runtime-layout {
  flex: 1 1 0;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}
.runtime-page-body .runtime-main {
  flex: 1 1 0;
  min-height: 0;
  max-height: 100%;
  grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.55fr);
  gap: 0.65rem;
  padding: 0.65rem 0.65rem 0;
  overflow: hidden;
}
.runtime-page-body .runtime-pane {
  min-height: 0;
  min-width: 0;
  max-height: 100%;
  border-radius: 8px;
  background: rgba(22, 33, 62, 0.66);
  border-color: rgba(93, 126, 154, 0.24);
  box-shadow: 0 6px 18px rgba(0,0,0,0.16);
  overflow: hidden;
}
.runtime-page-body .runtime-pane-header {
  padding: 0.48rem 0.72rem;
  border-bottom-color: rgba(93, 126, 154, 0.22);
  background: rgba(15, 52, 96, 0.26);
}
.runtime-page-body .runtime-pane-header h2 {
  font-size: 0.72rem;
}
.runtime-page-body .console-stream {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 0.62rem 0.78rem;
  font-size: 0.79rem;
  line-height: 1.48;
}
.runtime-approvals-shell {
  display: none;
  flex: 0 0 auto;
  margin: 0.75rem 0.75rem 0;
  border: 1px solid rgba(243, 156, 18, 0.4);
  border-radius: 10px 10px 0 0;
  background: rgba(26, 26, 46, 0.96);
  box-shadow: 0 -6px 20px rgba(0,0,0,0.18);
}
.runtime-approvals-shell[hidden] {
  display: none !important;
}
.runtime-approvals-shell.has-active-approvals {
  display: block;
}
.runtime-approvals-shell.has-approval-history {
  display: block;
}
.runtime-approvals-header {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid rgba(44, 62, 80, 0.85);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.runtime-approvals {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 12rem;
  overflow-y: auto;
  padding: 0.65rem 0.75rem 0.75rem;
}
@media (max-width: 767.98px) {
  .main-console {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
  }
  .runtime-layout {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }
  .runtime-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.65rem;
    min-height: 0;
    padding: 0.65rem 0.65rem 0;
    overflow: hidden;
  }
  .runtime-page-body .runtime-layout {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }
  .runtime-page-body .runtime-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.65rem;
    min-height: 0;
    padding: 0.65rem 0.65rem 0;
    overflow: hidden;
  }
  .runtime-page-body .runtime-pane-status {
    max-width: 46%;
  }
  /* Tap pane header to expand/collapse on mobile */
  .runtime-main.pane-trace-expanded {
    grid-template-rows: minmax(0, 3fr) minmax(0, 1fr);
  }
  .runtime-main.pane-response-expanded {
    grid-template-rows: minmax(0, 1fr) minmax(0, 3fr);
  }
  .runtime-page-body .runtime-main.pane-trace-expanded {
    grid-template-rows: minmax(0, 3fr) minmax(0, 1fr);
  }
  .runtime-page-body .runtime-main.pane-response-expanded {
    grid-template-rows: minmax(0, 1fr) minmax(0, 3fr);
  }
  .runtime-pane {
    min-height: 0;
    overflow: hidden;
  }
  .runtime-pane-header {
    cursor: pointer;
  }
  .response-pane,
  .trace-pane {
    min-height: 0;
    min-width: 0;
    width: 100%;
  }
  .runtime-pane-header {
    padding: 0.5rem 0.7rem;
  }
  .response-pane .console-stream,
  .trace-pane .console-stream {
    min-height: 0;
    max-height: none;
    padding: 0.5rem 0.7rem;
    overflow-y: auto;
  }
  .runtime-page-body .response-pane .console-stream,
  .runtime-page-body .trace-pane .console-stream {
    min-height: 0;
    max-height: none;
    padding: 0.5rem 0.7rem;
    overflow-y: auto;
  }
  .runtime-layout > .hint-bar {
    display: flex !important;
    padding: 0.35rem 0.65rem;
    gap: 0.35rem;
  }
  .hint-input {
    min-width: 0;
    font-size: 0.78rem;
  }
  .hint-send-btn {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0.35rem 0.7rem;
  }
  .composer-bar {
    margin-top: 0.4rem;
    padding: 0.4rem;
    padding-bottom: calc(0.4rem + env(safe-area-inset-bottom, 0px));
  }
  .runtime-page-body .console-input.composer-bar {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }
  .runtime-page-body .console-input.composer-bar textarea,
  .runtime-page-body .console-input.composer-bar button {
    min-width: 0;
  }
  .runtime-approvals-shell {
    margin: 0.5rem 0.65rem 0;
    border-radius: 10px;
  }
  .runtime-approvals {
    max-height: 24vh;
    overflow-y: auto;
  }
  .console-stream pre, .console-stream code, .stream-response .md-code {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
    max-height: 16rem;
    font-size: 0.9em;
  }
}

/* Sticky composer bar with safe-area padding */
.composer-bar {
  position: sticky;
  bottom: 0;
  padding: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  z-index: 45;
}
.composer-bar textarea {
  flex: 1;
  max-height: 8rem;
  resize: none;
}
.composer-bar .upload-btn {
  width: 44px;
  height: 44px;
}
.composer-bar .send-btn {
  min-width: 90px;
  height: 44px;
}

@media (max-width: 767.98px) {
  .console-input.composer-bar {
    position: static;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-areas:
      "input input input input"
      "upload mic speaker send";
    align-items: center;
    gap: 5px;
  }

  .console-input.composer-bar textarea {
    grid-area: input;
    width: 100%;
    min-width: 0;
    min-height: 3.1rem;
    max-height: 4.6rem;
    padding: 0.65rem 0.75rem;
    line-height: 1.35;
  }

  .console-input.composer-bar .upload-btn,
  .console-input.composer-bar .mic-btn,
  .console-input.composer-bar .speaker-btn,
  .console-input.composer-bar .send-btn {
    width: 100%;
    min-height: 44px;
    height: 44px;
    padding: 0.35rem 0.45rem;
  }

  .console-input.composer-bar .upload-btn { grid-area: upload; }
  .console-input.composer-bar .mic-btn { grid-area: mic; }
  .console-input.composer-bar .speaker-btn { grid-area: speaker; }
  .console-input.composer-bar .send-btn {
    grid-area: send;
    min-width: 0;
    justify-self: stretch;
  }

}


/* Individual stream entries */
.stream-entry {
  margin-bottom: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(44, 62, 80, 0.4);
}
.stream-entry:last-child { border-bottom: none; }

.stream-entry .stream-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.stream-entry .stream-meta .stream-time {
  color: var(--gray);
}

/* Prompt echo in stream */
.stream-prompt {
  color: var(--accent);
  white-space: pre-wrap;
  word-break: break-word;
}
.stream-prompt::before {
  content: "> ";
  color: var(--green);
  font-weight: 700;
}

/* Response text in stream */
.stream-response {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  padding: 0.3rem 0 0.3rem 0.8rem;
  border-left: 2px solid var(--border);
}

/* Response wrapper with copy button */
.stream-response-wrap {
  position: relative;
  padding-right: 7rem;  /* reserve space for Copy + Copy All buttons */
}
.copy-btn {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s, background 0.15s;
  z-index: 2;
  font-family: inherit;
  box-shadow: 0 0 4px rgba(0,0,0,0.4);

  min-height: 32px;
  min-width: 44px;}
.stream-response-wrap:hover .copy-btn,
.copy-btn:focus {
  opacity: 1;
}
.copy-btn:hover {
  background: var(--hover);
  color: var(--text);
  border-color: var(--accent);
}
.copy-btn-all {
  right: 3.5rem;
}
.copy-btn-prompt {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.5rem;
  opacity: 0.5;
  font-size: 0.6rem;
  padding: 0.1rem 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
}
.copy-btn-prompt:hover {
  opacity: 1;
  background: var(--hover);
  color: var(--text);
  border-color: var(--accent);
}
/* Turn break separator between multi-turn responses */
.stream-response-break {
  border-top: 1px dashed var(--border);
  margin: 0.4rem 0;
  padding-top: 0.3rem;
}
.stream-response-break .break-time {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Markdown rendering in responses */
.stream-response .md-code {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  margin: 0.3rem 0;
  font-size: 0.8rem;
  overflow-x: auto;
  white-space: pre;
}
.stream-response .md-inline {
  background: rgba(0, 180, 216, 0.1);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.85em;
}
.stream-response .md-heading {
  display: block;
  margin: 0.3rem 0 0.1rem;
  color: var(--accent);
}
.stream-response .md-bullet {
  display: block;
  padding-left: 0.5rem;
}

/* History trace steps in expanded view */
.history-trace {
  padding-left: 0.4rem;
  border-left: 2px solid var(--border);
}
.history-trace .trace-step {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 0.1rem 0 0.1rem 0.4rem;
  line-height: 1.4;
}

/* Work trace timeline — live incremental progress */
.work-timeline {
  margin: 0.3rem 0;
  padding-left: 0.4rem;
  border-left: 2px solid var(--border);
}
.work-timeline .tl-entry {
  font-size: 0.73rem;
  padding: 0.15rem 0 0.15rem 0.4rem;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s, color 0.2s;
}
.work-timeline .tl-entry.tl-active {
  color: var(--accent);
}
.work-timeline .tl-entry.tl-done {
  color: var(--text-muted);
  opacity: 0.6;
}
.work-timeline .tl-entry.tl-blocked {
  color: var(--orange);
}
.interrupted-card {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  background: rgba(210, 153, 34, 0.08);
  border: 1px solid var(--orange, #d29922);
  border-left: 3px solid var(--orange, #d29922);
  border-radius: 4px;
}
.interrupted-header {
  font-weight: 600;
  color: var(--orange, #d29922);
  font-size: 0.88rem;
  margin-bottom: 0.4rem;
}
.interrupted-prompt {
  font-size: 0.82rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 0.6rem;
  max-height: 120px;
  overflow-y: auto;
}
.interrupted-actions button {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  cursor: pointer;
}
.interrupted-actions .interrupted-resume {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.interrupted-actions .interrupted-resume:hover {
  background: var(--accent); color: var(--bg);
}
.interrupted-actions .interrupted-dismiss:hover {
  border-color: var(--text-muted);
  color: var(--text-muted);
}

.stream-image-wrap {
  margin: 0.5rem 0 0.75rem;
  display: inline-block;
  max-width: 100%;
}
.stream-image-button,
.attachment-image-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  margin: 0;
  cursor: zoom-in;
  line-height: 0;
}
.stream-image {
  display: block;
  max-width: 500px;
  max-height: 500px;
  width: auto;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
}
.stream-image-caption {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  max-width: 500px;
  word-break: break-all;
}
@media (max-width: 767.98px) {
  .stream-image { max-width: 100%; }
  .stream-image-caption { max-width: 100%; }
}

.email-notice {
  margin: 0.4rem 0;
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
  background: rgba(62, 139, 216, 0.08);
  border-left: 2px solid var(--accent);
  border-radius: 0 3px 3px 0;
  color: var(--text);
}
.email-notice .email-pk { color: var(--text-muted); font-size: 0.72rem; }

.hint-bar {
  display: flex !important;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  align-items: center;
  flex: 0 0 auto;
}
.hint-bar[aria-hidden="true"] {
  opacity: 0.72;
}
.hint-input {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
}
.hint-input:focus {
  outline: none;
  border-color: var(--accent);
}
.hint-send-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 4px;
  padding: 0.35rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.hint-send-btn:hover { opacity: 0.9; }
.hint-msg {
  margin: 0.3rem 0;
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
  color: var(--accent);
  background: rgba(0, 180, 216, 0.08);
  border-left: 2px solid var(--accent);
  border-radius: 0 3px 3px 0;
}

.feedback-wrap {
  margin: 0.5rem 0 1rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-left: 2px solid var(--border);
}
.feedback-label { margin-right: 0.5rem; }
.feedback-btn {
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 0.2rem 0.5rem; cursor: pointer; font-size: 1rem;
  margin: 0 0.15rem;
}
.feedback-btn:hover, .feedback-btn.selected {
  background: var(--accent); color: var(--bg);
}
.feedback-form { margin-top: 0.5rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.feedback-form textarea {
  flex: 1 1 100%; min-height: 2.5rem; max-width: 500px;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 0.3rem 0.5rem; font-size: 0.8rem;
}
.feedback-submit, .feedback-cancel {
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 0.25rem 0.6rem; cursor: pointer; font-size: 0.75rem;
}
.feedback-submit:hover { border-color: var(--accent); color: var(--accent); }
.feedback-done { color: var(--green); }
.feedback-err { color: var(--red); }

.work-timeline .tl-entry.tl-replay {
  opacity: 0.5;
  font-style: italic;
  border-left: 2px solid var(--border);
  padding-left: 0.5rem;
}
.work-timeline .tl-icon {
  margin-right: 0.3rem;
  display: inline-block;
  width: 1em;
  text-align: center;
}
.work-timeline .tl-phase {
  font-weight: 600;
  text-transform: capitalize;
}
.work-timeline .tl-detail {
  display: inline;
  min-width: 0;
  color: var(--text-muted);
  font-style: italic;
}
.work-timeline .tl-elapsed {
  color: var(--gray);
  font-size: 0.72rem;
  margin-left: 0.3rem;
}
.work-timeline .blocked-cat {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.6rem;
  color: var(--orange);
}
.work-timeline .blocked-action {
  color: var(--text-muted);
  font-size: 0.68rem;
}
/* Collapsed state — hide entries, show expand toggle */
.work-timeline.tl-collapsed .tl-entry {
  display: none;
}
.work-timeline .tl-expand {
  font-size: 0.68rem;
  color: var(--gray);
  cursor: pointer;
  padding: 0.1rem 0.4rem;
}
.work-timeline .tl-expand:hover {
  color: var(--accent);
  text-decoration: underline;
}
/* When expanded after collapse, show entries again */
.work-timeline:not(.tl-collapsed) .tl-entry {
  display: block;
}

/* Cancel button — lives in the response-pane-header when agent is busy */
.cancel-btn {
  padding: 0.25rem 0.9rem;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid var(--red);
  border-radius: 6px;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 30px;
  line-height: 1;
  transition: all 0.15s;
  flex-shrink: 0;
}
.cancel-btn:hover {
  background: rgba(231, 76, 60, 0.2);
}

/* Status messages */
.stream-status {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-style: italic;
}
.stream-status.status-ok { color: var(--green); font-style: normal; }
.stream-status.status-error { color: var(--red); font-style: normal; }
.stream-status.status-running { color: var(--orange); }

/* Expandable history entries */
.stream-expandable {
  cursor: pointer;
}
.stream-expandable:hover {
  background: rgba(255, 255, 255, 0.02);
}
.stream-expandable .expand-hint {
  color: var(--gray);
  font-size: 0.6rem;
  font-style: italic;
  opacity: 0;
  transition: opacity 0.15s;
}
.stream-expandable:hover .expand-hint {
  opacity: 1;
}
.stream-expandable .stream-detail {
  display: none;
}
.stream-expandable.expanded .stream-detail {
  display: block;
  margin-top: 0.4rem;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.stream-expandable.expanded .stream-preview {
  display: none;
}
.stream-expandable.expanded .expand-hint {
  opacity: 1;
}
.stream-expandable.expanded .expand-hint::after {
  content: " (click to collapse)";
}
.stream-expandable:not(.expanded) .expand-hint::after {
  content: "";
}
.stream-detail-section {
  margin-bottom: 0.4rem;
}
.stream-detail-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: block;
  margin-bottom: 0.15rem;
}

/* Attachment display */
.stream-attachment .attachment-preview {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.3rem;
}
.attachment-thumb {
  max-width: 180px;
  max-height: 120px;
  border-radius: 4px;
  border: 1px solid var(--border);
  cursor: zoom-in;
  transition: transform 0.15s;
}
.attachment-thumb:hover {
  transform: scale(1.05);
  border-color: var(--accent);
}
.attachment-name {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.image-lightbox[hidden] {
  display: none !important;
}
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 80);
  background: rgba(0, 0, 0, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
body.image-lightbox-open {
  overflow: hidden;
}
.image-lightbox-figure {
  margin: 0;
  max-width: min(96vw, 1400px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
.image-lightbox-img {
  max-width: 100%;
  max-height: calc(92vh - 2.5rem);
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
}
.image-lightbox-caption {
  max-width: min(96vw, 1000px);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  word-break: break-word;
}
.image-lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.image-lightbox-close:hover,
.image-lightbox-close:focus {
  border-color: var(--accent);
  outline: none;
}

/* Upload button */
.upload-btn {
  padding: 0.5rem 0.8rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 48px;
}
.upload-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* System/info messages */
.stream-system {
  color: var(--gray);
  font-size: 0.75rem;
}

/* Prompt input area */
.console-input {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  border-top: 2px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
@media (max-width: 767.98px) {
  .console-input {
    position: sticky;
    bottom: 0;
    padding-bottom: calc(0.7rem + env(safe-area-inset-bottom, 0px));
    z-index: 45;
  }
}
.console-input textarea {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.6rem 0.8rem;
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 1rem;
  line-height: 1.5;
  resize: none;
  min-height: 48px;
  max-height: 200px;
  outline: none;
  transition: border-color 0.15s;
}
.console-input textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(0, 180, 216, 0.2);
}
.console-input textarea::placeholder {
  color: var(--gray);
}
.console-input .send-btn{
  padding: 0.6rem 1.4rem;
  background: rgba(0, 180, 216, 0.1);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  min-height: 48px;
  letter-spacing: 0.3px;

  min-width: 80px;}
.console-input .send-btn:hover:not(:disabled) {
  background: rgba(0, 180, 216, 0.2);
  color: #fff;
}
.console-input .send-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: transparent;
}

/* Tasks drawer toggle */
.drawer-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  transition: all 0.15s;
}
.drawer-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* Tasks drawer (slides up from bottom or right side) */
.tasks-drawer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.tasks-drawer.open {
  max-height: 200px;
  overflow-y: auto;
}
.tasks-drawer table {
  font-size: 0.78rem;
}
.tasks-drawer th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.tasks-drawer .drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 1rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 2;
}
.tasks-drawer .drawer-header h3 {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

/* ==========================================================================
   Inline Approval Cards
   ========================================================================== */

.approval-card {
  background: var(--bg);
  border: 1px solid var(--orange);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  margin: 0.5rem 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
.approval-card.risk-critical {
  border-color: var(--red);
}
.approval-card.risk-high {
  border-color: var(--orange);
}
.approval-card.risk-medium {
  border-color: var(--yellow);
}
.approval-card.approval-danger {
  border-color: var(--red);
  border-width: 2px;
  background: rgba(231, 76, 60, 0.08);
  box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.15);
}
.approval-card.approval-danger .approval-title {
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.approval-card .approval-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.approval-card .approval-icon {
  font-size: 1rem;
  flex-shrink: 0;
}
.approval-card .approval-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.approval-card .approval-body {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}
.approval-card .approval-action {
  font-size: 0.75rem;
  color: var(--text);
  background: var(--bg-card);
  border-radius: 4px;
  padding: 0.3rem 0.6rem;
  margin: 0.3rem 0;
  font-family: 'SF Mono', 'Consolas', monospace;
  word-break: break-word;
}

.approval-card .approval-controls {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.approval-card .approval-btn {
  padding: 0.5rem 1.2rem;
  min-height: 44px;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.approval-btn-approve {
  background: rgba(46, 204, 113, 0.15);
  color: var(--green);
  border-color: var(--green);
}
.approval-btn-approve:hover {
  background: rgba(46, 204, 113, 0.3);
}
.approval-btn-deny {
  background: rgba(231, 76, 60, 0.1);
  color: var(--red);
  border-color: var(--red);
}
.approval-btn-deny:hover {
  background: rgba(231, 76, 60, 0.25);
}
.approval-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Resolved state */
.approval-card.resolved {
  opacity: 0.7;
  border-style: dashed;
}
.approval-card.resolved .approval-controls {
  display: none;
}
.approval-card .approval-decision {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.4rem;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  display: inline-block;
}
.approval-decision.decision-approve {
  background: rgba(46, 204, 113, 0.15);
  color: var(--green);
}
.approval-decision.decision-deny {
  background: rgba(231, 76, 60, 0.15);
  color: var(--red);
}


/* Accessibility helpers */
.skip-nav {
  position: absolute;
  left: 0;
  top: -40px;
  background: var(--accent);
  color: #001219;
  padding: 0.5rem 1rem;
  z-index: 1000;
  text-decoration: none;
  border-radius: 0 0 4px 0;
}
.skip-nav:focus-visible { top: 0; }
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}


/* Responsive breakpoints */
@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .detail-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
@media (max-width: 480px) {
  .main { padding: 1rem; }
  .sidebar { width: 100%; }
  .sidebar nav a { padding: 0.5rem 0.8rem; }
  .console-header { padding: 0.5rem; gap: 0.5rem; }
  .runtime-pane-header { padding: 0.55rem 0.75rem; }
  .runtime-pane-header h2 { font-size: 0.74rem; }
  .console-stream { padding: 0.6rem; }
  .response-pane .console-stream { min-height: 0; }
  .trace-pane .console-stream { min-height: 0; }
  .runtime-approvals-header { padding: 0.5rem 0.75rem; }
  .runtime-approvals { padding: 0.5rem 0.6rem 0.6rem; max-height: 7.5rem; }
  .stream-response-wrap { padding-right: 6rem; }
}

/* -----------------------------------------------------------------------
   Voice controls
   ----------------------------------------------------------------------- */
.voice-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  flex-shrink: 0;
  padding: 0;
}
.voice-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}
.voice-btn.voice-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.voice-btn.recording {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
  animation: recording-pulse 1.2s ease-in-out infinite;
}
@keyframes recording-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192,57,43,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(192,57,43,0); }
}
.voice-controls-drawer {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.voice-controls-drawer .voice-btn {
  height: 32px;
  font-size: 0.8rem;
  padding: 0 0.5rem;
  width: auto;
  min-width: unset;
}
