:root {
  /* Color Hunt palette: #010736 · #0D1C42 · #22396F · #FCF1D0 */
  color-scheme: dark;
  --cream: #FCF1D0;
  --navy-deep: #010736;
  --navy: #0D1C42;
  --navy-mid: #22396F;
  --bg: #010736;
  --bg-elev: #0D1C42;
  --bg-panel: #0D1C42;
  --border: #22396F;
  --text: #FCF1D0;
  --muted: rgba(252, 241, 208, 0.58);
  --accent: #22396F;
  --accent-2: #FCF1D0;
  --danger: #f87171;
  --ok: #34d399;
  --shadow: 0 18px 50px rgba(1, 7, 54, 0.55);
  --radius: 14px;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(34, 57, 111, 0.45), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(252, 241, 208, 0.07), transparent 50%),
    linear-gradient(180deg, var(--navy-deep), var(--bg));
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.shell {
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; overflow: hidden;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem 1.25rem; border-bottom: 1px solid var(--border);
  background: rgba(1, 7, 54, 0.92); backdrop-filter: blur(10px);
  flex-shrink: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: .75rem; font-weight: 700; letter-spacing: .02em; min-width: 0; }
.brand-text { min-width: 0; white-space: nowrap; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 24px rgba(252, 241, 208, 0.2);
  flex-shrink: 0;
}
.brand-text span { color: var(--muted); font-weight: 500; margin-left: .35rem; }
.topbar-refresh {
  width: 2.25rem; height: 2.25rem; min-height: 0; padding: 0;
  flex-shrink: 0; font-size: 1.05rem; line-height: 1;
}
.topbar-refresh:active { transform: rotate(-45deg); }
.topbar-refresh.spin { animation: topbar-spin .65s ease-in-out; }
@keyframes topbar-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.topbar-left { display: flex; align-items: center; gap: 1.25rem; min-width: 0; }
.host-metrics {
  display: flex; align-items: center; flex-wrap: wrap; gap: .85rem;
  padding-left: 1rem; border-left: 1px solid var(--border);
}
.metric-ring {
  position: relative; width: 44px; height: 44px; flex-shrink: 0;
}
.metric-ring svg {
  width: 100%; height: 100%; transform: rotate(-90deg);
}
.metric-ring .ring-bg {
  fill: none; stroke: rgba(34, 57, 111, 0.55); stroke-width: 3.2;
}
.metric-ring .ring-fill {
  fill: none; stroke: var(--accent-2); stroke-width: 3.2;
  stroke-linecap: round; transition: stroke-dasharray .45s ease, stroke .25s ease;
}
.metric-ring[data-level="warn"] .ring-fill { stroke: #fbbf24; }
.metric-ring[data-level="high"] .ring-fill { stroke: var(--danger); }
.metric-ring .metric-val {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: .58rem; font-weight: 600; color: var(--text);
  pointer-events: none;
}
.metric-ring .metric-lbl {
  position: absolute; left: 50%; bottom: -1px; transform: translateX(-50%);
  font-size: .58rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap; pointer-events: none;
}
.metric-specs {
  display: flex; align-items: stretch; gap: .65rem;
  padding: .2rem .55rem; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(13, 28, 66, 0.85);
}
.metric-spec {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 44px;
}
.metric-spec .spec-val {
  font-family: var(--mono); font-size: .78rem; font-weight: 600; line-height: 1.1; color: var(--text);
  white-space: nowrap;
}
.metric-spec .spec-lbl {
  font-size: .58rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
.usage-topbar-btn {
  flex-shrink: 0;
  font-size: .78rem;
  padding: .35rem .65rem;
  letter-spacing: .02em;
}
.usage-modal { max-width: 720px; }
.usage-filter-row { display: flex; flex-wrap: wrap; gap: 1rem 1.25rem; align-items: flex-end; }
.usage-filter-row .usage-period-row { flex: 1 1 12rem; }
.usage-hint { font-size: .78rem; color: var(--muted); margin: -.35rem 0 .5rem; line-height: 1.4; }
.usage-modal-body { display: flex; flex-direction: column; gap: .85rem; }
.usage-disclaimer {
  margin: 0; font-size: .82rem; color: var(--muted); line-height: 1.45;
}
.usage-period-row { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.usage-period-row .label { margin: 0; }
.usage-period-row .select { min-width: 11rem; }
.usage-subhead {
  margin: 0 0 .45rem; font-size: .95rem; font-weight: 600; color: var(--text);
}
.usage-self-card {
  padding: .75rem .85rem; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(13, 28, 66, 0.55);
}
.usage-dl {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .55rem .75rem; margin: 0;
}
.usage-dl div { margin: 0; }
.usage-dl dt {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin: 0 0 .15rem;
}
.usage-dl dd {
  margin: 0; font-family: var(--mono); font-size: .88rem; font-weight: 600;
}
.usage-table-wrap { overflow-x: auto; max-height: 280px; overflow-y: auto; }
.usage-table {
  width: 100%; border-collapse: collapse; font-size: .82rem;
}
.usage-table th, .usage-table td {
  padding: .4rem .5rem; border-bottom: 1px solid var(--border); text-align: left;
}
.usage-table th.num, .usage-table td.num { text-align: right; font-family: var(--mono); }
.usage-table th { color: var(--muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; }
.usage-email {
  display: block; font-size: .72rem; color: var(--muted); font-family: var(--mono); font-weight: 400;
}
.usage-table tfoot .usage-totals td {
  font-weight: 700; border-top: 1px solid var(--border); border-bottom: none;
}
.usage-status { font-size: .85rem; color: var(--muted); }
.header-model-pill {
  max-width: min(22rem, 42vw);
  padding: .28rem .65rem;
  border-radius: 999px;
  border: 1px solid rgba(252, 241, 208, 0.22);
  background: rgba(13, 28, 66, 0.82);
  color: var(--accent-2);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}
.topbar-right {
  display: flex; align-items: center; gap: 1rem; flex-shrink: 0; min-width: 0;
}
.userchip { color: var(--muted); font-size: .92rem; flex-shrink: 0; }
.panel-toggle {
  background: transparent; border: 1px solid var(--border); border-radius: 8px;
  color: var(--muted); cursor: pointer; padding: .4rem .5rem; line-height: 0;
  flex-shrink: 0; transition: border-color .15s, color .15s;
}
.panel-toggle:hover { color: var(--accent-2); border-color: var(--accent); }
.panel-toggle svg { width: 18px; height: 18px; display: block; }
.panel-toggle .icon-collapse { display: none; }
.layout:not(.layout-left-collapsed) .panel-toggle[data-panel-toggle="left"] .icon-expand { display: none; }
.layout:not(.layout-left-collapsed) .panel-toggle[data-panel-toggle="left"] .icon-collapse { display: block; }
.layout:not(.layout-right-collapsed) .panel-toggle[data-panel-toggle="right"] .icon-expand { display: none; }
.layout:not(.layout-right-collapsed) .panel-toggle[data-panel-toggle="right"] .icon-collapse { display: block; }

.layout {
  flex: 1; display: grid;
  --sidebar-w: 400px;
  --fileside-w: 300px;
  grid-template-columns: var(--sidebar-w) 6px 1fr var(--fileside-w);
  min-height: 0; overflow: hidden;
  transition: grid-template-columns .25s ease;
}
.layout.layout-resizing { transition: none; user-select: none; cursor: col-resize; }
.layout.layout-left-collapsed { --sidebar-w: 0px; }
.layout.layout-right-collapsed { --fileside-w: 0px; }
.sidebar-resizer {
  cursor: col-resize;
  background: transparent;
  position: relative;
  min-height: 0;
  touch-action: none;
}
.sidebar-resizer::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 2px; width: 2px;
  background: var(--border);
  opacity: .6;
  transition: opacity .15s ease, background .15s ease;
}
.sidebar-resizer:hover::after,
.sidebar-resizer:focus-visible::after,
.layout.layout-resizing .sidebar-resizer::after {
  opacity: 1;
  background: var(--accent-2);
}
.layout.layout-left-collapsed .sidebar-resizer {
  display: none;
  pointer-events: none;
}
.sidebar {
  border-right: 1px solid var(--border); background: rgba(13, 28, 66, 0.72);
  padding: 1rem; overflow: auto; min-height: 0;
  min-width: 0;
  transition: opacity .2s ease, visibility .2s ease, padding .25s ease, border-color .25s ease;
}
.layout.layout-left-collapsed .sidebar {
  opacity: 0; visibility: hidden; pointer-events: none;
  padding: 0; border-color: transparent; overflow: hidden;
}
.main { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.label { display: block; color: var(--muted); font-size: .8rem; margin-bottom: .35rem; text-transform: uppercase; letter-spacing: .06em; }
.select, .input, .textarea, .btn {
  width: 100%; border-radius: 10px; border: 1px solid var(--border);
  background: var(--navy); color: var(--text); font: inherit; padding: .7rem .85rem;
}
/* Native select popups do not use the page background. Cream text on Chrome's
   default light menu is unclickable, so a server choice never fires change. */
select.select {
  color-scheme: dark;
  background-color: #0D1C42;
  color: #FCF1D0;
}
select.select option,
select.select optgroup {
  background-color: #0D1C42;
  color: #FCF1D0;
}
.select:focus, .input:focus, .textarea:focus { outline: 2px solid rgba(252, 241, 208, 0.35); border-color: var(--accent-2); }
.btn {
  cursor: pointer; background: linear-gradient(135deg, var(--navy-mid), #2a4478);
  color: var(--cream); border: none; font-weight: 650; width: auto; padding: .7rem 1rem;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--navy); border: 1px solid var(--border); color: var(--text); }
.btn:disabled { opacity: .55; cursor: wait; }
.meta { color: var(--muted); font-size: .9rem; line-height: 1.45; }
.meta code { font-family: var(--mono); color: rgba(252, 241, 208, 0.88); font-size: .82rem; }
.meta-idle { color: var(--muted); }
.sidebar-accordion {
  margin-top: 1rem; padding-top: .85rem;
  border-top: 1px solid var(--border);
}
.sidebar-accordion > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: .4rem; min-width: 0;
}
.sidebar-accordion > summary::-webkit-details-marker { display: none; }
.sidebar-accordion > summary::marker { content: ''; }
.sidebar-accordion > summary::before {
  content: '▸'; flex-shrink: 0;
  font-size: .68rem; color: var(--muted);
  transition: transform .15s ease;
}
.sidebar-accordion[open] > summary::before { transform: rotate(90deg); }
.sidebar-accordion-title {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); flex-shrink: 0;
}
.sidebar-accordion-body {
  margin-top: .55rem;
  display: flex; flex-direction: column; gap: .55rem;
}
.sidebar-accordion-action {
  flex-shrink: 0; margin-left: auto; width: auto; padding: .35rem .5rem;
}
.sidebar-accordion > summary .sidebar-accordion-hint {
  flex: 1; min-width: 0;
  color: var(--muted); font-size: .72rem; line-height: 1.35;
  text-transform: none; letter-spacing: normal;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sessions-panel-body,
.notes-panel-body {
  margin-top: .45rem;
}
.conn {
  display: flex; align-items: center; gap: .55rem;
  margin-top: .75rem; padding: .55rem .7rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--navy); font-size: .85rem; color: var(--muted);
}
.conn-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: #64748b;
}
.conn[data-state="connecting"] .conn-dot {
  background: var(--accent-2);
  box-shadow: 0 0 0 0 rgba(252, 241, 208, 0.45);
  animation: pulse 1.4s ease-out infinite;
}
.conn[data-state="connecting"] { color: var(--accent-2); border-color: rgba(252, 241, 208, 0.35); }
.conn[data-state="connected"] .conn-dot { background: var(--ok); }
.conn[data-state="connected"] { color: var(--ok); border-color: rgba(52,211,153,.35); }
.conn[data-state="error"] .conn-dot { background: var(--danger); }
.conn[data-state="error"] { color: var(--danger); border-color: rgba(248,113,113,.35); }

.persona-dock {
  /* TEMP: hidden for cramped displays — restore display:flex when done */
  display: none !important;
  align-items: center; gap: 1rem;
  padding: .85rem 1rem; margin-bottom: .65rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(13, 28, 66, 0.95), rgba(1, 7, 54, 0.92));
  box-shadow: 0 10px 28px rgba(0,0,0,.22);
  flex-shrink: 0;
}
.persona-avatar {
  width: 72px; height: 72px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.persona-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.persona-info { min-width: 0; flex: 1; }
.persona-name {
  font-weight: 700; font-size: 1rem; letter-spacing: .03em;
  background: linear-gradient(90deg, var(--text), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.persona-status {
  margin-top: .2rem; color: var(--muted); font-size: .88rem; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.persona-model {
  margin-top: .15rem;
  color: var(--accent-2);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.persona-head { transform-origin: 40px 41px; }
.persona-eye { transform-origin: center; }
.persona-mouth { transform-origin: 40px 50px; }
.persona-ring { transform-origin: 40px 40px; }
.persona-antenna-tip { transform-origin: 40px 10px; }

.persona-dock[data-state="idle"] .persona-head {
  animation: persona-float 4s ease-in-out infinite;
}
.persona-dock[data-state="idle"] .persona-eye-l,
.persona-dock[data-state="idle"] .persona-eye-r,
.persona-dock[data-state="ready"] .persona-eye-l,
.persona-dock[data-state="ready"] .persona-eye-r {
  animation: persona-blink 4.5s ease-in-out infinite;
}
.persona-dock[data-state="ready"] .persona-antenna-tip {
  animation: persona-pulse-tip 2.4s ease-in-out infinite;
}

.persona-dock[data-state="connecting"] .persona-ring {
  animation: persona-spin 1.4s linear infinite;
  opacity: .75;
}
.persona-dock[data-state="connecting"] .persona-antenna-tip {
  animation: persona-pulse-tip .9s ease-in-out infinite;
}

.persona-dock[data-state="listening"] {
  border-color: rgba(248,113,113,.45);
  box-shadow: 0 0 0 1px rgba(248,113,113,.18), 0 10px 28px rgba(0,0,0,.22);
}
.persona-dock[data-state="listening"] .persona-ring {
  stroke: #f87171; opacity: .65;
  animation: persona-pulse-ring 1.1s ease-in-out infinite;
}
.persona-dock[data-state="listening"] .persona-eye-l,
.persona-dock[data-state="listening"] .persona-eye-r {
  fill: #fca5a5;
  animation: persona-listen-eyes 1.2s ease-in-out infinite;
}
.persona-dock[data-state="listening"] .persona-mouth {
  animation: persona-listen-mouth .55s ease-in-out infinite alternate;
}

.persona-dock[data-state="thinking"] .persona-eye-l { transform: translate(-1px, -2px); }
.persona-dock[data-state="thinking"] .persona-eye-r { transform: translate(1px, -2px); }
.persona-dock[data-state="thinking"] .persona-mouth {
  transform: scale(.72, 1);
  animation: persona-think-mouth 1.1s ease-in-out infinite;
}
.persona-dock[data-state="thinking"] .persona-ring {
  animation: persona-spin 2.8s linear infinite;
  opacity: .55;
}

.persona-dock[data-state="speaking"] .persona-mouth {
  animation: persona-speak 280ms ease-in-out infinite alternate;
}
.persona-dock[data-state="speaking"] .persona-head {
  animation: persona-nod 900ms ease-in-out infinite;
}

.persona-dock[data-state="error"] {
  border-color: rgba(248,113,113,.4);
}
.persona-dock[data-state="error"] .persona-ring { stroke: var(--danger); opacity: .7; }
.persona-dock[data-state="error"] .persona-eye-l,
.persona-dock[data-state="error"] .persona-eye-r { fill: var(--danger); }
.persona-dock[data-state="error"] .persona-mouth {
  fill: var(--danger);
  transform: scale(.85, .45);
}

@keyframes persona-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
@keyframes persona-blink {
  0%, 44%, 48%, 100% { transform: scaleY(1); }
  46% { transform: scaleY(.12); }
}
@keyframes persona-pulse-tip {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: .75; }
}
@keyframes persona-spin {
  to { transform: rotate(360deg); }
}
@keyframes persona-pulse-ring {
  0%, 100% { opacity: .45; }
  50% { opacity: .85; }
}
@keyframes persona-listen-eyes {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}
@keyframes persona-listen-mouth {
  from { transform: scale(1, 1); }
  to { transform: scale(1.15, 1.8); }
}
@keyframes persona-think-mouth {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}
@keyframes persona-speak {
  from { transform: scale(1, 1); }
  to { transform: scale(1.2, 2.4); }
}
@keyframes persona-nod {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(2deg); }
}

.chat {
  flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  padding: 1rem 1.25rem 1.25rem;
}
.messages {
  flex: 1; overflow: auto; display: flex; flex-direction: column; gap: .85rem;
  padding: .25rem .15rem 1rem; min-height: 0;
}
.bubble {
  max-width: 900px; padding: .9rem 1rem; border-radius: 12px; border: 1px solid var(--border);
  white-space: pre-wrap; word-break: break-word; line-height: 1.45; font-size: .95rem;
}
.bubble.user { align-self: flex-end; background: var(--navy-mid); border-color: #2a4478; }
.bubble.assistant { align-self: flex-start; background: var(--navy); }
.bubble-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: .75rem;
  margin-bottom: .35rem;
}
.bubble-head-left {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: .4rem .55rem; min-width: 0;
}
.bubble-model-tag {
  display: inline-block;
  padding: .1rem .4rem;
  border-radius: 6px;
  border: 1px solid rgba(252, 241, 208, 0.18);
  background: rgba(252, 241, 208, 0.06);
  color: var(--accent-2);
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: none;
  line-height: 1.3;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bubble.user .bubble-head { flex-direction: row-reverse; }
.bubble.user .bubble-head-left { justify-content: flex-end; }
.bubble .who { display: block; color: var(--muted); font-size: .72rem; margin-bottom: 0; text-transform: uppercase; letter-spacing: .08em; }
.bubble-when {
  color: var(--muted); font-size: .68rem; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.bubble-usage-cost {
  margin-top: .65rem; padding-top: .5rem; border-top: 1px solid var(--border);
  font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums;
}
.bubble-usage-cost strong { color: #facc15; font-weight: 600; }
.bubble-followup-actions {
  display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .55rem; padding-top: .5rem;
  border-top: 1px solid var(--border);
}
.bubble-followup-actions .btn { flex: 1 1 auto; min-width: 7rem; font-size: .78rem; }
.bubble-followup-actions .btn.busy { opacity: .55; cursor: wait; }
.bubble-action-short-glow {
  border: 2px solid #facc15 !important;
  color: #fef9c3;
  background: rgba(250, 204, 21, 0.08);
  box-shadow:
    0 0 10px rgba(250, 204, 21, 0.35),
    0 0 22px rgba(250, 204, 21, 0.18),
    inset 0 0 12px rgba(250, 204, 21, 0.06);
}
.bubble-action-short-glow:hover:not(:disabled) {
  border-color: #fde047 !important;
  box-shadow:
    0 0 14px rgba(253, 224, 71, 0.5),
    0 0 28px rgba(250, 204, 21, 0.25),
    inset 0 0 14px rgba(250, 204, 21, 0.1);
}
.bubble-action-short-glow:disabled {
  opacity: .5;
  box-shadow: none;
}
.bubble-action-recommended-amber {
  border: 1px solid rgba(245, 176, 65, 0.78) !important;
  color: #fef3c7;
  background: rgba(245, 176, 65, 0.06);
}
.bubble-action-recommended-amber:hover:not(:disabled) {
  border-color: rgba(253, 186, 72, 0.95) !important;
  background: rgba(245, 176, 65, 0.1);
}
.bubble-action-recommended-amber:disabled {
  opacity: .5;
}
.recommended-response-overlay {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center;
  background: rgba(2, 6, 23, 0.72); backdrop-filter: blur(4px);
}
.recommended-response-overlay[hidden] { display: none !important; }
.recommended-response-overlay-card {
  display: flex; flex-direction: column; align-items: stretch; gap: 1rem;
  padding: 1.75rem 2rem; border-radius: 14px;
  border: 1px solid var(--border); background: var(--bg-panel);
  box-shadow: var(--shadow); width: min(420px, 92vw);
  text-align: center;
}
.recommended-response-overlay-text {
  margin: 0; font-size: .92rem; color: var(--text); line-height: 1.45;
}
.recommended-response-overlay-text.is-error { color: var(--danger); }
.recommended-response-progress { width: 100%; }
.recommended-response-progress-active .short-answer-progress-fill {
  animation: short-answer-progress-shimmer 1.2s linear infinite;
}
.composer-followup-row {
  display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; margin-bottom: 0.35rem;
}
.bubble-inline-short-answer {
  margin-top: 0;
  margin-bottom: 0.5rem;
  padding: 1rem 1.15rem 1.05rem;
  border-radius: 12px;
  background: #060d28;
  border: 1px solid rgba(245, 176, 65, 0.72);
  box-shadow: 0 0 0 1px rgba(245, 176, 65, 0.08) inset;
}
.bubble-inline-short-answer-label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #4d9fff;
  padding-bottom: 0.55rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(34, 57, 111, 0.85);
}
.bubble-inline-short-answer-body {
  font-size: 0.92rem;
  line-height: 1.55;
  color: #f4f7fc;
}
.bubble-inline-short-answer.is-loading .short-answer-loading-label {
  color: #93c5fd;
}
.bubble-inline-short-answer-body p:first-child { margin-top: 0; }
.bubble-inline-short-answer-body p:last-child { margin-bottom: 0; }
.bubble-inline-short-sep {
  border: 0; border-top: 1px solid var(--border); margin: 0.85rem 0 0.55rem;
}
.bubble-inline-short-answer-err {
  margin: 0; font-size: 0.86rem; color: var(--danger);
}
body.auto-short-answer-on .bubble-action-short {
  display: none;
}
body.auto-short-answer-on .bubble-followup-actions {
  justify-content: flex-start;
}
body.auto-short-answer-on .bubble-followup-actions .bubble-action-recommended {
  flex: 0 0 auto;
  min-width: 0;
  width: auto;
}
.short-answer-output {
  min-height: 20rem;
  max-height: min(52vh, 28rem) !important;
  height: min(52vh, 28rem);
  resize: vertical;
  margin-top: .5rem;
}
#shortAnswerBackdrop .polish-modal {
  width: min(680px, 100%);
  max-height: min(94vh, 920px);
}
#shortAnswerBackdrop .short-answer-output {
  background: #060d28;
  border: 1px solid rgba(245, 176, 65, 0.72);
  border-radius: 12px;
  color: #f4f7fc;
  padding: 1rem 1.1rem;
}
#shortAnswerBackdrop #shortAnswerModalTitle {
  color: #4d9fff;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.85rem;
}
.short-answer-loading {
  margin-bottom: .85rem;
}
.short-answer-loading-label {
  margin: 0 0 .5rem; font-size: .84rem; color: #93c5fd;
}
.short-answer-progress-track {
  height: .45rem; border-radius: 999px;
  background: rgba(147, 197, 253, 0.15);
  overflow: hidden; border: 1px solid rgba(147, 197, 253, 0.25);
}
.short-answer-progress-fill {
  height: 100%; width: 0%; border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #facc15, #38bdf8);
  background-size: 200% 100%;
  transition: width 0.35s ease-out;
}
.short-answer-loading.is-active .short-answer-progress-fill {
  animation: short-answer-progress-shimmer 1.2s linear infinite;
}
@keyframes short-answer-progress-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.short-answer-output.is-loading {
  opacity: 0.45;
  pointer-events: none;
}
.chat-emphasis {
  font-weight: 700;
  color: #facc15;
}
.chat-heading {
  font-size: inherit;
  font-weight: 700;
  margin: .55rem 0 .15rem;
  line-height: inherit;
  color: var(--text);
}
.chat-code {
  display: block;
  width: 80%;
  max-width: 80%;
  margin: .45rem 0;
  padding: .4rem .55rem;
  border: 1px solid rgba(147, 160, 184, .28);
  border-radius: 6px;
  background: rgba(10, 16, 28, .55);
  font-family: var(--mono);
  font-size: .76rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  color: #c7d2fe;
}
.bubble .chat-link {
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.bubble .chat-formatted-body {
  white-space: normal;
  display: block;
}
.bubble .chat-link:hover { color: var(--cream); }
.composer {
  display: grid; grid-template-columns: 1fr auto; gap: .75rem; align-items: stretch;
  border-top: 1px solid var(--border); padding-top: 1rem;
  flex-shrink: 0; background: transparent;
}
.composer.drag {
  outline: 2px dashed rgba(34, 57, 111,.55);
  outline-offset: 4px;
  border-radius: 10px;
}
.composer-main { display: flex; flex-direction: column; gap: .5rem; min-width: 0; min-height: 0; }
.second-opinion-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: .85rem 1.1rem;
}
.second-opinion-toggle {
  display: flex; align-items: center; gap: .45rem;
  font-size: .78rem; color: var(--muted); cursor: pointer; user-select: none;
}
.second-opinion-toggle.disabled { opacity: .55; cursor: not-allowed; }
.second-opinion-toggle input { accent-color: #ea580c; }
.second-opinion-toggle:has(#secondOpinionOpus) input { accent-color: #8b5cf6; }
.second-opinion-toggle:has(#secondOpinionAstra) input { accent-color: #38bdf8; }
.second-opinion-model.grok-model { color: #fb923c; }
.second-opinion-model.opus-model { color: #c4b5fd; }
.second-opinion-model.astra-model { color: #7dd3fc; }
.grok-review {
  margin: .55rem 0 .75rem; padding: .55rem .7rem;
  border: 1px solid rgba(234, 88, 12, .35); border-radius: 8px;
  background: rgba(234, 88, 12, .08);
}
.opus-review {
  margin: .55rem 0 .75rem; padding: .55rem .7rem;
  border: 1px solid rgba(139, 92, 246, .35); border-radius: 8px;
  background: rgba(139, 92, 246, .08);
}
.astra-review {
  margin: .55rem 0 .75rem; padding: .55rem .7rem;
  border: 1px solid rgba(56, 189, 248, .35); border-radius: 8px;
  background: rgba(56, 189, 248, .08);
}
.grok-review summary {
  cursor: pointer; font-size: .78rem; font-weight: 600;
  color: #fdba74; list-style: none;
}
.opus-review summary {
  cursor: pointer; font-size: .78rem; font-weight: 600;
  color: #ddd6fe; list-style: none;
}
.astra-review summary {
  cursor: pointer; font-size: .78rem; font-weight: 600;
  color: #bae6fd; list-style: none;
}
.grok-review summary::-webkit-details-marker,
.opus-review summary::-webkit-details-marker,
.astra-review summary::-webkit-details-marker { display: none; }
.grok-review summary::before,
.opus-review summary::before,
.astra-review summary::before { content: '▸ '; }
.grok-review[open] summary::before,
.opus-review[open] summary::before,
.astra-review[open] summary::before { content: '▾ '; }
.grok-review-body {
  margin-top: .55rem; font-size: .86rem; line-height: 1.5; color: #fed7aa;
}
.opus-review-body {
  margin-top: .55rem; font-size: .86rem; line-height: 1.5; color: #ede9fe;
}
.astra-review-body {
  margin-top: .55rem; font-size: .86rem; line-height: 1.5; color: #e0f2fe;
}
.grok-review-err,
.opus-review-err,
.astra-review-err {
  font-size: .82rem; color: #fca5a5; border-color: rgba(239, 68, 68, .35);
  background: rgba(239, 68, 68, .08); padding: .45rem .6rem; border-radius: 8px;
}
.reviews-live .grok-review,
.reviews-live .opus-review { margin-top: .45rem; }
.composer-actions {
  display: flex; flex-direction: column; gap: .5rem;
  justify-content: stretch;
}
.composer-actions .btn { flex: 1 1 0; min-height: 2.75rem; }
.composer-send-stack {
  display: flex; flex-direction: column; gap: .35rem; flex: 1 1 0; min-width: 0;
}
.composer-send-stack .btn { flex: none; width: 100%; }
.composer-polish-btn.astra-model {
  border-color: rgba(56, 189, 248, .35);
  color: #e0f2fe;
}
.composer-polish-status {
  margin: 0; font-size: .78rem; color: #93c5fd; text-align: center;
}
.composer-polish-err {
  margin: 0; font-size: .78rem; color: var(--danger); text-align: center;
}
.composer-prompt-wrap {
  position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
}
.composer-polish-progress {
  position: absolute; top: 0; left: 0; right: 0; z-index: 4; pointer-events: none;
}
.composer-polish-progress-track {
  height: 5px; border-radius: 8px 8px 0 0; border: none;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}
.composer-prompt-wrap.is-polishing .composer-polish-progress-fill {
  animation: short-answer-progress-shimmer 1.2s linear infinite;
}
.composer-prompt-wrap.is-polishing .textarea {
  border-top-color: rgba(56, 189, 248, 0.45);
}
.btn-mic { font-size: 1.15rem; line-height: 1; }
.btn-mic.listening {
  background: linear-gradient(135deg, #b91c1c, #dc2626);
  border-color: #f87171;
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .03em;
  animation: pulse-mic 1.2s ease-in-out infinite;
}
@keyframes pulse-mic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(248, 113, 113, 0); }
}
.composer-main .textarea {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  height: 100%;
}
.submission-bubble-stats {
  flex: 0 0 auto;
  margin: 0.35rem 0 0;
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #cbd5e1;
  background: var(--navy-mid);
  border: 1px solid #2a4478;
  border-radius: 10px;
  align-self: flex-end;
  max-width: 100%;
  text-align: right;
}
.submission-bubble-label { font-weight: 600; color: #e2e8f0; }
.submission-bubble-metric { white-space: nowrap; }
.submission-bubble-cost { color: #facc15; font-weight: 600; }
.submission-bubble-sep { opacity: 0.55; margin: 0 0.35rem; }
.textarea { min-height: 88px; max-height: 160px; resize: vertical; }
.attach-btn { cursor: pointer; text-align: center; white-space: nowrap; }
.attach-btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.attach-row {
  display: flex; flex-wrap: wrap; gap: .5rem;
}
.attach-chip {
  position: relative; width: 72px; height: 72px; border-radius: 10px;
  overflow: hidden; border: 1px solid var(--border); background: var(--navy);
}
.attach-chip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-chip.file {
  width: auto; min-width: 88px; max-width: 160px; height: 72px;
  padding: .45rem .55rem 1.4rem; display: flex; flex-direction: column; gap: .2rem;
}
.attach-chip .attach-ext {
  font-size: .68rem; font-weight: 700; letter-spacing: .06em; color: #93c5fd;
}
.attach-chip .attach-name {
  font-size: .72rem; color: var(--text); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.attach-chip button {
  position: absolute; top: 2px; right: 2px; width: 22px; height: 22px;
  border: 0; border-radius: 6px; background: rgba(0,0,0,.65); color: #fff;
  cursor: pointer; line-height: 1; font-size: 14px;
}
.bubble-imgs {
  display: flex; flex-wrap: wrap; gap: .45rem; margin: .15rem 0 .55rem;
}
.bubble-files {
  display: flex; flex-wrap: wrap; gap: .4rem; margin: .15rem 0 .55rem;
}
.bubble-file {
  display: inline-block; padding: .2rem .5rem; border-radius: 6px;
  border: 1px solid var(--border); background: #0a101c;
  font-size: .78rem; color: #93c5fd;
}
.bubble-imgs img {
  max-width: min(280px, 100%); max-height: 180px; border-radius: 8px;
  border: 1px solid var(--border); object-fit: contain; background: #0a101c;
}
.bubble.thinking {
  border-color: rgba(34, 57, 111,.45);
  background: linear-gradient(180deg, var(--navy), var(--navy-deep));
}
.think-status {
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
  color: var(--accent-2); font-weight: 500; margin-bottom: .45rem;
}
.think-cancel { margin-left: auto; color: var(--text); }
.think-stop { margin-left: auto; background: #7f1d1d; border: 1px solid #991b1b; color: #fecaca; }
.think-stop:hover { filter: brightness(1.12); }
.think-pulse {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 0 rgba(252, 241, 208,.55);
  animation: pulse 1.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(252, 241, 208,.55); }
  70% { box-shadow: 0 0 0 10px rgba(252, 241, 208,0); }
  100% { box-shadow: 0 0 0 0 rgba(252, 241, 208,0); }
}
.think-tools {
  display: flex; flex-direction: column; gap: .25rem;
  margin: .25rem 0 .4rem; font-family: var(--mono); font-size: .78rem; color: var(--muted);
}
.think-tool[data-status="completed"] { color: var(--ok); }
.think-tool[data-status="error"] { color: var(--danger); }
.bubble.agent-fail { border-color: rgba(248,113,113,.4); }
.think-recover-hint { color: var(--muted); font-size: .85rem; margin: .4rem 0 .55rem; line-height: 1.4; }
.think-recover { display: flex; flex-wrap: wrap; gap: .45rem; }
.agent-activity {
  align-self: flex-start; max-width: min(920px, 100%); margin: -.15rem 0 .65rem 0;
  border: 1px solid var(--border); border-radius: 8px; background: #0a101c;
  font-size: .78rem;
}
.agent-activity > summary {
  cursor: pointer; padding: .45rem .65rem; color: var(--muted);
  font-family: var(--mono); list-style: none;
}
.agent-activity > summary::-webkit-details-marker { display: none; }
.agent-activity > summary::before { content: '▸ '; color: var(--accent-2); }
.agent-activity[open] > summary::before { content: '▾ '; }
.agent-activity-body {
  border-top: 1px solid var(--border); padding: .35rem .5rem .55rem;
  max-height: 420px; overflow: auto;
}
.agent-event { margin-bottom: .45rem; }
.agent-event:last-child { margin-bottom: 0; }
.agent-event-head {
  font-family: var(--mono); color: #93c5fd; margin-bottom: .2rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agent-event-body {
  margin: 0; padding: .45rem .55rem; border-radius: 6px;
  border: 1px solid var(--border); background: #060a12;
  color: var(--muted); font-family: var(--mono); font-size: .74rem;
  white-space: pre-wrap; word-break: break-word; max-height: 200px; overflow: auto;
}
.agent-event-command .agent-event-head { color: #fde68a; }
.agent-event-file_edit .agent-event-head { color: #86efac; }
.think-body {
  margin: .35rem 0 0; padding: .55rem .65rem; max-height: 160px; overflow: auto;
  border-radius: 8px; border: 1px solid var(--border); background: #0a101c;
  color: var(--muted); font-family: var(--mono); font-size: .78rem; white-space: pre-wrap;
  line-height: 1.4;
}
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
}
.login-card { width: min(420px, 100%); padding: 1.6rem; }
.login-card h1 { margin: 0 0 .35rem; font-size: 1.45rem; }
.login-card p { margin: 0 0 1.25rem; color: var(--muted); }
.field { margin-bottom: .9rem; }
.err { color: var(--danger); margin: .75rem 0; font-size: .92rem; }
.hint { color: var(--muted); font-size: .85rem; margin-top: .75rem; }
.server-model-hint { margin-top: .4rem; margin-bottom: .55rem; }
.server-model-hint strong { color: var(--text); font-weight: 600; }

.tenant-server-badge {
  padding: .75rem .85rem;
  margin-bottom: .75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(18, 26, 43, .85);
}
.tenant-server-badge .label { margin-bottom: .25rem; }
.tenant-server-name {
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
}
.tenant-server-badge .hint { margin-top: .35rem; margin-bottom: 0; }
.site-picker-hint { margin-top: .35rem; margin-bottom: .75rem; }
.site-picker-hint strong { color: var(--text); font-weight: 600; }

.fileside {
  border-left: 1px solid var(--border); background: rgba(13, 28, 66, 0.72);
  padding: .85rem; display: flex; flex-direction: column; gap: .65rem;
  min-height: 0; min-width: 0; overflow: hidden;
  transition: opacity .2s ease, visibility .2s ease, padding .25s ease, border-color .25s ease;
}
.layout.layout-right-collapsed .fileside {
  opacity: 0; visibility: hidden; pointer-events: none;
  padding: 0; border-color: transparent; overflow: hidden;
}
.filehead-panel-toggle { font-size: .78rem; min-width: 2.75rem; }
.fileside-expand-tab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: 10px 0 0 10px;
  background: rgba(13, 28, 66, 0.95);
  color: var(--muted);
  cursor: pointer;
  padding: .65rem .45rem;
  font: inherit;
  font-size: .78rem;
  letter-spacing: .04em;
  box-shadow: -4px 0 16px rgba(0, 0, 0, .25);
  transition: color .15s, border-color .15s, background .15s;
}
.fileside-expand-tab:hover,
.fileside-expand-tab:focus-visible {
  color: var(--accent-2);
  border-color: var(--accent);
  background: rgba(18, 26, 43, .98);
}
.fileside-expand-tab-text { font-weight: 600; }
.filehead {
  display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem;
  flex-shrink: 0;
}
.filehead-actions { display: flex; gap: .35rem; flex-shrink: 0; }
.filepath {
  font-family: var(--mono); font-size: .72rem; color: #c7d2fe;
  word-break: break-all; line-height: 1.35; margin-top: .15rem;
}
.btn-sm { padding: .35rem .55rem; font-size: .85rem; }
.filedrop {
  border: 1px dashed var(--border); border-radius: 10px; padding: .65rem;
  background: var(--navy); text-align: center; transition: border-color .15s, background .15s;
  flex-shrink: 0;
}
.filedrop.drag {
  border-color: rgba(34, 57, 111,.7);
  background: rgba(34, 57, 111,.08);
}
.filedrop-hint { color: var(--muted); font-size: .78rem; margin-bottom: .45rem; }
.filelist {
  flex: 1 1 auto; overflow-y: auto; overflow-x: hidden;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--navy); min-height: 0;
}
.fileempty, .fileerr {
  padding: .85rem; color: var(--muted); font-size: .85rem;
}
.fileerr { color: var(--danger); }
.filerow {
  display: grid; grid-template-columns: 18px 1fr auto auto; gap: .45rem; align-items: center;
  padding: .4rem .55rem; border-bottom: 1px solid rgba(36,48,73,.65);
  font-size: .82rem; cursor: default;
}
.filerow:last-child { border-bottom: none; }
.filerow.dir { cursor: pointer; }
.filerow.dir:hover { background: rgba(34, 57, 111,.1); }
.filerow .ico { color: var(--muted); font-family: var(--mono); font-size: .75rem; }
.filerow.dir .ico { color: var(--accent-2); }
.filerow .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filerow .meta { color: var(--muted); font-family: var(--mono); font-size: .68rem; }
.file-btns {
  display: flex; gap: .15rem; flex-shrink: 0; opacity: .55;
}
.filerow:hover .file-btns { opacity: 1; }
.file-act {
  border: 0; background: transparent; color: var(--muted);
  width: 1.35rem; height: 1.35rem; border-radius: 6px; cursor: pointer;
  font-size: .78rem; line-height: 1; padding: 0;
}
.file-act:hover { background: rgba(34, 57, 111,.15); color: var(--text); }
.file-act.file-del:hover { background: rgba(239,68,68,.15); color: var(--danger); }
.filestatus {
  color: var(--muted); font-size: .75rem; min-height: 1.1em; flex-shrink: 0;
  padding: .35rem .5rem; line-height: 1.4; word-break: break-word;
}
.filestatus.sticky {
  font-size: .82rem; background: rgba(34, 57, 111,.12); border-radius: 8px;
  border: 1px solid rgba(34, 57, 111,.25);
}
.filestatus.ok { color: var(--ok); }
.filestatus.ok.sticky {
  background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.35); color: var(--ok);
}
.filestatus.err { color: var(--danger); }
.filestatus.err.sticky {
  background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.35);
}

.sessions-search {
  font-size: .82rem; padding: .45rem .6rem;
}
.sessions-list {
  display: flex; flex-direction: column; gap: .35rem;
  max-height: 200px; overflow-y: auto; overflow-x: hidden;
}
.sessions-list > .noterow { flex-shrink: 0; }
.sessions-empty {
  color: var(--muted); font-size: .82rem; line-height: 1.4; padding: .2rem 0;
}
.sessions-empty.sessions-err { color: var(--danger); }
.session-chat { min-width: 0; }
.session-chat.active {
  border-color: rgba(34, 57, 111,.55); background: rgba(34, 57, 111,.14);
}
.session-chat.pending {
  border-color: rgba(252, 241, 208, .45);
  background: rgba(252, 241, 208, .08);
  box-shadow: inset 0 0 0 1px rgba(252, 241, 208, .12);
}
.session-chat.pending .note-title::after {
  content: ' · loading…';
  font-weight: 500;
  color: var(--cream);
  font-size: .75rem;
}

.active-chat-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .85rem;
  margin-bottom: .65rem; padding: .7rem .9rem .7rem .75rem;
  border: 1px solid rgba(252, 241, 208, .28); border-radius: 10px;
  border-left: 4px solid var(--cream);
  background: linear-gradient(105deg, rgba(34, 57, 111, .5) 0%, rgba(13, 28, 66, .92) 55%);
  box-shadow: 0 2px 14px rgba(1, 7, 54, .4), inset 0 1px 0 rgba(252, 241, 208, .08);
  font-size: .82rem;
}
.active-chat-bar[data-state="loading"] {
  border-color: rgba(252, 241, 208, .4);
  border-left-color: #e8c96a;
  background: linear-gradient(105deg, rgba(232, 201, 106, .12) 0%, rgba(13, 28, 66, .92) 50%);
}
.active-chat-main {
  display: flex; align-items: center; gap: .55rem; min-width: 0; flex: 1;
}
.active-chat-label {
  flex-shrink: 0;
  font-size: .65rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--navy-deep); background: var(--cream);
  padding: .22rem .5rem; border-radius: 5px;
}
.active-chat-bar[data-state="loading"] .active-chat-label {
  background: #e8c96a; color: var(--navy-deep);
}
.active-chat-title {
  font-size: 1.02rem; font-weight: 600; color: var(--cream);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: min(560px, 100%);
  text-shadow: 0 1px 2px rgba(1, 7, 54, .35);
}
.active-chat-meta {
  flex-shrink: 0;
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.35;
  font-family: var(--mono);
  padding: .32rem .72rem;
  border-radius: 999px;
  border: none;
  background: #0d1c42;
  box-shadow: 0 1px 3px rgba(1, 7, 54, .35);
}
.active-chat-actions {
  display: flex; align-items: center; gap: .45rem; flex-shrink: 0;
}
.active-chat-rename {
  padding: .28rem .55rem;
  font-size: .78rem;
  border-color: rgba(252, 241, 208, .35);
  color: var(--cream);
}
.active-chat-rename:hover:not(:disabled) {
  border-color: rgba(252, 241, 208, .55);
  background: rgba(34, 57, 111, .35);
}

.messages-panel {
  position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
}
.messages-panel.is-switching .messages {
  pointer-events: none; user-select: none;
}
.session-switch-overlay {
  position: absolute; inset: 0; z-index: 8;
  display: flex; align-items: center; justify-content: center;
  background: rgba(7, 11, 20, .55); backdrop-filter: blur(1px);
}
.session-switch-overlay[hidden] { display: none !important; }
.session-switch-overlay-inner {
  display: flex; align-items: center; gap: .65rem;
  padding: .75rem 1rem; border-radius: 10px;
  border: 1px solid rgba(252, 241, 208, .25);
  background: rgba(13, 28, 66, .92);
  color: var(--cream); font-size: .88rem; font-weight: 600;
}
.session-switch-spinner {
  width: 1rem; height: 1rem; border-radius: 50%;
  border: 2px solid rgba(252, 241, 208, .25);
  border-top-color: var(--cream);
  animation: persona-spin .75s linear infinite;
}

.notes-list {
  display: flex; flex-direction: column; gap: .35rem;
  max-height: 220px; overflow-y: auto;
}
.notes-list > .noterow { flex-shrink: 0; }
.notes-empty {
  color: var(--muted); font-size: .82rem; line-height: 1.4; padding: .2rem 0;
}
.notes-empty.notes-err { color: var(--danger); }
.noterow {
  display: grid; grid-template-columns: 1fr auto; gap: .25rem; align-items: stretch;
  border: 1px solid var(--border); border-radius: 10px; background: var(--navy);
  overflow: hidden;
}
.note-use {
  display: flex; flex-direction: column; gap: .15rem; align-items: flex-start;
  padding: .45rem .55rem; border: 0; background: transparent; color: var(--text);
  cursor: pointer; text-align: left; font: inherit; min-width: 0;
}
.note-use:hover { background: rgba(34, 57, 111,.1); }
.note-title {
  font-size: .82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 100%;
}
.note-preview {
  font-size: .72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 100%;
}
.note-btns {
  display: flex; flex-direction: column; border-left: 1px solid var(--border);
}
.note-btns button {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  cursor: pointer; font-size: .85rem; padding: 0 .45rem; min-width: 28px;
}
.note-btns button:hover { background: rgba(34, 57, 111,.12); color: var(--text); }
.note-btns .note-del:hover { color: var(--danger); }
.notes-editor {
  display: flex; flex-direction: column; gap: .45rem;
  padding: .55rem; border: 1px solid var(--border); border-radius: 10px; background: var(--navy);
}
.notes-title { font-size: .88rem; padding: .5rem .65rem; }
.notes-body { min-height: 72px; max-height: 140px; font-size: .88rem; resize: vertical; }
.notes-actions { display: flex; justify-content: flex-end; gap: .4rem; }

.tickets-panel-body { display: flex; flex-direction: column; gap: .55rem; }
.tickets-panel-intro { margin: 0; font-size: .75rem; line-height: 1.35; }
.tickets-list { display: flex; flex-direction: column; gap: .35rem; max-height: 160px; overflow: auto; }
.ticket-row.is-active { outline: 1px solid var(--accent, #22396F); }
.ticket-detail {
  display: flex; flex-direction: column; gap: .45rem;
  padding: .55rem; border: 1px solid var(--border); border-radius: 10px; background: var(--navy);
}
.ticket-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-size: .85rem; }
.ticket-detail-actions { flex-wrap: wrap; justify-content: flex-start; }
.ticket-status {
  display: inline-block; font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .03em; padding: .12rem .4rem; border-radius: 6px; background: rgba(34,57,111,.35);
}
.ticket-status-done { background: rgba(34, 197, 94, .2); color: #86efac; }
.ticket-status-needs_human, .ticket-status-blocked { background: rgba(251, 191, 36, .18); color: #fcd34d; }
.ticket-status-failed { background: rgba(248, 113, 113, .18); color: #fca5a5; }
.ticket-status-planning, .ticket-status-developing, .ticket-status-testing, .ticket-status-reviewing {
  background: rgba(96, 165, 250, .18); color: #93c5fd;
}
.ticket-steps { display: flex; flex-direction: column; gap: .35rem; max-height: 220px; overflow: auto; }
.ticket-step {
  border: 1px solid var(--border); border-radius: 8px; padding: .4rem .5rem; font-size: .78rem;
}
.ticket-step-head { color: var(--muted); margin-bottom: .25rem; }
.ticket-step-body {
  margin: 0; white-space: pre-wrap; word-break: break-word; font-size: .72rem;
  max-height: 120px; overflow: auto; color: var(--text);
}
.ticket-detail-err { color: var(--danger); margin: 0; font-size: .78rem; }

.polish-english-btn {
  white-space: nowrap; flex-shrink: 0;
  font-size: .78rem; padding: .35rem .65rem;
}
.polish-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: rgba(2, 6, 23, .78); backdrop-filter: blur(4px);
}
.polish-backdrop[hidden] { display: none !important; }
.polish-modal {
  width: min(640px, 100%); max-height: min(92vh, 900px); overflow: auto;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.polish-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.15rem .35rem; border-bottom: 1px solid var(--border);
}
.polish-modal-head h2 {
  margin: 0; font-size: 1.15rem; font-weight: 650;
}
.polish-close {
  width: 2rem; height: 2rem; min-height: 0; padding: 0;
  font-size: 1.35rem; line-height: 1;
}
.polish-modal-body { padding: 1rem 1.15rem 1.15rem; }
.polish-input-row {
  display: flex; gap: .55rem; align-items: stretch;
}
.polish-input { flex: 1; min-height: 8rem; resize: vertical; }
.polish-mic { flex-shrink: 0; align-self: flex-start; width: auto; }
.polish-controls {
  display: flex; align-items: flex-end; gap: .75rem; margin-top: .85rem;
}
.polish-style-wrap { flex: 1; min-width: 0; }
.polish-style { width: 100%; }
.polish-submit { flex-shrink: 0; min-width: 6.5rem; }
.polish-status {
  margin-top: .75rem; font-size: .88rem; color: var(--muted);
}
.polish-status[data-state="error"] { color: var(--danger); }
.polish-result { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.polish-output { min-height: 8rem; resize: vertical; }
.polish-result-actions {
  display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem;
}

.talk-polish-btn {
  white-space: nowrap; flex-shrink: 0;
  font-size: .78rem; padding: .35rem .65rem;
}
.talk-polish-backdrop {
  position: fixed; inset: 0; z-index: 110;
  display: flex; align-items: stretch; justify-content: center;
  background: rgba(2, 6, 23, .92); backdrop-filter: blur(6px);
}
.talk-polish-backdrop[hidden] { display: none !important; }
.talk-polish-screen {
  width: min(520px, 100%); display: flex; flex-direction: column;
  background: var(--bg-panel); border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.talk-polish-head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .85rem 1rem; border-bottom: 1px solid var(--border);
}
.talk-polish-head h2 { margin: 0; font-size: 1.1rem; font-weight: 650; }
.talk-polish-head-actions { display: flex; gap: .4rem; align-items: center; }
.talk-polish-voice.on { box-shadow: 0 0 0 2px rgba(34, 211, 238, .35); }
.talk-polish-close {
  width: 2rem; height: 2rem; min-height: 0; padding: 0;
  font-size: 1.35rem; line-height: 1;
}
.talk-polish-body {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 1.25rem 1rem 1.5rem; text-align: center; gap: 1rem;
}
.talk-polish-status {
  font-size: 1.05rem; font-weight: 600; line-height: 1.35;
  min-height: 2.8rem; color: var(--text);
}
.talk-polish-status[data-state="listening"] { color: var(--cream); }
.talk-polish-status[data-state="thinking"] { color: #93c5fd; }
.talk-polish-status[data-state="speaking"] { color: #a78bfa; }
.talk-polish-status[data-state="error"] { color: var(--danger); }
.talk-polish-transcript {
  width: 100%; max-height: 28vh; overflow: auto;
  padding: .75rem .85rem; border-radius: 10px;
  background: var(--navy); border: 1px solid var(--border);
  font-size: .92rem; line-height: 1.45; text-align: left;
  white-space: pre-wrap; color: var(--muted);
}
.talk-polish-server-row {
  width: 100%; display: flex; flex-direction: column; gap: .35rem;
}
.talk-polish-server-row .label { margin: 0; }
.talk-polish-server { width: 100%; min-width: 0; }
.talk-polish-quick {
  width: 100%; display: flex; flex-direction: column; gap: .45rem;
}
.talk-polish-quick-btn {
  width: 100%; text-align: left; padding: .55rem .75rem; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(13, 28, 66, 0.55); color: var(--text);
  font: inherit; font-size: .84rem; line-height: 1.35; cursor: pointer;
}
.talk-polish-quick-btn:hover:not(:disabled) {
  border-color: rgba(34, 211, 238, .45); background: rgba(34, 211, 238, .08);
}
.talk-polish-quick-btn:disabled { opacity: .45; cursor: not-allowed; }
.talk-polish-mic-wrap { flex: 1; display: flex; align-items: center; justify-content: center; }
.talk-polish-mic {
  width: min(9rem, 42vw); height: min(9rem, 42vw);
  border-radius: 50%; border: 3px solid var(--border);
  background: linear-gradient(145deg, var(--navy-mid), var(--navy-deep));
  color: #fff; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s;
  display: flex; align-items: center; justify-content: center;
}
.talk-polish-mic-icon { font-size: min(3rem, 12vw); line-height: 1; }
.talk-polish-mic.listening {
  border-color: var(--cream);
  box-shadow: 0 0 0 6px rgba(34, 211, 238, .18), 0 0 24px rgba(34, 211, 238, .25);
  transform: scale(1.03);
}
.talk-polish-mic.busy { opacity: .55; cursor: wait; }
.talk-polish-mic:disabled { opacity: .45; cursor: not-allowed; }
.talk-polish-style-row {
  width: 100%; display: flex; align-items: center; gap: .65rem;
}
.talk-polish-style-row .label { margin: 0; flex-shrink: 0; }
.talk-polish-style { flex: 1; min-width: 0; }
.talk-polish-hint {
  margin: 0; font-size: .82rem; color: var(--muted); line-height: 1.4;
}
@media (max-width: 900px) {
  .talk-polish-screen { width: 100%; min-height: 100dvh; border: none; border-radius: 0; }
  .talk-polish-transcript { max-height: 22vh; }
}

.kiosks-panel-body {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.kiosk-select {
  min-height: 9rem;
  font-size: .65rem;
  line-height: 1.22;
  padding: .25rem .35rem;
}
.kiosk-archived-toggle {
  font-size: .78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: .35rem;
}
.kiosk-selected {
  font-size: .78rem;
  color: var(--text);
  padding: .35rem .45rem;
  background: var(--surface2);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.kiosk-history {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .35rem;
  background: var(--surface);
}
.kiosk-history-turn {
  border-bottom: 1px solid var(--border);
  padding: .4rem 0;
}
.kiosk-history-turn:last-child { border-bottom: none; }
.kiosk-history-meta {
  font-size: .7rem;
  color: var(--muted);
  margin-bottom: .25rem;
}
.kiosk-history-user, .kiosk-history-assistant {
  font-size: .78rem;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: .25rem;
}
.kiosk-history-assistant .chat-link,
.kiosk-history-user .chat-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.kiosk-history-assistant .chat-link:hover,
.kiosk-history-user .chat-link:hover {
  color: var(--cream);
}
.kiosk-load-more { align-self: flex-start; margin-top: .25rem; }
.kiosk-repair-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .65rem;
  margin: .5rem 0 .65rem;
}
.kiosk-repair-hint { margin: 0; font-size: .78rem; flex: 1 1 8rem; }
#kioskRepairBackdrop .polish-modal,
.kiosk-repair-modal {
  width: min(1280px, 96vw) !important;
  max-width: min(1280px, 96vw) !important;
  max-height: min(94vh, 960px);
}
#kioskRepairBackdrop .short-answer-output {
  min-height: 22rem;
  max-height: min(62vh, 36rem) !important;
  height: min(62vh, 36rem);
}
.kiosk-repair-shot { margin: 0 0 .5rem; }
.kiosk-active-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: .45rem .75rem;
  font-size: .82rem;
  background: rgba(34, 57, 111, .35);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.kiosk-active-repair { margin-left: auto; }
.kiosk-active-label { color: var(--muted); margin-right: .35rem; }

.kiosk-preflight-hint {
  margin-top: .35rem;
  font-size: .72rem;
  color: var(--muted);
}
.kiosk-tailscale-status {
  margin-top: .35rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.kiosk-tailscale-online,
.sidebar-accordion-hint.kiosk-tailscale-online {
  color: #3dd68c;
}
.kiosk-tailscale-offline,
.sidebar-accordion-hint.kiosk-tailscale-offline {
  color: #f87171;
}
.kiosk-tailscale-checking {
  color: var(--muted);
  font-weight: 500;
}

@media (max-width: 1100px) {
  .layout { --sidebar-w: 320px; --fileside-w: 260px; }
}
@media (max-width: 900px) {
  html, body { overflow: auto; }
  .shell { height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; }
  .topbar { padding: .6rem .75rem; gap: .5rem; }
  .topbar-left, .topbar-right { gap: .5rem; }
  .topbar-right { margin-left: auto; }
  .brand,
  .host-metrics,
  .header-status,
  .userchip-id { display: none; }
  .layout {
    grid-template-columns: 1fr; overflow: visible;
    transition: none;
  }
  .sidebar {
    border-right: none; border-bottom: 1px solid var(--border); max-height: none;
    opacity: 1; visibility: visible; pointer-events: auto; padding: 1rem;
  }
  .layout.layout-left-collapsed .sidebar { display: none; }
  .chat { min-height: 60vh; }
  .messages { min-height: 220px; }
  .fileside {
    border-left: none; border-top: 1px solid var(--border);
    height: 420px; max-height: 420px;
    opacity: 1; visibility: visible; pointer-events: auto; padding: .85rem;
  }
  .layout.layout-right-collapsed .fileside { display: none; }
}
