:root {
  color-scheme: dark;
  --ink: #0b0d0c;
  --panel: #111412;
  --panel-2: #171a17;
  --paper: #eee9dd;
  --muted: #898d85;
  --line: rgba(238, 233, 221, .13);
  --acid: #d4ff45;
  --warm: #bd9861;
  --danger: #ff806f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--ink);
  color: var(--paper);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ink); }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 85% 0, rgba(129, 145, 74, .09), transparent 33%), var(--ink); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.grain { position: fixed; inset: 0; opacity: .035; pointer-events: none; z-index: 50; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.65'/%3E%3C/svg%3E"); }
.topbar { height: 76px; padding: 0 clamp(20px, 4vw, 64px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.wordmark { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 12px; letter-spacing: -.02em; }
.wordmark-mark { width: 33px; height: 33px; display: grid; place-items: center; border: 1px solid var(--paper); border-radius: 50%; font-family: Georgia, serif; font-style: italic; }
.wordmark b, .wordmark small { display: block; }
.wordmark b { font-size: 14px; }
.wordmark small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .13em; margin-top: 2px; }
.topbar-meta { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warm); box-shadow: 0 0 12px var(--warm); }
.status-dot.online { background: var(--acid); box-shadow: 0 0 12px rgba(212,255,69,.7); }
.icon-button { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 17px; }

.workspace { padding: 0 clamp(20px, 4vw, 64px) 80px; max-width: 1720px; margin: auto; }
.hero { min-height: 340px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .55fr); gap: 60px; align-items: end; padding: 55px 0 48px; }
.eyebrow { margin: 0 0 18px; color: var(--acid); font-size: 10px; line-height: 1; text-transform: uppercase; letter-spacing: .22em; font-weight: 700; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; letter-spacing: -.065em; margin: 0; line-height: .8; }
h1 { font-size: clamp(68px, 9vw, 142px); }
h1 i, h2 i { color: var(--muted); font-weight: 400; }
.hero-aside { padding-bottom: 3px; }
.hero-aside > p:first-child { color: #b7b7b0; line-height: 1.55; max-width: 430px; font-size: 14px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 25px 0 16px; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border: 1px solid var(--line); border-radius: 3px; background: #151815; color: var(--paper); text-decoration: none; cursor: pointer; font-size: 12px; font-weight: 650; letter-spacing: .02em; transition: border-color .2s, background .2s, color .2s, transform .2s; }
.button:hover { border-color: rgba(238,233,221,.4); transform: translateY(-1px); }
.button-primary { background: var(--acid); color: #11130e; border-color: var(--acid); }
.button-muted { background: #242724; color: #a3a69f; border-color: rgba(238,233,221,.09); }
.button-muted:hover { color: var(--paper); background: #2b2f2b; border-color: rgba(238,233,221,.18); }
.shortcut { color: #676b65; font-size: 11px; }
kbd { padding: 2px 5px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px; color: #aaa; font-size: 10px; }

.toolbar { position: sticky; top: 0; z-index: 10; min-height: 70px; margin: 0 calc(clamp(20px, 4vw, 64px) * -1) 30px; padding: 13px clamp(20px, 4vw, 64px); display: grid; grid-template-columns: minmax(230px, 1fr) repeat(3, minmax(150px, 180px)) auto; gap: 9px; align-items: center; background: rgba(11,13,12,.9); backdrop-filter: blur(18px); border-block: 1px solid var(--line); }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 3px; outline: 0; background: #121512; color: var(--paper); transition: border-color .2s, box-shadow .2s; }
input, select { height: 43px; padding: 0 13px; }
textarea { padding: 12px 13px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: rgba(212,255,69,.5); box-shadow: 0 0 0 3px rgba(212,255,69,.06); }
.search-field { position: relative; }
.search-field span { position: absolute; left: 14px; top: 10px; font-size: 20px; color: var(--muted); }
.search-field input { padding-left: 43px; }
.catalog-count { display: flex; align-items: baseline; gap: 7px; padding-left: 16px; }
.catalog-counts { display: flex; align-items: center; }
.catalog-count.secondary { padding-left: 13px; margin-left: 13px; border-left: 1px solid var(--line); }
.catalog-count b { font-family: Georgia, serif; font-size: 24px; font-weight: 400; }
.catalog-count span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }

.semantic-panel { display: grid; grid-template-columns: minmax(250px, .55fr) minmax(400px, 1.45fr); gap: clamp(28px, 5vw, 80px); margin: 0 0 30px; padding: clamp(24px, 3.2vw, 44px); border: 1px solid rgba(212,255,69,.18); background: linear-gradient(118deg, rgba(212,255,69,.055), rgba(17,20,18,.5) 44%, rgba(189,152,97,.035)); }
.semantic-panel[hidden] { display: none; }
.semantic-intro h2 { font-size: clamp(34px, 3.8vw, 58px); line-height: .9; }
.semantic-intro > p { max-width: 440px; margin: 24px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.semantic-composer { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; gap: 8px; align-items: center; }
.semantic-input input { border-color: rgba(212,255,69,.28); background: rgba(8,10,8,.64); }
.semantic-clear { min-height: 42px; padding: 0 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.semantic-clear:hover { color: var(--paper); }
.semantic-chips { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; margin-top: 14px; min-height: 48px; }
.semantic-empty { width: 100%; margin: 0; padding: 14px 0; border-top: 1px solid var(--line); color: #666b63; font: 10px/1.4 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .07em; }
.semantic-chip { min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 13px; border: 1px solid rgba(212,255,69,.3); border-radius: 999px; background: rgba(10,13,9,.82); }
.semantic-chip-copy { max-width: 240px; overflow: hidden; color: var(--paper); font: 12px/1.1 Georgia, serif; text-overflow: ellipsis; white-space: nowrap; }
.semantic-weight { height: 32px; display: flex; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 999px; background: #151815; }
.semantic-weight button { width: 28px; height: 30px; padding: 0; border: 0; background: transparent; color: var(--acid); cursor: pointer; }
.semantic-weight button:disabled { color: #3d423b; cursor: default; }
.semantic-weight output { min-width: 38px; color: #b8bdb3; font: 9px ui-monospace, monospace; text-align: center; }
.semantic-remove { width: 27px; height: 27px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #72776f; cursor: pointer; font-size: 17px; }
.semantic-remove:hover { color: var(--danger); background: rgba(255,128,111,.08); }

.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.person-card { position: relative; min-width: 0; background: var(--ink); padding: 9px 9px 17px; cursor: pointer; transition: background .2s; }
.person-card:hover { background: #141714; }
.portrait { position: relative; aspect-ratio: 3/4; overflow: hidden; background: linear-gradient(145deg, #20231f, #0f1110); }
.portrait img { width: 100%; height: 100%; display: block; object-fit: cover; filter: saturate(.82); transition: transform .4s, filter .4s; }
.person-card:hover .portrait img { transform: scale(1.025); filter: saturate(1); }
.portrait-missing { height: 100%; display: grid; place-items: center; color: #52564f; font-family: Georgia, serif; font-size: 44px; font-style: italic; }
.card-index { position: absolute; top: 10px; left: 10px; padding: 4px 6px; background: rgba(8,10,8,.72); color: #bbb; font: 9px ui-monospace, monospace; letter-spacing: .08em; }
.card-state { position: absolute; right: 9px; bottom: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--warm); box-shadow: 0 0 0 4px rgba(11,13,12,.7); }
.card-state.published { background: var(--acid); }
.card-state.excluded { background: var(--danger); }
.semantic-score { position: absolute; left: 10px; bottom: 10px; padding: 4px 6px; border: 1px solid rgba(212,255,69,.32); background: rgba(8,10,8,.78); color: var(--acid); font: 8px ui-monospace, monospace; letter-spacing: .06em; }
.card-tools { position: absolute; right: 16px; top: 16px; display: flex; gap: 5px; opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .2s; }
.person-card:hover .card-tools, .person-card:focus-within .card-tools { opacity: 1; transform: none; }
.card-tool { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid rgba(238,233,221,.22); border-radius: 3px; background: rgba(8,10,8,.84); color: var(--paper); cursor: pointer; font-size: 10px; }
.card-tool.publish { color: var(--acid); }
.card-copy { padding: 14px 3px 0; }
.card-copy h3 { margin: 0 0 6px; font: 400 18px/1.1 Georgia, serif; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-copy p { margin: 0; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.empty-state { grid-column: 1/-1; min-height: 330px; display: grid; place-items: center; text-align: center; color: var(--muted); }
.empty-state b { display: block; color: var(--paper); font: 30px Georgia, serif; margin-bottom: 8px; }
.catalog-pagination { margin: 30px auto 0; display: flex; align-items: center; justify-content: center; gap: 14px; }
.catalog-pagination[hidden] { display: none; }
.catalog-pagination span { min-width: 74px; color: var(--muted); font: 11px/1 ui-monospace, monospace; text-align: center; text-transform: uppercase; letter-spacing: .08em; }
.catalog-pagination .button:disabled { opacity: .35; cursor: default; transform: none; }
.notice { margin: 0 0 18px; padding: 12px 14px; border: 1px solid rgba(255,128,111,.35); color: #ffc0b7; background: rgba(255,128,111,.06); font-size: 13px; }

.drawer { position: fixed; z-index: 31; top: 0; right: 0; bottom: 0; width: min(680px, 100vw); background: #101310; border-left: 1px solid var(--line); transform: translateX(102%); transition: transform .35s cubic-bezier(.22,.8,.25,1); }
.drawer.open { transform: none; }
.drawer-scrim { position: fixed; inset: 0; z-index: 30; pointer-events: none; background: rgba(0,0,0,.55); opacity: 0; transition: opacity .3s; }
.drawer.open + .drawer-scrim { opacity: 1; pointer-events: auto; }
.drawer-scroll { height: 100%; overflow: auto; padding: 50px clamp(22px, 6vw, 60px) 70px; }
.drawer-close { position: absolute; z-index: 3; top: 18px; right: 20px; width: 38px; height: 38px; background: transparent; border: 1px solid var(--line); color: var(--paper); border-radius: 50%; font-size: 23px; cursor: pointer; }
.drawer h2, .face-dialog h2 { font-size: clamp(52px, 7vw, 82px); margin-bottom: 36px; }
.upload-preview { position: relative; aspect-ratio: 3/2; margin-bottom: 25px; overflow: hidden; border: 1px dashed #41463e; background: #151815; cursor: pointer; }
.upload-preview img { display: none; width: 100%; height: 100%; object-fit: cover; }
.upload-preview.has-image img { display: block; }
.upload-preview.has-image .upload-empty { display: none; }
.upload-empty { height: 100%; display: grid; place-content: center; text-align: center; gap: 6px; color: var(--muted); }
.upload-empty span { color: var(--acid); font-size: 35px; }
.upload-empty b { color: var(--paper); font-family: Georgia, serif; font-size: 20px; font-weight: 400; }
.upload-empty small { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.upload-preview input, .face-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.queue { margin: -12px 0 22px; color: var(--muted); font-size: 11px; }
.duplicate-check { margin: -7px 0 25px; padding: 14px; border: 1px solid rgba(189,152,97,.28); background: linear-gradient(145deg, rgba(189,152,97,.07), rgba(13,15,13,.2)); }
.duplicate-check[hidden] { display: none; }
.duplicate-check-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.duplicate-check-head span, .duplicate-check-head b { display: block; }
.duplicate-check-head span { margin-bottom: 4px; color: var(--warm); font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .16em; }
.duplicate-check-head b { font: 400 18px/1 Georgia, serif; }
.duplicate-check-head code { color: #6f746b; font-size: 8px; letter-spacing: .08em; }
.duplicate-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.duplicate-results .empty-state { min-height: 96px; }
.duplicate-result { position: relative; min-width: 0; padding: 6px; border: 1px solid var(--line); background: rgba(8,10,8,.72); }
.duplicate-result img { width: 100%; aspect-ratio: 3/4; display: block; object-fit: cover; background: var(--panel-2); }
.duplicate-result b { display: block; margin: 7px 0 4px; overflow: hidden; font: 400 13px/1.1 Georgia, serif; text-overflow: ellipsis; white-space: nowrap; }
.duplicate-result code { color: var(--muted); font-size: 10px; }
.duplicate-result.similar { border-color: rgba(189,152,97,.52); }
.duplicate-result.similar code { color: var(--warm); }
.duplicate-result.likely-same { border-color: rgba(255,128,111,.7); box-shadow: inset 0 0 0 1px rgba(255,128,111,.12); }
.duplicate-result.likely-same code { color: var(--danger); }
.duplicate-empty { grid-column: 1/-1; margin: 0; padding: 14px; color: var(--muted); font-size: 11px; line-height: 1.45; }
#identityForm { display: grid; gap: 17px; }
#identityForm > label, .field-pair > label, fieldset { display: grid; gap: 7px; color: #a6aaa2; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset { margin: 0; padding: 0; border: 0; display: flex; align-items: flex-end; gap: 15px; }
legend { margin-bottom: 13px; }
.check { display: flex; align-items: center; gap: 7px; height: 43px; color: var(--paper); font-size: 12px; text-transform: none; letter-spacing: 0; }
.check input { width: 15px; height: 15px; accent-color: var(--acid); }
.form-actions { display: flex; justify-content: space-between; gap: 9px; margin-top: 10px; }
.record-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.create-actions { display: flex; gap: 7px; margin-left: auto; }
.button-danger { color: #ff9c8e; border-color: rgba(255,128,111,.27); background: rgba(255,128,111,.055); }
.button-danger:hover { color: #ffd0c9; border-color: rgba(255,128,111,.58); background: rgba(255,128,111,.1); }

.face-dialog { width: min(940px, calc(100vw - 30px)); max-height: calc(100vh - 30px); padding: 45px; border: 1px solid var(--line); border-radius: 3px; background: #101310; color: var(--paper); }
.face-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(5px); }
.face-drop { position: relative; min-height: 145px; display: grid; place-content: center; gap: 7px; text-align: center; border: 1px dashed #4a5046; cursor: pointer; }
.face-drop.has-preview { padding-left: 118px; }
.face-query-preview { position: absolute; z-index: 1; left: 10px; top: 10px; width: 92px; height: 123px; object-fit: cover; border: 1px solid rgba(238,233,221,.22); border-radius: 3px; background: var(--panel); }
.face-query-preview[hidden] { display: none; }
.face-drop > span { color: var(--acid); font-size: 32px; }
.face-drop > small { color: var(--muted); }
.face-results { margin-top: 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 1px; background: var(--line); }
.face-result { position: relative; padding: 8px; background: var(--ink); }
.face-result img { width: 100%; aspect-ratio: 3/4; object-fit: cover; background: var(--panel); }
.face-result b { display: block; margin: 8px 0 3px; font: 15px Georgia, serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.face-result code { color: var(--acid); font-size: 11px; }
.face-result-yandex { position: absolute; right: 14px; top: 14px; width: 29px; height: 29px; border: 1px solid rgba(238,233,221,.28); border-radius: 3px; background: rgba(8,10,8,.86); color: var(--paper); cursor: pointer; font-size: 10px; }
.face-result-yandex:hover, .face-result-yandex:focus-visible { border-color: var(--acid); color: var(--acid); }

.drop-overlay { position: fixed; z-index: 60; inset: 14px; display: grid; place-items: center; pointer-events: none; opacity: 0; border: 1px solid var(--acid); background: rgba(9,11,9,.92); transition: opacity .15s; }
.drop-overlay.active { opacity: 1; }
.drop-overlay div { text-align: center; }
.drop-overlay span, .drop-overlay b, .drop-overlay small { display: block; }
.drop-overlay span { color: var(--acid); font-size: 70px; }
.drop-overlay b { font: 36px Georgia, serif; }
.drop-overlay small { margin-top: 10px; color: var(--muted); }
.import-choice { position: fixed; z-index: 70; inset: 0; display: grid; grid-template-columns: 1fr 1fr; background: rgba(7,9,7,.94); backdrop-filter: blur(12px); }
.import-choice[hidden] { display: none; }
.import-choice-side { position: relative; display: grid; place-content: center; gap: 10px; padding: 32px; border: 0; background: transparent; color: var(--paper); text-align: center; cursor: pointer; transition: background .22s ease, color .22s ease; }
.import-choice-side:first-child { border-right: 1px solid rgba(238,233,221,.12); }
.import-choice-side::before { content: ""; position: absolute; inset: 18px; border: 1px solid transparent; transition: border-color .22s ease, inset .22s ease; }
.import-choice-side:hover::before, .import-choice-side:focus-visible::before { inset: 12px; border-color: var(--acid); }
.import-choice-side.add:hover, .import-choice-side.add:focus-visible { background: radial-gradient(circle at 68% 50%, rgba(211,255,74,.14), transparent 48%); }
.import-choice-side.face:hover, .import-choice-side.face:focus-visible { background: radial-gradient(circle at 32% 50%, rgba(211,255,74,.14), transparent 48%); }
.import-choice-side > span { color: var(--acid); font: 11px/1 monospace; letter-spacing: .15em; }
.import-choice-side > b { font: 400 clamp(36px, 5vw, 72px)/.95 Georgia, serif; letter-spacing: -.04em; }
.import-choice-side > small { max-width: 280px; color: var(--muted); font-size: 11px; line-height: 1.5; text-transform: uppercase; letter-spacing: .08em; }
.import-choice-preview { position: absolute; z-index: 2; left: 50%; top: 50%; width: 86px; transform: translate(-50%, -50%); padding: 5px; border: 1px solid rgba(238,233,221,.3); border-radius: 4px; background: #0b0d0b; box-shadow: 0 8px 24px rgba(0,0,0,.35); pointer-events: none; }
.import-choice-preview img { display: block; width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 2px; }
.import-choice-preview code { display: block; margin-top: 6px; overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.import-choice-cancel { position: absolute; z-index: 3; right: 22px; top: 22px; width: 40px; height: 40px; border: 1px solid rgba(238,233,221,.25); border-radius: 50%; background: rgba(8,10,8,.8); color: var(--paper); font-size: 24px; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (max-width: 760px) {
  .topbar { height: 64px; }
  .hero { grid-template-columns: 1fr; gap: 28px; min-height: 0; padding: 45px 0 38px; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1/-1; }
  .semantic-panel { grid-template-columns: 1fr; padding: 24px 18px; }
  .semantic-composer { grid-template-columns: 1fr auto; }
  .semantic-clear { grid-column: 1/-1; justify-self: start; padding-left: 0; }
  .semantic-chip-copy { max-width: 150px; }
  .catalog-count.secondary { display: none; }
  .catalog-counts .catalog-count:first-child { padding-left: 0; }
  .catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-tools { opacity: 1; transform: none; }
  .field-pair { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; }
  .record-actions { width: 100%; }
  .record-actions .button { flex: 1; }
  .create-actions { width: 100%; margin-left: 0; }
  .create-actions .button { flex: 1; }
  .face-dialog { padding: 38px 18px 20px; }
  .import-choice-side { padding: 20px 10px; }
  .import-choice-side > b { font-size: clamp(28px, 9vw, 48px); }
  .import-choice-side > small { max-width: 150px; font-size: 9px; }
}
