@font-face {
  font-family: 'e-Ukraine';
  src: url('/admin/fonts/e-Ukraine-Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'e-Ukraine';
  src: url('/admin/fonts/e-Ukraine-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'e-Ukraine';
  src: url('/admin/fonts/e-Ukraine-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'e-Ukraine-Light';
  src: url('/admin/fonts/e-Ukraine-Light.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'e-Ukraine-Medium';
  src: url('/admin/fonts/e-Ukraine-Medium.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'e-Ukraine-Bold';
  src: url('/admin/fonts/e-Ukraine-Bold.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

:root {
  --bg-top: #e8ecf4;
  --bg-bottom: #f4f6fb;
  --surface: #ffffff;
  --text: #1a1d26;
  --text-muted: #5c6370;
  --border: #d8dee9;
  --primary: #1e3a5f;
  --primary-hover: #152a45;
  --accent: #3b5bdb;
  --accent-soft: #e8edfc;
  --success: #0d7a4f;
  --danger: #b42318;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow: 0 8px 30px rgba(22, 34, 68, 0.08);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(165deg, var(--bg-top), var(--bg-bottom));
}

a {
  color: var(--accent);
}

.app-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #2d4a7a);
  box-shadow: var(--shadow);
}

.brand-text h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-text p {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.7);
  padding: 28px;
  margin-bottom: 20px;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.card .hint {
  margin: 0 0 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-muted);
}

input[type='password'],
input[type='text'],
textarea {
  width: 100%;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  background: #fafbfe;
}

textarea {
  min-height: 420px;
  resize: vertical;
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-md);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--accent-soft);
  color: var(--primary);
}

.btn-secondary:hover {
  background: #dce4fb;
}

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

.btn-ghost:hover {
  background: #f6f8fc;
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  margin-bottom: 16px;
  display: none;
}

.alert.show {
  display: block;
}

.alert-error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecdca;
}

.alert-success {
  background: #ecfdf5;
  color: var(--success);
  border: 1px solid #a7f3d0;
}

.footer-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 720px;
}

.hidden {
  display: none !important;
}

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

.tab {
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #fafbfe;
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-muted);
}

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

.tab-pane {
  margin-top: 8px;
}

.nav-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pill {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fafbfe;
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--primary);
}

.row.spread {
  justify-content: space-between;
  align-items: center;
}

.grid2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px 18px;
  margin-top: 12px;
}

.grid2 .span2 {
  grid-column: 1 / -1;
}

@media (min-width: 560px) {
  .grid2 .span2 {
    grid-column: span 2;
  }
}

.chk-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 1.4rem;
}

.chk-row input {
  width: auto;
}

.vacancy-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.vac-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fafbfe;
}

.vac-card h4 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.vac-card .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.vacancy-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: #fafcff;
  margin-bottom: 12px;
}

.vacancy-editor select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font: inherit;
}

details summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 8px;
}

.mt {
  margin-top: 18px;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  filter: brightness(0.92);
}

.table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

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

.data-table th {
  background: #f4f6fb;
  font-weight: 600;
}

.data-table tr:nth-child(even) td {
  background: #fafbfe;
}

#ed-profile-json,
#sf-profile-json {
  min-height: 100px;
}

.profile-lead {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.profile-section {
  margin-top: 20px;
  padding: 18px 18px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fafcff 0%, #f6f8fc 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.profile-section legend {
  padding: 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
}

.profile-evod {
  border-left: 4px solid var(--accent);
}

.profile-photo-block {
  border-left: 4px solid #2d6a4f;
}

.hint-tight {
  margin: 0 0 12px !important;
  font-size: 0.8rem !important;
}

select {
  width: 100%;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  background: #fafbfe;
}

select:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.photo-id-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
}

.photo-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 200px;
  position: relative;
}

.photo-controls input[type='file'] {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.file-drop {
  display: inline-block;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--accent);
  background: var(--accent-soft);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.file-drop:hover {
  border-style: solid;
}

.card-qr-preview {
  width: 148px;
  height: 148px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line, #d8d2c6);
  object-fit: contain;
  padding: 10px;
  flex-shrink: 0;
}

.card-qr-preview.is-empty {
  opacity: 0.4;
  background: repeating-linear-gradient(
    -45deg,
    #f4f0e6,
    #f4f0e6 6px,
    #fff 6px,
    #fff 12px
  );
}

.card-qr-payload {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-all;
}

.id-card-mock {
  flex: 1;
  min-width: 260px;
  max-width: 340px;
  border-radius: 14px;
  background: linear-gradient(145deg, #1e3a5f 0%, #0f2744 55%, #152a45 100%);
  color: #fff;
  padding: 14px 16px;
  box-shadow: 0 12px 28px rgba(15, 39, 68, 0.35);
}

.id-card-mock-inner {
  display: flex;
  gap: 14px;
  align-items: stretch;
}

.id-card-photo-wrap {
  width: 76px;
  min-height: 96px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.id-card-photo-img {
  width: 100%;
  height: 100%;
  min-height: 96px;
  object-fit: cover;
  display: block;
}

.id-card-photo-img.is-empty {
  opacity: 0.35;
  object-fit: none;
  min-height: 96px;
  background: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.06) 6px,
    transparent 6px,
    transparent 12px
  );
}

.id-card-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  min-width: 0;
}

.id-card-chip {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 200, 120, 0.25);
  color: #ffe6bf;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.id-card-name {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: pre-line;
  word-break: break-word;
  color: rgba(255, 255, 255, 0.95);
}

.id-card-sub {
  font-size: 0.72rem;
  opacity: 0.75;
  font-family: ui-monospace, monospace;
}

#master-vacancies textarea#json-editor {
  min-height: 360px;
}

.profile-pdf-preview {
  border-left: 4px solid #7c3aed;
}

.pdf-filler-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pdf-filler-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pdf-filler-hint {
  font-size: 0.84rem;
  color: var(--muted);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.86rem;
}

.pdf-filler-stage-outer {
  overflow: auto;
  max-height: 78vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #e8eaed;
  padding: 12px;
}

.pdf-filler-stage {
  position: relative;
  margin: 0 auto;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.18);
  background: #fff;
}

.pdf-filler-stage canvas {
  display: block;
}

.pdf-filler-overlay {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  cursor: text;
}

.lang-switch {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.lang-btn {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
}

.lang-btn.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.pdf-filler-input.is-native-font,
.pdf-filler-live-text {
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  color: #000;
}

.pdf-filler-field.is-edited {
  background: #fff;
}

.pdf-filler-qr {
  z-index: 4;
  border: 1.5px dashed rgba(34, 197, 94, 0.55) !important;
  background: transparent;
}

.pdf-filler-qr:hover {
  border-color: #16a34a !important;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.pdf-filler-qr.is-qr-edited {
  background: #fff;
}

.pdf-filler-qr-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

.pdf-filler-photo {
  z-index: 5;
  overflow: hidden;
  cursor: pointer;
  border: 1.5px dashed rgba(37, 99, 235, 0.55) !important;
  background: transparent;
}

.pdf-filler-photo:hover {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.pdf-filler-photo.is-photo-edited {
  background: #fff;
}

.pdf-filler-photo-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

.pdf-qr-dialog {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 16px;
}

.pdf-qr-dialog.hidden {
  display: none !important;
}

.pdf-qr-dialog-card {
  width: min(480px, 100%);
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.pdf-qr-dialog-card h4 {
  margin: 0 0 8px;
}

.pdf-qr-actions {
  margin-top: 12px;
}

.pdf-filler-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.pdf-filler-pages.is-add-armed .pdf-filler-overlay {
  cursor: crosshair;
}

.pdf-filler-host {
  width: 100%;
}

.pdf-filler-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pdf-filler-actions .is-armed {
  background: #22c55e;
  color: #fff;
  border-color: #16a34a;
}

.pdf-filler-field.is-edited,
.pdf-filler-field.is-added {
  background: #fff;
  border-color: rgba(34, 197, 94, 0.45);
  overflow: visible;
}

.pdf-filler-field.is-hidden-text {
  background: #fff;
  border-color: rgba(148, 163, 184, 0.5);
}

.pdf-filler-live-text {
  display: block;
  white-space: pre;
  overflow: visible;
  color: #111;
  line-height: 1;
  pointer-events: none;
  letter-spacing: 0;
}

.pdf-filler-del {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  cursor: pointer;
  padding: 0;
  z-index: 3;
}

.pdf-filler-input {
  font-family: inherit;
}

.pdf-filler-field {
  position: absolute;
  pointer-events: auto;
  border: 1.5px dashed transparent;
  border-radius: 2px;
  box-sizing: border-box;
  transition: border-color 0.12s, background 0.12s;
}

.pdf-filler-field:hover {
  border-color: rgba(100, 116, 139, 0.45);
}

.pdf-filler-field.is-active {
  border-color: #22c55e;
  background: rgba(255, 255, 255, 0.96);
  z-index: 2;
}

.pdf-filler-field.is-photo {
  cursor: pointer;
  overflow: hidden;
}

.pdf-filler-field.is-photo:hover {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(255, 255, 255, 0.25);
}

.pdf-filler-stage.is-refreshing {
  opacity: 0.92;
}

.pdf-filler-input {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  resize: none;
  padding: 1px 2px;
  margin: 0;
  font-family: inherit;
  color: transparent;
  caret-color: transparent;
  outline: none;
  line-height: 1.15;
  overflow: visible;
  cursor: text;
}

.pdf-filler-input.is-editing {
  color: #111;
  caret-color: #111;
  background: #fff;
  overflow: visible;
}

.pdf-filler-input.is-upper {
  text-transform: uppercase;
}

.pdf-preview-toolbar,
.pdf-upload-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.pdf-upload-row input[type='file'] {
  max-width: 220px;
  font-size: 0.85rem;
}

.pdf-preview-status {
  font-size: 0.82rem;
  color: var(--muted);
}

.pdf-preview-frame {
  width: 100%;
  min-height: 520px;
  height: 72vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #f4f4f5;
}

@media (max-width: 640px) {
  .card {
    padding: 20px;
  }
  textarea {
    min-height: 320px;
  }
}
