:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --bg-soft: #e8edf5;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --surface-contrast: #0f1823;
  --surface-contrast-soft: #162233;
  --text: #152030;
  --muted: #64748b;
  --line: #d7e0ea;
  --line-strong: #c2cfdd;
  --accent: #3d7a6b;
  --accent-strong: #2b6154;
  --accent-soft: rgba(61, 122, 107, 0.12);
  --shadow: 0 14px 36px rgba(15, 23, 35, 0.07);
  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 40px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI Variable", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(61, 122, 107, 0.08), transparent 26%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

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

button,
.btn,
.nav-link {
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 112px;
  padding: 12px 14px;
  resize: vertical;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: rgba(61, 122, 107, 0.54);
  box-shadow: 0 0 0 4px rgba(61, 122, 107, 0.12);
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(32px, 4.2vw, 46px);
  line-height: 1.04;
}

h2 {
  font-size: 24px;
  line-height: 1.1;
}

h3 {
  font-size: 18px;
  line-height: 1.2;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

.admin-layout {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 0;
  padding: 28px 22px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(61, 122, 107, 0.28), transparent 24%),
    linear-gradient(180deg, #111b27 0%, var(--surface-contrast) 100%);
  color: #e9f0f7;
}

.brand-block {
  display: grid;
  gap: 6px;
}

.brand {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-meta,
.sidebar-footer__label,
.admin-eyebrow,
.stat-card__label,
.inline-note {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand-meta,
.sidebar-footer span {
  color: rgba(233, 240, 247, 0.68);
}

.sidebar-nav {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(233, 240, 247, 0.28) transparent;
}

.nav-group-label {
  margin: 12px 10px 0;
  color: rgba(233, 240, 247, 0.46);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: rgba(233, 240, 247, 0.76);
  font-weight: 700;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-link.is-active {
  color: #fff;
  border-color: rgba(233, 240, 247, 0.16);
  background: rgba(61, 122, 107, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.nav-link__badge {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  padding-inline: 7px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.18);
  color: #fde68a;
  font-size: 11px;
  font-weight: 800;
}

.nav-link__badge.is-critical {
  background: rgba(248, 113, 113, 0.2);
  color: #fecaca;
}

.nav-link__badge.is-warning {
  background: rgba(251, 191, 36, 0.18);
  color: #fde68a;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  align-self: end;
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(233, 240, 247, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-footer strong {
  font-size: 18px;
}

.admin-workspace {
  min-width: 0;
  padding: 28px 32px 40px;
}

.admin-topbar,
.panel-head,
.editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.admin-topbar {
  margin-bottom: 28px;
}

.admin-topbar__copy {
  display: grid;
  gap: 10px;
  max-width: 760px;
}

.admin-eyebrow {
  color: var(--accent-strong);
}

.admin-user-card {
  min-width: 220px;
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow);
}

.admin-user-card__label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-main {
  display: grid;
  gap: 24px;
}

.stats-grid,
.two-col,
.three-col,
.zone-editor-layout,
.field-row {
  display: grid;
  gap: 20px;
}

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

.stats-grid--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.two-col {
  grid-template-columns: minmax(0, 1.22fr) minmax(320px, 0.78fr);
  align-items: start;
}

.two-col--wide {
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
}

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.stat-card,
.panel,
.login-card,
.login-aside {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.stat-card {
  display: grid;
  gap: 10px;
  padding: 22px;
}

.stat-card strong {
  font-size: clamp(34px, 4vw, 46px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.stat-card__label {
  color: var(--accent-strong);
}

.stat-card--accent {
  background: linear-gradient(180deg, rgba(61, 122, 107, 0.12), rgba(255, 255, 255, 0.96));
}

.panel {
  padding: 24px;
  display: grid;
  gap: 20px;
}

.panel--form {
  gap: 18px;
}

.panel--nested {
  padding: 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: none;
}

.panel-head {
  align-items: center;
}

.panel-head--compact {
  margin-top: 6px;
}

.inline-note {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.sidebar-footer span,
.sidebar-footer strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.data-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.data-table tbody tr:hover {
  background: rgba(61, 122, 107, 0.04);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.form-grid,
.form-section {
  display: grid;
  gap: 16px;
}

.catalog-filter-form {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-soft);
}

.catalog-filter-form__actions {
  align-self: end;
}

.form-section {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-soft);
}

.form-section h3 {
  margin-bottom: 2px;
}

.field-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.checkbox-row {
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.checkbox-row span {
  color: var(--text);
  font-weight: 600;
}

.entity-list,
#zone-list {
  display: grid;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.entity-list li,
#zone-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.entity-list--compact {
  margin-top: 10px;
}

.entity-list strong,
#zone-list strong {
  display: block;
}

.entity-list span,
#zone-list span,
.empty-copy {
  color: var(--muted);
}

.table-wrap::before {
  content: "Гортайте таблицю горизонтально, якщо потрібно";
  display: none;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.complex-media-layout {
  align-items: start;
}

.complex-media-list,
.complex-media-card,
.complex-media-card__head,
.complex-media-card__grid,
.complex-media-preview {
  display: grid;
  gap: 14px;
}

.complex-media-list {
  gap: 18px;
}

.complex-media-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}

.complex-media-card__head {
  gap: 4px;
}

.complex-media-card__head strong {
  font-size: 18px;
}

.complex-media-card__head span {
  color: var(--muted);
  font-size: 13px;
}

.complex-media-card__grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.complex-media-preview {
  gap: 10px;
  color: var(--text);
}

.complex-media-preview span,
.form-hint {
  color: var(--muted);
  font-size: 13px;
}

.complex-media-preview img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.form-hint {
  margin: 0;
  line-height: 1.6;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-badge.is-available,
.status-badge.is-contacted,
.status-badge.is-sent,
.status-badge.is-success {
  background: rgba(45, 124, 95, 0.12);
  color: #24654f;
}

.status-badge.is-reserved,
.status-badge.is-processing,
.status-badge.is-pending,
.status-badge.is-partial_failed {
  background: rgba(188, 136, 40, 0.14);
  color: #916723;
}

.status-badge.is-sold,
.status-badge.is-failed {
  background: rgba(176, 90, 80, 0.12);
  color: #a24a40;
}

.status-badge.is-hidden,
.status-badge.is-archived,
.status-badge.is-skipped {
  background: rgba(100, 116, 139, 0.12);
  color: #526174;
}

.status-badge.is-role {
  background: rgba(22, 34, 51, 0.08);
  color: var(--surface-contrast);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(61, 122, 107, 0.14);
}

.btn:hover {
  transform: translateY(-1px);
  background: var(--accent-strong);
}

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

.btn.secondary,
.btn-ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
  box-shadow: none;
}

.btn.secondary:hover,
.btn-ghost:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.02);
  color: #fff;
  border-color: rgba(233, 240, 247, 0.12);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(233, 240, 247, 0.18);
}

.btn-block {
  width: 100%;
}

.btn-small {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-form select {
  min-width: 170px;
}

.text-link {
  color: var(--accent-strong);
  font-weight: 700;
}

.text-link:hover {
  text-decoration: underline;
}

.mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.editor-head {
  align-items: center;
}

.zone-editor-layout {
  grid-template-columns: minmax(0, 1.4fr) 360px;
  align-items: start;
}

.editor-stage {
  position: relative;
  overflow: hidden;
  min-height: 620px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(90deg, rgba(61, 122, 107, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(61, 122, 107, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, #eef4fb 0%, #f8fbff 100%);
  background-size: 28px 28px, 28px 28px, auto;
}

#editor-image,
#editor-overlay {
  width: 100%;
  display: block;
}

#editor-overlay {
  position: absolute;
  inset: 0;
}

#editor-overlay polygon,
#editor-overlay polyline {
  transition: opacity 160ms ease, stroke-width 160ms ease;
}

#editor-overlay polygon:hover {
  opacity: 0.94;
}

.editor-actions {
  display: grid;
  gap: 10px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(61, 122, 107, 0.14), transparent 24%),
    linear-gradient(180deg, #eef4fb 0%, #f5f8fc 100%);
}

.login-layout {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
}

.login-aside,
.login-card {
  padding: 32px;
}

.login-aside {
  background:
    radial-gradient(circle at top left, rgba(61, 122, 107, 0.28), transparent 26%),
    linear-gradient(180deg, #101823 0%, #152233 100%);
  color: #eff5fb;
}

.login-aside p,
.login-aside span {
  color: rgba(239, 245, 251, 0.78);
}

.login-aside .admin-eyebrow {
  color: #9fd3c7;
}

.login-aside__meta {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.login-aside__meta div {
  padding: 18px;
  border: 1px solid rgba(239, 245, 251, 0.1);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
}

.login-aside__meta strong {
  display: block;
  margin-bottom: 8px;
}

.login-card {
  display: grid;
  align-content: center;
  gap: 16px;
}

.login-card__head {
  display: grid;
  gap: 8px;
}

.flash.error {
  padding: 12px 14px;
  border: 1px solid rgba(176, 90, 80, 0.16);
  border-radius: 14px;
  background: rgba(254, 226, 226, 0.9);
  color: #9c2f2f;
}

.flash.success {
  padding: 12px 14px;
  border: 1px solid rgba(64, 128, 89, 0.16);
  border-radius: 14px;
  background: rgba(230, 244, 235, 0.9);
  color: #285c3a;
}

.settings-logo-preview,
.admin-image-grid,
.admin-image-card {
  display: grid;
  gap: 12px;
}

.settings-logo-preview {
  max-width: 220px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.settings-logo-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.settings-logo-preview img {
  max-height: 76px;
  object-fit: contain;
}

.admin-image-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: var(--space-4);
}

.admin-image-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.admin-image-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #fff;
}

@media (max-width: 1240px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-col,
  .two-col--wide,
  .zone-editor-layout,
  .login-layout {
    grid-template-columns: 1fr;
  }

  .complex-media-card__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1040px) {
  .admin-layout,
  .three-col {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
    gap: 18px;
  }

  .sidebar-nav {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    overflow: visible;
    padding-right: 0;
  }

  .admin-workspace {
    padding-top: 12px;
  }
}

@media (max-width: 720px) {
  .admin-workspace,
  .login-page {
    padding: 18px;
  }

  .admin-topbar,
  .panel-head,
  .editor-head,
  .field-row,
  .inline-form {
    grid-template-columns: 1fr;
    display: grid;
  }

  .stats-grid,
  .field-row {
    grid-template-columns: 1fr;
  }

  .panel,
  .login-card,
  .login-aside {
    padding: 20px;
  }

  .data-table {
    min-width: 560px;
  }

  .table-wrap::before {
    display: block;
  }

  .nav-link {
    min-height: 42px;
    border-radius: 14px;
  }

  .inline-form .btn,
  .inline-form select {
    width: 100%;
  }
}
