/* Оформление в стилистике Atlassian Design System.
   Имена токенов (N800, B400, G50…) взяты из ADS, чтобы правки сверялись
   с оригинальным Jira, а не подбирались на глаз. */

:root {
  --n0: #ffffff;  --n10: #fafbfc; --n20: #f4f5f7; --n30: #ebecf0;
  --n40: #dfe1e6; --n50: #c1c7d0; --n200: #7a869a; --n300: #6b778c;
  --n500: #505f79; --n600: #42526e; --n700: #253858; --n800: #172b4d;
  --b50: #deebff; --b75: #b3d4ff; --b200: #2684ff; --b300: #0065ff; --b400: #0052cc;
  --g50: #e3fcef; --g500: #006644;
  --r50: #ffebe6; --r400: #de350b; --r500: #bf2600;
  --y50: #fffae6; --y300: #ffab00; --y500: #ff8b00;
  --p50: #eae6ff; --p400: #5243aa;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --radius: 3px;
  --topbar-h: 52px;
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--n800);
  background: var(--n0);
}

a { color: var(--b400); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Верхняя панель ──────────────────────────────────────────────────── */

.topbar {
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); padding: 0 16px;
  border-bottom: 1px solid var(--n40); background: var(--n0);
  position: sticky; top: 0; z-index: 20;
}
.topbar__spacer { flex: 1; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--n800); }
.brand:hover { text-decoration: none; }
.brand__mark { color: var(--b400); font-size: 18px; }
.brand__name { font-weight: 700; font-size: 16px; }

.badge {
  padding: 2px 8px; border-radius: var(--radius);
  font-size: 11px; font-weight: 600; letter-spacing: .3px; white-space: nowrap;
}
.badge--warning { background: var(--y50); color: var(--y500); border: 1px solid var(--y300); }

/* ── Меню пользователя ───────────────────────────────────────────────── */

.menu { position: relative; }
.menu__trigger {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px; border-radius: var(--radius); cursor: pointer; list-style: none;
}
.menu__trigger::-webkit-details-marker { display: none; }
.menu__trigger:hover { background: var(--n30); }
.menu__label { color: var(--n300); font-size: 13px; }
.menu__panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px;
  background: var(--n0); border: 1px solid var(--n40); border-radius: var(--radius);
  box-shadow: 0 8px 16px rgba(9, 30, 66, .15); padding: 6px; z-index: 30;
}
.menu__meta { padding: 6px 10px; color: var(--n300); font-size: 12px; }
.menu__item {
  display: block; width: 100%; padding: 8px 10px; border-radius: var(--radius);
  color: var(--n700); text-align: left;
}
.menu__item:hover { background: var(--n30); text-decoration: none; }
.menu__item--button { border: 0; background: none; font: inherit; cursor: pointer; }

/* ── Поиск ───────────────────────────────────────────────────────────── */

.search input[type="search"] { width: 320px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="url"], textarea {
  width: 100%; padding: 6px 10px; font: inherit; color: var(--n800);
  background: var(--n10); border: 2px solid var(--n40); border-radius: var(--radius);
}
input:hover { background: var(--n30); }
input:focus, textarea:focus {
  outline: none; background: var(--n0); border-color: var(--b400);
}

/* ── Кнопки ──────────────────────────────────────────────────────────── */

.button {
  padding: 6px 12px; font: inherit; font-weight: 500; cursor: pointer;
  color: var(--n700); background: var(--n30);
  border: 0; border-radius: var(--radius);
}
.button:hover { background: var(--n40); }
.button:disabled { color: var(--n50); cursor: not-allowed; background: var(--n20); }
.button--primary { background: var(--b400); color: var(--n0); font-weight: 600; }
.button--primary:hover { background: var(--b300); }
.button--subtle { background: transparent; color: var(--n600); }
.button--subtle:hover { background: var(--n30); }

/* ── Компоновка рабочей области ──────────────────────────────────────── */

.workspace {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(420px, 5fr) minmax(480px, 6fr);
  height: calc(100vh - var(--topbar-h));
}
.workspace--single { grid-template-columns: var(--sidebar-w) 1fr; }

.page { padding: 24px; }
.page--centered { display: flex; justify-content: center; padding-top: 64px; }

/* ── Экран входа ─────────────────────────────────────────────────────────
   Раскладка повторяет Atlassian: серый фон, логотип над карточкой,
   узкая белая карточка по центру. Знак и названия — наши: выдавать
   систему за Atlassian нельзя. */

.auth {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 56px 16px 32px;
  background: var(--n20);
}
.auth__inner { width: 100%; max-width: 420px; }
.auth__brand {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-bottom: 24px;
}
.auth__mark { color: var(--b400); font-size: 26px; line-height: 1; }
.auth__product { font-size: 22px; font-weight: 600; color: var(--n800); }
.auth__card {
  padding: 32px 40px 36px;
  background: var(--n0);
  border-radius: var(--radius);
  box-shadow: 0 0 1px rgba(9, 30, 66, .31), 0 4px 8px -2px rgba(9, 30, 66, .25);
}
.auth__title {
  margin: 0 0 20px;
  font-size: 16px; font-weight: 500; text-align: center; color: var(--n800);
}
.auth__alt { margin: 16px 0 0; text-align: center; font-size: 13px; }
.auth__note {
  margin: 18px 0 0; padding-top: 14px;
  border-top: 1px solid var(--n30);
  color: var(--n300); font-size: 12px; line-height: 1.5;
}
.auth__footer {
  margin: 24px 0 0; text-align: center; color: var(--n300); font-size: 12px;
}
.auth__divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; color: var(--n300); font-size: 12px;
}
.auth__divider::before, .auth__divider::after {
  content: ""; flex: 1; border-top: 1px solid var(--n40);
}
.button--block {
  display: block; width: 100%; padding: 9px 12px; text-align: center;
  /* Названия поставщиков по-русски длинные: перенос допускаем, но строки
     не должны слипаться. */
  line-height: 1.35;
}
a.button--block:hover { text-decoration: none; }

/* ── Навигация ───────────────────────────────────────────────────────── */

.sidebar {
  background: var(--n20); border-right: 1px solid var(--n40);
  padding: 8px 0 16px; overflow-y: auto;
}
.sidebar__caption {
  padding: 14px 16px 6px; color: var(--n300);
  font-size: 11px; font-weight: 700; letter-spacing: .6px;
}
.sidebar__note {
  margin: 16px 16px 0; padding-top: 12px; border-top: 1px solid var(--n40);
  color: var(--n200); font-size: 11px;
}
.nav { list-style: none; margin: 0; padding: 0 8px; }
.nav__item {
  display: block; padding: 7px 10px; border-radius: var(--radius);
  color: var(--n600); font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav__item:hover { background: var(--n30); text-decoration: none; }
.nav__item--active { background: var(--b50); color: var(--b400); font-weight: 600; }

/* ── Список задач ────────────────────────────────────────────────────── */

.issue-list { overflow-y: auto; border-right: 1px solid var(--n40); }
.list-header {
  display: flex; align-items: baseline; gap: 10px;
  height: 46px; padding: 0 16px; border-bottom: 1px solid var(--n40);
}
.list-header__title { margin: 0; font-size: 16px; }
.list-header__count { color: var(--n300); font-size: 12px; }

.issue-table { width: 100%; border-collapse: collapse; }
.issue-table thead th {
  padding: 8px; border-bottom: 2px solid var(--n40);
  color: var(--n300); font-size: 11px; font-weight: 700;
  text-transform: uppercase; text-align: left;
}
.issue-table td { padding: 8px; border-bottom: 1px solid var(--n30); vertical-align: middle; }
.issue-row { cursor: pointer; }
.issue-row:hover { background: var(--n20); }
.issue-row:focus-visible { outline: 2px solid var(--b400); outline-offset: -2px; }
.issue-row--selected { background: var(--b50); }
.issue-table__empty { padding: 32px; color: var(--n200); text-align: center; }

.col-type, .col-assignee, .col-priority { width: 36px; text-align: center; }
.col-key { width: 92px; font-weight: 600; }
.col-status { width: 140px; }
.col-updated { width: 110px; color: var(--n300); font-size: 12px; }
.col-summary { max-width: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Карточка задачи ─────────────────────────────────────────────────── */

.issue-detail { overflow-y: auto; padding: 22px 24px; }
.issue { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; }
.issue-detail--wide .issue { max-width: 1100px; }
.breadcrumbs {
  display: flex; align-items: center; gap: 6px;
  color: var(--n300); font-size: 12px; font-weight: 600;
}
.breadcrumbs__sep { color: var(--n50); }
.issue__summary { margin: 6px 0 14px; font-size: 22px; line-height: 1.3; }
.issue__actions { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }

.section-title {
  margin: 24px 0 8px; color: var(--n600); font-size: 13px; font-weight: 700;
}
.section-title__count { color: var(--n300); font-size: 12px; font-weight: 400; margin-left: 6px; }

.details {
  padding: 14px 16px 16px; border: 1px solid var(--n40); border-radius: var(--radius);
}
.details .section-title { margin-top: 0; }
.details__grid {
  display: grid; grid-template-columns: auto 1fr; gap: 11px 12px; margin: 0;
}
.details__grid dt { color: var(--n300); font-size: 12px; font-weight: 600; }
.details__grid dd { margin: 0; display: flex; align-items: center; gap: 6px; }
.details__grid--muted dd { color: var(--n600); }
.details__rule { border: 0; border-top: 1px solid var(--n40); margin: 14px 0; }

.comments { list-style: none; margin: 0; padding: 0; }
.comment { display: flex; gap: 12px; margin-bottom: 16px; }
.comment__head { display: flex; align-items: baseline; gap: 8px; }
.comment__author { font-weight: 600; }
.comment__time { color: var(--n300); font-size: 12px; }
.placeholder { color: var(--n200); text-align: center; padding: 48px; }

/* ── Аватары, лозенджи, иконки ───────────────────────────────────────── */

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--avatar-bg, var(--n200)); color: var(--n0);
  font-weight: 600; flex: none;
}
.avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.avatar--md { width: 32px; height: 32px; font-size: 12px; }
.avatar--empty { background: var(--n30); color: var(--n200); border: 1px dashed var(--n50); }

.lozenge {
  display: inline-block; padding: 2px 6px; border-radius: var(--radius);
  font-size: 11px; font-weight: 700; letter-spacing: .3px; white-space: nowrap;
}
.lozenge--neutral { background: var(--n30); color: var(--n700); }
.lozenge--blue { background: var(--b50); color: var(--b400); }
.lozenge--green { background: var(--g50); color: var(--g500); }
.lozenge--red { background: var(--r50); color: var(--r500); }
.lozenge--yellow { background: var(--y50); color: var(--y500); }
.lozenge--purple { background: var(--p50); color: var(--p400); }

.icon { vertical-align: middle; flex: none; }

/* ── Карточки и формы ────────────────────────────────────────────────── */

.card {
  width: 100%; max-width: 560px; padding: 28px 32px;
  border: 1px solid var(--n40); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(9, 30, 66, .08);
}
.card--narrow { max-width: 420px; }
.card__title { margin: 0 0 8px; font-size: 20px; }
.card__lead { margin: 0 0 20px; color: var(--n300); }
.card__meta { margin-top: 18px; color: var(--n300); font-size: 12px; }

.form { display: grid; gap: 14px; }
.form__actions { display: flex; gap: 8px; }
.field { display: grid; gap: 4px; }
.field__label { color: var(--n600); font-size: 12px; font-weight: 600; }
.field__hint { color: var(--n300); font-size: 12px; }
.field__error { color: var(--r500); font-size: 12px; }

.alert { padding: 10px 12px; border-radius: var(--radius); }
.alert--error { background: var(--r50); color: var(--r500); }

.messages { padding: 12px 24px 0; display: grid; gap: 8px; }
.message { padding: 10px 12px; border-radius: var(--radius); background: var(--b50); color: var(--b400); }
.message--error { background: var(--r50); color: var(--r500); }
.message--success { background: var(--g50); color: var(--g500); }

/* ── Содержимое ADF ──────────────────────────────────────────────────── */

.adf { line-height: 1.6; }
.adf p { margin: 0 0 12px; }
.adf h1, .adf h2, .adf h3, .adf h4, .adf h5, .adf h6 { margin: 20px 0 8px; line-height: 1.3; }
.adf h1 { font-size: 20px; } .adf h2 { font-size: 17px; } .adf h3 { font-size: 15px; }
.adf ul, .adf ol { margin: 0 0 12px; padding-left: 22px; }
.adf li { margin-bottom: 4px; }
.adf blockquote {
  margin: 0 0 12px; padding-left: 12px; border-left: 3px solid var(--n40); color: var(--n600);
}
.adf code { font-family: var(--mono); font-size: 12px; background: var(--n20); padding: 1px 4px; border-radius: 2px; }
.adf-code {
  margin: 0 0 12px; padding: 10px 12px; overflow-x: auto;
  background: var(--n20); border: 1px solid var(--n40); border-radius: var(--radius);
}
.adf-code code { background: none; padding: 0; }
.adf hr { border: 0; border-top: 1px solid var(--n40); margin: 16px 0; }
.adf-empty { color: var(--n200); }
.adf-panel { margin: 0 0 12px; padding: 10px 12px; border-left: 3px solid; border-radius: 0 var(--radius) var(--radius) 0; }
.adf-panel--info { background: var(--b50); border-color: var(--b400); }
.adf-panel--note { background: var(--p50); border-color: var(--p400); }
.adf-panel--success { background: var(--g50); border-color: var(--g500); }
.adf-panel--warning { background: var(--y50); border-color: var(--y300); }
.adf-panel--error { background: var(--r50); border-color: var(--r400); }
.adf-panel > p:last-child { margin-bottom: 0; }
.mention { background: var(--n30); color: var(--n700); border-radius: var(--radius); padding: 0 4px; }
.adf-table-wrap { overflow-x: auto; margin: 0 0 12px; }
.adf-table { border-collapse: collapse; width: 100%; }
.adf-table th, .adf-table td { border: 1px solid var(--n40); padding: 6px 8px; text-align: left; vertical-align: top; }
.adf-table th { background: var(--n20); font-weight: 600; }
.adf-tasks { list-style: none; padding-left: 0; }
.adf-task--done { color: var(--n200); text-decoration: line-through; }
.adf-task__box { margin-right: 6px; }
.adf-media {
  display: inline-block; margin: 0 0 12px; padding: 12px 16px; color: var(--n300);
  background: var(--n20); border: 1px dashed var(--n40); border-radius: var(--radius);
}
.adf-media__icon { margin-right: 6px; }
.adf-expand { margin: 0 0 12px; }
.adf-expand summary { cursor: pointer; color: var(--n600); font-weight: 600; }

/* ── Индикация загрузки htmx ─────────────────────────────────────────── */

.htmx-request.issue-row { opacity: .6; }
#issue-detail.htmx-request { opacity: .5; transition: opacity .1s; }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: var(--sidebar-w) 1fr; }
  .issue-detail { display: none; }
  .workspace--single .issue-detail { display: block; }
  .issue { grid-template-columns: minmax(0, 1fr); }
}
