:root {
  --bg: #0e1420;
  --card: #16202f;
  --card2: #1b2739;
  --border: #2a3a52;
  --text: #e8eef7;
  --muted: #8b9bb4;
  --accent: #2f81f7;
  --accent-h: #1f6feb;
  --green: #2ea043;
  --green-t: #4ade80;
  --amber: #d29922;
  --amber-t: #fbbf24;
  --red: #f85149;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, #16283f 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}
.layout { display: flex; min-height: 100vh; }

/* ---- sidebar ---- */
.sidebar {
  width: 230px; flex-shrink: 0; padding: 20px 14px;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #0a66c2, #2f81f7);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; color: #fff;
}
.brand .sub { color: var(--muted); font-size: 12px; }
nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
nav a {
  display: flex; align-items: center; gap: 8px;
  color: var(--muted); text-decoration: none;
  padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 550;
}
nav a:hover { background: rgba(47,129,247,.08); color: var(--text); }
nav a.active { background: rgba(47,129,247,.15); color: #79b8ff; }
.cnt {
  margin-left: auto; font-size: 11.5px; background: var(--card2);
  border-radius: 999px; padding: 2px 8px; color: var(--muted);
}
.cnt.hot:not(:empty) { background: rgba(248,81,73,.18); color: var(--red); font-weight: 700; }
.cnt:empty { display: none; }
.sidebar-footer { display: flex; flex-direction: column; gap: 10px; padding: 0 8px; }
.muted-link { color: var(--muted); font-size: 13px; text-decoration: none; }
.muted-link:hover { color: var(--accent); }
.logout {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer;
}
.logout:hover { color: var(--red); border-color: var(--red); }

/* ---- main ---- */
main { flex: 1; padding: 28px 32px 80px; max-width: 1200px; }
h1 { font-size: 21px; margin: 0 0 4px; font-weight: 650; }
.page-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.loading { color: var(--muted); padding: 40px; text-align: center; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.grid { display: grid; gap: 14px; }
.grid.cols4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.stat { text-align: center; padding: 18px 12px; }
.stat .num { font-size: 30px; font-weight: 750; }
.stat .lbl { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.stat.green .num { color: var(--green-t); }
.stat.amber .num { color: var(--amber-t); }
.stat.red .num { color: var(--red); }

/* KPI */
.kpi-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid rgba(42,58,82,.5); }
.kpi-row:last-child { border-bottom: none; }
.kpi-controls { display: flex; align-items: center; gap: 10px; }
.kpi-controls .val { font-size: 20px; font-weight: 700; min-width: 44px; text-align: center; }
.kpi-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--card2); color: var(--text); font-size: 18px; font-weight: 700; cursor: pointer;
}
.kpi-btn:hover { border-color: var(--accent); color: var(--accent); }

/* generic */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  background: linear-gradient(180deg, var(--accent), var(--accent-h));
  color: #fff; border: none; border-radius: 9px;
  padding: 9px 16px; font-size: 13.5px; font-weight: 650; cursor: pointer;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: var(--card2); border: 1px solid var(--border); color: var(--text); }
.btn.ghost:hover { border-color: var(--accent); filter: none; }
.btn.small { padding: 6px 11px; font-size: 12.5px; }
.btn.danger { background: none; border: 1px solid var(--border); color: var(--muted); }
.btn.danger:hover { border-color: var(--red); color: var(--red); }
.btn.green { background: linear-gradient(180deg, #34b155, var(--green)); }

textarea, input[type=text] {
  width: 100%; background: var(--card2); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 11px 13px; font-size: 14px;
  outline: none; font-family: inherit; resize: vertical;
}
textarea:focus, input[type=text]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,129,247,.15); }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.A, .badge.B { background: rgba(46,160,67,.15); color: var(--green-t); }
.badge.C { background: rgba(210,153,34,.15); color: var(--amber-t); }
.badge.D { background: rgba(248,81,73,.13); color: var(--red); }
.badge.gray { background: var(--card2); color: var(--muted); }
.score { font-weight: 800; font-size: 17px; }
.score.hi { color: var(--green-t); } .score.mid { color: var(--amber-t); } .score.lo { color: var(--red); }

.lead-row { border-bottom: 1px solid rgba(42,58,82,.5); padding: 14px 2px; }
.lead-row:last-child { border-bottom: none; }
.lead-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lead-head a { color: var(--accent); text-decoration: none; font-weight: 650; font-size: 14.5px; }
.lead-head a:hover { text-decoration: underline; }
.lead-head .spacer { flex: 1; }
.lead-sub { color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.5; }
.details { margin-top: 10px; display: none; }
.details.open { display: block; }
.details table { width: 100%; border-collapse: collapse; font-size: 13px; }
.details td { padding: 5px 8px; border-bottom: 1px solid rgba(42,58,82,.4); vertical-align: top; }
.details td:first-child { color: var(--muted); white-space: nowrap; width: 180px; }
.linkish { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12.5px; padding: 0; }
.linkish:hover { color: var(--accent); }

/* карточка анализа: пост/переписка → вердикт → готовые тексты */
.analysis-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px;
}
.analysis-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.block-title {
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.author { font-size: 13px; color: var(--text); font-weight: 600; }
.quote {
  margin: 0; padding: 12px 16px; border-left: 3px solid var(--accent);
  background: var(--card2); border-radius: 0 10px 10px 0;
  color: var(--text); font-size: 13.5px; line-height: 1.6;
  max-height: 150px; overflow-y: auto; white-space: pre-wrap;
}
.block { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(42,58,82,.6); }
.block .block-title { display: block; margin-bottom: 8px; }
.risk {
  margin-left: 10px; font-size: 12px; font-weight: 600;
  color: var(--muted); background: var(--card2); padding: 3px 9px; border-radius: 999px;
}
.risk-high { color: var(--red); background: rgba(248,81,73,.13); }
.risk-medium { color: var(--amber-t); background: rgba(210,153,34,.13); }
.risk-low { color: var(--green-t); background: rgba(46,160,67,.13); }

.draft {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 8px;
}
.draft-num {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(47,129,247,.15); color: #79b8ff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.draft-text { flex: 1; font-size: 13.5px; line-height: 1.55; }
.draft .copy { flex-shrink: 0; }

/* редактор промптов */
[data-prompt] textarea {
  margin-top: 10px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12.5px; line-height: 1.55;
}
.fixed-format {
  margin: 8px 0 0; padding: 12px 14px; border-radius: 10px;
  background: var(--card2); border: 1px solid var(--border);
  color: var(--muted); font-family: ui-monospace, Consolas, monospace;
  font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-x: auto;
}

.result-json { margin-top: 12px; }
.comment-box {
  background: var(--card2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin-top: 8px; font-size: 13.5px; line-height: 1.55; position: relative;
}
.comment-box .copy { position: absolute; top: 8px; right: 8px; }
.verdict { font-size: 15px; font-weight: 700; margin: 10px 0 4px; }
.verdict.comment { color: var(--green-t); } .verdict.like { color: var(--amber-t); } .verdict.skip { color: var(--red); }

.due { color: var(--red); font-weight: 700; }
.hint-box { background: rgba(47,129,247,.08); border: 1px solid rgba(47,129,247,.3); border-radius: 10px; padding: 12px 14px; margin-top: 10px; font-size: 13.5px; }
.hint-panel {
  margin-top: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--card2); border: 1px solid var(--border);
}
.touch-history { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.touch-history div { padding: 3px 0; }

.status-line { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.status-line.err { color: var(--red); }
.empty { color: var(--muted); text-align: center; padding: 34px 10px; }

.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 18px; font-size: 14px; display: none; box-shadow: 0 8px 30px rgba(0,0,0,.4);
}
.toast.show { display: block; animation: fadeIn .2s ease; }
.toast.ok { border-color: #1f4d2b; color: var(--green-t); }
.toast.err { border-color: #6e2830; color: var(--red); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mt { margin-top: 12px; }
h2.sec { font-size: 15px; font-weight: 650; margin: 22px 0 10px; }

/* собранные с LinkedIn данные профиля */
.lead-role { color: var(--muted); font-size: 13px; margin-left: 4px; }
.cv { padding: 4px 2px; }
.cv-section { margin-bottom: 16px; }
.cv-section:last-child { margin-bottom: 0; }
.cv-section .block-title { display: block; margin-bottom: 6px; }
.cv-about { font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; max-height: 220px; overflow-y: auto; }
.cv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cv-table td { padding: 4px 8px; border-bottom: 1px solid rgba(42,58,82,.4); }
.cv-table td:first-child { color: var(--muted); width: 130px; }
.cv-item { padding: 8px 0; border-bottom: 1px solid rgba(42,58,82,.4); }
.cv-item:last-child { border-bottom: none; }
.cv-title { font-size: 13.5px; font-weight: 600; }
.cv-company { color: var(--muted); font-weight: 500; }
.cv-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.cv-desc { font-size: 13px; line-height: 1.55; margin-top: 6px; white-space: pre-wrap; max-height: 160px; overflow-y: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--card2); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 11px; font-size: 12.5px; color: var(--text);
}
