/* Боковая панель заявки и форма новой заявки. */
.panel-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(27, 26, 23, 0.16); animation: fade var(--mid) var(--ease); }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(480px, 100vw);
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -16px 0 40px rgba(27, 26, 23, 0.12);
  animation: slide-in var(--mid) var(--ease);
}
.panel.is-closing { transform: translateX(16px); opacity: 0; transition: transform var(--fast) var(--ease), opacity var(--fast) var(--ease); }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.panel__head { padding: 12px 12px 0 24px; border-bottom: 1px solid var(--line); }
.panel__bar { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.panel__num { font: 500 13px/20px var(--mono); color: var(--text-2); }
.panel__created { color: var(--text-3); font-size: 13px; }
.panel__close { margin-left: auto; }
.panel__title { font: 600 22px/28px var(--font-display); letter-spacing: -0.01em; margin: 6px 0 4px; }
.panel__job { color: var(--text-2); margin-bottom: 14px; }

.stagebar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 -1px; }
.stagebar__btn {
  position: relative; height: 40px; padding: 0 4px;
  border: 0; background: transparent; color: var(--text-3);
  font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: color var(--fast) var(--ease);
}
.stagebar__btn::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: transparent; transition: background-color var(--fast) var(--ease); }
.stagebar__btn:hover { color: var(--text); }
.stagebar__btn[aria-pressed="true"] { color: var(--text); }
.stagebar__btn[aria-pressed="true"]::after { background: var(--accent); }
.stagebar__btn.is-passed { color: var(--text-2); }

.panel__body { overflow-y: auto; overscroll-behavior: contain; padding: 20px 24px 32px; display: grid; gap: 24px; align-content: start; }
.panel__section { display: grid; gap: 10px; }
.panel__h { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text-3); }

.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-radius: var(--r-card);
  background: var(--danger-soft); color: #7D1A14; font-size: 13px;
}
.alert .icon { margin-top: 2px; color: var(--danger); }
.alert b { font-weight: 600; }

.facts { display: grid; gap: 8px; margin: 0; }
.fact { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; align-items: start; }
.fact .icon { margin-top: 2px; color: var(--text-3); }
.fact dd { margin: 0; }
.fact__muted { color: var(--text-3); font-size: 12px; }

.params { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 12px; }
.params .field--wide { grid-column: 1 / -1; }
.amount { display: flex; align-items: baseline; gap: 8px; height: 36px; padding: 0 10px; border-radius: var(--r-control); background: var(--sunken); border: 1px solid var(--line); align-items: center; }
.amount__v { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.amount__hint { color: var(--text-3); font-size: 12px; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { position: relative; display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 10px; padding: 0 0 12px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 14px; bottom: 0; width: 1px; background: var(--line-strong); }
.timeline li:last-child::before { display: none; }
.timeline__dot { width: 9px; height: 9px; margin: 5px 0 0 3px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--text-3); }
.timeline__dot--stage { border-color: var(--accent); }
.timeline__dot--created { background: var(--text-3); }
.timeline__text { color: var(--text-2); font-size: 13px; }
.timeline time { color: var(--text-3); font-size: 12px; white-space: nowrap; }

.comments { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.comment { padding: 10px 12px; border-radius: var(--r-card); background: var(--sunken); border: 1px solid var(--line); }
.comment__meta { display: flex; gap: 8px; font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
.comment__meta b { color: var(--text-2); font-weight: 600; }
.comment p { white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form { display: grid; gap: 8px; }
.comment-form textarea { min-height: 64px; }
.comment-form__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-3); font-size: 12px; }
.comments__empty { color: var(--text-3); font-size: 13px; }

/* ---------- форма новой заявки ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.form-row3 { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 16px; }
.form-grid .field--wide { grid-column: 1 / -1; }
.seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; padding: 3px; background: var(--sunken); border: 1px solid var(--line-strong); border-radius: var(--r-control); }
.seg[aria-invalid="true"] { border-color: var(--danger); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 28px; border-radius: 6px;
  color: var(--text-2); font-size: 13px; font-weight: 500;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line), var(--shadow-card); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-hint { color: var(--text-3); font-size: 12px; }

@media (max-width: 719px) {
  .panel { width: 100vw; border-left: 0; box-shadow: none; }
  .panel-scrim { display: none; }
  .panel__head { padding: 8px 8px 0 16px; }
  .panel__body { padding: 16px 16px 32px; }
  .panel__title { font-size: 20px; }
  .stagebar__btn { font-size: 12px; }
  .comment-form__row > span { visibility: hidden; }
  .form-grid { grid-template-columns: 1fr; }
  .form-row3 { grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .form-row3 > :first-child { grid-column: 1 / -1; }
}
