/* Компоненты кита для доски (B-7): кнопки, поля, статус, карточки.
   Разметку дают макросы app/templates/components/*.html. Значения — только var(--…) из tokens.css. */

/* Кнопки ---------------------------------------------------------------------------
   Основная — сосновая пилюля, одна на экран. Вторичная — паттерн А (pine-tint, pine-dark, без обводки),
   рядом с основной не больше одной. Третье действие и дальше — текстом (.btn-text). */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-h-cabinet);
  min-width: var(--tap-min);
  padding: 0 var(--space-5);
  border: 0;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: var(--fs-button-cabinet);
  line-height: var(--lh-button);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background-color var(--motion-fast);
  max-width: 100%;
}
.btn:focus-visible { box-shadow: var(--shadow-focus); border-radius: var(--radius-pill); }
.btn[disabled], .btn[aria-disabled="true"] { cursor: not-allowed; background: var(--bg-soft); color: var(--text-muted); }

.btn-primary { background: var(--action-primary); color: var(--action-primary-text); }
.btn-primary:hover { background: var(--action-primary-hover); color: var(--action-primary-text); }

.btn-secondary { background: var(--action-secondary); color: var(--action-secondary-text); }
.btn-secondary:hover { background: var(--action-secondary); color: var(--action-primary-hover); text-decoration: underline; }

.btn-text {
  background: transparent;
  color: var(--link);
  padding: 0 var(--space-3);
}
.btn-text:hover { color: var(--link-hover); text-decoration: underline; }

.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); }

.btn .htmx-indicator { display: none; }
.btn.htmx-request .htmx-indicator { display: inline; }

/* Поля ------------------------------------------------------------------------------ */

.field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.field-label { font-size: var(--fs-label); line-height: var(--lh-label); font-weight: var(--fw-semibold); color: var(--text-heading); }
.field-hint { font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: var(--fw-medium); color: var(--text-muted); }
.field-error { font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); color: var(--state-error); }

.input, .select, .textarea {
  width: 100%;
  min-height: var(--control-h-cabinet);
  padding: 0 var(--space-3);
  border: var(--border-w) solid var(--field-border);
  border-radius: var(--radius-m);
  background: var(--bg-card);
  color: var(--text-body);
  font-family: inherit;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}
.textarea { padding: var(--space-2) var(--space-3); min-height: calc(var(--control-h-cabinet) * 2.5); resize: vertical; }
.select { appearance: none; -webkit-appearance: none; padding-right: var(--space-7); background-image: none; cursor: pointer; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: var(--space-4);
  top: 50%;
  width: var(--space-2);
  height: var(--space-2);
  border-right: calc(var(--border-w) * 2) solid var(--text-muted);
  border-bottom: calc(var(--border-w) * 2) solid var(--text-muted);
  transform: translateY(-75%) rotate(45deg);
  pointer-events: none;
}
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { box-shadow: var(--shadow-focus); border-radius: var(--radius-m); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--state-error); }

/* Статус: точка и слово ------------------------------------------------------------- */

.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  font-weight: var(--fw-semibold);
  color: var(--text-body);
  white-space: nowrap;
}
.status-dot { width: var(--status-dot); height: var(--status-dot); border-radius: var(--radius-pill); flex: none; background: var(--state-neutral); }
.status-neutral .status-dot { background: var(--state-neutral); }
.status-active { color: var(--selected-text); }
.status-active .status-dot { background: var(--state-success); }
.status-success { color: var(--selected-text); }
.status-success .status-dot { background: var(--state-success); }
.status-warning { color: var(--state-warning); }
.status-warning .status-dot { background: var(--state-warning); }
.status-danger { color: var(--state-error); }
.status-danger .status-dot { background: var(--state-error); }

/* Панель: самостоятельный объект с тонкой рамкой line ------------------------------- */

.panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  border: var(--border-w) solid var(--divider);
  border-radius: var(--radius-m);
  background: var(--bg-card);
  min-width: 0;
}
.panel-title { font-size: var(--fs-h3); line-height: var(--lh-h3); }

/* Сообщение: причина и действие, цвет по смыслу */
.notice { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-m); background: var(--bg-soft); font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); }
.notice-error { background: var(--state-error-tint); color: var(--state-error); }
.notice-warning { background: var(--state-warning-tint); color: var(--state-warning); }

/* Карточка задачи на доске --------------------------------------------------------- */

.issue-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  border: var(--border-w) solid var(--divider);
  border-radius: var(--radius-m);
  background: var(--bg-card);
  color: var(--text-body);
  text-decoration: none;
  min-width: 0;
}
a.issue-card:hover { border-color: var(--field-border); color: var(--text-body); }
a.issue-card:focus-visible { border-radius: var(--radius-m); }
.issue-card.is-urgent { border-color: var(--state-error); }
.issue-card-key { font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: var(--fw-semibold); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.issue-card-title { font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); color: var(--text-heading); }
.issue-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-muted); }

.person {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
  color: var(--text-heading);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  font-weight: var(--fw-semibold);
}

/* Шапка карточки задачи (экран «Карточка») ------------------------------------------ */

.issue-head { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.issue-head-facts { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); color: var(--text-muted); margin: 0; }
.issue-head-facts div { display: flex; gap: var(--space-1); }
.issue-head-facts dt { margin: 0; }
.issue-head-facts dd { margin: 0; color: var(--text-body); }
