* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --font-main: 'Futura PT', 'Futura', 'Century Gothic', 'Trebuchet MS', sans-serif;
  --font-logo: 'Montserrat', sans-serif;
  --layout-max: 1510px;
  --primary-red: #c4272b;
  --primary-red-dark: #a81e22;
  --bg-page: #f4f7fc;
  --card-bg: #fff;
  --card-shadow: 0 12px 28px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.02);
  --text-dark: #1e293b;
  --text-muted: #475569;
  --text-light: #64748b;
  --border-light: #e9edf2;
  --gray-bg: #f1f5f9;
  --danger: #b42318;
  --success-bg: #e9f9ef;
  --success-text: #1f7a34;
  --error-bg: #ffecec;
}

body,
input,
select,
textarea,
button {
  font-family: var(--font-main);
}

body {
  background: var(--bg-page);
  color: var(--text-dark);
  line-height: 1.55;
  font-size: 18px;
  min-height: 100vh;
}

/* Header */
.header {
  background: var(--card-bg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03), 0 1px 0 var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-light);
}

.header-content {
  max-width: var(--layout-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon {
  background: var(--primary-red);
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-logo);
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.logo-text {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
}

.logo-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-top: 4px;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* Layout */
.container {
  max-width: var(--layout-max);
  margin: 22px auto;
  padding: 0 24px 24px;
}

.main-content {
  background: var(--card-bg);
  border-radius: 28px;
  padding: 24px 28px 28px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-light);
}

.page-lead {
  margin: 0 0 22px;
  color: var(--text-muted);
  font-size: 17px;
  line-height: 1.55;
  max-width: 900px;
}

.contract-types {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 22px;
}

.contract-type {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--border-light);
  border-radius: 18px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-main);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.contract-type:hover {
  border-color: var(--primary-red);
  box-shadow: 0 0 0 3px rgba(196, 39, 43, 0.1);
}

.contract-type.is-active {
  border-color: var(--primary-red);
  background: #fff8f8;
  box-shadow: 0 0 0 3px rgba(196, 39, 43, 0.12);
}

.payment-variant.is-admin-only { display: none !important; }
body.is-admin .payment-variant.is-admin-only { display: flex !important; }

.contract-type-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
}

.contract-type-hint {
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-muted);
}

.contract-type-badge {
  display: inline-flex;
  margin-top: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--gray-bg);
  color: var(--text-light);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.contract-type.is-active .contract-type-badge {
  background: var(--primary-red);
  color: #fff;
}

/* Sections */
.section-card {
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-light);
}

.section-card:last-of-type {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.section-card h2 {
  margin: 0 0 18px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field.full-width {
  grid-column: span 2;
}

label {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 17px;
}

.required::after {
  content: ' *';
  color: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-light);
  background: #fff;
  font-size: 17px;
  color: var(--text-dark);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-red);
  box-shadow: 0 0 0 3px rgba(196, 39, 43, 0.1);
}

input[readonly],
input:disabled,
textarea:disabled,
select:disabled {
  background: var(--gray-bg);
  color: var(--text-muted);
  cursor: not-allowed;
}

.field.is-disabled {
  opacity: 0.72;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.field-hint {
  font-size: 15px;
  color: var(--text-light);
  line-height: 1.4;
}

.field-hint-prominent {
  display: block;
  margin-top: 6px;
  padding: 10px 12px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  color: #c45a00;
  background: #fff4e5;
  border: 1px solid #f0b27a;
  border-radius: 10px;
}

.field.error input,
.field.error select,
.field.error textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.1);
}

.error-text {
  color: var(--danger);
  font-size: 15px;
}

.field[hidden] {
  display: none;
}

/* Toggle (Да / Нет) */
.toggle-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.toggle-option {
  background: var(--gray-bg);
  padding: 10px 18px;
  border-radius: 26px;
  cursor: pointer;
  border: none;
  font-family: var(--font-main);
  font-size: 17px;
  font-weight: 600;
  color: var(--text-dark);
  transition: background 0.15s, color 0.15s;
}

.toggle-option:hover {
  background: #e2e8f0;
}

.toggle-option.is-active {
  background: var(--primary-red);
  color: #fff;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 40px;
  padding: 12px 22px;
  font-weight: 600;
  font-size: 17px;
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-family: var(--font-main);
  transition: background 0.15s;
}

.btn[hidden],
#adminBtn[hidden] {
  display: none !important;
}

.btn-primary {
  background: var(--primary-red);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-red-dark);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--gray-bg);
  color: var(--text-dark);
}

.btn-secondary:hover {
  background: #e2e8f0;
}

/* Form status */
.form-status {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border-light);
  font-size: 16px;
  color: var(--text-light);
}

.form-status-template {
  color: var(--text-muted);
}

/* Footer */
.footer {
  text-align: center;
  padding: 8px 24px 24px;
  color: var(--text-light);
  font-size: 16px;
}

/* Toast */
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1200;
  min-width: 280px;
  max-width: 420px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--text-dark);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  box-shadow: var(--card-shadow);
}

.toast.error {
  background: var(--danger);
}

.toast[hidden] {
  display: none;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-overlay.is-loading .modal-close {
  display: none;
}

body.is-lookup-locked {
  overflow: hidden;
}

body.is-lookup-locked .app-shell,
body.is-lookup-locked .form-card,
body.is-lookup-locked form {
  pointer-events: none;
}

.lookup-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 18px 8px 8px;
}

.lookup-spinner {
  width: 42px;
  height: 42px;
  border: 3px solid #e2e8f0;
  border-top-color: #0f274a;
  border-radius: 50%;
  animation: lookup-spin 0.8s linear infinite;
}

.lookup-loading-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

@keyframes lookup-spin {
  to {
    transform: rotate(360deg);
  }
}

.modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  box-shadow: var(--card-shadow);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 22px 24px 0;
}

.modal-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
}

.modal-close {
  border: none;
  background: var(--gray-bg);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-close:hover {
  background: #e2e8f0;
  color: var(--text-dark);
}

.modal-body {
  padding: 16px 24px;
  overflow: auto;
  max-height: min(60vh, 520px);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px 22px;
  flex-wrap: wrap;
}

.modal-lead {
  margin: 0 0 16px;
  color: var(--text-muted);
  line-height: 1.55;
  font-size: 17px;
}

.modal-lead-success {
  color: var(--text-dark);
  font-weight: 600;
}

.clear-countdown-lead {
  font-size: 18px;
}

.clear-countdown-num {
  color: var(--primary-red);
  font-variant-numeric: tabular-nums;
  font-size: 1.25em;
}

.generate-confirm-preview {
  margin-top: 4px;
}

.ai-changes {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 18px;
}

.ai-change-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 12px 14px;
  background: var(--gray-bg);
  border-radius: 12px;
  border: 1px solid var(--border-light);
}

.ai-change-label {
  font-size: 13px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ai-change-from {
  color: var(--text-muted);
  text-decoration: line-through;
  font-size: 15px;
}

.ai-change-arrow {
  display: none;
}

.ai-change-to {
  color: var(--success-text);
  font-weight: 600;
  font-size: 16px;
}

.ai-preview-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.ai-preview-label {
  font-size: 13px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ai-preview-text {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--border-light);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-dark);
}

.ai-preview-after {
  border-color: #b7e4c7;
  background: var(--success-bg);
}

.validation-section {
  margin: 0 0 16px;
}

.validation-section:last-child {
  margin-bottom: 0;
}

.validation-section-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}

.validation-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.validation-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  background: var(--gray-bg);
}

.validation-item--missing {
  border-color: #f5c2c0;
  background: var(--error-bg);
}

.validation-item--invalid {
  border-color: #f0c36d;
  background: #fff8e8;
}

.validation-item-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
}

.validation-item-text {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.4;
}

.company-preview {
  margin: 0;
}

.company-preview-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 8px 14px;
  padding: 10px 0;
  border-top: 1px solid var(--border-light);
}

.company-preview-row:first-child {
  border-top: none;
  padding-top: 0;
}

.company-preview dt {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
}

.company-preview dd {
  margin: 0;
  font-size: 17px;
  line-height: 1.45;
}

.company-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.company-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-main);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.company-item:hover {
  border-color: var(--primary-red);
  box-shadow: 0 0 0 3px rgba(196, 39, 43, 0.1);
}

.company-item-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-dark);
}

.company-item-meta,
.company-item-address,
.company-item-status {
  font-size: 15px;
  line-height: 1.45;
}

.company-item-meta {
  color: var(--text-dark);
}

.company-item-address {
  color: var(--text-muted);
}

.company-item-status.is-active {
  color: var(--success-text);
}

.company-item-status.is-warning {
  color: #b45309;
}

@media (max-width: 900px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .grid,
  .field.full-width {
    grid-template-columns: 1fr;
    grid-column: span 1;
  }

  .contract-types {
    grid-template-columns: 1fr;
  }

  .form-status {
    flex-direction: column;
  }

  .company-preview-row {
    grid-template-columns: 1fr;
  }

  .logo-text {
    font-size: 24px;
  }
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 8px;
  border-radius: 999px;
  background: var(--gray-bg);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  max-width: min(360px, 46vw);
  cursor: pointer;
}

.user-chip.is-admin {
  background: #e8f1ff;
  color: #1e3a8a;
}

.user-chip.is-empty {
  opacity: 0.85;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #0f274a;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex: 0 0 auto;
}

.user-chip-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.user-chip-text strong {
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip-text span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.identity-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 16px;
  margin-bottom: 16px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
}

.identity-banner i {
  margin-top: 3px;
  color: #2563eb;
}

.identity-banner.is-ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.identity-banner.is-ok i {
  color: #059669;
}

.identity-banner.is-warning {
  background: #fff7ed;
  border-color: #fed7aa;
}

.identity-banner.is-warning i {
  color: #ea580c;
}

.identity-banner strong {
  display: block;
  margin-bottom: 4px;
}

.identity-banner p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.4;
}

.admin-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1200;
}

.admin-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.admin-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(1100px, 96vw);
  height: 100vh;
  background: #fff;
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  z-index: 1300;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.admin-drawer.is-resizing,
.admin-drawer.is-resizing * {
  user-select: none;
}

.admin-drawer.is-open {
  transform: translateX(0);
}

.admin-drawer.is-wide {
  width: min(1400px, 98vw);
}

.admin-drawer.is-full {
  width: 100vw;
}

.admin-resize-edge {
  position: absolute;
  top: 0;
  left: 0;
  width: 8px;
  height: 100%;
  cursor: ew-resize;
  z-index: 5;
}

.admin-resize-edge::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 2px;
  width: 3px;
  height: 48px;
  margin-top: -24px;
  border-radius: 3px;
  background: #cbd5e1;
}

.admin-resize-edge:hover::after,
.admin-drawer.is-resizing .admin-resize-edge::after {
  background: #0f274a;
}

.admin-drawer-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 18px 18px 18px 22px;
  box-sizing: border-box;
}

.admin-drawer-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.admin-resize-hint {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.admin-drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.admin-drawer-header h2 {
  font-size: 24px;
  margin-bottom: 4px;
}

.admin-drawer-header p,
.admin-empty {
  color: var(--text-muted);
  font-size: 15px;
}

.admin-drawer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.admin-tab {
  border: 1px solid var(--border-light);
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
}

.admin-tab.is-active {
  background: #0f274a;
  border-color: #0f274a;
  color: #fff;
}

.admin-tab-panel {
  display: none;
  min-height: 0;
}

.admin-tab-panel.is-active {
  display: block;
}

.admin-tab-panel[data-panel="contracts"].is-active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 420px;
}

.admin-filters {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-filters-contracts {
  grid-template-columns: 1.6fr 0.8fr;
  flex-shrink: 0;
}

.admin-contracts-layout {
  display: flex;
  gap: 0;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  height: calc(100vh - 220px);
}

.admin-contracts-list {
  flex: 1 1 58%;
  min-width: 240px;
  min-height: 0;
  overflow: auto;
}

.admin-split-handle {
  flex: 0 0 10px;
  cursor: col-resize;
  position: relative;
  margin: 0 2px;
}

.admin-split-handle::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 4px;
  width: 2px;
  border-radius: 2px;
  background: #cbd5e1;
}

.admin-split-handle:hover::before,
.admin-drawer.is-resizing .admin-split-handle::before {
  background: #0f274a;
}

.admin-contract-detail {
  flex: 1 1 42%;
  min-width: 220px;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  min-height: 180px;
  overflow: auto;
}

.admin-contract-detail h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.admin-contract-detail .admin-sub {
  margin-bottom: 12px;
}

.admin-file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-file-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--gray-bg);
}

.admin-file-row strong {
  font-size: 13px;
}

.admin-row-active {
  background: #e8eef8;
}

.admin-table-wrap.is-resizable table {
  table-layout: fixed;
  width: 100%;
}

.admin-table-wrap.is-resizable th {
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-table-wrap.is-resizable td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-col-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 2;
}

.admin-col-resizer:hover,
.admin-col-resizer.is-active {
  background: rgba(15, 39, 74, 0.18);
}

@media (max-width: 1100px) {
  .admin-contracts-layout {
    flex-direction: column;
    height: auto;
  }

  .admin-split-handle {
    display: none;
  }

  .admin-contracts-list,
  .admin-contract-detail {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
  }
}

.admin-filters input,
.admin-filters select {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.admin-kpi {
  background: var(--gray-bg);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-kpi span {
  color: var(--text-muted);
  font-size: 14px;
}

.admin-kpi strong {
  font-size: 28px;
}

.admin-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.admin-chip {
  background: var(--gray-bg);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
}

.admin-block-title {
  margin: 12px 0 8px;
  font-size: 18px;
}

.admin-table-wrap {
  border: 1px solid var(--border-light);
  border-radius: 14px;
  overflow: auto;
  margin-bottom: 16px;
  background: #fff;
}

.admin-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.admin-table-wrap th,
.admin-table-wrap td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

.admin-table-wrap th {
  background: var(--gray-bg);
  color: var(--text-muted);
}

.admin-sub {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

.status-pill {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.is-signed {
  background: #d1fae5;
  color: #065f46;
}

.btn-tiny {
  padding: 6px 10px;
  font-size: 12px;
}

@media (max-width: 900px) {
  .admin-filters {
    grid-template-columns: 1fr;
  }
}

.admin-filters-2 {
  grid-template-columns: 0.8fr auto;
}

.admin-admins-form {
  grid-template-columns: 1.2fr 0.8fr auto;
  align-items: center;
}

.admin-help {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 12px;
  line-height: 1.45;
}

.feedback-text {
  max-width: 360px;
  white-space: pre-wrap;
  word-break: break-word;
}

.cabinet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1200;
}

.cabinet-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.cabinet-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(460px, 100vw);
  height: 100vh;
  background: #fff;
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  z-index: 1300;
  padding: 20px;
  overflow: auto;
}

.cabinet-drawer.is-open {
  transform: translateX(0);
}

.cabinet-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.cabinet-header h2 {
  font-size: 24px;
  margin-bottom: 4px;
}

.cabinet-header p {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
}

.cabinet-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 16px;
  background: var(--gray-bg);
  margin-bottom: 18px;
}

.cabinet-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #0f274a;
  color: #fff;
  font-weight: 700;
}

.cabinet-card strong {
  display: block;
  margin-bottom: 4px;
}

.cabinet-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.cabinet-feedback h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.cabinet-hint {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 14px;
}

.cabinet-feedback label {
  display: block;
  font-weight: 600;
  margin: 0 0 6px;
}

.cabinet-feedback select,
.cabinet-feedback textarea {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  margin-bottom: 12px;
  resize: vertical;
}

.cabinet-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.cabinet-status {
  color: var(--text-muted);
  font-size: 14px;
}

.section-card[data-section-id='ipPassport'][hidden] {
  display: none !important;
}

.file-field input[type='file'] {
  padding: 12px;
  border: 1px dashed var(--border-light);
  border-radius: 14px;
  background: #fff;
  width: 100%;
}

.admin-ai-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font-weight: 700;
}
.passport-review {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.72);
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 12px;
  padding: 12px;
  overflow: hidden;
}
.passport-review[hidden] { display: none; }
.passport-review-panel {
  background: #fff;
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  height: calc(100dvh - 24px);
  max-height: calc(100dvh - 24px);
  margin: 0;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.passport-review-head {
  display: flex;
  justify-content: space-between;
  gap: 12px 16px;
  align-items: flex-start;
  flex: 0 0 auto;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
}
.passport-review-head h2 { margin: 0 0 4px; font-size: 20px; }
.passport-review-head p { margin: 0; color: #475569; max-height: 4.6em; overflow: auto; }
.passport-review-rail {
  flex: 0 0 148px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  position: sticky;
  top: 12px;
  align-self: center;
}
.passport-review-rail .btn { width: 100%; min-height: 48px; font-size: 16px; }
.passport-review-split { display: grid; grid-template-columns: 1fr 1fr; min-height: 0; flex: 1; }
.passport-review-preview, .passport-review-fields { min-height: 0; overflow: auto; }
.passport-review-preview { background: #0f172a; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; overflow: hidden; }
.passport-review-fields { padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.passport-review-row { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #334155; }
.passport-review-row input, .passport-review-row textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}
@media (max-width: 800px) {
  .passport-review-split { grid-template-columns: 1fr; }
  .passport-review-preview { min-height: 240px; }
}

.passport-review-warn {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 700;
  line-height: 1.4;
}

.passport-file-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.passport-file-chip { display: flex; justify-content: space-between; gap: 8px; align-items: center; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 6px 10px; }
.passport-file-chip button { border: 0; background: transparent; color: #b91c1c; cursor: pointer; font: inherit; }
.doc-preview { display: flex; flex-direction: column; min-height: 0; height: 100%; background: #0f172a; }
.doc-preview-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 8px; flex: 0 0 auto; }
.doc-preview-tab {
  flex: 0 0 auto;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.doc-preview-tab.is-active { background: #fff; color: #0f172a; border-color: #fff; }
.doc-preview-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  color: #e2e8f0;
  background: #111827;
  flex: 0 0 auto;
}
.doc-preview-tools button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.doc-preview-tools input[type='range'] { flex: 1; min-width: 80px; }
.doc-preview-stage { flex: 1; min-height: 0; overflow: auto; }
.doc-preview-page { display: none; }
.doc-preview-page.is-active { display: block; }
.doc-preview-page img {
  display: block;
  width: calc(var(--zoom, 1) * 100%);
  max-width: none;
  height: auto;
}
.doc-preview-page embed {
  display: block;
  width: calc(var(--zoom, 1) * 100%);
  height: calc(var(--zoom, 1) * 72vh);
  border: 0;
  background: #fff;
}

.card-choice { display: flex; flex-direction: column; gap: 8px; }
.card-choice-title { font-weight: 700; }
.card-choice-table { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: stretch; }
.card-choice-cell {
  display: grid;
  grid-template-columns: 18px 1fr;
  grid-template-rows: auto 1fr;
  gap: 4px 8px;
  margin: 0;
  padding: 10px;
  min-height: 96px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.card-choice-cell input { grid-row: 1 / span 2; margin: 2px 0 0; width: 16px; height: 16px; }
.card-choice-source { font-size: 12px; font-weight: 700; color: #9a3412; }
.card-choice-value { white-space: pre-wrap; line-height: 1.35; }
.card-choice-cell:has(input:checked) { border-color: #c2410c; background: #fff7ed; }
@media (max-width: 800px) { .card-choice-table { grid-template-columns: 1fr; } }
.passport-review-row em { font-style: normal; color: #64748b; font-weight: 500; }

.office-preview {
  white-space: pre-wrap;
  color: #0f172a;
  background: #fff;
  margin: 0;
  padding: 16px;
  width: calc(var(--zoom, 1) * 100%);
  max-width: none;
  box-sizing: border-box;
  font: 14px/1.45 sans-serif;
}
