/* ==============================================================================
   TMA Styles: Midnight Slate & Teal Atelier
   Палитра и атмосферные слои адаптированы под фоновые изображения bg_1 и bg_2.
   Без фиолетовых градиентов, без backdrop-blur, с проверкой контраста WCAG AA.
   ============================================================================== */

:root {
  color-scheme: dark;

  /* Поверхности (полуночный сланец и текстура темного камня из bg_1 / bg_2) */
  --bg-canvas: #161722;
  --bg-surface: rgba(25, 30, 44, 0.88);
  --bg-surface-header: rgba(20, 24, 36, 0.72);
  --bg-surface-solid: #191E2C;
  --bg-subtle: rgba(16, 20, 30, 0.78);
  --bg-input: #111521;
  --bg-input-focus: #141928;
  --bg-hover: #21293C;

  /* Текст (лунный светлый тон без резкого ослепления чистого белого) */
  --text-primary: #EAF0F4;
  --text-secondary: #ADC0CF;
  --text-muted: #93A6B6;
  --text-placeholder: #8397A8;

  /* Границы (холодный сланцево-бирюзовый оттенок) */
  --border-subtle: rgba(110, 174, 192, 0.18);
  --border-strong: rgba(110, 174, 192, 0.34);

  /* Акценты (петрольно-бирюзовый пигмент эмблемы и статусы) */
  --accent-primary: #176E87;
  --accent-primary-hover: #1B7F9B;
  --accent-primary-text: #52C7DD;
  --accent-primary-soft: rgba(34, 140, 166, 0.18);
  --accent-contrast: #F5FAFC;

  --status-approved-fg: #5ED1A5;
  --status-approved-bg: rgba(45, 168, 122, 0.16);

  --status-unpublished-fg: #7AB8E8;
  --status-unpublished-bg: rgba(68, 138, 200, 0.16);

  --status-pending-fg: #F0B35B;
  --status-pending-bg: rgba(224, 152, 56, 0.15);

  --status-danger-fg: #F28080;
  --status-danger-bg: rgba(220, 76, 76, 0.16);

  --status-rejected-fg: #9AA5B1;
  --status-rejected-bg: rgba(148, 163, 184, 0.14);

  /* Шрифты */
  --font-serif: "PT Serif", Georgia, serif;
  --font-sans: "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  /* Радиусы по функциональной роли */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Плавность переходов */
  --ease-out-snappy: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
}

/* ==============================================================================
   Фиксированные фоновые слои Mini App (без iOS background-attachment: fixed)
   ============================================================================== */
.tma-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background-color: var(--bg-canvas);
}

.tma-bg-layer {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  transition: opacity 0.28s var(--ease-out-snappy);
  will-change: opacity;
}

/* bg_1: верхняя эмблема плавно растворяется в основной фон #161722 под формой */
.tma-bg-form {
  background-image: url("/static/img/bg_1.webp");
  background-position: center top;
  background-size: cover;
  opacity: 1;
}

/* bg_2: центральный символ ключа для вкладки «Мои кейсы» */
.tma-bg-history {
  background-image: url("/static/img/bg_2.webp");
  background-position: center center;
  background-size: cover;
  opacity: 0;
}

body.view-history .tma-bg-form {
  opacity: 0;
}

body.view-history .tma-bg-history {
  opacity: 0.94;
}

/* На широких экранах (ПК / планшет) ограничиваем ширину рисунка и мягко растворяем края в #161722 */
@media (min-width: 641px) {
  .tma-bg-form {
    background-size: 640px auto;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 18%, #000 82%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, #000 18%, #000 82%, transparent 100%);
  }

  .tma-bg-history {
    background-size: min(620px, 85vw) auto;
    -webkit-mask-image: radial-gradient(ellipse 46% 58% at 50% 50%, #000 45%, transparent 98%);
    mask-image: radial-gradient(ellipse 46% 58% at 50% 50%, #000 45%, transparent 98%);
  }
}

.font-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

.app-container {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding:
    max(16px, env(safe-area-inset-top, 0px))
    max(16px, env(safe-area-inset-right, 0px))
    16px
    max(16px, env(safe-area-inset-left, 0px));
}

/* ==============================================================================
   Шапка студента (располагается поверх верхней эмблемы bg_1)
   ============================================================================== */
.student-header {
  background: var(--bg-surface-header);
  border: 1px solid rgba(82, 199, 221, 0.24);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 10px 28px rgba(7, 10, 16, 0.42);
}

.badge-academic {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-primary-text);
  background: var(--accent-primary-soft);
  border: 1px solid rgba(82, 199, 221, 0.24);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.student-name {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 8px;
}

.student-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tag-chip {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* Прогресс-бар */
.progress-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.progress-numbers strong {
  font-size: 16px;
  color: var(--accent-primary-text);
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  /* Монохромная бирюзовая шкала прогресса */
  background: linear-gradient(90deg, #176E87 0%, #3BB2C9 100%);
  border-radius: 4px;
  transition: width 0.3s var(--ease-out-snappy);
}

/* Навигационные табы */
.tma-nav {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
}

.nav-tab {
  flex: 1;
  min-height: 44px;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.nav-tab:focus-visible {
  outline: 2px solid var(--accent-primary-text);
  outline-offset: 2px;
}

@media (hover: hover) {
  .nav-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
  }
}

.nav-tab.active {
  background: var(--accent-primary);
  color: var(--accent-contrast);
  border-color: rgba(82, 199, 221, 0.45);
}

/* ==============================================================================
   Форма подачи кейса
   ============================================================================== */
.academic-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.section-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.section-step {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-primary-text);
  background: var(--accent-primary-soft);
  border: 1px solid rgba(82, 199, 221, 0.22);
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  margin-top: 2px;
  flex-shrink: 0;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.section-header-body {
  flex: 1;
  min-width: 0;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.section-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.req-star {
  color: var(--status-danger-fg);
}

/* Поля ввода */
.field-group {
  margin-bottom: 16px;
  min-width: 0;
}

.field-group:last-child {
  margin-bottom: 0;
}

.fields-row {
  display: flex;
  gap: 12px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

@media (max-width: 400px) {
  .fields-row {
    flex-direction: column;
    gap: 16px;
  }
}

.field-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.label-hint {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-muted);
}

.selected-counter {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-primary-text);
  background: var(--accent-primary-soft);
  border: 1px solid rgba(82, 199, 221, 0.22);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

.text-input,
.textarea-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.text-input::placeholder,
.textarea-input::placeholder {
  color: var(--text-placeholder);
}

.text-input:focus,
.textarea-input:focus {
  background: var(--bg-input-focus);
  border-color: var(--accent-primary-text);
  box-shadow: 0 0 0 2px rgba(82, 199, 221, 0.22);
}

.textarea-input {
  resize: vertical;
  line-height: 1.5;
}

/* Сетка чипсов (Модули и Сферы) */
.chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-btn {
  min-height: 44px;
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: left;
  user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

@media (hover: hover) {
  .chip-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
  }
}

.chip-btn:focus-visible {
  outline: 2px solid var(--accent-primary-text);
  outline-offset: 2px;
}

.chip-btn.selected {
  background: var(--accent-primary);
  color: var(--accent-contrast);
  border-color: #36A6BD;
  font-weight: 600;
}

.chip-btn.selected::before {
  content: "✓";
  margin-right: 6px;
  font-size: 12px;
  font-weight: 700;
}

/* Дропзона загрузки файлов */
.file-dropzone {
  position: relative;
  overflow: hidden;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  text-align: center;
  padding: 24px 16px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

@media (hover: hover) {
  .file-dropzone:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary-text);
  }
}

.file-dropzone.is-dragover {
  background: rgba(23, 110, 135, 0.22);
  border-color: var(--accent-primary-text);
}

.file-dropzone:focus-within {
  border-color: var(--accent-primary-text);
  box-shadow: 0 0 0 2px rgba(82, 199, 221, 0.22);
}

/* Прозрачный оверлей вместо display: none: гарантирует прямой клик по input в ПК-клиентах */
.file-overlay-input {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  margin: 0;
  padding: 0;
  font-size: 16px;
}

.file-overlay-input::-webkit-file-upload-button,
.file-overlay-input::file-selector-button {
  width: 100%;
  height: 100%;
  cursor: pointer;
  border: 0;
  padding: 0;
  margin: 0;
}

.dropzone-label {
  position: relative;
  z-index: 1;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.upload-desktop-hint {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.upload-icon {
  font-size: 28px;
}

.upload-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.upload-hints {
  font-size: 11px;
  color: var(--text-muted);
}

.file-selected-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--accent-primary-soft);
  border: 1px solid rgba(82, 199, 221, 0.45);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--accent-primary-text);
  font-weight: 600;
}

.file-selected-badge span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-remove {
  background: none;
  border: none;
  font-size: 16px;
  min-width: 32px;
  min-height: 32px;
  color: var(--accent-primary-text);
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
}

.btn-remove:focus-visible {
  outline: 2px solid var(--accent-primary-text);
  outline-offset: 2px;
}

/* Библиотека файлов из чата с ботом */
.chat-media-section {
  margin-bottom: 14px;
}

.chat-media-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.btn-refresh-drafts {
  min-height: 34px;
  padding: 4px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-refresh-drafts:focus-visible {
  outline: 2px solid var(--accent-primary-text);
  outline-offset: 2px;
}

@media (hover: hover) {
  .btn-refresh-drafts:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
  }
}

.chat-media-empty-hint {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.chat-media-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-media-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.chat-media-item:focus-visible {
  outline: 2px solid var(--accent-primary-text);
  outline-offset: 2px;
}

@media (hover: hover) {
  .chat-media-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
  }
}

.chat-media-item.selected {
  background: rgba(23, 110, 135, 0.22);
  border-color: var(--accent-primary-text);
  box-shadow: 0 0 0 1px var(--accent-primary-text);
}

.chat-media-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.chat-media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.chat-media-meta {
  flex: 1;
  min-width: 0;
}

.chat-media-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-media-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-media-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chat-media-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-subtle);
}

.chat-media-item.selected .chat-media-pill {
  color: var(--accent-contrast);
  background: var(--accent-primary);
  border-color: #36A6BD;
}

.chat-media-delete {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-media-delete:focus-visible {
  outline: 2px solid var(--status-danger-fg);
  outline-offset: 2px;
}

@media (hover: hover) {
  .chat-media-delete:hover {
    color: var(--status-danger-fg);
    background: var(--status-danger-bg);
  }
}

/* Список прикрепленных медиафайлов кейса */
.attached-media-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.attached-media-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.attached-media-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attached-media-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: rgba(23, 110, 135, 0.14);
  border: 1px solid rgba(82, 199, 221, 0.35);
  border-radius: var(--radius-md);
}

.attached-media-index {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-primary-soft);
  border: 1px solid rgba(82, 199, 221, 0.32);
  color: var(--accent-primary-text);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.attached-media-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.attached-media-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-media-order {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-solid);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-media-order:focus-visible {
  outline: 2px solid var(--accent-primary-text);
  outline-offset: 2px;
}

.btn-media-order:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@media (hover: hover) {
  .btn-media-order:not(:disabled):hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
  }
}

/* Алерт возврата на доработку */
.alert-revision {
  background: var(--status-pending-bg);
  border: 1px solid rgba(240, 179, 91, 0.36);
  border-left: 4px solid var(--status-pending-fg);
  border-radius: var(--radius-md);
  padding: 14px;
}

.alert-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--status-pending-fg);
  margin-bottom: 4px;
}

.alert-text {
  font-size: 13px;
  color: var(--text-primary);
}

/* ==============================================================================
   Живой предпросмотр публикации
   ============================================================================== */
.preview-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.preview-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.char-counter {
  font-size: 12px;
  color: var(--text-muted);
}

.char-counter.warning {
  color: var(--status-pending-fg);
  font-weight: 600;
}

.char-counter.danger {
  color: var(--status-danger-fg);
  font-weight: 700;
}

.post-preview-card {
  background: #101520;
  border: 1px solid rgba(82, 199, 221, 0.25);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-primary);
}

.post-preview-card b {
  font-weight: 700;
  color: #F4F9FC;
}

.post-preview-card a {
  color: var(--accent-primary-text);
  text-decoration: none;
  font-weight: 600;
}

/* ==============================================================================
   Кнопки действий
   ============================================================================== */
.form-actions {
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  z-index: 100;
}

.btn-primary-action {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  background: var(--accent-primary);
  color: var(--accent-contrast);
  border: 1px solid rgba(82, 199, 221, 0.38);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(6, 10, 16, 0.58);
  transition: background-color 0.15s ease, transform 0.08s ease;
}

.btn-primary-action:focus-visible {
  outline: 2px solid var(--accent-primary-text);
  outline-offset: 2px;
}

@media (hover: hover) {
  .btn-primary-action:hover {
    background: var(--accent-primary-hover);
  }
}

.btn-primary-action:active {
  transform: scale(0.99);
}

.btn-primary-action:disabled {
  background: #273143;
  color: #7E90A0;
  border-color: transparent;
  cursor: not-allowed;
  box-shadow: none;
}

/* ==============================================================================
   Список истории кейсов (поверх центрального фона bg_2)
   ============================================================================== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.empty-history-state {
  text-align: center;
  padding: 44px 20px;
  background: rgba(20, 24, 36, 0.78);
  border: 1px solid rgba(82, 199, 221, 0.22);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
}

.empty-history-icon {
  font-size: 34px;
  margin-bottom: 10px;
}

.case-card {
  background: rgba(22, 27, 40, 0.80);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.case-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.case-card-date {
  font-size: 11px;
  color: var(--text-muted);
}

.case-status-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.status-approved {
  color: var(--status-approved-fg);
  background: var(--status-approved-bg);
}

.status-unpublished {
  color: var(--status-unpublished-fg);
  background: var(--status-unpublished-bg);
}

.status-pending {
  color: var(--status-pending-fg);
  background: var(--status-pending-bg);
}

.status-revision {
  color: var(--status-danger-fg);
  background: var(--status-danger-bg);
}

.status-rejected {
  color: var(--status-rejected-fg);
  background: var(--status-rejected-bg);
}

.case-card-client {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.case-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.case-card-comment {
  background: var(--status-danger-bg);
  border-left: 3px solid var(--status-danger-fg);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.btn-edit-case {
  min-height: 44px;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-edit-case:focus-visible {
  outline: 2px solid var(--accent-primary-text);
  outline-offset: 2px;
}

@media (hover: hover) {
  .btn-edit-case:hover {
    background: var(--bg-hover);
  }
}

/* Уважение системной настройки снижения анимаций */
@media (prefers-reduced-motion: reduce) {
  .tma-bg-layer,
  .progress-bar-fill,
  .nav-tab,
  .chip-btn,
  .btn-primary-action {
    transition: none;
  }
}
