/* Canvas Tracker — Popup Styles */

:root {
  /* Colors */
  --canvas-red: #d63e36;
  --canvas-red-dark: #b83830;
  --canvas-blue: #385898;
  --canvas-blue-dark: #2d4373;
  
  --bg: #f7f7f7;
  --surface: #ffffff;
  --surface-hover: #f1f3f5;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --border: #e0e0e0;
  --border-strong: #ced4da;
  
  /* Status Colors */
  --urgent: #e85d04;
  --due-soon: #f48c06;
  --ok: #2d6a4f;
  --overdue: #c1121f;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  
  /* Typography */
  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --size-xs: 0.65rem;
  --size-sm: 0.75rem;
  --size-md: 0.85rem;
  --size-lg: 1rem;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  
  /* Borders */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
}

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

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  min-width: 360px;
  max-width: 480px;
  line-height: 1.5;
}

/* ── Typography ──────────────────────────────────────────── */

.view-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: var(--space-sm) var(--space-md) var(--space-xs);
  font-weight: var(--weight-bold);
}

/* ── Buttons ─────────────────────────────────────────────── */

button {
  font-family: inherit;
  cursor: pointer;
  transition: all 0.12s ease;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
}

.btn-primary {
  background: var(--canvas-red);
  color: white;
  padding: var(--space-sm) var(--space-lg);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-md);
  font-size: var(--size-md);
}

.btn-primary:hover {
  background: var(--canvas-red-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: var(--space-sm) var(--space-lg);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-md);
  font-size: var(--size-md);
}

.btn-secondary:hover {
  background: var(--bg);
  border-color: var(--border-strong);
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: white;
  font-size: var(--size-lg);
}

.btn-icon:hover {
  background: rgba(255,255,255,0.3);
}

/* ── Header ──────────────────────────────────────────────── */

header {
  background: var(--canvas-red);
  color: white;
  padding: 10px 14px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.header-main {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-logo {
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.25);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--weight-bold);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.header-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.header-title {
  font-size: var(--size-md);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
}

.header-sub {
  font-size: var(--size-xs);
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cache-badge {
  font-size: 0.6rem;
  background: rgba(255,255,255,0.25);
  padding: 2px 7px;
  border-radius: 10px;
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  gap: var(--space-xs);
  margin-left: auto;
}

/* ── Tab Navigation ──────────────────────────────────────── */

#tab-bar {
  display: flex;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 48px;
  z-index: 9;
}

.tab {
  flex: 1;
  padding: 10px 0;
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  color: var(--text-muted);
}

.tab.active {
  color: var(--canvas-red);
  border-bottom-color: var(--canvas-red);
}

.tab:hover:not(.active) {
  color: var(--text);
  background: var(--bg);
}

/* ── Views ───────────────────────────────────────────────── */

.view { display: none; }
.view.active { display: block; animation: fadeIn 0.2s ease-out; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Filter Bar ──────────────────────────────────────────── */

.filter-bar {
  padding: var(--space-sm) var(--space-md);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

#course-filter {
  width: 100%;
  padding: 6px 8px;
  font-size: var(--size-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

/* ── Item List ───────────────────────────────────────────── */

main {
  max-height: 480px;
  overflow-y: auto;
}

.item-list {
  list-style: none;
  padding: var(--space-sm) 10px;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* ── Assignment Items ────────────────────────────────────── */

.assignment-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  transition: all 0.15s ease;
}

.assignment-item:hover {
  border-color: var(--canvas-blue);
  box-shadow: var(--shadow-sm);
}

.assignment-item.overdue { border-left: 4px solid var(--overdue); }
.assignment-item.urgent   { border-left: 4px solid var(--urgent); }
.assignment-item.due-soon { border-left: 4px solid var(--due-soon); }

.assignment-item[data-html-url]:not([data-html-url=""]) { cursor: pointer; }

.assignment-main { flex: 1; min-width: 0; }

.course-name {
  font-size: var(--size-xs);
  color: var(--canvas-blue);
  font-weight: var(--weight-semibold);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.assignment-name {
  font-size: var(--size-md);
  font-weight: var(--weight-medium);
  margin-bottom: 3px;
  line-height: 1.3;
}

.due-date {
  font-size: var(--size-sm);
  color: var(--text-muted);
}
.due-date.overdue  { color: var(--overdue); font-weight: var(--weight-semibold); }
.due-date.urgent   { color: var(--urgent); font-weight: var(--weight-semibold); }
.due-date.due-soon { color: var(--due-soon); }

.assignment-actions {
  display: flex;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.dismiss-btn, .open-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
}

.dismiss-btn:hover { background: var(--ok); color: white; border-color: var(--ok); }
.open-btn:hover    { background: var(--canvas-blue); color: white; border-color: var(--canvas-blue); }

/* ── Course Cards ────────────────────────────────────────── */

.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.course-card:hover {
  border-color: var(--canvas-blue);
  background: var(--surface-hover);
  box-shadow: var(--shadow-md);
}

.course-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--canvas-blue);
  flex-shrink: 0;
}

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

.course-full-name {
  font-size: var(--size-md);
  font-weight: var(--weight-medium);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.course-code {
  font-size: var(--size-sm);
  color: var(--text-muted);
  margin-top: 2px;
}

.course-arrow {
  font-size: var(--size-md);
  color: var(--text-muted);
  transition: transform 0.15s;
}

.course-card:hover .course-arrow {
  transform: translateX(3px);
  color: var(--canvas-blue);
}

/* ── Course Detail ───────────────────────────────────────── */

.detail-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.back-btn {
  background: none;
  border: none;
  color: var(--canvas-blue);
  font-size: var(--size-md);
  font-weight: var(--weight-medium);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.back-btn:hover { background: var(--bg); }

.detail-header h2 {
  font-size: var(--size-md);
  font-weight: var(--weight-semibold);
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Detail Tabs ─────────────────────────────────────────── */

.detail-tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.detail-tab {
  flex: 1;
  padding: var(--space-sm) 0;
  font-size: var(--size-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--text-muted);
}

.detail-tab.active {
  color: var(--canvas-red);
  border-bottom-color: var(--canvas-red);
}

.detail-tab:hover:not(.active) {
  background: var(--bg);
  color: var(--text);
}

.detail-sub-view {
  animation: fadeIn 0.15s ease-out;
}

/* ── State Messages ──────────────────────────────────────── */

.state-msg {
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
  font-size: var(--size-md);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.state-msg.error { color: var(--overdue); }

.loader {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--canvas-red);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ── Settings Panel ──────────────────────────────────────── */

#settings-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.settings-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 360px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.settings-header h2 { font-size: var(--size-lg); }

#close-settings {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  padding: 0;
  width: 32px;
  height: 32px;
}

.settings-body {
  padding: var(--space-lg);
}

.settings-group {
  margin-bottom: var(--space-lg);
}

.settings-group label {
  display: block;
  font-size: var(--size-sm);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-xs);
  color: var(--text);
}

.settings-body input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--size-md);
}

.settings-body small {
  display: block;
  font-size: var(--size-xs);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

#token-status {
  margin-top: var(--space-md);
  font-size: var(--size-sm);
  text-align: center;
}

/* ── Dark Theme ─────────────────────────────────────────── */

body.dark-theme {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-hover: #1f242c;
  --text: #c9d1d9;
  --text-muted: #8b949e;
  --border: #30363d;
  --border-strong: #444c56;
}

body.dark-theme header {
  background: linear-gradient(135deg, #b92d26 0%, #8b1c17 100%);
}

/* ── Settings Row (theme toggle etc.) ───────────────────── */

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-sm);
}

.theme-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg);
  padding: 2px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.theme-opt {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: var(--size-xs);
  font-weight: var(--weight-semibold);
  background: transparent;
  border: none;
  color: var(--text-muted);
}

.theme-opt.active {
  background: var(--surface);
  color: var(--canvas-red);
  box-shadow: var(--shadow-sm);
}

/* ── Course Teacher & Rating Badge ──────────────────────── */

.course-teacher {
  color: var(--text-muted);
  font-size: var(--size-sm);
}

.rating-badge {
  background: #f4a020;
  color: white;
  border-radius: 8px;
  padding: 1px 5px;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-block;
  vertical-align: middle;
}

/* ── Summary Banner ──────────────────────────────────────── */

.summary-banner {
  margin: var(--space-sm) var(--space-md) 0;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--size-sm);
  font-weight: var(--weight-semibold);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.summary-banner.urgent {
  background: rgba(232, 93, 4, 0.12);
  color: var(--urgent);
  border: 1px solid rgba(232, 93, 4, 0.3);
}

.summary-banner.ok {
  background: rgba(45, 106, 79, 0.1);
  color: var(--ok);
  border: 1px solid rgba(45, 106, 79, 0.25);
}

/* ── No-token State ──────────────────────────────────────── */

.no-token-state {
  padding: var(--space-xl) var(--space-lg);
  gap: var(--space-md);
}

.no-token-icon {
  font-size: 2rem;
  line-height: 1;
}

/* ── Grade Cards ─────────────────────────────────────────── */

.grade-card {
  cursor: default;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: var(--space-md) var(--space-md) var(--space-sm);
  border-left: 4px solid var(--border);
}

.grade-card:hover {
  border-left-color: inherit;
}

.grade-card.grade-a { border-left-color: #2d6a4f; }
.grade-card.grade-b { border-left-color: #52b788; }
.grade-card.grade-c { border-left-color: #f4a020; }
.grade-card.grade-d { border-left-color: #e85d04; }
.grade-card.grade-f { border-left-color: #c1121f; }
.grade-card.grade-none { border-left-color: var(--border-strong); }

.grade-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.grade-course-name {
  font-size: var(--size-md);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.grade-scores {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.grade-score {
  font-size: 1.4rem;
  font-weight: var(--weight-bold);
  line-height: 1;
}

.grade-card.grade-a .grade-score { color: #2d6a4f; }
.grade-card.grade-b .grade-score { color: #1a7340; }
.grade-card.grade-c .grade-score { color: #f4a020; }
.grade-card.grade-d .grade-score { color: #e85d04; }
.grade-card.grade-f .grade-score { color: #c1121f; }
.grade-card.grade-none .grade-score { color: var(--text-muted); }

.grade-letter {
  font-size: var(--size-xs);
  font-weight: var(--weight-bold);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: white;
}

.grade-card.grade-a .grade-letter { background: #2d6a4f; }
.grade-card.grade-b .grade-letter { background: #1a7340; }
.grade-card.grade-c .grade-letter { background: #f4a020; }
.grade-card.grade-d .grade-letter { background: #e85d04; }
.grade-card.grade-f .grade-letter { background: #c1121f; }
.grade-card.grade-none .grade-letter { background: var(--text-muted); }

.grade-meta {
  font-size: var(--size-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.grade-bar-track {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: var(--space-xs);
}

.grade-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
  background: var(--border-strong);
}

.grade-card.grade-a .grade-bar-fill { background: #2d6a4f; }
.grade-card.grade-b .grade-bar-fill { background: #52b788; }
.grade-card.grade-c .grade-bar-fill { background: #f4a020; }
.grade-card.grade-d .grade-bar-fill { background: #e85d04; }
.grade-card.grade-f .grade-bar-fill { background: #c1121f; }
.grade-card.grade-none .grade-bar-fill { background: var(--border-strong); }

/* ── Professor Section ───────────────────────────────────── */

.professor-section {
  padding: var(--space-md);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.prof-name {
  font-size: var(--size-md);
  font-weight: var(--weight-bold);
}

.prof-stars {
  font-size: var(--size-lg);
  color: #f4a020;
}

.prof-rating {
  font-size: var(--size-sm);
  color: var(--text-muted);
}

/* ── Agent View ──────────────────────────────────────────── */

/* Agent view uses flex column so input row sticks to bottom */
#view-agent.active {
  display: flex;
  flex-direction: column;
  height: 480px;
  overflow: hidden;
}

.agent-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding-right: var(--space-md);
  flex: 0 0 auto;
}

.agent-badge {
  font-size: 0.6rem;
  font-weight: var(--weight-bold);
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, var(--canvas-red), #9b2226);
  color: #fff;
  padding: 2px 6px;
  border-radius: 99px;
  margin-top: 14px;
}

/* ── 18-tool collapsible panel ───────────────────────────── */

.agent-tools-panel {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.agent-tools-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-md);
  font-size: var(--size-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.agent-tools-summary::-webkit-details-marker { display: none; }

.agent-tools-toggle-hint {
  font-size: 0.6rem;
  font-weight: var(--weight-normal);
  color: var(--border-strong);
}

.agent-tools-body {
  padding: var(--space-xs) var(--space-md) var(--space-sm);
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.agent-tool-family-label {
  font-size: 0.6rem;
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--canvas-red);
  margin-bottom: 3px;
}

.agent-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 4px;
}

.agent-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s, background 0.12s;
}
.agent-tool-btn:hover {
  border-color: var(--canvas-red);
  background: rgba(214, 62, 54, 0.06);
}

.agent-tool-btn-icon { font-size: 0.9rem; line-height: 1; }
.agent-tool-btn-name {
  font-size: 0.68rem;
  font-weight: var(--weight-semibold);
  color: var(--text);
  line-height: 1.2;
}
.agent-tool-btn-id {
  font-size: 0.58rem;
  font-family: monospace;
  color: var(--text-muted);
  line-height: 1.2;
}

.agent-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-height: 60px;
}

.agent-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 90%;
}
.agent-msg--user {
  align-self: flex-end;
  align-items: flex-end;
}
.agent-msg--agent {
  align-self: flex-start;
  align-items: flex-start;
}

.agent-bubble {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-lg);
  font-size: var(--size-sm);
  line-height: 1.5;
  max-width: 100%;
}
.agent-msg--user .agent-bubble {
  background: var(--canvas-red);
  color: #fff;
  border-bottom-right-radius: var(--radius-sm);
}
.agent-msg--agent .agent-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
}
.agent-msg--agent .agent-bubble strong { font-weight: var(--weight-semibold); }
.agent-msg--agent .agent-bubble em { font-style: italic; color: var(--text-muted); }

/* Thinking state */
.agent-bubble--thinking {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-muted);
  font-style: italic;
}
.agent-thinking-dots span {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--canvas-red);
  animation: agent-dot 1.2s ease-in-out infinite;
}
.agent-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.agent-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes agent-dot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Tool trace */
.agent-trace {
  margin: 0 var(--space-md) var(--space-xs);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  background: rgba(56, 88, 152, 0.06);
  border: 1px solid rgba(56, 88, 152, 0.15);
  font-size: var(--size-xs);
  color: var(--text-muted);
}
.agent-trace-title {
  font-weight: var(--weight-semibold);
  color: var(--canvas-blue);
  margin-bottom: var(--space-xs);
  font-size: var(--size-xs);
}
.agent-tool-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}
.agent-tool-icon {
  font-size: 10px;
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}
.agent-tool-name {
  font-family: monospace;
  font-size: 0.65rem;
  color: var(--canvas-blue);
}
.agent-tool-label {
  color: var(--text-muted);
  font-size: 0.65rem;
}

/* Input row */
.agent-input-row {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md) var(--space-md);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.agent-input {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--size-sm);
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  resize: none;
  line-height: 1.4;
}
.agent-input:focus { border-color: var(--canvas-red); }

.agent-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--canvas-red);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.agent-send-btn:hover { background: var(--canvas-red-dark); }
.agent-send-btn:active { transform: scale(0.92); }
.agent-send-btn:disabled { opacity: 0.5; cursor: default; }

/* Query label shown above each fresh result (stateless — one result at a time) */
.agent-query-label {
  font-size: var(--size-xs);
  color: var(--text-muted);
  padding: var(--space-xs) var(--space-sm);
  margin-bottom: var(--space-xs);
  border-left: 2px solid var(--border-strong);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Utilities ───────────────────────────────────────────── */

.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 400px) {
  body { min-width: 320px; }
}

