@import url("https://fonts.googleapis.com/css2?family=Sofia+Sans:opsz,wght@8..144,400;8..144,500;8..144,600;8..144,700;8..144,800;8..144,900&display=swap");

:root {
  color-scheme: dark;
  --bg: #050402;
  --panel: rgba(255, 247, 225, 0.065);
  --panel-strong: rgba(196, 163, 90, 0.13);
  --line: rgba(196, 163, 90, 0.22);
  --line-strong: rgba(225, 201, 137, 0.42);
  --text: #fff8e8;
  --muted: #b9ad92;
  --soft: #151109;
  --accent: #c4a35a;
  --accent-strong: #e1c989;
  --gold-deep: #7e6838;
  --gold-soft: #f5e9ca;
  --ok: #e8c979;
  --warn: #caa95d;
  --radius: 8px;
  --page-pad: clamp(16px, 3vw, 34px);
  --font: "Sofia Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(145deg, #030302 0%, #0c0905 52%, #050402 100%);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

body::before {
  display: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

input,
select,
textarea {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

button {
  color: inherit;
  -webkit-user-select: none;
  user-select: none;
}

a,
img,
svg {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
}

.shell {
  width: min(100%, 1240px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 var(--page-pad) max(34px, env(safe-area-inset-bottom));
}

.topbar {
  min-height: calc(72px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 10;
  margin-inline: calc(var(--page-pad) * -1);
  padding-inline: var(--page-pad);
  background: linear-gradient(180deg, rgba(5, 4, 2, 0.97), rgba(5, 4, 2, 0.68), rgba(5, 4, 2, 0));
  backdrop-filter: blur(18px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(246, 214, 143, 0.24);
  border-radius: 8px;
  background: rgba(13, 11, 7, 0.82);
  backdrop-filter: blur(12px);
}

.language-label {
  padding: 0 8px 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.language-switcher button {
  width: 32px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 18px;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
  position: relative;
}

.language-switcher button.active {
  background: #292929;
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.flag-icon {
  display: block;
  line-height: 1;
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0;
}

.brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 0;
  border: 0;
  background: transparent;
}

.brand span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.app {
  min-height: calc(100dvh - 74px - env(safe-area-inset-top));
  padding: 12px 0 36px;
}

.brand-partnership {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 0 14px;
}

.partner-logo {
  width: 40px;
  height: 40px;
  display: block;
  object-fit: contain;
  opacity: 0.96;
}

.partnership-symbol {
  color: rgba(225, 201, 137, 0.78);
  font-size: 21px;
  font-weight: 500;
  line-height: 1;
}

.admin-login-screen {
  min-height: calc(100dvh - 112px - env(safe-area-inset-top));
  display: grid;
  place-items: center;
  padding: 28px 0 max(42px, env(safe-area-inset-bottom));
}

.admin-login-card {
  width: min(100%, 460px);
}

.admin-login-logo {
  width: 104px;
  height: 104px;
  display: block;
  object-fit: contain;
  margin: 0 auto 22px;
}

.admin-login-card .kicker,
.admin-login-card h2 {
  text-align: center;
}

.hero {
  min-height: calc(100dvh - 118px - env(safe-area-inset-top));
  display: grid;
  align-content: center;
  gap: clamp(16px, 3vw, 26px);
  padding: clamp(14px, 3vw, 34px) 0 max(44px, env(safe-area-inset-bottom));
}

.hero-logo {
  width: min(170px, 44vw);
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

.headline {
  margin: 0 0 10px;
  font-size: clamp(38px, 10vw, 78px);
  line-height: 0.96;
  letter-spacing: 0;
  text-align: center;
  color: var(--gold-soft);
  background: linear-gradient(110deg, #fff8e8 0%, #f4ce76 45%, #a77a28 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lead {
  max-width: 560px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
  text-align: center;
}

.choice-grid,
.admin-grid,
.stats-grid,
.photo-grid,
.event-grid,
.staff-grid {
  display: grid;
  gap: 14px;
}

.choice-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 6px;
}

.entry-panel {
  width: min(100%, 520px);
  margin: 6px auto 0;
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 248, 232, 0.08), rgba(214, 174, 88, 0.035)),
    var(--panel);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 24px);
}

.admin-entry {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.admin-entry .ghost {
  width: 100%;
}

.admin-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.45fr);
  align-items: start;
}

.admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background:
    linear-gradient(135deg, rgba(246, 214, 143, 0.13), rgba(255, 248, 232, 0.035)),
    var(--panel);
}

.admin-mini {
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(214, 174, 88, 0.08);
  padding: 14px 16px;
}

.admin-mini span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.admin-mini strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 16px;
}

.admin-shell {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 248, 232, 0.055), rgba(214, 174, 88, 0.03)),
    rgba(5, 4, 2, 0.42);
  padding: clamp(10px, 2vw, 14px);
}

.admin-content {
  margin-top: 12px;
}

.selection-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(214, 174, 88, 0.055);
  padding: 12px;
}

.selection-filter-bar .ghost {
  min-width: 120px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
}

.event-grid,
.staff-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.photo-grid {
  grid-template-columns: repeat(auto-fill, minmax(164px, 1fr));
}

.panel,
.card,
.stat,
.photo-card,
.selection-card {
  box-shadow: none;
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 248, 232, 0.075), rgba(214, 174, 88, 0.028)),
    var(--panel);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
}

.panel {
  padding: clamp(18px, 2.4vw, 26px);
  overflow: hidden;
}

.event-form-panel {
  position: relative;
  z-index: 3;
  overflow: visible;
}

.card {
  min-height: 220px;
  padding: 22px;
}

.card h2,
.panel h2,
.section-title {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.1;
}

.card p,
.panel p,
.muted {
  color: var(--muted);
  line-height: 1.55;
}

.muted {
  margin: 0;
}

.kicker {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.actions,
.row,
.tabs,
.inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.actions {
  margin-top: 18px;
}

.tabs {
  margin: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.34);
}

.btn,
.ghost,
.danger,
.tab {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 248, 232, 0.06);
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.btn {
  color: #110c04;
  background: #c4a35a;
  border-color: rgba(255, 240, 183, 0.7);
}

.btn:active,
.ghost:active,
.danger:active,
.tab:active {
  transform: translateY(1px);
}

.ghost {
  color: var(--text);
  border-color: rgba(246, 214, 143, 0.24);
}

.danger {
  color: #fff8e8;
  background: rgba(157, 115, 39, 0.08);
  border-color: rgba(214, 174, 88, 0.26);
}

.small {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 13px;
}

.tab.active {
  background: rgba(214, 174, 88, 0.22);
  border-color: rgba(246, 214, 143, 0.48);
  color: #fff8e8;
}

.form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 232, 0.075);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 248, 232, 0.05);
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(246, 214, 143, 0.7);
}

.localized-date-field {
  position: relative;
}

.localized-date-field input {
  padding-right: 56px;
}

.date-picker-button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  padding: 0;
  cursor: pointer;
}

.date-picker-button:hover,
.date-picker-button:focus-visible {
  background: rgba(246, 214, 143, 0.12);
  outline: none;
}

.calendar-symbol {
  position: relative;
  width: 17px;
  height: 16px;
  display: block;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.calendar-symbol::before {
  content: "";
  position: absolute;
  top: 3px;
  right: -2px;
  left: -2px;
  border-top: 2px solid currentColor;
}

.calendar-symbol::after {
  content: "";
  position: absolute;
  top: -4px;
  left: 3px;
  width: 2px;
  height: 5px;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 7px 0 0 currentColor;
}

.localized-calendar {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: min(328px, calc(100vw - 48px));
  border: 1px solid rgba(246, 214, 143, 0.36);
  border-radius: 16px;
  background: rgba(20, 17, 11, 0.98);
  backdrop-filter: blur(18px);
  padding: 12px;
}

.localized-calendar[hidden] {
  display: none;
}

.calendar-header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 6px;
}

.calendar-header strong {
  min-width: 0;
  text-align: center;
  text-transform: capitalize;
}

.calendar-nav {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 248, 232, 0.055);
  color: var(--text);
  padding: 0;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.calendar-weekdays,
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.calendar-weekdays {
  margin: 10px 0 5px;
}

.calendar-weekdays span {
  display: grid;
  place-items: center;
  min-height: 24px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.calendar-day {
  aspect-ratio: 1;
  min-width: 0;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  padding: 0;
  cursor: pointer;
}

.calendar-day:hover,
.calendar-day:focus-visible {
  border-color: rgba(246, 214, 143, 0.45);
  background: rgba(246, 214, 143, 0.1);
  outline: none;
}

.calendar-day.today {
  border-color: rgba(246, 214, 143, 0.42);
}

.calendar-day.selected {
  border-color: #f5d98d;
  background: #c4a35a;
  color: #171006;
  font-weight: 900;
}

.calendar-day.empty {
  pointer-events: none;
  visibility: hidden;
}

.calendar-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.calendar-footer button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 248, 232, 0.055);
  color: var(--text);
  padding: 7px 12px;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.field select option {
  background: #151109;
}

.event-context-picker {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(214, 174, 88, 0.09);
  padding: 15px;
}

.file-input-native {
  position: absolute;
  width: 1px !important;
  height: 1px;
  min-height: 0 !important;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  opacity: 0;
  padding: 0 !important;
}

.file-picker {
  min-height: 52px;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 232, 0.075);
  padding: 7px;
  color: var(--text) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  cursor: pointer;
}

.file-picker-action {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(246, 214, 143, 0.34);
  border-radius: 6px;
  background: rgba(214, 174, 88, 0.14);
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.file-picker-status {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.file-input-native:focus + .file-picker {
  border-color: rgba(246, 214, 143, 0.7);
}

.download-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.btn:disabled,
.ghost:disabled,
.danger:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.notice {
  border: 1px solid rgba(246, 214, 143, 0.28);
  background: rgba(214, 174, 88, 0.095);
  color: #fff8e8;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.45;
}

.divider {
  width: 100%;
  height: 1px;
  border: 0;
  background: var(--line);
  margin: 18px 0;
}

.workflow {
  display: grid;
  gap: 8px;
  margin: 14px 0 16px;
}

.workflow div {
  display: grid;
  grid-template-columns: 44px 1fr;
  column-gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(214, 174, 88, 0.055);
  padding: 12px;
}

.workflow span {
  grid-row: span 2;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #c4a35a;
  color: #100c05;
  font-size: 12px;
  font-weight: 900;
}

.workflow strong {
  color: var(--text);
  font-size: 14px;
}

.workflow p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.success {
  border-color: rgba(246, 214, 143, 0.34);
  background: rgba(214, 174, 88, 0.11);
  color: #fff8e8;
}

.stat {
  padding: 16px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
}

.event-card {
  padding: 16px;
}

.event-cover-thumb,
.event-cover-empty {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.26);
}

.event-cover-thumb {
  object-fit: contain;
}

.event-cover-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.event-cover-action {
  width: 100%;
  margin-top: 14px;
  cursor: pointer;
}

.cover-guidance {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.event-card.active {
  border-color: rgba(246, 214, 143, 0.45);
  background: rgba(214, 174, 88, 0.12);
}

.nfc-panel {
  overflow: visible;
}

.nfc-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  align-items: end;
  gap: 24px;
}

.nfc-heading h2 {
  margin-bottom: 8px;
}

.nfc-event-field {
  min-width: 0;
}

.nfc-workflow {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 22px;
}

.nfc-actions {
  margin-bottom: 14px;
}

.master-code-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 4px 0 14px;
  border-block: 1px solid var(--line);
  padding: 14px 2px;
}

.master-code-card .kicker {
  margin-bottom: 4px;
}

.master-code-card code {
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  padding: 10px 13px;
  font: 800 15px/1 "Sofia Sans", sans-serif;
  letter-spacing: 0.06em;
}

.nfc-link-list {
  display: grid;
  gap: 8px;
  max-height: 560px;
  margin-top: 16px;
  padding-right: 4px;
  overflow: auto;
  overscroll-behavior: contain;
}

.nfc-link-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 232, 0.045);
  padding: 8px;
}

.nfc-link-row strong {
  padding-left: 6px;
  font-size: 13px;
}

.nfc-link-row input {
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--muted);
  padding: 8px 10px;
  font: 12px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.event-card h3,
.selection-card h3 {
  margin: 0 0 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pill.ok {
  border-color: rgba(246, 214, 143, 0.34);
  background: rgba(214, 174, 88, 0.13);
  color: #fff8e8;
}

.pill.off {
  border-color: rgba(214, 174, 88, 0.16);
  background: rgba(0, 0, 0, 0.22);
  color: #a99d83;
}

.photo-card {
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(145deg, rgba(255, 248, 232, 0.07), rgba(0, 0, 0, 0.16)),
    rgba(14, 11, 6, 0.8);
}

.photo-card button {
  width: 100%;
  display: block;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.photo-card img {
  width: 100%;
  aspect-ratio: 1 / 1.2;
  display: block;
  object-fit: cover;
  background: #100c05;
}

.photo-meta {
  padding: 10px 11px 12px;
}

.photo-meta strong {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
}

.photo-meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.photo-actions .ghost,
.photo-actions .danger {
  width: auto;
  min-width: 0;
  flex: 1 1 92px;
}

.photo-card.selected {
  border-color: rgba(255, 240, 183, 0.78);
}

.photo-card.selected::after {
  content: "Избрана";
  position: absolute;
  top: 10px;
  right: 10px;
  border-radius: 999px;
  background: #c4a35a;
  color: #100c05;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 900;
}

.protected-photo {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.privacy-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding:
    max(20px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.privacy-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(5, 4, 2, 0.86);
  backdrop-filter: blur(18px);
}

.privacy-viewer {
  width: min(100%, 820px);
  max-height: calc(100svh - 40px);
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: rgba(12, 10, 6, 0.98);
  padding: clamp(14px, 2.6vw, 20px);
  overflow: auto;
  overscroll-behavior: contain;
}

.privacy-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.privacy-toolbar > div {
  min-width: 0;
}

.privacy-toolbar h2 {
  margin: 0;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.privacy-toolbar .ghost {
  flex: 0 0 auto;
  min-width: 88px;
}

.privacy-photo-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #050402;
}

.privacy-photo-wrap img {
  width: 100%;
  max-height: 68svh;
  display: block;
  object-fit: contain;
}

.admin-preview .privacy-photo-wrap {
  background: #0b0804;
}

.print-caption {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.print-caption strong {
  color: var(--text);
}

.print-mode {
  display: grid;
  gap: 16px;
}

.print-mode-sheet {
  min-height: min(72svh, 860px);
  display: grid;
  align-items: center;
}

.print-mode-sheet img {
  width: 100%;
  max-height: 68svh;
  object-fit: contain;
}

.watermark-grid {
  position: absolute;
  inset: -20%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-content: space-around;
  gap: 26px;
  transform: rotate(-22deg);
  pointer-events: none;
  opacity: 0.22;
}

.watermark-grid span {
  color: #fff4c8;
  font-size: clamp(16px, 4vw, 38px);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-align: center;
  white-space: nowrap;
}

.privacy-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.privacy-flash::before {
  content: "Защитен преглед";
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(5, 4, 2, 0.9);
  color: #e1c989;
  font-size: clamp(28px, 8vw, 72px);
  font-weight: 900;
  pointer-events: none;
}

.selection-card {
  padding: 16px;
}

.selection-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.selection-head > div {
  min-width: 0;
}

.selection-identity {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.selection-person,
.selection-table {
  display: grid;
  align-content: center;
}

.selection-person span,
.selection-table span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.selection-person h3 {
  margin: 4px 0 0;
  color: #ffffff;
  font-size: clamp(21px, 3vw, 28px);
  line-height: 1.05;
}

.selection-table {
  min-width: 86px;
  border-left: 1px solid var(--line);
  padding-left: 12px;
}

.selection-table strong {
  margin-top: 2px;
  color: var(--accent-strong);
  font-size: clamp(25px, 4vw, 34px);
  line-height: 1;
}

.selection-meta {
  margin: 12px 0 0 !important;
  color: var(--muted);
  font-size: 13px;
}

.selection-head .pill {
  flex: 0 0 auto;
}

.thumb-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 2px;
}

.thumb-btn {
  width: 112px;
  flex: 0 0 112px;
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(214, 174, 88, 0.055);
  padding: 7px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.thumb-btn img {
  width: 72px;
  height: 72px;
  width: 100%;
  object-fit: cover;
  border-radius: 0;
  border: 1px solid var(--line);
}

.thumb-btn span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.sticky-bar {
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  gap: 10px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px;
  background:
    linear-gradient(135deg, rgba(255, 248, 232, 0.07), rgba(214, 174, 88, 0.035)),
    rgba(5, 4, 2, 0.9);
  backdrop-filter: blur(18px);
}

.sticky-bar .btn,
.sticky-bar .ghost {
  flex: 1;
}

.empty {
  padding: 28px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

@media (max-width: 860px) {
  .choice-grid,
  .admin-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .card {
    min-height: 0;
  }

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

  .admin-mini {
    min-width: 0;
  }

  .tabs {
    border-radius: 8px;
  }

  .nfc-heading,
  .nfc-workflow {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .topbar-actions {
    gap: 6px;
  }

  .language-switcher button {
    width: 27px;
    height: 28px;
  }

  .language-label {
    display: none;
  }

  :root {
    --page-pad: 14px;
  }

  .shell {
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: calc(62px + env(safe-area-inset-top));
  }

  .brand img {
    width: 34px;
    height: 34px;
  }

  .brand span {
    max-width: 160px;
    font-size: 14px;
  }

  .hero {
    min-height: calc(100dvh - 86px - env(safe-area-inset-top));
    align-content: center;
    gap: 14px;
    padding: 10px 0 max(30px, env(safe-area-inset-bottom));
  }

  .hero-logo {
    width: min(132px, 38vw);
    border-radius: 20px;
  }

  .headline {
    font-size: clamp(34px, 11vw, 48px);
    margin-bottom: 8px;
  }

  .lead {
    font-size: 14px;
    line-height: 1.4;
  }

  .entry-panel {
    padding: 16px;
  }

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

  .selection-filter-bar {
    grid-template-columns: 1fr;
  }

  .selection-filter-bar .ghost {
    width: 100%;
  }

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

  .file-picker-action,
  .file-picker-status {
    width: 100%;
    text-align: center;
  }

  .panel {
    padding: 16px;
  }

  .localized-calendar {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    margin-top: 8px;
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .photo-meta {
    padding: 9px;
  }

  .privacy-lightbox {
    place-items: stretch;
    padding:
      max(14px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }

  .privacy-viewer {
    width: 100%;
    max-height: calc(100svh - 28px);
    align-self: center;
    border-radius: 0;
  }

  .privacy-toolbar {
    align-items: center;
    gap: 10px;
  }

  .privacy-toolbar h2 {
    font-size: 17px;
  }

  .privacy-toolbar .ghost {
    min-height: 40px;
    min-width: 74px;
    padding-inline: 10px;
  }

  .privacy-photo-wrap img {
    max-height: 56svh;
  }

  .selection-head {
    display: grid;
  }

  .selection-identity {
    width: 100%;
  }

  .selection-person {
    min-width: 0;
    flex: 1;
  }

  .master-code-card {
    align-items: stretch;
    flex-direction: column;
  }

  .master-code-card code {
    width: 100%;
    text-align: center;
  }

  .nfc-link-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .nfc-link-row input {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .sticky-bar {
    border-radius: 8px;
    padding: 8px;
  }

  .thumb-btn {
    width: 98px;
    flex-basis: 98px;
  }

  .actions .btn,
  .actions .ghost,
  .actions .danger,
  .inline-form .btn,
  .inline-form .ghost {
    width: 100%;
  }
}

@media print {
  body * {
    visibility: hidden !important;
  }

  .print-sheet,
  .print-sheet * {
    visibility: visible !important;
  }

  .print-sheet {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    display: grid !important;
    place-items: center !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    overflow: hidden !important;
  }

  .print-sheet img {
    max-width: 100vw !important;
    max-height: 92vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
  }

  .print-caption {
    position: fixed;
    left: 18px;
    right: 18px;
    bottom: 12px;
    border: 0;
    color: #111;
    background: transparent;
  }

  .print-caption strong {
    color: #111;
  }
}
