@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,600;0,9..40,700;1,9..40,400&display=swap");

:root {
  --bg: #f7f9ff;
  --surface: #ffffff;
  --border: #e4e9fb;
  --text: #10214a;
  --muted: #6c7897;
  --accent: #4d5dff;
  --accent-dim: #3d4cef;
  --danger: #d84f61;
  --radius: 10px;
  --font: "DM Sans", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 8% -12%, #eaf0ff 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #f1edff 0%, transparent 52%), var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

nav.tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
  min-width: 0;
}

.userbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.35rem;
}

/* Как «Запустить анализ» (.btn); «Выйти» — .btn.btn-ghost без заливки */
.userbar .userbar-btn {
  -webkit-appearance: none;
  appearance: none;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.userbar .btn.btn-ghost:hover:not(:disabled) {
  background: rgba(77, 93, 255, 0.08);
  color: var(--text);
}

.profile-modal-body .profile-role {
  margin: 0 0 0.75rem;
}

.profile-modal-body .profile-meta {
  margin: 1rem 0 0;
  font-size: 0.88rem;
}

.profile-modal-body .profile-warning {
  margin: 0.75rem 0 0;
}

.profile-modal-body .profile-password-block {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.profile-modal-body .profile-password-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.profile-modal-body .js-change-password-form .status {
  min-height: 1.1rem;
  margin-top: 0.75rem;
}

.profile-modal-body dl.profile-kv {
  margin: 0;
}

.profile-modal-body dl.profile-kv dt {
  margin: 0.65rem 0 0;
  font-weight: 600;
  font-size: 0.92rem;
}

.profile-modal-body dl.profile-kv dt:first-child {
  margin-top: 0;
}

.profile-modal-body dl.profile-kv dd {
  margin: 0.2rem 0 0;
  padding: 0;
  font-size: 0.95rem;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.92em;
}

.logout-form {
  display: inline;
  margin: 0;
}

.btn-text {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

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

nav.tabs a {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

nav.tabs a:hover {
  color: var(--text);
  background: rgba(77, 93, 255, 0.08);
  text-decoration: none;
}

nav.tabs a.active {
  background: #f2f5ff;
  color: var(--text);
  border: 1px solid var(--border);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 14px 36px rgba(25, 56, 130, 0.08);
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 0.75rem;
  font-weight: 700;
}

p.lead {
  color: var(--muted);
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}

.drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  margin-bottom: 1rem;
  transition: border-color 0.15s, background 0.15s;
}

.drop.drag {
  border-color: var(--accent);
  background: rgba(77, 93, 255, 0.08);
}

/* Юридический блок: тот же цвет, что у «Загрузите видеозапись» (.lead), мельче кегль */
.card p.lead.upload-disclaimer {
  font-size: 0.72rem;
  line-height: 1.45;
  margin: 0 0 1rem;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.2rem;
  border-radius: 8px;
  border: none;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}

.btn:hover:not(:disabled) {
  background: var(--accent-dim);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.status {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.results {
  margin-top: 1.75rem;
  display: none;
}

.results.visible {
  display: block;
}

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field .value {
  background: #f8faff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92rem;
}

.field .value.compact {
  white-space: normal;
}

table.history {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

table.history th,
table.history td {
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

table.history th {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

table.history tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}

table.history tbody tr:hover {
  background: #f5f7ff;
}

table.history th.history-actions-col,
table.history td.history-actions {
  text-align: right;
  width: 1%;
  white-space: nowrap;
}

table.history .btn-compact {
  font-size: 0.85rem;
  padding: 0.28rem 0.65rem;
}

.history-failed-tag {
  margin-left: 0.5rem;
  font-size: 0.8rem;
}

.detail-delete-row {
  margin-top: 1.25rem;
  margin-bottom: 0;
}

.empty {
  color: var(--muted);
  padding: 1rem 0;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-top: 0.5rem;
}

.stack-form .form-label:first-child {
  margin-top: 0;
}

.form-input {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f9fbff;
  color: var(--text);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
}

.form-check input {
  width: 1rem;
  height: 1rem;
}

table.admin-table code {
  font-size: 0.85em;
  color: var(--muted);
}

table.admin-table th.admin-actions-col,
table.admin-table td.admin-actions {
  text-align: right;
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
}

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

.back {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

@media (max-width: 600px) {
  header.top {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Блокировка контента при исчерпанном демо (модальное окно поверх) */
.cabinet-demo-locked-body .wrap > .card {
  opacity: 0.28;
  pointer-events: none;
}

.cabinet-demo-locked-body header.top {
  opacity: 1;
  pointer-events: auto;
}

.modal-root .modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(16, 33, 74, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-root .modal-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 520px;
  width: 100%;
  max-height: min(86vh, 640px);
  overflow: auto;
  padding: 1.35rem 1.5rem;
  box-shadow: 0 24px 70px rgba(16, 33, 74, 0.2);
}

.modal-title {
  font-size: 1.2rem;
  margin: 0 0 1rem;
  font-weight: 700;
}

.modal-body.doc-stub {
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.modal-body.doc-stub .legal-doc-text {
  white-space: pre-wrap;
  line-height: 1.45;
  margin: 0 0 1rem;
}

.modal-body .muted-stub {
  color: var(--muted);
  font-size: 0.88rem;
}

.modal-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.quota-line {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  background: #f8faff;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.criteria-report {
  margin: 1rem 0 1.1rem;
  padding: 1rem 1.05rem;
  border: 1px solid #e8edff;
  border-radius: 14px;
  background: #fbfcff;
}

.criteria-report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.15rem;
}

.criteria-report-header-text {
  min-width: 0;
  flex: 1;
}

.criteria-report-kicker {
  margin: 0 0 0.35rem;
  color: #8b96b5;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.criteria-report-title {
  margin: 0;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.criteria-report-badge {
  flex-shrink: 0;
  width: 4.35rem;
  height: 4.35rem;
  border-radius: 50%;
  border: 2px solid rgba(77, 93, 255, 0.45);
  background: linear-gradient(145deg, #eef2ff 0%, #f7f9ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(77, 93, 255, 0.12);
}

.criteria-report-badge-score {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-align: center;
  padding: 0 0.2rem;
}

.criteria-report-badge-score.criteria-report-badge-empty {
  color: var(--muted);
  font-size: 1.1rem;
}

.criteria-report-divider {
  height: 1px;
  margin: 1rem 0 0.85rem;
  background: linear-gradient(90deg, transparent, #dfe6f8 12%, #dfe6f8 88%, transparent);
  border: none;
}

.criteria-card-title {
  margin: 0 0 0.85rem;
  color: #647293;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.criteria-list {
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
}

.criteria-item {
  display: flex;
  flex-direction: column;
  gap: 0.34rem;
}

.criteria-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
}

.criteria-name {
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 700;
}

.criteria-score {
  color: #425171;
  font-size: 1.02rem;
  font-weight: 700;
}

.criteria-bar {
  position: relative;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: #e9eef9;
  overflow: hidden;
}

.criteria-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4d5dff 0%, #5f6cff 100%);
}

.criteria-footnote {
  margin-top: 0.95rem;
  color: #647293;
  font-size: 0.9rem;
}
