:root {
  --bg: #ffffff;
  --sidebar: #f3f6fa;
  --line: #dfe5ee;
  --muted-line: #e2e7ee;
  --text: #1f2937;
  --muted: #8a95a3;
  --blue: #2c7bc5;
  --blue-soft: #eaf2ff;
  --bubble: #f8fafc;
  --user: #e8eef7;
  --danger: #d72121;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
  letter-spacing: -0.011em;
}

button,
input {
  font: inherit;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 300px;
  padding: 32px 22px;
  background: var(--sidebar);
  border-right: 1px solid #eef1f5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 27px;
  font-weight: 760;
  letter-spacing: 0;
}

.brand-mark,
.avatar,
.composer button {
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--blue-soft);
  color: var(--blue);
}

.brand-mark {
  width: 36px;
  height: 36px;
  font-size: 18px;
}

.new-chat {
  width: 100%;
  min-height: 54px;
  margin: 36px 0 26px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #d8e0ea;
  border-radius: 14px;
  background: #fff;
  color: #3b4654;
  text-align: left;
  cursor: default;
}

.new-chat span {
  font-size: 26px;
  line-height: 1;
}

.sidebar-lines span {
  display: block;
  height: 9px;
  margin: 12px 0;
  border-radius: 999px;
  background: #dfe4eb;
}

.sidebar-lines span:nth-child(1) {
  width: 78%;
}

.sidebar-lines span:nth-child(2) {
  width: 56%;
}

.sidebar-lines span:nth-child(3) {
  width: 68%;
}

.sidebar-lines span:nth-child(4) {
  width: 48%;
}

.progress-list {
  margin-top: 34px;
  display: grid;
  gap: 10px;
}

.progress-item {
  padding: 11px 12px;
  border-radius: 8px;
  color: #7b8795;
}

.progress-item span {
  display: inline-block;
  min-width: 32px;
  font-weight: 780;
}

.progress-item b {
  font-size: 14px;
  font-weight: 650;
}

.progress-item.active {
  background: #fff;
  color: #263243;
  box-shadow: inset 0 0 0 1px #dfe6ef;
}

.progress-item.done {
  color: var(--blue);
}

.workspace {
  min-height: 100vh;
  margin-left: 300px;
}

.screen {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.intro-screen,
.survey-screen,
.done-screen {
  display: grid;
  place-items: center;
  padding: 48px;
}

.intro-copy,
.survey-card,
.done-card {
  width: min(780px, 100%);
}

.intro-copy h1,
.survey-card h2,
.done-card h2 {
  margin: 0 0 18px;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: 0;
}

.intro-copy p,
.survey-head p,
.done-card p {
  color: #657282;
  font-size: 18px;
  line-height: 1.55;
}

.participant-field {
  display: grid;
  gap: 8px;
  margin: 30px 0 18px;
  color: #657282;
  font-weight: 650;
}

.participant-field input {
  width: 260px;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
}

.status-message {
  margin: 24px 0 16px;
  color: #657282;
  font-size: 16px;
  line-height: 1.45;
}

.status-message.error {
  color: #b42318;
}

.primary-action {
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 10px;
  background: #1f2937;
  color: #fff;
  font-weight: 720;
  cursor: pointer;
}

.chat-screen {
  position: relative;
  padding: 38px 56px 124px;
}

.chat-scroll {
  width: 100%;
  max-width: none;
  margin: 0;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.user-message {
  justify-content: flex-end;
  width: 100%;
}

.bubble {
  max-width: min(720px, 72%);
  padding: 13px 18px;
  border-radius: 16px;
  background: var(--user);
  font-size: 16px;
  line-height: 1.45;
}

.avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  font-size: 15px;
  border-radius: 12px;
}

.assistant-stack {
  width: min(760px, 100%);
}

.answer-card,
.process-card {
  border: 1px solid #e2e7ee;
  border-radius: 16px;
  background: #f8fafc;
}

.answer-card {
  padding: 16px 20px;
  font-size: 16px;
  line-height: 1.5;
}

.answer-card.single-line {
  display: inline-block;
}

.answer-heading {
  margin: 0 0 18px;
}

.answer-summary {
  margin: 22px 0 0;
  font-size: 22px;
}

.answer-summary.large {
  font-size: 21px;
}

.result-table {
  border-collapse: collapse;
  font-size: 20px;
}

.result-table th,
.result-table td {
  padding: 10px 16px;
  border: 1px solid var(--line);
  text-align: left;
}

.result-table th {
  background: #eef3f8;
  font-weight: 780;
}

.process-card {
  margin-top: 18px;
  padding: 14px 18px 18px;
  color: #657282;
}

.process-card summary {
  cursor: pointer;
  color: #7b8795;
  font-weight: 780;
  font-size: 18px;
}

.process-card dl {
  margin: 12px 0 0;
}

.process-row {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 18px;
  padding: 9px 0;
  border-top: 1px solid #e7ebf1;
}

.process-row dt {
  color: #8b96a5;
  font-weight: 780;
}

.process-row dd {
  margin: 0;
}

code {
  padding: 2px 7px;
  border-radius: 5px;
  background: #edf1f6;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.trend-chart {
  display: block;
  width: min(560px, 100%);
  margin: 8px 0 24px 18px;
}

.trend-chart .axis {
  stroke: #d8e0ea;
  stroke-width: 2;
}

.trend-chart polyline {
  fill: none;
  stroke: var(--blue);
  stroke-width: 3;
}

.trend-chart circle {
  fill: var(--blue);
}

.trend-chart .release {
  stroke: var(--danger);
  stroke-dasharray: 6 5;
  stroke-width: 2;
}

.trend-chart text {
  font-size: 14px;
  fill: #97a2b1;
}

.trend-chart .release-label {
  fill: var(--danger);
}

.chat-screen {
  display: flex;
  flex-direction: column;
}

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 24px;
}

.task-banner {
  margin-bottom: 20px;
  padding: 18px 22px;
  border: 1px solid #dbe6f3;
  border-radius: 14px;
  background: var(--blue-soft);
}

.task-banner-head {
  font-weight: 780;
  font-size: 15px;
  color: var(--blue);
  margin-bottom: 6px;
}

.task-banner p {
  margin: 0;
  color: #4a5666;
  font-size: 16px;
  line-height: 1.5;
}

.task-banner .task-hint {
  margin-top: 8px;
  color: #8d98a7;
  font-size: 14px;
}

.finish-btn {
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.sidebar-finish {
  width: 100%;
  min-height: 54px;
  margin: 36px 0 26px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #d8e0ea;
  border-radius: 14px;
  background: #fff;
  color: var(--blue);
  font-weight: 720;
  font-size: 16px;
}

.sidebar-finish:hover {
  background: var(--blue-soft);
  border-color: var(--blue);
}

.sidebar-finish.highlight {
  border-color: var(--blue);
  background: var(--blue-soft);
  animation: finish-pulse 1.6s ease-in-out infinite;
}

@keyframes finish-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(44, 123, 197, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(44, 123, 197, 0); }
}

.steps-list {
  margin: 22px 0 30px;
  padding-left: 22px;
  color: #4a5666;
  font-size: 17px;
  line-height: 1.7;
}

.steps-list li {
  margin-bottom: 8px;
}

.empty-state {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
}

.empty-mark {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 28px;
}

.empty-state h1 {
  margin: 8px 0 0;
  font-size: 34px;
}

.empty-state p {
  max-width: 560px;
  color: #657282;
  font-size: 17px;
  line-height: 1.5;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
}

.suggestions button {
  padding: 12px 18px;
  border: 1px solid #d8e0ea;
  border-radius: 14px;
  background: #fff;
  color: #3b4654;
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.suggestions button:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.chat-answer {
  font-size: 16px;
  line-height: 1.55;
}

.chat-answer p {
  margin: 0 0 12px;
}

.chat-answer p:last-child,
.chat-answer ul:last-child,
.chat-answer ol:last-child,
.chat-answer .markdown-table-wrap:last-child,
.chat-answer .formula-line:last-child {
  margin-bottom: 0;
}

.chat-answer ul,
.chat-answer ol {
  margin: 8px 0 12px;
  padding-left: 22px;
}

.chat-answer li {
  margin: 4px 0;
}

.chat-answer h3,
.chat-answer h4,
.chat-answer h5 {
  margin: 14px 0 8px;
  color: #243144;
  font-size: 17px;
  line-height: 1.35;
}

.chat-answer h3:first-child,
.chat-answer h4:first-child,
.chat-answer h5:first-child {
  margin-top: 0;
}

.chat-answer strong {
  font-weight: 780;
}

.chat-answer em {
  font-style: italic;
}

.formula-line {
  margin: 8px 0 12px;
}

.formula-line code {
  display: block;
  width: 100%;
  padding: 10px 12px;
  overflow-x: auto;
  border: 1px solid #dfe6ef;
  border-radius: 8px;
  background: #fff;
  color: #233044;
  white-space: pre-wrap;
}

.markdown-table-wrap {
  max-width: 100%;
  margin: 10px 0 14px;
  overflow-x: auto;
}

.markdown-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  background: #fff;
}

.markdown-table-wrap th,
.markdown-table-wrap td {
  padding: 9px 10px;
  border: 1px solid #dfe6ef;
  text-align: left;
  vertical-align: top;
}

.markdown-table-wrap th {
  background: #eef3f8;
  font-weight: 780;
}

.typing {
  display: inline-flex;
  gap: 6px;
}

.typing i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #c2ccd9;
  animation: typing 1s infinite ease-in-out;
}

.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.error-text {
  color: var(--danger);
  font-size: 16px;
}

.retry-btn {
  margin-top: 10px;
  padding: 8px 16px;
  border: 1px solid var(--blue);
  border-radius: 10px;
  background: #fff;
  color: var(--blue);
  font-weight: 650;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.12s;
}

.retry-btn:hover {
  background: var(--blue-soft);
}

.composer {
  position: fixed;
  right: 56px;
  bottom: 28px;
  left: 356px;
  max-width: none;
  min-height: 58px;
  padding: 7px 10px 7px 22px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  border: 1px solid #d9e1eb;
  border-radius: 24px;
  background: #fff;
}

.composer textarea {
  flex: 1;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  padding: 11px 0;
  max-height: 200px;
  overflow-y: auto;
}

.composer textarea::placeholder {
  color: #a2acba;
}

.composer button {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(31, 41, 55, 0.32);
  backdrop-filter: blur(2px);
  animation: overlay-in 0.18s ease;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: min(720px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(31, 41, 55, 0.28) !important;
  animation: modal-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.survey-card {
  padding: 34px;
  border: 1px solid #e0e6ee;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 60px rgba(31, 41, 55, 0.08);
}

.survey-card.wide {
  width: min(1240px, 100%);
}

.readiness-screen,
.survey-screen.full {
  padding: 40px 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue) !important;
  font-size: 14px !important;
  font-weight: 780;
  text-transform: uppercase;
}

.scale-caption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 0 14px;
  color: #7f8a99;
  font-size: 14px;
}

.survey-form {
  display: grid;
  gap: 14px;
  margin-bottom: 24px;
}

.survey-form.compact {
  gap: 10px;
}

.likert-row {
  display: block;
  margin: 0;
  padding: 16px 18px;
  border: 1px solid #eef1f6;
  border-radius: 12px;
  background: #fff;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.likert-row:hover {
  border-color: #d6e2f2;
  box-shadow: 0 2px 10px rgba(44, 123, 197, 0.06);
}

.likert-row legend {
  display: block;
  width: 100%;
  padding: 0;
  margin-bottom: 14px;
  font-size: 15px;
  line-height: 1.45;
  color: #2b3441;
}

.radio-grid {
  display: grid;
  grid-template-columns: repeat(7, 38px);
  gap: 8px;
}

/* В широком опроснике — вопрос слева, шкала справа */
.survey-card.wide .likert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.survey-card.wide .likert-row legend {
  margin-bottom: 0;
  flex: 1;
}

.survey-card.wide .radio-grid {
  flex: 0 0 auto;
}

.radio-cell {
  position: relative;
  cursor: pointer;
}

.radio-cell input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.radio-cell span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid #d6deea;
  background: #fff;
  color: #8a95a3;
  font-size: 14px;
  font-weight: 650;
  transition: all 0.12s;
}

.radio-cell:hover span {
  border-color: var(--blue);
  color: var(--blue);
}

.radio-cell input:checked + span {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 4px 10px rgba(44, 123, 197, 0.3);
}

.radio-cell input:focus-visible + span {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.scale-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 22px;
  margin-right: 10px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 780;
  vertical-align: 1px;
}

.scale-caption {
  font-weight: 600;
}

.scale-caption span:first-child { color: #c2683a; }
.scale-caption span:last-child { color: #2c7bc5; }

.needs-attention {
  outline: 2px solid rgba(215, 33, 33, 0.25);
  outline-offset: 8px;
}

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: 100%;
    padding: 22px;
    border-right: 0;
  }

  .sidebar-lines {
    display: none;
  }

  .workspace {
    margin-left: 0;
  }

  .chat-screen {
    padding: 24px 18px 116px;
  }

  .bubble,
  .answer-card {
    font-size: 19px;
  }

  .assistant-message {
    gap: 10px;
  }

  .process-row,
  .likert-row {
    grid-template-columns: 1fr;
  }

  .radio-grid {
    grid-template-columns: repeat(7, minmax(28px, 1fr));
  }

  .composer {
    left: 18px;
    right: 18px;
  }

  .intro-screen,
  .survey-screen,
  .done-screen {
    padding: 22px;
    place-items: start center;
  }
}

.login-body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(160deg, #eef2f8 0%, #e3ecf7 100%);
}

.login-card {
  width: min(420px, 100%);
  padding: 36px;
  border: 1px solid #e2e8f2;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(31, 41, 55, 0.12);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.login-brand .brand-mark {
  width: 44px;
  height: 44px;
  font-size: 22px;
}

.login-title {
  font-size: 19px;
  font-weight: 740;
}

.login-sub {
  margin-top: 2px;
  color: #8a95a3;
  font-size: 13px;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-field {
  display: grid;
  gap: 7px;
  color: #4a5666;
  font-size: 14px;
  font-weight: 600;
}

.login-field input {
  height: 46px;
  padding: 0 14px;
  border: 1px solid #d8e0ea;
  border-radius: 11px;
  background: #fff;
  color: var(--text);
  font-size: 15px;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.login-field input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(44, 123, 197, 0.15);
}

.login-btn {
  margin-top: 6px;
  width: 100%;
  background: var(--blue);
}

.login-error {
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fdeaea;
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
}

.admin-body {
  min-height: 100vh;
  background: #eef2f8;
  color: #1f2937;
}

.admin-shell {
  width: min(1500px, calc(100% - 56px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.admin-header h1 {
  margin: 4px 0 0;
  font-size: 30px;
  letter-spacing: -0.01em;
}

.admin-header-actions {
  display: flex;
  gap: 10px;
}

.admin-action {
  min-height: 44px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 6px 16px rgba(44, 123, 197, 0.25);
  transition: transform 0.12s, box-shadow 0.12s;
}

.admin-action::before {
  content: "↓";
  font-size: 15px;
}

.admin-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(44, 123, 197, 0.32);
}

.admin-action.secondary {
  background: #fff;
  color: #253044;
  box-shadow: 0 2px 8px rgba(31, 41, 55, 0.06);
}

.admin-action.secondary::before {
  content: "";
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.admin-stats div,
.admin-section {
  border: 1px solid #e2e8f2;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(31, 41, 55, 0.04);
}

.admin-stats div {
  position: relative;
  padding: 18px 20px;
  overflow: hidden;
}

.admin-stats div::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--blue);
}

.admin-stats span {
  display: block;
  color: #6b7788;
  font-size: 13px;
  font-weight: 600;
}

.admin-stats b {
  display: block;
  margin-top: 8px;
  font-size: 32px;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.admin-section {
  margin-top: 20px;
  padding: 22px 24px;
}

.admin-section h2 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 740;
}

.admin-hint {
  margin: -8px 0 16px;
  color: #6b7788;
  font-size: 13px;
  line-height: 1.5;
}

.muted-n {
  color: #97a2b1;
  font-size: 12px;
  font-weight: 500;
}

.diff {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  background: #f0f2f6;
  color: #6b7788;
}

.diff-up {
  background: #e3f5ec;
  color: #1a8a52;
}

.diff-down {
  background: #fdeaea;
  color: var(--danger);
}

.admin-details {
  margin-top: 20px;
  border: 1px solid #e2e8f2;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(31, 41, 55, 0.04);
}

.admin-details > summary {
  padding: 18px 24px;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  color: #2b3441;
  list-style: none;
}

.admin-details > summary::-webkit-details-marker {
  display: none;
}

.admin-details > summary::before {
  content: "▸ ";
  color: var(--blue);
}

.admin-details[open] > summary::before {
  content: "▾ ";
}

.admin-details .admin-grid {
  padding: 0 18px 18px;
}

.admin-details .admin-section {
  margin-top: 0;
}

.admin-section h3 {
  margin: 18px 0 8px;
  color: #526071;
  font-size: 14px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
}

.admin-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th,
.admin-table td {
  padding: 12px 12px;
  border-bottom: 1px solid #eef1f6;
  text-align: left;
  vertical-align: middle;
}

.admin-table thead th {
  position: sticky;
  top: 0;
  background: #f7f9fc;
  color: #6b7788;
  font-weight: 740;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.admin-table tbody tr {
  transition: background 0.1s;
}

.admin-table tbody tr:hover {
  background: #f5f8fd;
}

.admin-table code {
  background: #eef2f8;
  font-weight: 650;
}

.compact-table {
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.badge-done {
  background: #e3f5ec;
  color: #1a8a52;
}

.badge-progress {
  background: #fff2dd;
  color: #b9791b;
}

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 650;
}

.tag-open {
  background: #eaf2ff;
  color: #2c7bc5;
}

.tag-closed {
  background: #f0f2f6;
  color: #6b7788;
}

.sets-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.sets-cell .tag {
  font-size: 11px;
  padding: 2px 8px;
}

.admin-links {
  white-space: nowrap;
}

.admin-links a {
  margin-right: 8px;
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid #d8e0ea;
  color: var(--blue);
  font-weight: 650;
  font-size: 13px;
  text-decoration: none;
  transition: background 0.1s;
}

.admin-links a:hover {
  background: var(--blue-soft);
}

.admin-links form {
  display: inline;
  margin: 0;
}

.link-btn {
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid #f0c9c9;
  background: #fff;
  color: var(--danger);
  font-weight: 650;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}

.link-btn:hover {
  background: #fdeaea;
}

.link-btn:disabled {
  border-color: #e4e9f0;
  background: #f7f9fc;
  color: #a6afbd;
  cursor: not-allowed;
}

.link-btn:disabled:hover {
  background: #f7f9fc;
}

.restore-btn {
  border-color: #b9dfcb;
  color: #1a8a52;
}

.restore-btn:hover {
  background: #e3f5ec;
}

.permanent-btn {
  border-color: #e6a9a9;
  background: #fff7f7;
}

.trash-section:target {
  outline: 3px solid rgba(44, 123, 197, 0.18);
  outline-offset: 4px;
}

.progress-bar {
  width: 130px;
  height: 8px;
  margin-bottom: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eef5;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2c7bc5, #4f9be0);
}

.chat-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.chat-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: 1px solid #d8e0ea;
  border-radius: 11px;
  background: #fff;
  color: #4a5666;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.12s;
}

.chat-tab:hover {
  border-color: var(--blue);
}

.chat-tab.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.chat-tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  font-size: 12px;
}

.chat-tab.active .chat-tab-count {
  background: rgba(255, 255, 255, 0.25);
}

.chat-thread {
  display: none;
}

.chat-thread.active {
  display: block;
}

.chat-thread-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #6b7788;
  font-size: 13px;
  font-weight: 650;
}

.chat-thread-head form {
  margin: 0;
}

.chat-thread-scroll {
  max-height: 460px;
  overflow-y: auto;
  padding: 14px 16px;
  border: 1px solid #eef1f6;
  border-radius: 14px;
  background: #f7f9fc;
}

.thread-msg {
  display: flex;
  margin-bottom: 12px;
}

.thread-msg.user {
  justify-content: flex-end;
}

.thread-bubble {
  max-width: 78%;
  padding: 11px 15px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.thread-msg.user .thread-bubble {
  background: var(--user);
  border-bottom-right-radius: 4px;
}

.thread-msg.assistant .thread-bubble {
  background: #fff;
  border: 1px solid #e7ebf1;
  border-bottom-left-radius: 4px;
}

.admin-empty {
  margin: 0;
  color: #7a8696;
}

@media (max-width: 1000px) {
  .admin-stats,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
