/* ==========================================================================
   MEGAHACK — тикеты и админка
   Подключается после style.css: использует те же токены и кнопки.
   1. Форма заявки         4. Статус тикета
   2. Приоритеты и пилюли  5. Админка
   3. Результат отправки   6. Адаптив
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Форма заявки
   -------------------------------------------------------------------------- */
[hidden] { display: none !important; }

.support-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.82fr);
  gap: 18px;
  align-items: start;
}

.form-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #0e1117, #0a0d12);
  box-shadow: var(--sh-card);
}

.form-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.form-ico {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--acid-line);
  border-radius: 12px;
  background: var(--acid-soft);
  color: var(--acid);
}
.form-ico .ico { width: 21px; height: 21px; }
.form-head h2 { margin: 2px 0 4px; font-size: 22px; letter-spacing: -0.02em; }
.form-head p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); }

.form-grid { display: grid; gap: 18px; }

.field { margin: 0; padding: 0; border: 0; min-width: 0; }
.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  font-family: var(--f-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}
.field-label .opt {
  font-family: var(--f-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin-left: 4px;
}
.req { color: var(--acid); }
.field-hint { margin: 6px 0 0; font-size: 12px; line-height: 1.5; color: var(--dim); }

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="search"],
.field textarea,
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: 11px;
  background: var(--ink-2);
  color: var(--text);
  font-family: var(--f-ui);
  font-size: 14.5px;
  line-height: 1.5;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.field input::placeholder,
.field textarea::placeholder { color: #5a6373; }
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: rgba(201, 247, 90, 0.45);
  background: #10141b;
  box-shadow: 0 0 0 3px rgba(201, 247, 90, 0.1);
}
.field textarea { min-height: 168px; resize: vertical; line-height: 1.7; }
.field select { appearance: none; cursor: pointer; }

.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.field-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}
.counter { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.08em; color: var(--dim); white-space: nowrap; }
.counter b { color: var(--muted); font-weight: 500; }

.field.is-invalid input,
.field.is-invalid textarea { border-color: rgba(251, 113, 133, 0.55); }
.field.is-invalid input:focus,
.field.is-invalid textarea:focus { box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.12); }

.field-err { margin: 6px 0 0; font-size: 12.5px; color: #ffa0ad; }
.field-err::before { content: "! "; font-weight: 700; }

.form-alert {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px 15px;
  border: 1px solid rgba(251, 113, 133, 0.35);
  border-radius: 11px;
  background: rgba(251, 113, 133, 0.07);
  font-size: 13px;
  line-height: 1.55;
  color: #ffb8c2;
}
.form-alert .ico { width: 16px; height: 16px; margin-top: 2px; flex: none; }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.form-note { margin: 0; font-size: 12px; line-height: 1.55; color: var(--dim); max-width: 300px; }
.form-note a { color: var(--acid); text-decoration: underline; text-underline-offset: 3px; }

/* Ловушка для ботов: спрятана от людей, но не display:none. */
.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.btn[disabled] { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn .spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(10, 13, 5, 0.35);
  border-top-color: #0a0d05;
  border-radius: 50%;
  animation: mh-spin 0.7s linear infinite;
}
@keyframes mh-spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   2. Приоритеты и пилюли
   -------------------------------------------------------------------------- */
.prio-group { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.prio {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.018);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ease);
}
.prio:hover { border-color: var(--line-2); background: rgba(255, 255, 255, 0.035); }
.prio input { position: absolute; opacity: 0; pointer-events: none; }
.prio:focus-within { box-shadow: 0 0 0 3px rgba(201, 247, 90, 0.12); }

.prio-dot {
  width: 9px;
  height: 9px;
  margin-top: 6px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}
.prio-low .prio-dot { color: var(--green); }
.prio-medium .prio-dot { color: var(--amber); }
.prio-high .prio-dot { color: var(--red); }

.prio-body { display: grid; gap: 2px; min-width: 0; }
.prio-body b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.prio-body small { font-size: 11.5px; line-height: 1.4; color: var(--dim); }

.prio-check {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: auto;
  flex: none;
  margin-top: 3px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  color: transparent;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.prio-check .ico { width: 10px; height: 10px; stroke-width: 3; }

.prio:has(input:checked) { border-color: rgba(201, 247, 90, 0.4); background: rgba(201, 247, 90, 0.07); }
.prio:has(input:checked) .prio-check { border-color: var(--acid); background: var(--acid); color: #0a0d05; }
.prio.is-checked { border-color: rgba(201, 247, 90, 0.4); background: rgba(201, 247, 90, 0.07); }
.prio.is-checked .prio-check { border-color: var(--acid); background: var(--acid); color: #0a0d05; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.pill-low { color: #86efac; border-color: rgba(74, 222, 128, 0.32); background: rgba(74, 222, 128, 0.08); }
.pill-medium { color: #f7d08a; border-color: rgba(245, 194, 107, 0.32); background: rgba(245, 194, 107, 0.08); }
.pill-high { color: #ff9aa8; border-color: rgba(251, 113, 133, 0.35); background: rgba(251, 113, 133, 0.09); }

.pill-new { color: #9adcff; border-color: rgba(125, 211, 252, 0.3); background: rgba(125, 211, 252, 0.08); }
.pill-in_progress { color: #d6c8ff; border-color: rgba(180, 161, 255, 0.32); background: rgba(180, 161, 255, 0.08); }
.pill-answered { color: #86efac; border-color: rgba(74, 222, 128, 0.32); background: rgba(74, 222, 128, 0.08); }
.pill-closed { color: var(--dim); background: rgba(255, 255, 255, 0.03); }

/* --------------------------------------------------------------------------
   3. Результат отправки
   -------------------------------------------------------------------------- */
.result-card { padding: 34px 30px; }
.result-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--acid);
}
.result-kicker .ico { width: 14px; height: 14px; stroke-width: 2.4; }
.result-card h2 { margin: 12px 0 8px; font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.025em; }
.result-card > p { margin: 0; font-size: 14px; line-height: 1.65; color: var(--muted); max-width: 560px; }

.result-id-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 22px 0 16px;
  padding: 16px 18px;
  border: 1px dashed rgba(201, 247, 90, 0.4);
  border-radius: 14px;
  background: rgba(201, 247, 90, 0.05);
}
.result-id-label {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}
.result-id {
  font-family: var(--f-mono);
  font-size: clamp(1.35rem, 4vw, 1.8rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #e2ff9a;
}
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 7px 11px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.copy-btn:hover { color: var(--text); border-color: var(--acid-line); background: var(--acid-soft); }
.copy-btn .ico { width: 13px; height: 13px; }

.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.result-hint {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.022);
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}
.result-hint .ico { width: 17px; height: 17px; margin-top: 2px; flex: none; color: var(--sky); }
.result-hint b { color: var(--text); }
.result-hint a { color: var(--acid); text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------------------------
   4. Статус тикета
   -------------------------------------------------------------------------- */
.lookup-card { padding: 24px; }
.lookup-row { display: flex; gap: 10px; flex-wrap: wrap; }
.lookup-row input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: 11px;
  background: var(--ink-2);
  color: var(--text);
  font-family: var(--f-mono);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lookup-row input:focus {
  outline: none;
  border-color: rgba(201, 247, 90, 0.45);
  box-shadow: 0 0 0 3px rgba(201, 247, 90, 0.1);
}

.ticket-card {
  margin-top: 18px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #0e1117, #0a0d12);
  box-shadow: var(--sh-card);
}
.ticket-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ticket-crumbs { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.ticket-crumbs b { color: var(--acid); font-weight: 500; }
.ticket-subject { margin: 10px 0 10px; font-size: clamp(1.3rem, 2.6vw, 1.8rem); letter-spacing: -0.025em; line-height: 1.2; }
.ticket-pills { display: flex; gap: 7px; flex-wrap: wrap; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin: 20px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}
.mini-label {
  display: block;
  margin-bottom: 3px;
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.mini-value { display: block; font-size: 13.5px; color: var(--text); overflow-wrap: anywhere; }

.ticket-desc {
  margin: 0;
  padding: 16px 18px;
  border-left: 2px solid var(--acid-line);
  border-radius: 0 12px 12px 0;
  background: rgba(201, 247, 90, 0.035);
  font-size: 14.2px;
  line-height: 1.75;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 12px;
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.answers { display: grid; gap: 10px; }
.answer {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--acid);
  border-radius: 0 12px 12px 0;
  background: rgba(201, 247, 90, 0.045);
}
.answer p { margin: 6px 0 0; font-size: 14px; line-height: 1.7; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.answer time { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.08em; color: var(--dim); }

.timeline { margin: 0; padding: 0; list-style: none; display: grid; gap: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 12px; padding-bottom: 14px; }
.timeline li::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 0;
  left: 7px;
  width: 1px;
  background: var(--line);
}
.timeline li:last-child::before { display: none; }
.timeline .dot {
  width: 8px;
  height: 8px;
  margin: 5px 0 0 3px;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 8px rgba(201, 247, 90, 0.5);
}
.timeline .dot.muted { background: var(--dim); box-shadow: none; }
.timeline b { font-size: 13px; font-weight: 600; color: var(--text); }
.timeline span { display: block; font-size: 11.5px; color: var(--dim); }
.timeline time { font-family: var(--f-mono); font-size: 10px; color: var(--dim); }

.empty-card {
  padding: 46px 24px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
  text-align: center;
}
.empty-card .ico { width: 26px; height: 26px; margin: 0 auto 12px; color: var(--dim); }
.empty-card h3 { margin: 0 0 6px; font-size: 16px; }
.empty-card p { margin: 0 auto; max-width: 420px; font-size: 13.5px; color: var(--dim); }

/* --------------------------------------------------------------------------
   5. Админка
   -------------------------------------------------------------------------- */
.admin-top { position: sticky; top: 0; z-index: 60; border-bottom: 1px solid var(--line); background: rgba(7, 8, 12, 0.96); backdrop-filter: blur(14px); }
.admin-top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.admin-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.admin-badge {
  padding: 4px 8px;
  border: 1px solid var(--acid-line);
  border-radius: 6px;
  background: var(--acid-soft);
  font-family: var(--f-mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--acid);
  white-space: nowrap;
}
.admin-actions { display: flex; align-items: center; gap: 10px; }
.admin-actions .btn { min-height: 38px; }
.admin-pulse {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}
.admin-pulse i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }

.admin-main { padding: 26px 0 60px; }

.admin-login-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 40px 0; }
.admin-login-wrap .container { display: grid; place-items: center; width: 100%; }
.login-card {
  width: min(430px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #0e1117, #0a0d12);
  box-shadow: var(--sh-card);
}
.login-card h1 { margin: 14px 0 22px; font-size: 24px; letter-spacing: -0.02em; }
.login-card > p { margin: 0 0 22px; font-size: 13.5px; color: var(--muted); }
.login-card .field + .field { margin-top: 14px; }
.login-card .btn { width: 100%; margin-top: 18px; justify-content: center; }

.admin-grid {
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-list-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #0e1117, #0a0d12);
  box-shadow: var(--sh-card);
}
.admin-toolbar { display: grid; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.admin-toolbar .search { width: 100%; }
.admin-toolbar .search input { height: 40px; }

.filters { display: flex; flex-wrap: wrap; gap: 5px; }
.filter-btn {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.filter-btn:hover { color: var(--text); border-color: var(--line-2); }
.filter-btn .n { margin-left: 5px; font-family: var(--f-mono); font-size: 9.5px; color: var(--dim); }
.filter-btn.active { border-color: rgba(201, 247, 90, 0.35); background: rgba(201, 247, 90, 0.08); color: #fff; }
.filter-btn.active .n { color: var(--acid); }

.admin-select-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.admin-select-row select {
  padding: 7px 30px 7px 10px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: var(--ink-2);
  color: var(--muted);
  font-family: var(--f-ui);
  font-size: 12px;
  appearance: none;
  cursor: pointer;
}
.admin-select-row select:focus { outline: none; border-color: var(--acid-line); }
.admin-select-row span { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }

.admin-list { max-height: calc(100vh - 262px); overflow-y: auto; overscroll-behavior: contain; }

.admin-item {
  position: relative;
  display: block;
  width: 100%;
  padding: 12px 15px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font-family: var(--f-ui);
  text-align: left;
  cursor: pointer;
  transition: background 0.18s;
}
.admin-item:hover { background: rgba(255, 255, 255, 0.032); }
.admin-item.active { background: rgba(201, 247, 90, 0.07); box-shadow: inset 2px 0 0 var(--acid); }
.admin-item:last-child { border-bottom: 0; }

.admin-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.admin-item-id { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.06em; color: var(--dim); }
.admin-item-id.new { color: var(--acid); }
.admin-item-subject {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}
.admin-item-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 5px; font-size: 11px; color: var(--dim); }
.admin-item-meta .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.admin-item-meta .prio-low { color: var(--green); }
.admin-item-meta .prio-medium { color: var(--amber); }
.admin-item-meta .prio-high { color: var(--red); }

.admin-empty { padding: 44px 22px; text-align: center; font-size: 13px; color: var(--dim); }

.admin-detail {
  min-height: 460px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #0e1117, #0a0d12);
  box-shadow: var(--sh-card);
}
.detail-empty {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  min-height: 460px;
  text-align: center;
  color: var(--dim);
}
.detail-empty .ico { width: 30px; height: 30px; margin: 0 auto; color: #3a414d; }
.detail-empty h3 { margin: 0; font-size: 16px; color: var(--muted); }
.detail-empty p { margin: 0; max-width: 320px; font-size: 13px; }

.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.detail-id { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.1em; color: var(--dim); }
.detail-subject { margin: 8px 0 10px; font-size: clamp(1.25rem, 2.4vw, 1.65rem); letter-spacing: -0.02em; line-height: 1.25; }
.detail-pills { display: flex; gap: 7px; flex-wrap: wrap; }

.detail-text {
  margin: 0;
  padding: 15px 17px;
  border-left: 2px solid var(--acid-line);
  border-radius: 0 11px 11px 0;
  background: rgba(201, 247, 90, 0.035);
  font-size: 13.8px;
  line-height: 1.72;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.status-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.status-row .label { margin-right: 4px; font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.status-btn {
  padding: 7px 11px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: var(--f-ui);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.status-btn:hover { color: var(--text); border-color: var(--line-2); background: rgba(255, 255, 255, 0.04); }
.status-btn.active { border-color: rgba(201, 247, 90, 0.4); background: var(--acid-soft); color: #fff; }

.thread { display: grid; gap: 10px; margin-top: 14px; }

.admin-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 380px;
  margin-top: 4px;
  padding: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.015);
}
.admin-thread .bubble { max-width: min(86%, 620px); }
.bubble .fail-note { display: block; margin-top: 6px; font-size: 11px; color: #ffa0ad; }

.thread-msg {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.022);
  font-size: 13.4px;
  line-height: 1.65;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.thread-msg.admin { border-color: rgba(201, 247, 90, 0.2); background: rgba(201, 247, 90, 0.05); color: var(--text); }
.thread-msg.failed { border-color: rgba(251, 113, 133, 0.35); background: rgba(251, 113, 133, 0.06); }
.thread-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}
.thread-head b { font-weight: 500; color: var(--muted); letter-spacing: 0.08em; }
.thread-msg .fail-note { display: block; margin-top: 6px; font-size: 11.5px; color: #ffa0ad; }

.reply-box { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.reply-box textarea {
  width: 100%;
  min-height: 110px;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: 11px;
  background: var(--ink-2);
  color: var(--text);
  font-family: var(--f-ui);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
}
.reply-box textarea:focus {
  outline: none;
  border-color: rgba(201, 247, 90, 0.45);
  box-shadow: 0 0 0 3px rgba(201, 247, 90, 0.1);
}
.reply-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.reply-hint { font-size: 11.5px; line-height: 1.5; color: var(--dim); max-width: 380px; }
.reply-hint b { color: var(--muted); }
.reply-hint .warn { color: #f2cd8b; }

.ticket-facts { display: grid; gap: 9px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.ticket-facts div { display: flex; justify-content: space-between; gap: 14px; font-size: 12.5px; }
.ticket-facts .fact-k { color: var(--dim); }
.ticket-facts .fact-v { color: var(--muted); text-align: right; overflow-wrap: anywhere; }
.ticket-facts .fact-v.ok { color: #86efac; }
.ticket-facts .fact-v.bad { color: #ffa0ad; }

/* --------------------------------------------------------------------------
   6. Адаптив
   -------------------------------------------------------------------------- */
@media (max-width: 1040px) {
  .support-layout { grid-template-columns: minmax(0, 1fr); }
  .support-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .support-side .side-card:last-child { grid-column: 1 / -1; }

  .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .admin-list { max-height: 360px; }
  .admin-detail { min-height: 0; }
  .detail-empty { min-height: 240px; }
}

@media (max-width: 760px) {
  .admin-pulse { display: none; }
  .admin-main { padding-top: 18px; }
}

@media (max-width: 640px) {
  .form-card { padding: 20px; }
  .prio-group { grid-template-columns: minmax(0, 1fr); }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .support-side { grid-template-columns: minmax(0, 1fr); }
  .form-head { gap: 11px; }
  .form-head h2 { font-size: 19px; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .form-actions .btn { justify-content: center; }
  .form-note { max-width: none; }
  .result-card { padding: 24px 20px; }
  .result-id-row { padding: 14px; }
  .copy-btn { margin-left: 0; }
  .ticket-card { padding: 20px; }
  .admin-top-inner { height: 58px; }
  .admin-brand .brand-word { font-size: 16px; }
  .admin-detail { padding: 18px; }
  .admin-main { padding-bottom: 40px; }
  .lookup-row .btn { width: 100%; justify-content: center; }
  .admin-select-row { flex-wrap: wrap; }
}

/* ==========================================================================
   Центр поддержки: список тикетов + чат
   ========================================================================== */
.page-head--compact { padding-bottom: 30px; }

.section--tight { padding-top: 34px; }

.support-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.support-title-row .page-lead { max-width: 640px; }
.support-title-row .btn { flex: none; }

.support-center {
  display: grid;
  grid-template-columns: 336px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  min-height: 640px;
}

/* --- Список тикетов --- */
.tickets-panel {
  display: flex;
  flex-direction: column;
  max-height: 720px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #0e1117, #0a0d12);
  box-shadow: var(--sh-card);
}
.tickets-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.tickets-panel-head h2 { margin: 0; font-size: 15px; letter-spacing: -0.01em; }
.panel-badge {
  min-width: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--muted);
  text-align: center;
}

.tickets-list {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.tickets-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 46px 22px;
  text-align: center;
  color: var(--dim);
}
.tickets-empty .ico { width: 26px; height: 26px; color: #3d4450; }
.tickets-empty p { margin: 0; font-size: 12.5px; line-height: 1.55; max-width: 220px; }

.ticket-item {
  position: relative;
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: inherit;
  font-family: var(--f-ui);
  text-align: left;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.ticket-item:hover { background: rgba(255, 255, 255, 0.035); }
.ticket-item.active {
  border-color: rgba(201, 247, 90, 0.24);
  background: rgba(201, 247, 90, 0.075);
  box-shadow: inset 2px 0 0 var(--acid);
}
.ticket-item-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ticket-item-subject {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13.2px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}
.ticket-item-time { flex: none; font-family: var(--f-mono); font-size: 9px; color: var(--dim); }
.ticket-item-bottom { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--dim); }
.ticket-item-bottom .pill { padding: 2.5px 7px; font-size: 8.5px; letter-spacing: 0.08em; }
.ticket-item .prio-dot { width: 6px; height: 6px; margin: 0; }
.ticket-item.unread::after {
  content: "";
  position: absolute;
  right: 11px;
  bottom: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 8px var(--acid);
}

.tickets-panel-foot {
  display: grid;
  gap: 8px;
  padding: 10px 12px 14px;
  border-top: 1px solid var(--line);
}
.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  padding: 5px 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--f-ui);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s;
}
.text-btn .ico { width: 13px; height: 13px; }
.text-btn:hover { color: var(--acid); }

.attach-form { display: flex; gap: 6px; }
.attach-form input {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--ink-2);
  color: var(--text);
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.attach-form input:focus {
  outline: none;
  border-color: rgba(201, 247, 90, 0.45);
  box-shadow: 0 0 0 3px rgba(201, 247, 90, 0.1);
}
.attach-form .btn { padding: 8px 10px; font-size: 12px; }
.attach-note { margin: 0; font-size: 10.5px; line-height: 1.5; color: #4f5764; }

/* --- Чат --- */
.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 640px;
  max-height: 720px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background:
    radial-gradient(700px 300px at 50% 0%, rgba(201, 247, 90, 0.035), transparent 70%),
    linear-gradient(180deg, #0d1016, #090b10);
  box-shadow: var(--sh-card);
}

.chat-empty {
  flex: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 48px 28px;
  text-align: center;
}
.chat-empty-ico {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 4px;
  border: 1px solid var(--line-2);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--dim);
}
.chat-empty-ico .ico { width: 27px; height: 27px; }
.chat-empty h3 { margin: 0; font-size: 17px; }
.chat-empty p { margin: 0 0 8px; max-width: 330px; font-size: 13px; line-height: 1.6; color: var(--dim); }

.chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.012);
}
.chat-person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.chat-person-text { min-width: 0; }
.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #d9ff7d, #a9e234);
  color: #0a0d05;
  font-family: var(--f-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.chat-subject {
  max-width: 460px;
  margin: 0 0 2px;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.chat-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 11.5px;
  color: var(--dim);
}
.chat-meta .sep { color: #3d4450; }
.chat-status { color: var(--acid); }
.chat-status.is-closed { color: var(--dim); }
.chat-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.chat-actions .pill { padding: 4px 9px; font-size: 8.5px; }
.chat-actions .btn { white-space: nowrap; }
.chat-actions .btn .ico { width: 14px; height: 14px; }

.chat-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}
.chat-date {
  align-self: center;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

.chat-row { display: flex; gap: 8px; }
.chat-row.out { justify-content: flex-end; }
.chat-row.in { justify-content: flex-start; }
.bubble {
  max-width: min(78%, 560px);
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.6px;
  line-height: 1.6;
}
.bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble time { display: block; margin-top: 5px; font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.06em; color: var(--dim); }
.bubble-in {
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  background: #141821;
  color: var(--text);
}
.bubble-out {
  border: 1px solid rgba(201, 247, 90, 0.26);
  border-bottom-right-radius: 4px;
  background: rgba(201, 247, 90, 0.11);
  color: #eef7d9;
}
.bubble-author {
  display: block;
  margin-bottom: 3px;
  font-family: var(--f-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--acid);
}
.bubble-avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-top: 2px;
  flex: none;
  border: 1px solid var(--acid-line);
  border-radius: 50%;
  background: var(--acid-soft);
  font-family: var(--f-mono);
  font-size: 8.5px;
  color: var(--acid);
}

.chat-tip {
  display: flex;
  gap: 9px;
  padding: 10px 12px;
  border: 1px dashed rgba(201, 247, 90, 0.25);
  border-radius: 10px;
  background: rgba(201, 247, 90, 0.045);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
}
.chat-tip .ico { width: 14px; height: 14px; margin-top: 1px; flex: none; color: var(--acid); }
.chat-tip a { color: var(--acid); text-decoration: underline; text-underline-offset: 2px; }

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 13px 16px 8px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}
.composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 150px;
  padding: 11px 13px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--ink-2);
  color: var(--text);
  font-family: var(--f-ui);
  font-size: 13.5px;
  line-height: 1.5;
  resize: none;
}
.composer textarea::placeholder { color: #5a6373; }
.composer textarea:focus {
  outline: none;
  border-color: rgba(201, 247, 90, 0.45);
  box-shadow: 0 0 0 3px rgba(201, 247, 90, 0.1);
}
.composer-send {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--acid);
  color: #0a0d05;
  cursor: pointer;
  box-shadow: 0 10px 24px -12px rgba(201, 247, 90, 0.9);
  transition: transform 0.2s var(--ease), background 0.2s;
}
.composer-send:hover { background: #d9ff7d; transform: translateY(-1px); }
.composer-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.composer-send .ico { width: 18px; height: 18px; }
.composer-hint {
  margin: 0;
  padding: 0 18px 12px;
  font-size: 10.5px;
  line-height: 1.5;
  color: #4f5764;
}

.chat-closed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  font-size: 12.5px;
  color: var(--dim);
}

/* --- Модалка --- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 4, 7, 0.74);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--line-2);
  border-radius: 20px;
  background: linear-gradient(180deg, #0f131a, #0a0d12);
  box-shadow: 0 40px 100px -30px #000, 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  animation: modalIn 0.26s var(--ease);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.modal-head .eyebrow { margin: 0; }
.modal-head h2 { margin: 6px 0 0; font-size: 22px; letter-spacing: -0.02em; }
.modal-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.modal-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.modal-close .ico { width: 15px; height: 15px; }

.modal-form .form-grid { gap: 14px; }
.modal-form .field textarea { min-height: 140px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

body.modal-open { overflow: hidden; }

@media (max-width: 1040px) {
  .support-center { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .tickets-panel { max-height: 340px; }
  .chat-panel { min-height: 540px; max-height: none; }
  .chat-subject { max-width: 100%; }
}

@media (max-width: 760px) {
  .chat-head { flex-wrap: wrap; padding: 13px 15px; }
  .chat-actions { width: 100%; justify-content: space-between; }
  .chat-thread { padding: 14px; }
  .bubble { max-width: 88%; }
  .chat-subject { white-space: normal; }
}

@media (max-width: 640px) {
  .section--tight { padding-top: 20px; }
  .support-title-row { align-items: flex-start; }
  .support-title-row .btn { width: 100%; justify-content: center; }
  .support-center { gap: 12px; }
  .page-head--compact { padding-bottom: 22px; }
  .modal { padding: 12px; }
  .modal-card { padding: 18px; max-height: calc(100vh - 24px); border-radius: 16px; }
  .modal-actions .btn { flex: 1; justify-content: center; }
  .composer { padding: 11px 12px 7px; }
  .composer-hint { padding: 0 14px 10px; }
  .tickets-panel { max-height: 300px; }
  .chat-panel { min-height: 480px; }
}

