:root {
  --bg: #f2eadc;
  --panel: #fffaf2;
  --ink: #211714;
  --muted: #78695d;
  --line: #e5d8c6;
  --accent: #5b0f20;
  --accent-2: #7a1b31;
  --gold: #d1ad59;
  --ok: #24744d;
  --danger: #b33a32;
  --soft: #f6e7d6;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(209, 173, 89, 0.18), transparent 32%),
    linear-gradient(180deg, #efe3d2 0%, var(--bg) 46%, #f8f1e7 100%);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.92);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-weight: 900;
  color: var(--accent);
}

.brand-logo {
  width: 154px;
  max-height: 54px;
  object-fit: contain;
  display: block;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #f7e6c6;
  color: #fff;
  border: 2px solid var(--gold);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 900;
}

.brand small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.topbar nav {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.nav-link {
  border: 1px solid var(--line);
  background: var(--accent);
  border-radius: 999px;
  padding: 9px 14px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 22px 52px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 1.05fr);
  gap: 28px;
  align-items: start;
}

.intro {
  min-height: 560px;
  border-radius: 8px;
  padding: 42px;
  background:
    linear-gradient(135deg, rgba(12, 8, 7, 0.88), rgba(91, 15, 32, 0.82)),
    url("/assets/identity-bg.png") center / cover no-repeat,
    radial-gradient(circle at 70% 20%, rgba(209, 173, 89, 0.35), transparent 34%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: sticky;
  top: 86px;
}

.eyebrow {
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 1.45;
}

h1 {
  margin: 10px 0 14px;
  font-size: 44px;
  line-height: 1.03;
  letter-spacing: 0;
  color: inherit;
}

.lead {
  color: rgba(255, 255, 255, 0.88);
  max-width: 590px;
  font-size: 16px;
  line-height: 1.52;
  margin: 8px 0;
}

.notice {
  margin-top: 22px;
  border: 1px solid rgba(209, 173, 89, 0.45);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.12);
  padding: 14px 15px;
  color: #fff2cf;
  font-size: 13px;
  line-height: 1.45;
}

.hero-points {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.hero-points span {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 10px 12px;
  color: #fff7e6;
  font-weight: 750;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 48px -32px rgba(53, 17, 12, 0.45);
}

.form-panel {
  padding: 22px;
}

.panel-head {
  display: flex;
  align-items: start;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0;
  font-size: 20px;
  color: var(--accent);
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.badge {
  margin-left: auto;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.section-title {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.section-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.section-title h3 {
  margin: 0;
  color: var(--accent);
  font-size: 16px;
}

.section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.full {
  grid-column: 1 / -1;
}

label {
  display: block;
  margin-bottom: 6px;
  color: #46382f;
  font-size: 13px;
  font-weight: 750;
}

.req {
  color: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  font: inherit;
  font-size: 15px;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(139, 42, 61, 0.11);
}

.hint {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  padding: 13px;
  border-radius: 8px;
  background: #f8eddd;
  border: 1px solid var(--line);
  color: #4f4036;
  font-size: 13px;
  line-height: 1.45;
}

.consent input {
  width: 19px;
  height: 19px;
  margin-top: 1px;
  accent-color: var(--accent);
  flex: none;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

.btn {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 12px 18px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

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

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

.btn.secondary {
  background: #efe4d4;
  color: #5c4a3d;
}

.btn.sm {
  padding: 8px 11px;
  font-size: 13px;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.upload-item {
  min-width: 0;
}

.camera-box {
  min-height: 220px;
  border: 1.5px dashed #c7b69a;
  border-radius: 8px;
  background: #fff7ea;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  position: relative;
  overflow: hidden;
}

.camera-box:hover {
  border-color: var(--accent);
  background: #fff6e8;
}

.camera-box input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.camera-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--gold);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.camera-box b {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.camera-box small {
  color: var(--muted);
}

.camera-box img {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.camera-box.has-image {
  border-style: solid;
}

.camera-box.has-image .camera-icon,
.camera-box.has-image b,
.camera-box.has-image small {
  display: none;
}

.photo-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
  margin-top: 8px;
}

.photo-tools .btn {
  flex: 1 1 auto;
  min-width: 92px;
}

.editor-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(33, 23, 20, 0.62);
  backdrop-filter: blur(5px);
}

.editor-modal.open {
  display: flex;
}

.editor-card {
  width: min(720px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 28px 80px rgba(20, 8, 6, 0.35);
  padding: 22px;
}

.editor-card h2 {
  margin: 0 0 6px;
  text-align: center;
  color: var(--ink);
  font-size: 24px;
}

.editor-card p {
  margin: 0 0 16px;
  text-align: center;
  color: var(--muted);
}

.editor-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.zoom-control {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  min-width: 220px;
  flex: 1;
}

.zoom-control input {
  padding: 0;
}

.sharp-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.sharp-control input {
  width: 20px;
  height: 20px;
}

.editor-frame {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #726b62;
  overflow: hidden;
  min-height: 260px;
}

#editorCanvas {
  max-width: 100%;
  display: block;
}

.editor-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.status {
  min-height: 20px;
  font-size: 14px;
  font-weight: 700;
}

.status.ok {
  color: var(--ok);
}

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

.admin-shell {
  display: grid;
  gap: 16px;
}

.cabinet-body {
  background: #f4ecdf;
}

.cabinet-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.cabinet-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(91, 15, 32, 0.98), rgba(64, 8, 20, 0.98)),
    url("/assets/identity-bg.png") center / cover no-repeat;
  color: #f8eadf;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cabinet-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  margin-bottom: 28px;
}

.cabinet-brand img {
  width: 76px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.cabinet-brand b,
.cabinet-brand span {
  font-weight: 900;
}

.cabinet-brand small {
  display: block;
  color: var(--gold);
  font-size: 12px;
  margin-top: 2px;
}

.cabinet-menu-label {
  margin: 8px 12px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.cabinet-menu {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  padding: 13px 14px;
  text-align: left;
  font: inherit;
  font-weight: 800;
}

.cabinet-menu:hover,
.cabinet-menu.active {
  background: rgba(209, 173, 89, 0.16);
  color: #fff;
}

.cabinet-user {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  padding-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.cabinet-user b {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 20px;
}

.cabinet-user span {
  font-weight: 850;
}

.cabinet-main {
  min-width: 0;
  padding: 24px;
  display: grid;
  gap: 16px;
}

.cabinet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cabinet-top h1 {
  margin: 0;
  color: var(--ink);
  font-size: 28px;
}

.cabinet-top p {
  margin: 4px 0 0;
  color: var(--muted);
}

.cabinet-section {
  display: none;
}

.cabinet-section.active {
  display: block;
}

.section-pad {
  padding: 18px;
}

.section-pad h2 {
  margin: 0 0 14px;
  color: var(--accent);
}

.cards-list {
  display: grid;
  gap: 10px;
}

.cabinet-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 13px;
  display: grid;
  gap: 10px;
}

.cabinet-card b {
  color: var(--accent);
}

.cabinet-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.mini-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.mini-fields span {
  border-radius: 999px;
  background: #f5ecde;
  padding: 6px 10px;
  color: #5f4d3f;
  font-weight: 750;
}

.check-grid.horizontal {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.category-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 14px;
}

.category-card b {
  display: block;
  color: var(--accent);
}

.category-card span {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--accent);
  font-weight: 900;
  margin: 10px 0;
}

.category-card small {
  display: block;
  color: var(--muted);
  line-height: 1.45;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffaf2;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 9px 13px;
}

.chip.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #fff7ea;
}

.stats-row div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 12px;
}

.stats-row b {
  display: block;
  color: var(--accent);
  font-size: 26px;
  line-height: 1;
}

.stats-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.toolbar {
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.toolbar input {
  max-width: 360px;
}

.toolbar .spacer {
  flex: 1;
}

.table-panel {
  overflow: hidden;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid #efe7dc;
  text-align: left;
  vertical-align: top;
  padding: 9px 10px;
  font-size: 13px;
  line-height: 1.35;
}

th {
  position: sticky;
  top: 0;
  background: #f1e4d2;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

.check-grid {
  display: grid;
  gap: 4px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.check.ok {
  color: var(--ok);
}

.check.miss {
  color: var(--danger);
}

td:first-child,
th:first-child {
  text-align: center;
  width: 46px;
}

.passport-number {
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 7px;
}

.passport-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  width: 190px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffaf2;
}

.passport-preview.empty-passport {
  display: block;
  width: 150px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.passport-side {
  min-height: 72px;
  border: 1px dashed #c8b99e;
  border-radius: 5px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
}

.passport-side img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
}

.empty {
  padding: 38px 18px;
  color: var(--muted);
  text-align: center;
}

.doc-link {
  display: inline-flex;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  padding: 7px 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 12px;
}

.single-doc {
  max-width: 1040px;
}

.doc-page {
  padding: 24px;
}

.doc-header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--accent);
}

.doc-header h1 {
  margin: 6px 0;
  font-size: 32px;
}

.doc-header p {
  margin: 0;
  color: var(--muted);
}

.doc-stamp {
  border: 2px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  padding: 12px 16px;
  text-align: center;
  font-weight: 900;
  line-height: 1.2;
  min-width: 92px;
}

.doc-page h2 {
  margin: 22px 0 12px;
  color: var(--accent);
  font-size: 18px;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.doc-grid.compact {
  grid-template-columns: repeat(4, 1fr);
}

.doc-field {
  min-height: 54px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  background: #fff;
}

.doc-field b {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.doc-field span {
  white-space: pre-wrap;
  font-size: 14px;
}

.pass-card {
  border: 1px solid var(--line);
  background: #fffaf2;
}

.pass-top {
  display: grid;
  grid-template-columns: 1.2fr 1.1fr 1.3fr;
}

.pass-top .doc-field {
  border-top: 0;
  border-left: 0;
}

.image-grid {
  display: grid;
  grid-template-columns: 0.8fr 1fr 1fr;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.image-title {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.image-frame {
  min-height: 150px;
  border: 1.5px dashed #c8b99e;
  border-radius: 7px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
}

.image-box:first-child .image-frame {
  aspect-ratio: 3 / 4;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-box:first-child .image-frame img {
  object-fit: cover;
}

.doc-note {
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
  border-radius: 8px;
  white-space: pre-wrap;
}

.print-title {
  display: none;
}

@media (max-width: 880px) {
  .cabinet-shell {
    grid-template-columns: 1fr;
  }

  .cabinet-sidebar {
    position: static;
    height: auto;
  }

  .cabinet-main {
    padding: 14px;
  }

  .cabinet-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .intro {
    min-height: auto;
    padding: 20px;
    position: static;
  }

  h1 {
    font-size: 30px;
  }

  .intro .lead:nth-of-type(n+2),
  .hero-points {
    display: none;
  }

  .notice {
    margin-top: 12px;
    max-height: 132px;
    overflow: auto;
  }
}

@media (max-width: 620px) {
  .topbar-inner,
  .layout {
    padding-left: 14px;
    padding-right: 14px;
  }

  .brand small {
    display: none;
  }

  .brand-logo {
    width: 118px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .upload-grid {
    grid-template-columns: 1fr;
  }

  .camera-box {
    min-height: 180px;
  }

  .form-panel {
    padding: 16px;
  }

  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .editor-card {
    padding: 16px;
  }

  .editor-actions {
    grid-template-columns: 1fr;
  }

  .editor-controls .btn,
  .photo-tools .btn {
    width: auto;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .toolbar,
  .intro,
  .notice {
    display: none;
  }

  .layout {
    max-width: none;
    padding: 0;
  }

  .panel {
    border: 0;
    box-shadow: none;
  }

  .print-title {
    display: block;
    margin: 0 0 8px;
    font-size: 13px;
    color: #111;
  }

  table {
    min-width: 0;
    font-size: 8px;
  }

  th,
  td {
    padding: 4px;
    font-size: 8px;
    color: #111;
  }

  .single-doc {
    max-width: none;
  }

  .doc-page {
    padding: 12mm;
  }

  .doc-header h1 {
    font-size: 22px;
  }

  .doc-grid,
  .doc-grid.compact {
    grid-template-columns: repeat(2, 1fr);
  }

  .pass-top {
    grid-template-columns: 1fr;
  }

  .image-frame {
    min-height: 115px;
  }
}
