:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --panel-2: #fbfcfd;
  --text: #161b22;
  --text-strong: #0f172a;
  --muted: #667085;
  --line: #e6e9ef;
  --soft-line: #f1f3f6;
  --accent: #f26a00;
  --accent-2: #14715f;
  --accent-soft: #fff3e8;
  --control: #f3f5f8;
  --control-hover: #e9edf3;
  --danger: #b42318;
  --warn: #b45309;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent-2); }
button, input, select, textarea { font: inherit; }
button {
  min-height: 36px;
  border: 1px solid transparent;
  background: var(--control);
  color: #263241;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.25;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}
button:hover { background: var(--control-hover); }
button:active { transform: translateY(1px); }
button.primary {
  background: var(--text-strong);
  color: #fff;
  border-color: var(--text-strong);
  box-shadow: 0 8px 18px rgba(15, 23, 42, .12);
}
button.primary:hover { background: #273244; border-color: #273244; }
button.danger { color: var(--danger); background: #fff1f2; }
button.danger:hover { background: #ffe4e6; }
button:disabled { opacity: .55; cursor: not-allowed; }
input, select, textarea {
  width: 100%;
  border: 1px solid #d9dee7;
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  min-height: 42px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
select {
  border-color: #dfe4ec;
  background-color: #fff;
}
.public-shell input,
.public-shell select,
.public-shell textarea {
  min-height: 40px;
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid var(--accent-soft);
  border-color: #ffb36b;
}
label {
  display: grid;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  color: #303948;
}
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 276px 1fr;
}
.sidebar {
  background: #fff;
  color: var(--text);
  padding: 30px 22px;
  border-right: 1px solid var(--line);
}
.brand {
  font-weight: 800;
  margin-bottom: 30px;
  font-size: 20px;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand img {
  width: 136px;
  height: auto;
  display: block;
  object-fit: contain;
  object-position: center;
}
.nav { display: grid; gap: 2px; }
.nav button {
  background: transparent;
  color: #4b5565;
  border-color: transparent;
  text-align: left;
  padding: 10px 12px;
  font-weight: 650;
  line-height: 1.25;
  border-radius: 10px;
  min-height: 42px;
}
.nav button.active {
  background: #fff7ed;
  border-color: transparent;
  color: #9a3412;
  font-weight: 700;
  box-shadow: none;
}
.nav button:hover { background: #f7f8fa; border-color: transparent; }
.main { padding: 30px 34px 48px; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
  padding: 0;
  border-bottom: 0;
}
.page {
  max-width: 1180px;
  margin: 0;
}
.public-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 20px 18px 48px;
}
.public-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 24px;
}
.public-header img {
  width: 132px;
  height: auto;
  display: block;
  object-fit: contain;
  object-position: left top;
}
.public-header a {
  color: #98a2b3;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.public-header a:hover {
  color: #475467;
}
.public-hero {
  margin-bottom: 18px;
}
.public-hero h1 {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(32px, 4.4vw, 46px);
  line-height: .98;
  letter-spacing: 0;
}
.public-hero p {
  max-width: 610px;
  margin: 10px 0 0;
  color: #667085;
  font-size: 16px;
  line-height: 1.42;
}
.eyebrow {
  margin: 0 0 12px !important;
  color: #d35400 !important;
  font-size: 13px !important;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.public-info {
  margin: 30px 0 0;
  padding: 18px 0 0;
  color: #747b87;
  font-size: 14px;
  line-height: 1.38;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}
.public-info p {
  margin: 0;
}
.public-info h2 {
  margin: 0 0 5px;
  color: #626a76;
  font-size: 14px;
  line-height: 1.25;
}
.public-info a {
  color: #68717e;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.footer-info {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  gap: 16px 28px;
}
.footer-region {
  grid-column: 1 / -1;
  padding-top: 4px;
}
.public-form {
  display: grid;
  gap: 12px;
}
.form-section {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .035);
}
.section-number {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff7ed;
  color: #c2410c;
  font-weight: 900;
}
.section-content h2 {
  margin: 2px 0 12px;
  color: var(--text-strong);
  font-size: 20px;
}
.section-note {
  margin: -6px 0 12px;
  color: #667085;
  line-height: 1.45;
}
.field-grid {
  display: grid;
  gap: 12px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .035);
}
.stack { display: grid; gap: 20px; }
.public-shell .stack { gap: 18px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.title { margin: 0 0 8px; font-size: 28px; letter-spacing: 0; line-height: 1.15; font-weight: 850; color: var(--text-strong); }
.subtitle { margin: 0 0 20px; color: var(--muted); line-height: 1.5; }
.upload-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 92px;
  border: 1.5px dashed #c8d0dc;
  border-radius: 14px;
  padding: 16px;
  background: #fbfcfd;
}
.upload-card.drag {
  border-color: #f26a00;
  background: #fff7ed;
}
.upload-card strong {
  display: block;
  color: var(--text-strong);
  margin-bottom: 4px;
}
.upload-card span {
  color: #667085;
}
.upload-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff7ed;
  color: #d35400;
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
}
.form-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 6px 0 0;
}
.submit-button {
  min-height: 46px;
  padding-inline: 22px;
}
.file-list, .audit-list { display: grid; gap: 12px; }
.file-list.compact:empty {
  display: none;
}
.file-list.compact {
  gap: 6px;
  margin-top: 8px;
}
.upload-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--soft-line);
}
.upload-file-row:last-child {
  border-bottom: 0;
}
.upload-file-row strong {
  display: block;
  font-size: 14px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.upload-file-row .small {
  font-size: 12px;
}
.file-item, .audit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 13px 14px;
  background: var(--panel-2);
}
.settings-help {
  padding: 14px 16px;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  background: #fff7ed;
  color: #475467;
  font-size: 14px;
  line-height: 1.45;
}
.settings-help strong {
  display: block;
  margin-bottom: 6px;
  color: #1f2937;
}
.settings-help ol {
  margin: 0;
  padding-left: 20px;
}
.settings-help code,
.chat-item code {
  padding: 3px 6px;
  border-radius: 7px;
  background: #fff;
  color: #9a3412;
  font-size: 13px;
  font-weight: 800;
}
.chat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fbfcfd;
}
.chat-item code {
  white-space: nowrap;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: #eef1f5;
  color: #414b5a;
  white-space: nowrap;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
.status-pill.ok { background: #dcfce7; color: #166534; }
.status-pill.warn { background: #fff2cc; color: #8a4b00; }
.status-pill.bad { background: #fee2e2; color: #991b1b; }
.status-dot {
  width: 8px;
  height: 8px;
  display: inline-flex;
  border-radius: 50%;
  flex: 0 0 auto;
}
.status-dot.ok { background: #22c55e; }
.status-dot.warn { background: #f59e0b; }
.status-dot.bad { background: #ef4444; }
.document-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}
.document-card.needs-attention {
  border-color: #f7cc8f;
  background: #fffdf8;
}
.document-card.blocked {
  border-color: #fecaca;
  background: #fffafa;
}
.document-main {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.document-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #f2f4f7;
  color: #475467;
  font-size: 12px;
  font-weight: 850;
}
.document-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 7px;
  overflow-wrap: anywhere;
}
.document-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: #667085;
  font-size: 13px;
}
.document-meta > span:not(.status-pill) {
  display: inline-flex;
  align-items: center;
}
.document-meta > span:not(.status-pill)::after {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #c7ced9;
  margin-left: 8px;
}
.document-warning {
  margin-top: 12px;
  max-width: 760px;
  border-left: 3px solid #f59e0b;
  padding: 9px 11px;
  background: #fff7ed;
  color: #7c2d12;
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  line-height: 1.45;
}
.compact-warning {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.35;
}
.document-warning span { color: #9a3412; }
.document-actions {
  min-width: 190px;
  display: grid;
  justify-items: stretch;
  gap: 8px;
}
.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(15, 23, 42, .52);
}
.preview-dialog {
  width: min(1120px, 100%);
  height: min(820px, calc(100vh - 44px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
}
.preview-header,
.preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.preview-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}
.preview-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}
.preview-zoom-controls button {
  min-height: 30px;
  min-width: 32px;
  padding: 5px 9px;
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}
.preview-zoom-controls span {
  min-width: 78px;
  color: #475467;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}
.preview-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}
.preview-body {
  min-height: 0;
  background: #f6f7f9;
}
.image-preview-body {
  overflow: hidden;
}
.image-preview-stage {
  width: 100%;
  height: 100%;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 18px;
}
.image-preview-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  object-fit: contain;
  box-shadow: 0 8px 28px rgba(15, 23, 42, .16);
  background: #fff;
}
.preview-body iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #fff;
}
.preview-link {
  color: #9a3412;
  font-weight: 800;
  text-decoration: none;
}
.preview-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.document-primary {
  background: #161b22;
  border-color: #161b22;
  color: #fff;
}
.document-primary:hover {
  background: #2a313b;
  border-color: #2a313b;
}
.soft-action {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fed7aa;
}
.soft-action:hover {
  background: #ffedd5;
  border-color: #fdba74;
}
.link-button {
  border-color: transparent;
  background: transparent;
  color: #596579;
  padding: 7px 8px;
  font-weight: 700;
  min-height: 32px;
}
.link-button:hover {
  background: #f2f4f7;
  border-color: transparent;
  color: #293241;
}
.danger-link {
  color: #b42318;
}
.danger-link:hover {
  background: #fff1f2;
  color: #991b1b;
}
.table-action {
  border-color: transparent;
  background: transparent;
  color: #9a3412;
  padding: 7px 10px;
}
.table-action:hover {
  background: #fff7ed;
  border-color: transparent;
}
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.bad { background: #fee2e2; color: #991b1b; }
.error, .success {
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 14px;
}
.error { background: #fee2e2; color: #991b1b; }
.success { background: #dcfce7; color: #166534; }
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
th, td {
  border-bottom: 1px solid var(--soft-line);
  padding: 15px 16px;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}
th {
  background: #fbfcfd;
  font-weight: 750;
  color: #586174;
  font-size: 13px;
}
tbody tr:hover { background: #fffaf5; }
tr:last-child td { border-bottom: 0; }
td .row {
  gap: 6px;
  align-items: center;
}
td input,
td select {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 8px;
  border-color: #dfe4ec;
}
td select {
  max-width: 240px;
}
td:last-child,
th:last-child {
  text-align: center;
}
td:last-child .row {
  justify-content: center;
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  max-width: min(380px, calc(100vw - 32px));
  padding: 13px 16px;
  border-radius: 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .22);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast.success {
  background: #15803d;
}
.toast.error {
  background: #b42318;
}
.login {
  max-width: 420px;
  margin: 60px auto;
  padding: 0 18px;
}
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: #dfe3ea;
}
.avatar-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: #9a3d00;
  font-weight: 800;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}
.avatar-upload {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f3f5f8;
  cursor: pointer;
  flex: 0 0 auto;
}
.avatar-upload .avatar {
  width: 100%;
  height: 100%;
  display: flex;
  border-radius: 50%;
  object-fit: cover;
}
.avatar-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.avatar-upload::after {
  content: "Загрузить";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  transition: opacity .15s ease;
}
.avatar-upload:hover::after,
.avatar-upload:focus-within::after {
  opacity: 1;
}
.profile-identity {
  display: flex;
  align-items: center;
  gap: 16px;
}
.profile-identity strong {
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
}
.empty {
  padding: 26px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  background: #fff;
}
.consent-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 0;
  font-weight: 650;
  line-height: 1.45;
}
.consent-row input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}
.consent-row a {
  font-weight: 750;
}
.consent-section {
  padding-block: 16px;
}
.consent-section .section-content h2 {
  margin-bottom: 10px;
}
.small { font-size: 13px; color: var(--muted); }
.nowrap { white-space: nowrap; }

h2 {
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.25;
}

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .main { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  table { display: block; overflow-x: auto; }
  .document-card { grid-template-columns: 1fr; }
  .document-actions { min-width: 0; justify-items: start; }
  .preview-modal { padding: 10px; }
  .preview-dialog { height: calc(100vh - 20px); }
  .preview-header,
  .preview-footer { align-items: flex-start; flex-direction: column; }
  .preview-header-actions { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .preview-zoom-controls { flex-wrap: wrap; }
  .public-header { margin-bottom: 28px; }
  .footer-info { grid-template-columns: 1fr; }
  .form-section { grid-template-columns: 1fr; }
  .upload-card { grid-template-columns: 1fr; }
  .form-footer { justify-content: stretch; }
  .submit-button { width: 100%; }
}
