:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --panel-soft: #f1f5f6;
  --text: #162022;
  --muted: #647174;
  --line: #dfe6e8;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --success: #067647;
  --warning: #b54708;
  --success-soft: #dcfae6;
  --warning-soft: #fff4d6;
  --shadow: 0 10px 30px rgba(18, 32, 36, 0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { display: none; grid-template-columns: 280px 1fr; min-height: 100vh; }
.app-shell.unlocked { display: grid; }
.auth-screen { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: #0f1d20; }
.auth-screen.hidden { display: none; }
.auth-panel { display: grid; gap: 18px; width: min(420px, 100%); padding: 28px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 8px; background: #fff; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26); }
.auth-panel .brand-mark { color: #fff; }
.auth-panel h1 { font-size: 26px; }
.auth-panel p { margin-top: 4px; color: var(--muted); }
.sidebar { display: flex; flex-direction: column; gap: 24px; padding: 24px; background: #0f1d20; color: #f8fbfb; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 8px; background: #15a196; font-weight: 800; }
.brand strong, .brand span { display: block; }
.brand span, .connection-card small { color: #adc1c4; font-size: 13px; }
.nav { display: grid; gap: 8px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px; border: 0; border-radius: 8px; background: transparent; color: #dbe7e8; text-align: left; }
.nav-item:hover, .nav-item.active { background: rgba(255, 255, 255, 0.1); color: #fff; }
svg { width: 18px; height: 18px; }
.connection-card { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 12px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 8px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #f04438; }
.status-dot.connected { background: #12b76a; }
.main { min-width: 0; padding: 28px; }
.topbar, .toolbar, .panel-header, .button-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.topbar { margin-bottom: 24px; }
.eyebrow { margin: 0 0 4px; color: var(--accent); font-size: 12px; font-weight: 700; text-transform: uppercase; }
h1, h2, p { margin: 0; }
h1 { font-size: 30px; }
h2 { font-size: 18px; }
.topbar-actions { display: flex; gap: 10px; }
.primary-button, .secondary-button, .icon-button, .danger-button, .success-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; border-radius: 8px; border: 1px solid transparent; padding: 0 14px; }
.primary-button { background: var(--accent); color: #fff; }
.primary-button:hover { background: var(--accent-strong); }
.secondary-button, .icon-button { background: #fff; border-color: var(--line); color: var(--text); }
.icon-button { width: 40px; padding: 0; }
.danger-button { border: 0; background: var(--danger); color: #fff; }
.success-button { border: 0; background: var(--success); color: #fff; }
.view { display: none; }
.view.active { display: block; }
.toolbar { margin-bottom: 18px; }
.search-box { display: flex; align-items: center; gap: 10px; width: min(520px, 100%); height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.search-box input { width: 100%; border: 0; outline: 0; }
select, input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); outline: 0; }
input:disabled { background: #eef3f4; color: var(--muted); cursor: not-allowed; }
select, input { height: 44px; padding: 0 12px; }
textarea { resize: vertical; padding: 12px; line-height: 1.5; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.content-grid { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 18px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.panel-header { padding: 18px; border-bottom: 1px solid var(--line); }
.panel-header p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.contacts-list, .prompt-list { display: grid; max-height: calc(100vh - 214px); overflow: auto; }
.contact-card, .prompt-card { display: grid; gap: 8px; padding: 14px 18px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; }
.contact-card:hover, .contact-card.active { background: var(--panel-soft); }
.contact-main, .detail-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.contact-name { font-weight: 800; }
.contact-meta, .detail-line span, .prompt-card p { color: var(--muted); font-size: 13px; }
.asset-card { word-break: break-word; cursor: pointer; }
.asset-card:hover, .asset-card.active { background: var(--panel-soft); }
.asset-card.active { border-left: 3px solid var(--accent); }
.asset-link { color: var(--accent); font-size: 13px; font-weight: 800; text-decoration: none; }
.asset-link:hover { color: var(--accent-strong); text-decoration: underline; }
.badge { display: inline-flex; align-items: center; min-height: 24px; border-radius: 999px; padding: 0 9px; font-size: 12px; font-weight: 800; }
.badge.active { background: var(--success-soft); color: var(--success); }
.badge.paused { background: var(--warning-soft); color: var(--warning); }
.detail-panel, .empty-state { min-height: 520px; }
.detail-body { display: grid; gap: 18px; padding: 18px; }
.detail-card { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.detail-card h3 { margin: 0; font-size: 15px; }
.lead-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.lead-form-grid label:first-child { grid-column: 1 / -1; }
.lead-editor .inline-row { margin: 2px 0 0; }
.empty-state { display: grid; place-items: center; align-content: center; gap: 10px; color: var(--muted); text-align: center; padding: 24px; }
.empty-state svg { width: 42px; height: 42px; }
.prompt-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr); gap: 18px; }
.prompt-layout .panel { padding-bottom: 18px; }
.prompt-layout label, .settings-panel label, .form-grid { margin: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.file-drop { place-items: center; min-height: 150px; padding: 24px; border: 1px dashed #9cb4b7; border-radius: 8px; background: #f5fbfb; text-align: center; }
.file-drop svg { width: 34px; height: 34px; color: var(--accent); }
.file-drop input { display: none; }
.button-row { justify-content: flex-start; margin: 18px; }
.settings-panel { max-width: 720px; }
.toast { position: fixed; right: 24px; bottom: 24px; display: none; max-width: min(420px, calc(100vw - 48px)); padding: 13px 15px; border-radius: 8px; background: #0f1d20; color: #fff; box-shadow: var(--shadow); }
.toast.show { display: block; }
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .content-grid, .prompt-layout { grid-template-columns: 1fr; }
  .contacts-list, .prompt-list { max-height: none; }
}
@media (max-width: 640px) {
  .main, .sidebar { padding: 18px; }
  .topbar, .toolbar, .form-grid { align-items: stretch; flex-direction: column; grid-template-columns: 1fr; }
  .lead-form-grid { grid-template-columns: 1fr; }
}
