/* ============================================================
   ox — Brand Book Themes
   Seven colors. Flat. Opaque. Crisp. Twelve interpretations.
   ============================================================ */

/* --- local fonts --- */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: block;
  src: url(/fonts/manrope-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 300 600;
  font-display: block;
  src: url(/fonts/outfit-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url(/fonts/ibm-plex-mono-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: block;
  src: url(/fonts/ibm-plex-mono-500-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: block;
  src: url(/fonts/ibm-plex-mono-600-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- brand palette (constant) --- */
:root {
  --indigo:      #2B2D7C;
  --slate:       #6B6D8F;
  --vermillion:  #E8471B;
  --clay:        #B8926E;
  --amber:       #F5A623;
  --beige:       #E8D5C0;
  --white:       #FFFFFF;

  --font-display: 'Manrope', sans-serif;
  --font-body:    'Outfit', sans-serif;
  --font-mono:    'IBM Plex Mono', monospace;

  --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --step-1: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --step-2: clamp(1.5rem, 1.3rem + 1vw, 2rem);

  --space-xs:  0.5rem;
  --space-sm:  1rem;
  --space-md:  2rem;

  --radius:      6px;
  --shadow:      0 1px 3px rgba(0,0,0,0.06);

  --ease-enter:  cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-pulse:  ease-in-out;
  --duration-enter:   0.8s;
  --duration-hover:   0.2s;
  --duration-pulse:   1.2s;
}

/* ============================================================
   THEME TOKENS
   --t-bg           page background
   --t-surface      panel / card / chat background
   --t-inset        code blocks, inputs inside panels
   --t-field        standalone inputs on page bg
   --t-on-bg        text on page background
   --t-on-surface   text on panel surfaces
   --t-on-inset     text on inset / field elements
   --t-on-accent    text on accent-colored backgrounds
   --t-heading      heading / section title color
   --t-accent       primary interactive accent
   --t-danger       error / alert
   --t-border       subtle structural borders
   --t-border-strong bold structural / column dividers
   --t-stripe       panel bottom accent stripe
   --t-btn-bg       primary action button background
   --t-btn-text     primary action button text
   --t-muted        secondary text (labels, keys, metadata)
   --t-faint        tertiary text (system messages, empty states)
   ============================================================ */

/* --- Noon (12): stark white, vermillion burns, maximum poster clarity --- */
[data-theme="noon"] {
  --t-bg:            var(--white);
  --t-surface:       var(--white);
  --t-inset:         var(--beige);
  --t-field:         var(--beige);
  --t-on-bg:         var(--indigo);
  --t-on-surface:    var(--indigo);
  --t-on-inset:      var(--indigo);
  --t-on-accent:     var(--white);
  --t-heading:       var(--vermillion);
  --t-accent:        var(--vermillion);
  --t-danger:        var(--vermillion);
  --t-border:        var(--slate);
  --t-border-strong: var(--indigo);
  --t-stripe:        var(--vermillion);
  --t-btn-bg:        var(--indigo);
  --t-btn-text:      var(--white);
  --t-muted:         var(--slate);
  --t-faint:         var(--clay);
}

/* --- Early Afternoon (1, default): white canvas, amber warms in --- */
[data-theme="early-afternoon"], :root {
  --t-bg:            var(--white);
  --t-surface:       var(--white);
  --t-inset:         var(--beige);
  --t-field:         var(--beige);
  --t-on-bg:         var(--indigo);
  --t-on-surface:    var(--indigo);
  --t-on-inset:      var(--indigo);
  --t-on-accent:     var(--indigo);
  --t-heading:       var(--indigo);
  --t-accent:        var(--amber);
  --t-danger:        var(--vermillion);
  --t-border:        var(--clay);
  --t-border-strong: var(--indigo);
  --t-stripe:        var(--amber);
  --t-btn-bg:        var(--vermillion);
  --t-btn-text:      var(--white);
  --t-muted:         var(--slate);
  --t-faint:         var(--clay);
}

/* --- Late Afternoon (2): beige earth appears, amber glow building --- */
[data-theme="late-afternoon"] {
  --t-bg:            var(--beige);
  --t-surface:       var(--white);
  --t-inset:         var(--beige);
  --t-field:         var(--white);
  --t-on-bg:         var(--indigo);
  --t-on-surface:    var(--indigo);
  --t-on-inset:      var(--indigo);
  --t-on-accent:     var(--indigo);
  --t-heading:       var(--indigo);
  --t-accent:        var(--amber);
  --t-danger:        var(--vermillion);
  --t-border:        var(--slate);
  --t-border-strong: var(--indigo);
  --t-stripe:        var(--amber);
  --t-btn-bg:        var(--amber);
  --t-btn-text:      var(--indigo);
  --t-muted:         var(--slate);
  --t-faint:         var(--clay);
}

/* --- Golden Hour (3): everything amber, warmest light theme --- */
[data-theme="golden-hour"] {
  --t-bg:            var(--beige);
  --t-surface:       var(--white);
  --t-inset:         var(--beige);
  --t-field:         var(--white);
  --t-on-bg:         var(--indigo);
  --t-on-surface:    var(--indigo);
  --t-on-inset:      var(--indigo);
  --t-on-accent:     var(--indigo);
  --t-heading:       var(--indigo);
  --t-accent:        var(--amber);
  --t-danger:        var(--vermillion);
  --t-border:        var(--slate);
  --t-border-strong: var(--indigo);
  --t-stripe:        var(--amber);
  --t-btn-bg:        var(--vermillion);
  --t-btn-text:      var(--white);
  --t-muted:         var(--slate);
  --t-faint:         var(--clay);
}

/* --- Sunset (4): beige sky, indigo shadows rise, vermillion marks --- */
[data-theme="sunset"] {
  --t-bg:            var(--beige);
  --t-surface:       var(--indigo);
  --t-inset:         var(--white);
  --t-field:         var(--white);
  --t-on-bg:         var(--indigo);
  --t-on-surface:    var(--beige);
  --t-on-inset:      var(--indigo);
  --t-on-accent:     var(--indigo);
  --t-heading:       var(--vermillion);
  --t-accent:        var(--amber);
  --t-danger:        var(--vermillion);
  --t-border:        var(--slate);
  --t-border-strong: var(--vermillion);
  --t-stripe:        var(--amber);
  --t-btn-bg:        var(--vermillion);
  --t-btn-text:      var(--white);
  --t-muted:         var(--clay);
  --t-faint:         var(--slate);
}

/* --- Dusk (5): indigo canvas, white surfaces float like last light --- */
[data-theme="dusk"] {
  --t-bg:            var(--indigo);
  --t-surface:       var(--white);
  --t-inset:         var(--beige);
  --t-field:         var(--white);
  --t-on-bg:         var(--beige);
  --t-on-surface:    var(--indigo);
  --t-on-inset:      var(--indigo);
  --t-on-accent:     var(--indigo);
  --t-heading:       var(--amber);
  --t-accent:        var(--amber);
  --t-danger:        var(--vermillion);
  --t-border:        var(--slate);
  --t-border-strong: var(--amber);
  --t-stripe:        var(--vermillion);
  --t-btn-bg:        var(--vermillion);
  --t-btn-text:      var(--white);
  --t-muted:         var(--slate);
  --t-faint:         var(--clay);
}

/* --- Twilight (6): full indigo, amber the only warmth --- */
[data-theme="twilight"] {
  --t-bg:            var(--indigo);
  --t-surface:       var(--indigo);
  --t-inset:         var(--white);
  --t-field:         var(--white);
  --t-on-bg:         var(--beige);
  --t-on-surface:    var(--beige);
  --t-on-inset:      var(--indigo);
  --t-on-accent:     var(--indigo);
  --t-heading:       var(--amber);
  --t-accent:        var(--amber);
  --t-danger:        var(--vermillion);
  --t-border:        var(--slate);
  --t-border-strong: var(--amber);
  --t-stripe:        var(--amber);
  --t-btn-bg:        var(--vermillion);
  --t-btn-text:      var(--white);
  --t-muted:         var(--clay);
  --t-faint:         var(--slate);
}

/* --- Evening (7): softer borders, amber buttons, settling --- */
[data-theme="evening"] {
  --t-bg:            var(--indigo);
  --t-surface:       var(--indigo);
  --t-inset:         var(--beige);
  --t-field:         var(--beige);
  --t-on-bg:         var(--beige);
  --t-on-surface:    var(--beige);
  --t-on-inset:      var(--indigo);
  --t-on-accent:     var(--indigo);
  --t-heading:       var(--amber);
  --t-accent:        var(--amber);
  --t-danger:        var(--vermillion);
  --t-border:        var(--slate);
  --t-border-strong: var(--beige);
  --t-stripe:        var(--amber);
  --t-btn-bg:        var(--amber);
  --t-btn-text:      var(--indigo);
  --t-muted:         var(--clay);
  --t-faint:         var(--slate);
}

/* --- Night (8): white text for sharpness, beige insets warm the dark --- */
[data-theme="night"] {
  --t-bg:            var(--indigo);
  --t-surface:       var(--indigo);
  --t-inset:         var(--beige);
  --t-field:         var(--beige);
  --t-on-bg:         var(--white);
  --t-on-surface:    var(--white);
  --t-on-inset:      var(--indigo);
  --t-on-accent:     var(--indigo);
  --t-heading:       var(--amber);
  --t-accent:        var(--amber);
  --t-danger:        var(--vermillion);
  --t-border:        var(--slate);
  --t-border-strong: var(--amber);
  --t-stripe:        var(--vermillion);
  --t-btn-bg:        var(--vermillion);
  --t-btn-text:      var(--white);
  --t-muted:         var(--clay);
  --t-faint:         var(--slate);
}

/* --- Midnight (9): coldest, white headings, amber accent --- */
[data-theme="midnight"] {
  --t-bg:            var(--indigo);
  --t-surface:       var(--indigo);
  --t-inset:         var(--white);
  --t-field:         var(--white);
  --t-on-bg:         var(--white);
  --t-on-surface:    var(--white);
  --t-on-inset:      var(--indigo);
  --t-on-accent:     var(--indigo);
  --t-heading:       var(--white);
  --t-accent:        var(--amber);
  --t-danger:        var(--vermillion);
  --t-border:        var(--slate);
  --t-border-strong: var(--amber);
  --t-stripe:        var(--vermillion);
  --t-btn-bg:        var(--amber);
  --t-btn-text:      var(--indigo);
  --t-muted:         var(--clay);
  --t-faint:         var(--slate);
}

/* --- Dawn (10): indigo bg, beige surfaces emerge, amber first light --- */
[data-theme="dawn"] {
  --t-bg:            var(--indigo);
  --t-surface:       var(--beige);
  --t-inset:         var(--white);
  --t-field:         var(--white);
  --t-on-bg:         var(--beige);
  --t-on-surface:    var(--indigo);
  --t-on-inset:      var(--indigo);
  --t-on-accent:     var(--white);
  --t-heading:       var(--amber);
  --t-accent:        var(--vermillion);
  --t-danger:        var(--vermillion);
  --t-border:        var(--slate);
  --t-border-strong: var(--amber);
  --t-stripe:        var(--amber);
  --t-btn-bg:        var(--amber);
  --t-btn-text:      var(--indigo);
  --t-muted:         var(--slate);
  --t-faint:         var(--clay);
}

/* --- Late Morning (11): white canvas, beige surfaces, building toward noon --- */
[data-theme="late-morning"] {
  --t-bg:            var(--white);
  --t-surface:       var(--beige);
  --t-inset:         var(--white);
  --t-field:         var(--white);
  --t-on-bg:         var(--indigo);
  --t-on-surface:    var(--indigo);
  --t-on-inset:      var(--indigo);
  --t-on-accent:     var(--white);
  --t-heading:       var(--indigo);
  --t-accent:        var(--vermillion);
  --t-danger:        var(--vermillion);
  --t-border:        var(--slate);
  --t-border-strong: var(--indigo);
  --t-stripe:        var(--indigo);
  --t-btn-bg:        var(--amber);
  --t-btn-text:      var(--indigo);
  --t-muted:         var(--slate);
  --t-faint:         var(--clay);
}

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

/* --- canvas --- */
body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  background: var(--t-bg);
  color: var(--t-on-bg);
  padding: var(--space-md) var(--space-sm);
}

/* --- layout --- */
.container {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
}
.chat-column {
  flex: 1;
  min-width: 0;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  padding-right: var(--space-sm);
}
.debug-column {
  width: 420px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 1px solid var(--t-border-strong);
  padding-left: var(--space-sm);
}

/* --- header row + theme picker --- */
.header-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}
h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--step-2);
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--t-heading);
}
h1 span {
  font-weight: 400;
  color: var(--t-muted);
  letter-spacing: 0;
}
#theme-picker {
  position: fixed;
  top: var(--space-sm);
  right: var(--space-sm);
  z-index: 100;
}

/* --- analog clock --- */
.clock {
  display: block;
  cursor: default;
}
.clock-face {
  fill: var(--t-surface);
  stroke: var(--t-border-strong);
  stroke-width: 2;
}
.clock-hand {
  stroke: var(--t-accent);
  stroke-width: 2.5;
  stroke-linecap: round;
}
.clock-hand-group {
  transition: transform 0.4s var(--ease-spring);
}
.clock-center {
  fill: var(--t-accent);
}
.clock-dot {
  fill: var(--t-on-surface);
  opacity: 0.4;
  transition: r 0.2s var(--ease-spring), opacity 0.2s, fill 0.2s;
}
.clock-dot-active {
  fill: var(--t-accent);
  opacity: 1;
}
.clock-hour {
  cursor: pointer;
  outline: none;
}
.clock-hour:focus .clock-dot {
  opacity: 0.8;
}
.clock-hit {
  pointer-events: all;
}
.clock-dragging {
  cursor: grabbing;
}
.clock-dragging .clock-hour {
  cursor: grabbing;
}
.clock-hand-no-transition {
  transition: none !important;
}

/* --- mode toggle (centered on clock face) --- */
.clock-mode-toggle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: transparent;
  border: none;
  padding: 2px;
  color: var(--t-accent);
  opacity: 0.45;
  cursor: pointer;
  transition: opacity var(--duration-hover);
}
.clock-mode-toggle:hover {
  opacity: 1;
  transform: translate(-50%, -50%);
}

/* subtle pulse on center dot when following wall clock */
.clock-live .clock-center {
  animation: pulse var(--duration-pulse) var(--ease-pulse) infinite;
}

/* --- chat output --- */
#output {
  background: var(--t-surface);
  border: 1px solid var(--t-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-sm);
  min-height: 300px;
  max-height: 600px;
  overflow-y: auto;
  margin-bottom: var(--space-sm);
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--t-on-surface);
}
.user-msg      { color: var(--t-accent); }
.assistant-msg { color: var(--t-on-surface); }
.tool-call     { color: var(--t-heading); }
.tool-result   { color: var(--t-muted); }
.error         { color: var(--t-danger); }
.system        { color: var(--t-faint); }

/* --- status bar --- */
#status-bar {
  height: 24px;
  margin-bottom: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--t-on-bg);
}
#status-bar .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--t-accent);
  animation: pulse var(--duration-pulse) var(--ease-pulse) infinite;
}
#status-bar .status-label {
  color: var(--t-accent);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
#status-bar .status-detail {
  color: var(--t-muted);
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* --- input row --- */
#input-row {
  display: flex;
  gap: var(--space-xs);
}
#input {
  flex: 1;
  padding: 0.7em 1em;
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--t-field);
  color: var(--t-on-inset);
  border: 1px solid var(--t-border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.3s;
}
#input:focus { border-color: var(--t-accent); }
#input::placeholder { color: var(--t-on-inset); opacity: 0.3; }
#input:disabled { opacity: 0.5; }

/* --- buttons (primary action) --- */
button {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0.7em 1.8em;
  transition: transform var(--duration-hover);
  background: var(--t-btn-bg);
  color: var(--t-btn-text);
}
button:hover  { transform: translateY(-2px); }
button:active { transform: translateY(0); }
button:disabled {
  background: var(--t-border);
  color: var(--t-on-inset);
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* --- debug panel headers --- */
.debug-header {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: -0.03em;
  color: var(--t-heading);
  margin-bottom: var(--space-xs);
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
  padding-top: var(--space-xs);
}
.debug-header h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: -0.03em;
  color: var(--t-heading);
  text-transform: uppercase;
}
.debug-header .path {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--t-muted);
}

/* --- debug panels (shared) --- */
.debug-panel {
  background: var(--t-surface);
  border: 1px solid var(--t-border);
  border-bottom: 2px solid var(--t-stripe);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-xs);
  max-height: 720px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--t-on-surface);
}
.debug-panel details {
  margin-bottom: 2px;
}
.debug-panel summary {
  cursor: pointer;
  color: var(--t-accent);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  padding: 4px 0;
  user-select: none;
  list-style: none;
}
.debug-panel summary::before {
  content: '\25b8 ';
  color: var(--t-muted);
}
.debug-panel details[open] > summary::before {
  content: '\25be ';
}
.debug-panel .section-body {
  padding-left: var(--space-sm);
  border-left: 1px solid var(--t-border);
  margin-left: 4px;
  margin-bottom: var(--space-xs);
}

/* --- key-value pairs --- */
.debug-panel .kv {
  display: flex;
  gap: var(--space-xs);
}
.debug-panel .kv .k {
  color: var(--t-muted);
  flex-shrink: 0;
}
.debug-panel .kv .v {
  color: var(--t-on-surface);
  word-break: break-all;
}
.debug-panel .str-val { color: var(--t-accent); }
.debug-panel .num-val { color: var(--t-danger); }
.debug-panel .empty   { color: var(--t-faint); }

/* --- history messages --- */
.debug-panel .msg-entry {
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--t-border);
}
.debug-panel .msg-entry:last-child { border-bottom: none; }

.debug-panel .role-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3em 0.8em;
  border-radius: 3px;
}
.debug-panel .role-user {
  background: transparent;
  color: var(--t-on-surface);
  border: 1px solid currentColor;
}
.debug-panel .role-assistant {
  background: var(--t-accent);
  color: var(--t-on-accent);
}
.debug-panel .role-tool-result {
  background: var(--t-danger);
  color: var(--white);
}
.debug-panel .block-tag {
  color: var(--t-muted);
  font-size: 0.65rem;
}
.debug-panel .tool-name {
  color: var(--t-accent);
  font-weight: 600;
}
.debug-panel .msg-content {
  padding-left: var(--space-sm);
  color: var(--t-on-surface);
  white-space: pre-wrap;
  word-break: break-word;
}
.debug-panel .msg-content-trunc {
  color: var(--t-faint);
}

/* --- section header (with edit button) --- */
.debug-panel .section-header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* --- ghost buttons (edit, del, new, copy, reset) --- */
.edit-btn,
.debug-panel .edit-btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.3em 0.8em;
  background: transparent;
  color: var(--t-on-surface);
  border: 1px solid currentColor;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform var(--duration-hover), color 0.2s;
}
.edit-btn:hover,
.debug-panel .edit-btn:hover {
  color: var(--t-accent);
  transform: translateY(-1px);
}
.edit-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}
.edit-btn:disabled:hover {
  color: var(--t-on-surface);
  transform: none;
}

/* --- system prompt editor --- */
.debug-panel .system-textarea {
  width: 100%;
  min-height: 120px;
  padding: var(--space-xs);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--t-inset);
  color: var(--t-on-inset);
  border: 1px solid var(--t-accent);
  border-radius: var(--radius);
  resize: vertical;
  outline: none;
}
.debug-panel .edit-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.debug-panel .edit-actions button {
  font-size: 0.75rem;
  padding: 0.3em 0.8em;
}

/* --- save / cancel buttons --- */
.save-btn,
.debug-panel .save-btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.75rem;
  background: var(--t-accent);
  color: var(--t-on-accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0.3em 0.8em;
  transition: transform var(--duration-hover);
}
.save-btn:hover { transform: translateY(-1px); }

.cancel-btn,
.debug-panel .cancel-btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.75rem;
  background: transparent;
  color: var(--t-on-surface);
  border: 1px solid currentColor;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0.3em 0.8em;
  transition: transform var(--duration-hover), color 0.2s;
}
.cancel-btn:hover {
  color: var(--t-accent);
  transform: translateY(-1px);
}

/* --- tool panel forms --- */
.tool-form-field {
  margin-bottom: var(--space-xs);
}
.tool-form-field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--t-muted);
  margin-bottom: 2px;
}
.tool-form-field input,
.tool-form-field textarea {
  width: 100%;
  padding: 0.5em 0.7em;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--t-inset);
  color: var(--t-on-inset);
  border: 1px solid var(--t-border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.3s;
}
.tool-form-field input:focus,
.tool-form-field textarea:focus {
  border-color: var(--t-accent);
}
.tool-form-field textarea {
  resize: vertical;
  min-height: 60px;
}
.tool-form-actions {
  display: flex;
  gap: 6px;
}
.tool-form-actions button {
  font-size: 0.75rem;
  padding: 0.3em 0.8em;
}
.tool-form-error {
  color: var(--t-danger);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  margin-top: 4px;
}

/* --- profile row --- */
.profile-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--space-xs);
}
.profile-row select {
  flex: 1;
  padding: 0.4em 0.6em;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--t-inset);
  color: var(--t-on-inset);
  border: 1px solid var(--t-border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.3s;
}
.profile-row select:focus { border-color: var(--t-accent); }
.profile-row button {
  padding: 0.3em 0.8em;
  font-size: 0.75rem;
}
.profile-name-input {
  flex: 1;
  padding: 0.4em 0.6em;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--t-inset);
  color: var(--t-on-inset);
  border: 1px solid var(--t-accent);
  border-radius: var(--radius);
  outline: none;
}

/* --- tool library list --- */
.tool-library-list {
  margin-bottom: var(--space-xs);
}
.tool-library-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid var(--t-border);
}
.tool-library-row:last-child { border-bottom: none; }
.tool-library-row input[type="checkbox"] {
  accent-color: var(--t-accent);
}
.tool-library-row .tool-lib-name {
  flex: 1;
  color: var(--t-accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
}
.tool-library-row .tool-lib-del {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.65rem;
  padding: 0.2em 0.6em;
  background: transparent;
  color: var(--t-on-surface);
  border: 1px solid currentColor;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.2s;
}
.tool-library-row .tool-lib-del:hover {
  color: var(--t-danger);
}
.tool-panel-divider {
  border: none;
  border-top: 1px solid var(--t-border);
  margin: var(--space-xs) 0;
}
.tool-panel-empty {
  color: var(--t-faint);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  margin-bottom: var(--space-xs);
}

/* --- request log --- */
.debug-panel .request-json {
  background: var(--t-inset);
  color: var(--t-on-inset);
  border-radius: var(--radius);
  padding: var(--space-xs);
  margin: 4px 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 400px;
  overflow-y: auto;
}

/* --- panel spinner --- */
.panel-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) 0;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--t-border);
  border-top-color: var(--t-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- API key overlay --- */
.api-key-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.api-key-dialog {
  background: var(--t-surface);
  color: var(--t-on-surface);
  border: 1px solid var(--t-border-strong);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  padding: var(--space-md);
  max-width: 420px;
  width: 90%;
}
.api-key-dialog h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-1);
  color: var(--t-heading);
  margin-bottom: var(--space-xs);
}
.api-key-dialog p {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--t-muted);
  margin-bottom: var(--space-sm);
  line-height: 1.5;
}
.api-key-input {
  width: 100%;
  padding: 0.7em 1em;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  background: var(--t-field);
  color: var(--t-on-inset);
  border: 1px solid var(--t-border);
  border-radius: var(--radius);
  outline: none;
  margin-bottom: var(--space-sm);
  transition: border-color 0.3s;
}
.api-key-input:focus {
  border-color: var(--t-accent);
}
.api-key-actions {
  display: flex;
  gap: 6px;
}

/* --- utility --- */
.text-muted {
  color: var(--t-muted);
}
