@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --bg-base: hsl(222, 25%, 7%);
  --bg-surface: hsl(222, 22%, 11%);
  --bg-elevated: hsl(222, 20%, 15%);
  --bg-hover: hsl(222, 18%, 19%);
  --accent-primary: hsl(187, 100%, 48%);
  --accent-glow: hsl(187, 100%, 48%, 0.15);
  --accent-border: hsl(187, 100%, 48%, 0.3);
  --accent-secondary: hsl(264, 80%, 65%);
  --accent-success: hsl(145, 65%, 48%);
  --accent-warning: hsl(38, 95%, 55%);
  --accent-danger: hsl(354, 80%, 58%);
  --text-primary: hsl(210, 20%, 96%);
  --text-secondary: hsl(210, 10%, 65%);
  --text-muted: hsl(210, 8%, 42%);
  --text-inverse: hsl(222, 25%, 7%);
  --border-subtle: hsl(222, 15%, 20%);
  --border-medium: hsl(222, 12%, 28%);
  --shadow-md: 0 4px 16px hsl(222, 35%, 3%, 0.5);
  --shadow-glow: 0 0 24px hsl(187, 100%, 48%, 0.12);
  --sidebar-w: 220px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;
  --trans-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 15px;
}

body {
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: Inter, system-ui, sans-serif;
  line-height: 1.6;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-full);
}

#app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
}

#sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  box-shadow: var(--shadow-glow);
  font-size: 18px;
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 700;
}

.logo-sub {
  margin-top: -2px;
  padding-left: 46px;
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-badge {
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 6px 10px;
  border: 1px solid hsl(145, 65%, 48%, 0.2);
  border-radius: var(--radius-full);
  background: hsl(145, 65%, 48%, 0.1);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-success);
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-text {
  color: var(--accent-success);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 hsl(145, 65%, 48%, 0.4);
  }
  50% {
    opacity: 0.8;
    box-shadow: 0 0 0 4px hsl(145, 65%, 48%, 0);
  }
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  padding: 16px 12px;
}

.nav-section-label {
  margin-top: 8px;
  padding: 10px 8px 6px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-section-label:first-child {
  margin-top: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--trans-smooth);
  user-select: none;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent-primary);
  border-color: var(--accent-border);
}

.nav-icon {
  width: 20px;
  flex-shrink: 0;
  text-align: center;
}

.nav-badge {
  min-width: 20px;
  margin-left: auto;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: var(--text-inverse);
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
}

.firm-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.firm-chip-info {
  min-width: 0;
}

.firm-chip-name {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.firm-chip-industry {
  color: var(--text-muted);
  font-size: 0.7rem;
}

#main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: hsl(222, 23%, 9%, 0.86);
}

.topbar-title h1 {
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: 0;
}

.topbar-subtitle {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-weight: 700;
  transition: var(--trans-smooth);
  white-space: nowrap;
}

.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.78rem;
}

.btn-lg {
  min-height: 46px;
  padding: 0 20px;
  font-size: 0.95rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), hsl(187, 100%, 40%));
  color: var(--text-inverse);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  border-color: var(--border-medium);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.btn:hover {
  transform: translateY(-1px);
}

#content-area {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 350px);
  gap: 12px;
  overflow: hidden;
  padding: 12px;
}

.chat-panel,
.tool-feed-panel {
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-md);
}

.chat-panel {
  display: flex;
  flex-direction: column;
}

.chat-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.call-status-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.call-avatar {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(222, 18%, 24%), hsl(222, 18%, 17%));
  border: 1px solid var(--border-medium);
}

.call-name {
  font-weight: 700;
}

.call-meta {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.call-timer {
  padding: 7px 10px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  color: var(--accent-primary);
  font-size: 0.8rem;
  font-weight: 700;
}

.call-start-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 36px 24px;
  text-align: center;
}

.call-start-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  border-radius: var(--radius-xl);
  background: var(--accent-glow);
  border: 1px solid var(--accent-border);
  font-size: 34px;
}

.call-start-title {
  font-size: 1.35rem;
  font-weight: 800;
}

.call-start-sub {
  max-width: 560px;
  margin: 8px 0 22px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.call-start-screen .btn + .btn {
  margin-top: 10px;
}

.call-start-note {
  max-width: 520px;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.chat-body {
  min-height: 0;
  flex: 1;
  display: none;
  flex-direction: column;
}

.chat-messages {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.message {
  max-width: 760px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.agent {
  background: hsl(187, 100%, 48%, 0.09);
  border-color: var(--accent-border);
}

.caller {
  margin-left: auto;
  background: var(--bg-elevated);
  border-color: var(--border-medium);
}

.chat-hints {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 20px 10px;
}

.hint-chip {
  flex-shrink: 0;
  padding: 7px 10px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.76rem;
  white-space: nowrap;
}

.hint-chip:hover {
  color: var(--accent-primary);
  border-color: var(--accent-border);
}

.hint-chip:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.chat-input-area {
  padding: 14px 18px 18px;
  border-top: 1px solid var(--border-subtle);
}

.chat-input-wrapper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: end;
}

textarea {
  width: 100%;
  min-height: 44px;
  max-height: 120px;
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  outline: none;
  background: var(--bg-base);
  color: var(--text-primary);
}

textarea:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.send-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--accent-primary);
  color: var(--text-inverse);
  font-weight: 900;
}

.tool-feed-panel {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.tool-feed-header {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.tool-feed-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 800;
}

.tool-feed-count {
  min-width: 22px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--accent-glow);
  color: var(--accent-primary);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.tool-feed-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 118px;
  max-height: 230px;
  overflow-y: auto;
  padding: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.tool-feed-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-height: 112px;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.78rem;
}

.empty-icon {
  margin-bottom: 6px;
  font-size: 1.25rem;
}

.empty-sub {
  margin-top: 4px;
  font-size: 0.68rem;
}

.tool-event {
  padding: 10px 11px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-base);
}

.tool-event.done {
  border-color: hsl(145, 65%, 48%, 0.28);
}

.tool-event-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 0.76rem;
  font-weight: 800;
  min-width: 0;
}

.tool-event-header > div:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-event-status {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--accent-success);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.62rem;
}

.tool-event-params {
  color: var(--text-muted);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.67rem;
  overflow-wrap: anywhere;
}

.side-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.section-title {
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lead {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 7px 10px;
  margin: 0;
  font-size: 0.78rem;
}

.lead dt {
  color: var(--text-muted);
}

.lead dd {
  min-width: 0;
  margin: 0;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.slots {
  display: grid;
  gap: 7px;
}

.slot {
  width: 100%;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 4px;
  text-align: left;
  padding: 9px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  color: var(--text-secondary);
  font-size: 0.76rem;
  transition: var(--trans-smooth);
}

button.slot:hover {
  border-color: var(--accent-border);
  color: var(--text-primary);
  background: hsl(187, 100%, 48%, 0.07);
}

pre {
  min-height: 88px;
  max-height: 170px;
  overflow: auto;
  padding: 11px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  color: var(--text-secondary);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: grid;
  gap: 10px;
}

.toast {
  width: min(360px, calc(100vw - 36px));
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-md);
}

.toast-title {
  font-weight: 800;
  font-size: 0.8rem;
}

.toast-msg {
  color: var(--text-secondary);
  font-size: 0.74rem;
}

/* ── View pages ──────────────────────────────────────────────────── */

.view-page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
}

.view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  max-width: 1100px;
}

.view-card {
  padding: 20px 22px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-md);
}

.view-card-title {
  margin-bottom: 14px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.view-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  color: var(--text-muted);
  text-align: center;
  gap: 6px;
}

.view-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.view-empty-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.view-section-title {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lead-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  max-width: 1100px;
}

.lead-card {
  padding: 16px 18px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-md);
}

.lead-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.lead-card-avatar {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(222, 18%, 24%), hsl(222, 18%, 17%));
  border: 1px solid var(--border-medium);
  font-size: 16px;
}

.lead-card-name {
  font-weight: 700;
  font-size: 0.9rem;
}

.lead-card-time {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  white-space: nowrap;
}

.lead-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lead-badge.booked {
  background: hsl(145, 65%, 48%, 0.15);
  color: var(--accent-success);
  border: 1px solid hsl(145, 65%, 48%, 0.3);
}

.lead-badge.emergency {
  background: hsl(354, 80%, 58%, 0.15);
  color: var(--accent-danger);
  border: 1px solid hsl(354, 80%, 58%, 0.3);
}

.slot-grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  max-width: 1100px;
  margin-bottom: 28px;
}

.slot-view-card {
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.slot-view-card.booked {
  border-color: var(--accent-border);
  background: var(--accent-glow);
  color: var(--text-primary);
}

.slot-view-card-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.slot-view-card.booked .slot-view-card-label {
  color: var(--accent-primary);
}

.call-log-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 860px;
}

.call-log-entry {
  padding: 16px 18px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-md);
}

.call-log-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.call-log-caller {
  font-weight: 700;
  font-size: 0.88rem;
}

.call-log-time {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.call-log-messages {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 280px;
  overflow-y: auto;
}

.call-log-msg {
  font-size: 0.78rem;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  line-height: 1.4;
}

.call-log-msg.agent {
  background: hsl(187, 100%, 48%, 0.08);
  border: 1px solid var(--accent-border);
}

.call-log-msg.caller {
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  margin-left: 24px;
}

/* ── Config tabs & forms ─────────────────────────────────────────── */

.config-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0;
}

.config-tab {
  padding: 8px 16px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  transition: var(--trans-smooth);
  position: relative;
  top: 1px;
}

.config-tab:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.config-tab.active {
  color: var(--accent-primary);
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  border-bottom-color: var(--bg-surface);
}

.config-section {
  max-width: 780px;
}

.config-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-label {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  outline: none;
  background: var(--bg-base);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.85rem;
  transition: var(--trans-smooth);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-hint {
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.form-hint code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  padding: 1px 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
}

.integration-block {
  padding: 18px 20px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  margin-bottom: 4px;
}

.integration-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.integration-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 18px;
}

.integration-name {
  font-size: 0.9rem;
  font-weight: 700;
}

.integration-sub {
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.integration-status {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

.integration-status.ok {
  background: hsl(145, 65%, 48%, 0.12);
  color: var(--accent-success);
  border: 1px solid hsl(145, 65%, 48%, 0.25);
}

.integration-status.missing {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* ── End config tabs & forms ────────────────────────────────────── */

/* ── End view pages ────────────────────────────────────────────── */

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  #app {
    display: block;
    height: auto;
    min-height: 100vh;
  }

  #sidebar {
    display: none;
  }

  #main {
    min-height: 100vh;
  }

  #topbar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  #content-area {
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
    padding: 12px;
  }

  .chat-panel {
    min-height: 640px;
  }

  .tool-feed-panel {
    overflow: visible;
  }
}
