:root {
  --accent: #3b6ef5;
  --accent-hover: #2f5cd8;
  --accent-soft: #eef3ff;
  --text: #1c2437;
  --text-soft: #6b7690;
  --text-faint: #9aa4bb;
  --border: #e3e9f4;
  --danger: #d64545;
  --ok: #2ea36b;
  --radius: 20px;
}

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

html, body { height: 100%; }

body {
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(180deg, #fafcff 0%, #f1f5fc 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 620px;
  margin: 0 auto;
  padding: 56px 20px 40px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* Заголовок */
.header { text-align: center; margin-bottom: 36px; }
.header h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.subtitle { margin-top: 10px; color: var(--text-soft); font-size: 14px; }

/* Навигация */
.nav {
  margin-top: 18px;
  display: inline-flex;
  gap: 4px;
  background: #eaeffa;
  border-radius: 12px;
  padding: 4px;
}
.nav a {
  text-decoration: none;
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 9px;
  transition: background .15s, color .15s;
}
.nav a:hover { color: var(--text); }
.nav a.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(35, 60, 120, 0.10);
}

/* Карточка */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 10px 50px rgba(35, 60, 120, 0.08);
  padding: 28px;
}

/* Баннер про плагин */
.banner {
  background: #fff4e8;
  border: 1px solid #f5ddc0;
  color: #8a5a1e;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
}
.banner a { color: inherit; font-weight: 600; }

/* Дроп-зона */
.dropzone {
  border: 2px dashed #c9d6ee;
  border-radius: 16px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  color: var(--text-faint);
  transition: border-color .2s, background .2s, transform .1s;
  outline: none;
}
.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.01);
}
.dz-icon { width: 64px; height: 64px; margin-bottom: 14px; color: #b8c5e0; }
.dz-title { font-size: 18px; font-weight: 600; color: var(--text); }
.dz-hint { margin-top: 8px; font-size: 13px; line-height: 1.6; color: var(--text-faint); }

/* Список файлов */
.file-list { list-style: none; margin-top: 6px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 6px;
  border-bottom: 1px solid var(--border);
  animation: fadeIn .25s ease;
}
.file-item:last-child { border-bottom: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } }

.fi-icon { flex: none; width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 15px; }
.fi-main { flex: 1; min-width: 0; }
.fi-name { font-size: 14px; font-weight: 500; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.fi-meta { font-size: 12px; color: var(--text-faint); margin-top: 2px;
  display: flex; gap: 8px; align-items: center; }
.sig-badge {
  background: #e7f6ee; color: var(--ok);
  border-radius: 20px; padding: 1px 9px; font-size: 11px; font-weight: 600;
}
.fi-status { flex: none; font-size: 13px; color: var(--text-faint); }
.fi-status.ok { color: var(--ok); }
.fi-status.err { color: var(--danger); }

.fi-remove {
  flex: none; border: none; background: none; cursor: pointer;
  width: 28px; height: 28px; border-radius: 8px;
  color: var(--text-faint); font-size: 16px; line-height: 1;
  transition: background .15s, color .15s;
}
.fi-remove:hover { background: #fdeeee; color: var(--danger); }

/* Спиннер */
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin .7s linear infinite; display: inline-block;
  vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Кнопки */
.btn {
  border: none; cursor: pointer; font-family: inherit;
  font-size: 15px; font-weight: 600;
  border-radius: 14px; padding: 12px 22px;
  transition: background .15s, box-shadow .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }

.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 6px 20px rgba(59, 110, 245, 0.30);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-ghost {
  background: none; color: var(--accent);
  border: 1.5px solid #ccd9f5;
}
.btn-ghost:hover:not(:disabled) { background: var(--accent-soft); }

.btn-big { width: 100%; padding: 16px; font-size: 16px; margin-top: 20px; }

/* Ошибки */
.error-box {
  margin-top: 16px;
  background: #fdf0f0; border: 1px solid #f3d4d4; color: var(--danger);
  border-radius: 12px; padding: 12px 16px; font-size: 13px; line-height: 1.5;
  word-break: break-word;
}

/* Панель готовности */
.done-panel { margin-top: 24px; text-align: center; }
.done-title {
  font-size: 17px; font-weight: 600; color: var(--ok);
  margin-bottom: 4px;
}
.done-actions { display: flex; flex-direction: column; gap: 4px; }

/* Футер */
.footer {
  margin-top: 28px; text-align: center;
  font-size: 12.5px; color: var(--text-faint); line-height: 1.6;
}
.footer a { color: var(--text-soft); }

/* Модал */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(28, 36, 55, 0.35);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}
.modal {
  background: #fff; border-radius: var(--radius);
  box-shadow: 0 20px 70px rgba(20, 35, 80, 0.25);
  width: 100%; max-width: 480px;
  max-height: 85vh; display: flex; flex-direction: column;
  padding: 26px;
}
.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 18px; }

.cert-list { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.cert-loading { color: var(--text-faint); font-size: 14px; padding: 20px 0; text-align: center; }

.cert-item {
  border: 1.5px solid var(--border); border-radius: 14px;
  padding: 13px 16px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.cert-item:hover:not(.disabled) { border-color: #b8c9ef; }
.cert-item.selected { border-color: var(--accent); background: var(--accent-soft); }
.cert-item.disabled { opacity: .45; cursor: default; }
.cert-name { font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.cert-person { font-size: 13px; color: var(--text); margin-top: 3px; }
.cert-info { font-size: 12px; color: var(--text-faint); margin-top: 4px; line-height: 1.5; }
.cert-tag { font-size: 11px; font-weight: 600; color: var(--danger); }
.cert-tag.used { color: var(--text-faint); }

.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px;
}

/* Страница проверки */
.warn-badge {
  background: #fdf3e3; color: #b07b1e;
  border-radius: 20px; padding: 1px 9px; font-size: 11px; font-weight: 600;
}

.results { margin-top: 22px; display: flex; flex-direction: column; gap: 18px; }
.res-doc-name { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.res-doc + .res-doc { border-top: 1px solid var(--border); padding-top: 18px; }

.res-sig {
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.res-sig.res-ok { border-color: #cdeeda; background: #f4fcf7; }
.res-sig.res-fail { border-color: #f3d4d4; background: #fdf6f6; }

.res-status { font-size: 14.5px; font-weight: 700; }
.res-ok .res-status { color: var(--ok); }
.res-fail .res-status { color: var(--danger); }

.res-sig-file { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; word-break: break-all; }
.res-error { font-size: 13px; color: var(--danger); margin-top: 8px; }

.res-signer {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.hidden { display: none !important; }

@media (max-width: 480px) {
  .page { padding-top: 32px; }
  .card { padding: 20px; }
  .dropzone { padding: 36px 16px; }
}
