/* Трекер: спокойная бело-синяя админка */
:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eff4ff;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --border: #e4e9f2;
  --border-strong: #cfd8e8;
  --ink: #0f172a;
  --ink-2: #64748b;
  --ink-3: #94a3b8;
  --green: #0f9d58;  --green-bg: #e8f6ee;
  --amber: #b45309;  --amber-bg: #fdf3e3;
  --red: #dc2626;    --red-bg: #fdecec;
  --violet: #7c3aed; --violet-bg: #f3eeff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px rgba(15, 23, 42, .05);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14.5px/1.55 Inter, -apple-system, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }

/* ===== Каркас ===== */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 224px; flex: none;
  display: flex; flex-direction: column;
  padding: 18px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--blue); color: #fff;
  font-weight: 700; font-size: 16px;
}
.brand-mark.big { width: 46px; height: 46px; font-size: 22px; border-radius: 12px; margin-bottom: 14px; }
.brand-text { font-weight: 700; font-size: 16px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 8px;
  color: var(--ink-2); font-weight: 500;
}
.nav-item:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.nav-item.on { background: var(--blue-soft); color: var(--blue-dark); font-weight: 600; }
.nav-item svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.me { display: flex; align-items: center; gap: 9px; padding: 6px 8px; }
.me img, .me-stub { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.me-stub { display: grid; place-items: center; background: var(--blue-soft); color: var(--blue-dark); font-weight: 700; font-size: 12px; }
.me-name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-exit { display: block; padding: 6px 8px; font-size: 13px; color: var(--ink-3); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 18px 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.top h1 { font-size: 19px; flex: 1; }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.content { padding: 22px 26px 40px; }
.content.wide { padding-inline: 18px; }

/* ===== Элементы ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--ink); font: 600 13.5px Inter, sans-serif; cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); text-decoration: none; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-dark { background: #0f172a; border-color: #0f172a; color: #fff; }
.btn-dark:hover { background: #1e293b; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.wide-btn { width: 100%; justify-content: center; }

input[type=text], input[type=search], input[type=password], input[type=date], select, textarea {
  width: 100%; padding: 8px 11px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font: 400 14px Inter, sans-serif;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: transparent; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.alert { padding: 10px 13px; border-radius: 8px; background: var(--red-bg); color: var(--red); font-size: 13.5px; }
.empty { padding: 40px 16px; text-align: center; color: var(--ink-3); }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--bg); color: var(--ink-2);
}
.tag.blue { background: var(--blue-soft); color: var(--blue-dark); }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.amber { background: var(--amber-bg); color: var(--amber); }
.tag.red { background: var(--red-bg); color: var(--red); }
.tag.violet { background: var(--violet-bg); color: var(--violet); }
.key { font-weight: 700; font-size: 12px; color: var(--ink-2); letter-spacing: .02em; }
.ava { width: 22px; height: 22px; border-radius: 50%; }
.ava-stub {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--blue-soft); color: var(--blue-dark); font-size: 10.5px; font-weight: 700;
}

/* ===== Доска ===== */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; align-items: start; overflow-x: auto; padding-bottom: 10px; }
.col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 140px; }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.col-head b { font-size: 13px; }
.col-count { font-size: 12px; color: var(--ink-3); }
.col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.col.drag-over { outline: 2px dashed var(--blue); outline-offset: -2px; }

.ticket { display: block; padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: grab; }
.ticket:hover { border-color: var(--blue); text-decoration: none; box-shadow: var(--shadow); }
.ticket-top { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.ticket-title { font-size: 13.5px; line-height: 1.4; margin-bottom: 9px; }
.ticket-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ===== Таблица бэклога ===== */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; padding: 10px 14px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); border-bottom: 1px solid var(--border); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:hover { background: var(--blue-soft); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters select, .filters input { width: auto; min-width: 150px; }

/* ===== Карточка задачи ===== */
.issue { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: start; }
.issue-main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.pane { padding: 18px; }
.pane h2 { font-size: 15px; margin-bottom: 12px; }
.issue-title { font-size: 21px; line-height: 1.3; margin-bottom: 8px; }
.desc { white-space: pre-wrap; line-height: 1.6; color: var(--ink); }
.side-pane { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 18px; }
.field { margin-bottom: 13px; }
.field:last-child { margin-bottom: 0; }

.comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; }
.comment-body { min-width: 0; flex: 1; }
.comment-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.comment-head b { font-size: 13.5px; }
.comment-head span { font-size: 12px; color: var(--ink-3); }
.comment-text { white-space: pre-wrap; font-size: 14px; }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.feed li { display: flex; gap: 9px; font-size: 13px; color: var(--ink-2); }
.feed time { color: var(--ink-3); font-size: 12px; white-space: nowrap; }

.links { display: flex; flex-direction: column; gap: 8px; }
.link-row { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.link-row .tag { flex: none; }
.link-row a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Выкатки и мониторинг ===== */
.rollout { display: flex; gap: 10px; flex-wrap: wrap; }
.env-card { flex: 1; min-width: 190px; padding: 16px; }
.env-card h3 { font-size: 14px; margin-bottom: 6px; }
.env-state { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { padding: 15px 17px; }
.metric b { display: block; font-size: 24px; font-weight: 700; }
.metric span { font-size: 12px; color: var(--ink-2); }

/* ===== Вход ===== */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card { width: min(380px, 92vw); padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); text-align: center; }
.login-card h1 { font-size: 20px; margin-bottom: 6px; }
.login-card .muted { font-size: 13.5px; margin: 0 0 18px; }
.login-key { display: flex; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side { width: auto; flex-direction: row; align-items: center; gap: 12px; padding: 10px 14px; overflow-x: auto; }
  .nav { flex-direction: row; }
  .nav-item span { display: none; }
  .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; display: flex; align-items: center; gap: 8px; }
  .issue { grid-template-columns: 1fr; }
  .side-pane { position: static; }
}

/* Переключатель проектов */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.seg-btn {
  display: inline-block;
  padding: 6px 13px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font: 600 13px Inter, sans-serif;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.seg-btn:hover { color: var(--ink); text-decoration: none; }
.seg-btn.on { background: var(--surface); color: var(--blue-dark); box-shadow: var(--shadow); }

/* Вложенные картинки в комментариях */
.comment-text .shot {
  display: block;
  max-width: min(420px, 100%);
  margin: 8px 0 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.paste-hint { margin-top: 6px; font-size: 12.5px; color: var(--ink-2); }

/* Превью приложенных картинок до отправки */
.strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { position: relative; display: inline-block; line-height: 0; }
.chip img {
  width: 72px; height: 72px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border);
}
.chip-x {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px; padding: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--ink); color: #fff;
  font-size: 11px; line-height: 1; cursor: pointer;
}
.chip-x:hover { background: var(--red); }

/* Цитирование */
.reply-btn {
  margin-left: auto;
  padding: 2px 8px;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--ink-3);
  font: 600 12px Inter, sans-serif; cursor: pointer;
}
.comment:hover .reply-btn { color: var(--blue); background: var(--blue-soft); }
.quote, .reply-strip {
  display: block;
  position: relative;
  margin: 2px 0 8px;
  padding: 8px 12px;
  border-left: 3px solid var(--blue);
  border-radius: 0 8px 8px 0;
  background: var(--blue-soft);
  text-decoration: none;
}
.quote:hover { text-decoration: none; background: #e3ecff; }
.quote-author { display: block; font-size: 12.5px; font-weight: 700; color: var(--blue-dark); }
.quote-text { display: block; font-size: 13px; color: var(--ink-2); }
.reply-strip { margin-top: 8px; padding-right: 30px; }
.reply-strip .chip-x { top: 50%; right: 6px; transform: translateY(-50%); }

/* Напоминание о непривязанном Telegram */
.warn-strip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 11px 15px;
  border: 1px solid var(--amber);
  border-radius: 10px;
  background: var(--amber-bg);
  color: var(--amber);
  font-size: 13.5px;
}
.warn-strip a { color: var(--amber); font-weight: 700; text-decoration: underline; }

/* Класс с display перебивал атрибут hidden */
[hidden] { display: none !important; }

/* Доска всегда в один экран: длинный бэклог прокручивается внутри своей
   колонки, а колонки-цели остаются на виду — карточку не нужно тащить вверх. */
.board { align-items: stretch; height: calc(100vh - 150px); padding-bottom: 0; }
.col { height: 100%; overflow: hidden; }
.col-body { flex: 1; overflow-y: auto; min-height: 120px; }
.board .col:first-child { background: var(--bg); }
