/* ── TeamHub: темна тема ── */
:root {
  --bg: #0e1116;
  --bg2: #151a22;
  --bg3: #1c232e;
  --border: #2a3341;
  --text: #e6ebf2;
  --muted: #8b98ab;
  --accent: #4f8cff;
  --accent2: #7c5cff;
  --green: #2ecc8f;
  --red: #ff5c72;
  --yellow: #ffc94d;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, 'Segoe UI', Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button {
  background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: 8px 14px; font-size: 14px; cursor: pointer; font-weight: 600;
}
button:hover { filter: brightness(1.1); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
button.ghost:hover { color: var(--text); border-color: var(--muted); }
button.danger { background: transparent; color: var(--red); border: 1px solid transparent; }
button.small { padding: 4px 9px; font-size: 12.5px; }
input, textarea, select {
  background: var(--bg3); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 11px; font-size: 14px; font-family: inherit; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; }
label { font-size: 12.5px; color: var(--muted); display: block; margin: 10px 0 4px; }
.loading { padding: 60px; text-align: center; color: var(--muted); }

/* ── Каркас ── */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 218px; flex-shrink: 0; background: var(--bg2); border-right: 1px solid var(--border);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.logo { font-size: 17px; font-weight: 800; padding: 4px 10px 16px; letter-spacing: .3px; }
.logo span { color: var(--accent); }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px;
  color: var(--muted); cursor: pointer; font-weight: 500; user-select: none;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--bg3); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.sidebar .spacer { flex: 1; }
.userbox { padding: 10px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.userbox b { color: var(--text); display: block; }
.main { flex: 1; padding: 24px 28px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; }
.page-head .grow { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }

/* ── Логін ── */
.auth-wrap { margin: auto; width: 360px; max-width: 92vw; padding-top: 12vh; }
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.auth-wrap .card { padding: 26px; }
.auth-wrap h1 { font-size: 20px; margin-bottom: 4px; }
.error-msg { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ── Канбан ── */
.board-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.board-tab {
  padding: 6px 13px; border-radius: 8px; background: var(--bg3); color: var(--muted);
  cursor: pointer; border: 1px solid var(--border); font-size: 13.5px;
}
.board-tab.active { color: var(--text); border-color: var(--accent); }
.kanban { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 20px; }
.kcol {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  width: 272px; flex-shrink: 0; padding: 10px;
}
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; }
.kcol-head b { flex: 1; font-size: 13.5px; }
.kcol-count { color: var(--muted); font-size: 12px; background: var(--bg3); border-radius: 10px; padding: 1px 8px; }
.kcards { display: flex; flex-direction: column; gap: 8px; min-height: 30px; }
.kcard {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 11px; cursor: grab; font-size: 14px;
}
.kcard:hover { border-color: var(--muted); }
.kcard .tags { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.pill {
  font-size: 11px; padding: 1px 8px; border-radius: 20px;
  background: rgba(79,140,255,.15); color: var(--accent); font-weight: 600;
}
.pill.due { background: rgba(255,201,77,.13); color: var(--yellow); }
.pill.overdue { background: rgba(255,92,114,.15); color: var(--red); }
.pill.who { background: rgba(46,204,143,.13); color: var(--green); }
.kcards.dragover { outline: 2px dashed var(--accent); outline-offset: 3px; border-radius: 8px; }
.add-inline { margin-top: 8px; }

/* ── Доки ── */
.docs-layout { display: flex; gap: 20px; align-items: flex-start; }
.docs-list { width: 250px; flex-shrink: 0; }
.docs-folder { font-size: 11.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); margin: 14px 4px 5px; }
.doc-item { padding: 7px 10px; border-radius: 7px; cursor: pointer; color: var(--muted); font-size: 14px; }
.doc-item:hover { background: var(--bg3); color: var(--text); }
.doc-item.active { background: var(--bg3); color: var(--text); }
.doc-view { flex: 1; min-width: 0; }
.md-body { line-height: 1.65; }
.md-body h1, .md-body h2, .md-body h3 { margin: 18px 0 8px; }
.md-body p, .md-body ul, .md-body ol, .md-body pre, .md-body table { margin-bottom: 10px; }
.md-body code { background: var(--bg3); padding: 1px 6px; border-radius: 5px; font-size: 13px; }
.md-body pre { background: var(--bg3); padding: 12px; border-radius: 8px; overflow-x: auto; }
.md-body pre code { background: none; padding: 0; }
.md-body table { border-collapse: collapse; width: 100%; }
.md-body th, .md-body td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; font-size: 14px; }
.md-body blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--muted); }
.doc-editor textarea { min-height: 55vh; font-family: ui-monospace, monospace; font-size: 13.5px; }

/* ── Vault ── */
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
table.data th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.secret-cell { font-family: ui-monospace, monospace; font-size: 13px; }

/* ── AdSpy ── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }
.findings { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.finding { display: flex; gap: 14px; }
.finding img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: var(--bg3); }
.finding .kbadge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 5px; }
.k-new_creative { background: rgba(79,140,255,.15); color: var(--accent); }
.k-new_geo { background: rgba(46,204,143,.15); color: var(--green); }
.k-reach_spike { background: rgba(255,201,77,.15); color: var(--yellow); }
.chip { display: inline-flex; align-items: center; gap: 7px; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; font-size: 13.5px; margin: 3px 4px 3px 0; }
.chip button { padding: 0 4px; background: none; color: var(--red); font-size: 15px; }

/* ── Модалка ── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; z-index: 50;
}
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 22px; width: 480px; max-width: 100%; max-height: 82vh; overflow-y: auto; }
.modal h2 { font-size: 17px; margin-bottom: 6px; }
.modal .row { display: flex; gap: 10px; }
.modal .row > div { flex: 1; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; justify-content: flex-end; }

.toast {
  position: fixed; bottom: 22px; right: 22px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 18px; font-size: 14px; z-index: 99; box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.toast.err { border-color: var(--red); }
