:root {
  --green: #55b900;
  --green-dark: #2f8a25;
  --green-ink: #145421;
  --green-soft: #edf8e5;
  --green-pale: #f6fbef;
  --nav: #0b1824;
  --nav-2: #102231;
  --nav-line: #22394a;
  --text: #17202a;
  --muted: #687481;
  --line: #e2e8dc;
  --line-strong: #cfdcca;
  --warn: #f39a2d;
  --danger: #c9362b;
  --bg: #f4f7ef;
  --panel: #ffffff;
  --shadow: 0 16px 42px rgba(18, 38, 24, 0.09);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
}

a {
  color: var(--green-dark);
  text-decoration: none;
}

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

button,
.periods a {
  min-height: 38px;
  border: 0;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--green);
  color: #fff;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 700;
}

button.secondary,
.periods a {
  background: var(--green-soft);
  color: var(--green-dark);
}

button:hover,
.periods a.active {
  background: var(--green-dark);
  color: #fff;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(85, 185, 0, 0.22);
  outline-offset: 2px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #5b6873;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  background: #fbfdf8;
}

td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

tr:hover {
  background: #fbfdf9;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
  padding: 9px 11px;
  font-weight: 500;
}

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

code,
pre {
  white-space: pre-wrap;
  word-break: break-word;
}

.brand-inline {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
}

.brand-inline img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: block;
}

.brand-inline span,
.brand-inline strong {
  display: block;
}

.brand-inline span {
  color: var(--green-ink);
  font-size: 13px;
  font-weight: 800;
}

.brand-inline strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1.1;
}

.public-body {
  background:
    linear-gradient(180deg, #f9fcf4 0, #f3f7ee 240px),
    var(--bg);
}

.public-home-body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

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

.public-brand {
  padding: 6px 0;
}

.public-brand strong {
  font-size: 13px;
  color: var(--muted);
}

.public-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 24px 44px;
}

.public-home-wrap {
  max-width: none;
  width: 100vw;
  height: 100vh;
  padding: 0;
}

.home-placeholder {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  margin-left: calc(50% - 50vw);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  padding: 0;
  overflow: hidden;
}

.home-placeholder img {
  grid-column: 2;
  width: 64px;
  height: 64px;
  display: block;
  border-radius: 16px;
  box-shadow: 0 14px 32px rgba(18, 38, 24, 0.13);
}

.home-placeholder h1 {
  grid-column: 3;
  justify-self: start;
  margin: 0 0 0 18px;
  color: var(--text);
  font-size: 28px;
  line-height: 1.05;
  font-weight: 900;
  white-space: nowrap;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.page-head h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.12;
}

.page-head p {
  margin: 7px 0 0;
  color: var(--muted);
}

.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.public-object-head {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.public-url,
.soft-pill,
.object-chip,
.category-badge,
.status-badge,
.points-chip {
  min-height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 10px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.public-url,
.soft-pill,
.object-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-ink);
}

.public-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.periods,
.filters,
.inline-form,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.periods {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 5px;
  box-shadow: 0 8px 24px rgba(18, 38, 24, 0.05);
}

.periods a {
  min-height: 34px;
  padding: 7px 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-grid article,
.patrol-card,
.panel,
.login-panel,
.empty {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card {
  position: relative;
  min-height: 132px;
  overflow: hidden;
  padding: 16px;
}

.metric-card::after {
  content: none;
}

.ui-icon {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  fill: currentColor;
}

.metric-icon {
  position: absolute;
  right: 15px;
  top: 15px;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--green-soft);
  color: var(--green);
}

.metric-icon .ui-icon {
  width: 38px;
  height: 38px;
}

.metric-card small,
.summary-grid span,
.metric-row span {
  color: var(--muted);
}

.metric-card small {
  display: block;
  font-size: 13px;
  font-weight: 800;
}

.metric-card strong,
.summary-grid strong {
  display: block;
  margin-top: 7px;
  font-size: 28px;
  line-height: 1.1;
}

.metric-card > span:not(.metric-icon) {
  display: block;
  margin-top: 8px;
  max-width: 190px;
  font-size: 13px;
}

.metric-card .metric-icon {
  color: var(--green);
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 12px;
}

.section-title {
  margin: 0;
  font-size: 20px;
}

.section-title-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 12px;
}

.patrol-card {
  padding: 16px;
}

.card-top,
.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.card-top {
  align-items: flex-start;
  justify-content: space-between;
}

.card-top em {
  display: block;
}

.card-date-block .inline-icon-label,
.card-top .public-card-time,
.soft-warning {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  line-height: 1.2;
}

.card-date-block .inline-icon-label .ui-icon,
.card-top .public-card-time .ui-icon {
  display: block;
  flex: 0 0 auto;
}

.card-date-block {
  display: grid;
  gap: 4px;
  min-width: 0;
  text-align: left;
}

.card-top em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.public-card-time {
  margin-top: 0;
  color: var(--green-ink);
  font-size: 18px;
  white-space: nowrap;
}

.inline-icon-label .ui-icon,
.public-card-time .ui-icon {
  width: 17px;
  height: 17px;
}

.warning {
  border-color: rgba(243, 154, 45, 0.45);
}

.soft-warning,
.soft-note,
.form-error,
.form-ok,
.flash {
  border-radius: var(--radius);
  padding: 10px 12px;
}

.soft-warning,
.form-error,
.flash.error {
  background: #fff5ec;
  color: #8b3d00;
}

.soft-warning .ui-icon {
  width: 17px;
  height: 17px;
}

.soft-note,
.form-ok,
.flash.ok {
  background: var(--green-soft);
  color: var(--green-dark);
}

.empty,
.login-panel {
  max-width: 520px;
  margin: 52px auto;
  padding: 24px;
}

.public-empty {
  text-align: center;
}

.public-login p,
.admin-login-card p {
  margin: 14px 0 18px;
  color: var(--muted);
}

.visual-key-login {
  max-width: 560px;
}

.visual-key-form {
  display: grid;
  gap: 14px;
}

.visual-key-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.visual-key-tile {
  aspect-ratio: 1;
  min-height: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  display: grid;
  gap: 3px;
  place-items: center;
  padding: 6px;
}

.visual-key-tile:hover,
.visual-key-tile.selected {
  border-color: rgba(85, 185, 0, 0.42);
  background: var(--green-soft);
  color: var(--green-ink);
}

.visual-key-tile:disabled {
  cursor: default;
  opacity: 0.72;
}

.visual-key-tile span {
  font-size: 30px;
  line-height: 1;
}

.visual-key-tile small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
}

.visual-key-progress {
  min-height: 16px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.visual-key-progress span {
  width: 10px;
  height: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
}

.visual-key-progress span.active {
  border-color: var(--green);
  background: var(--green);
}

.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(237, 248, 229, 0.92), rgba(244, 247, 239, 0.82)),
    #f5f8f0;
}

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

.admin-body {
  display: grid;
  grid-template-columns: 254px minmax(0, 1fr);
  min-height: 100vh;
  background: #eef3e8;
}

.admin-body-plain {
  grid-template-columns: 1fr;
}

.admin-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--nav);
  color: #dce8d4;
  padding: 18px;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.admin-brand img {
  width: 46px;
  height: 46px;
  border-radius: 13px;
}

.admin-brand strong,
.admin-brand small {
  display: block;
}

.admin-brand strong {
  color: #fff;
  font-size: 18px;
}

.admin-brand small {
  color: #9eb0bd;
  font-size: 12px;
}

.admin-menu {
  display: grid;
  gap: 5px;
}

.admin-menu a,
.link-button {
  border-radius: var(--radius);
  color: #dce8d4;
  background: transparent;
  padding: 10px;
  text-align: left;
  font-weight: 800;
}

.admin-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-menu a span {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 0;
  display: grid;
  place-items: center;
  color: #9eb0bd;
  font-size: 16px;
}

.admin-menu a .menu-icon .ui-icon {
  width: 16px;
  height: 16px;
}

.admin-menu a:hover,
.admin-menu a.active {
  background: var(--nav-2);
  color: #fff;
}

.admin-menu a.active span {
  border-color: transparent;
  background: transparent;
  color: #baf08b;
}

.admin-logout {
  margin-top: auto;
}

.link-button {
  width: 100%;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.link-button .ui-icon {
  width: 16px;
  height: 16px;
}

.link-button:hover {
  background: var(--nav-2);
}

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

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 74px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(246, 249, 242, 0.94);
  backdrop-filter: blur(12px);
  padding: 14px 22px;
}

.admin-topbar span,
.admin-topbar strong {
  display: block;
}

.admin-topbar > div > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-topbar > div > strong {
  margin-top: 3px;
  font-size: 21px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.admin-user {
  min-height: 30px;
  border-radius: 999px;
  background: var(--nav);
  color: #fff;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

.admin-content {
  padding: 22px;
}

.admin-section-head {
  margin-bottom: 14px;
}

.admin-summary .metric-card {
  min-height: 126px;
}

.dashboard-front-selector {
  align-items: center;
}

.dashboard-front-selector select,
.dashboard-front-selector .button-like {
  min-height: 38px;
}

.dashboard-front-selector select {
  min-width: 160px;
}

.admin-front-head h2 {
  margin: 0;
  font-size: 24px;
}

.panel {
  overflow: auto;
  padding: 18px;
  margin-bottom: 16px;
}

.panel h2,
.panel h3 {
  margin-top: 0;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 18px;
}

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

.split {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 16px;
}

.split.wide,
.admin-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.75fr);
  gap: 16px;
  align-items: start;
}

.admin-filters {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 10px 26px rgba(18, 38, 24, 0.06);
  margin-bottom: 16px;
  padding: 12px;
}

.admin-filter-panel {
  display: grid;
  grid-template-columns: minmax(190px, 1.1fr) minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(170px, 0.9fr) minmax(170px, 0.9fr) auto;
  gap: 14px 18px;
  align-items: end;
  padding: 18px;
}

.admin-filter-panel label {
  min-width: 0;
  color: #3f4d63;
  font-size: 13px;
  font-weight: 800;
  gap: 0;
}

.admin-filter-panel label > input,
.admin-filter-panel label > select {
  margin-top: 7px;
}

.admin-filters input:not([type="checkbox"]),
.admin-filters select {
  min-width: 148px;
}

.admin-filter-panel input:not([type="checkbox"]),
.admin-filter-panel select {
  width: 100%;
  height: 38px;
  min-width: 0;
}

.filter-switch {
  min-height: 63px;
  display: grid;
  align-content: start;
  gap: 0;
}

.filter-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.filter-switch i {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #c9d3de;
  cursor: pointer;
  margin-top: 15px;
  margin-bottom: 1px;
  transition: background 0.18s ease;
}

.filter-switch i::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(18, 38, 24, 0.16);
  transition: transform 0.18s ease;
}

.filter-switch input:checked + i {
  background: var(--green);
}

.filter-switch input:checked + i::before {
  transform: translateX(16px);
}

.filter-actions {
  min-height: 38px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.filter-actions .button-like,
.filter-actions button {
  height: 38px;
  min-height: 38px;
  padding-top: 0;
  padding-bottom: 0;
}

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

.check {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.check input {
  width: auto;
  min-height: 0;
}

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

.data-panel {
  max-width: 100%;
}

.data-table {
  min-width: 980px;
  width: 100%;
}

.click-row {
  cursor: pointer;
}

.click-row.selected {
  box-shadow: inset 4px 0 0 var(--green);
  background: #f8fcf4;
}

.row-warning {
  background: #fff7ed;
}

.group-row td {
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 900;
}

.category-badge {
  background: #f0f4ed;
  color: #46505a;
}

.status-badge.ok {
  background: var(--green-soft);
  color: var(--green-dark);
}

.status-badge.danger {
  background: #fff0ea;
  color: var(--danger);
}

.points-chip {
  background: #edf4fb;
  color: #244c72;
}

.detail-panel {
  max-height: calc(100vh - 112px);
  position: sticky;
  top: 92px;
}

.detail-drawer {
  border-color: var(--line-strong);
}

.drawer-workspace {
  position: relative;
}

.drawer-workspace .data-panel {
  width: 100%;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgba(8, 22, 30, 0.28);
  opacity: 0;
  animation: drawerBackdropIn 0.22s ease forwards;
}

.detail-drawer.is-open {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  width: min(560px, calc(100vw - 24px));
  max-height: none;
  border-radius: 0;
  margin: 0;
  overflow: auto;
  box-shadow: -18px 0 42px rgba(8, 22, 30, 0.2);
  transform: translateX(100%);
  animation: drawerSlideIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.drawer-backdrop.is-closing {
  animation: drawerBackdropOut 0.18s ease forwards;
}

.detail-drawer.is-open.is-closing {
  animation: drawerSlideOut 0.2s ease forwards;
}

@keyframes drawerSlideIn {
  from {
    transform: translateX(100%);
  }

  to {
    transform: translateX(0);
  }
}

@keyframes drawerBackdropIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes drawerSlideOut {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(100%);
  }
}

@keyframes drawerBackdropOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.drawer-titlebar {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.96);
  margin: -18px -18px 16px;
  padding: 14px 18px;
}

.drawer-titlebar h2 {
  margin: 0;
  font-size: 18px;
}

.detail-head {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.detail-head h2 {
  margin: 0;
}

.detail-list {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 9px 12px;
  margin: 0 0 18px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-list dd {
  margin: 0;
  min-width: 0;
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.detail-metrics span {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdf8;
  padding: 10px;
}

.detail-metrics small,
.detail-muted {
  color: var(--muted);
}

.detail-metrics strong {
  display: block;
  margin-top: 4px;
}

.detail-date-line {
  margin: 4px 0 6px;
  color: var(--text);
  font-weight: 800;
}

.detail-device-line {
  margin: 0 0 14px;
  color: var(--muted);
}

.raw-box {
  max-height: 310px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f1b25;
  color: #d8efe1;
  padding: 12px;
  font-size: 12px;
}

.empty-state {
  color: var(--muted);
}

.empty-state h2 {
  color: var(--text);
}

.timeline {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.timeline-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
}

.timeline-row > span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fff;
  font-weight: 900;
}

.timeline-row p {
  margin: 3px 0;
  color: var(--muted);
}

.timeline-point-time {
  font-weight: 800;
}

.timeline-gap {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  margin: -2px 0;
}

.timeline-gap::before {
  content: "";
  justify-self: center;
  width: 2px;
  min-height: 20px;
  border-radius: 999px;
  background: var(--line-strong);
}

.timeline-gap span {
  align-self: center;
  width: max-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfdf8;
  color: var(--muted);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
}

@media (prefers-reduced-motion: reduce) {
  .drawer-backdrop,
  .detail-drawer.is-open,
  .constructor-point-drawer.is-open {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .photo-marker::before,
  .photo-marker::after {
    animation: none;
    transform: translate(-50%, -50%);
  }
}

.route-version-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.route-version-bar div {
  min-width: 0;
}

.route-version-bar span,
.route-version-bar strong,
.route-version-bar small {
  display: block;
}

.route-version-bar span,
.route-version-bar small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.route-version-bar strong {
  margin: 4px 0;
  font-size: 18px;
}

.constructor-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.02fr) minmax(420px, 0.98fr);
  gap: 16px;
  align-items: start;
}

.map-panel {
  position: sticky;
  top: 92px;
}

.map-upload {
  margin-bottom: 12px;
}

.map-upload label {
  min-width: 260px;
}

.map-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #eff6e7;
}

#mapCanvas {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  display: block;
  background: #eff6e7;
  cursor: crosshair;
}

.map-hint {
  position: absolute;
  left: 12px;
  bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--green-ink);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
}

.points-panel {
  overflow: visible;
}

.point-field {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 12px;
  margin: 0 0 12px;
  padding: 12px;
  background: #fff;
}

.point-field.is-selected {
  border-color: rgba(85, 185, 0, 0.68);
  box-shadow: 0 0 0 3px rgba(85, 185, 0, 0.12);
}

.point-field legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% - 6px);
  padding: 0 4px;
  color: var(--green-ink);
  font-weight: 900;
}

.point-field legend small {
  color: var(--muted);
  font-size: 11px;
}

.point-field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px;
}

.point-form-fields {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.photo-editor {
  display: grid;
  gap: 12px;
}

.photo-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #eef5e8;
  cursor: crosshair;
  padding: 10px;
  user-select: none;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  border-radius: 7px;
  display: block;
  object-fit: cover;
  transform: translate(var(--photo-x, 0), var(--photo-y, 0)) scale(var(--photo-scale, 1));
  transform-origin: center;
}

.photo-preview.fit-contain img {
  object-fit: contain;
}

.point-editor-pane.is-photo-pan-mode .photo-preview {
  cursor: grab;
}

.point-editor-pane.is-photo-pan-mode .photo-preview:active {
  cursor: grabbing;
}

.photo-marker {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.photo-marker::before,
.photo-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.photo-marker::before {
  z-index: 2;
  width: 14px;
  height: 14px;
  background: var(--green);
  box-shadow: 0 7px 16px rgba(20, 84, 33, 0.24);
  animation: markerPulseGreen 1.7s ease-in-out infinite;
}

.photo-marker::after {
  z-index: 1;
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.88);
  animation: markerPulseWhite 1.7s ease-in-out infinite;
}

@keyframes markerPulseGreen {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(0.92);
  }

  50% {
    transform: translate(-50%, -50%) scale(1.18);
  }
}

@keyframes markerPulseWhite {
  0%,
  100% {
    opacity: 0.88;
    transform: translate(-50%, -50%) scale(0.9);
  }

  50% {
    opacity: 0.48;
    transform: translate(-50%, -50%) scale(1.42);
  }
}

.photo-scale {
  accent-color: var(--green);
}

.photo-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-tools .ui-icon {
  width: 16px;
  height: 16px;
}

.photo-tools button.active {
  border-color: rgba(85, 185, 0, 0.42);
  background: var(--green-soft);
  color: var(--green-dark);
}

.raw-config-panel {
  margin-top: 16px;
}

.button-like {
  min-height: 38px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--green);
  color: #fff;
  padding: 9px 14px;
  font-weight: 800;
}

.button-like.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-dark);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

.object-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.object-catalog-panel {
  overflow: auto;
}

.object-catalog-table {
  min-width: 860px;
}

.object-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 9px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--text);
  padding: 16px;
}

.object-card h2,
.object-card p {
  margin: 0;
}

.object-card p,
.object-card span {
  color: var(--muted);
}

.object-card > div {
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
}

.constructor-object-create {
  max-width: 980px;
}

.constructor-object-form,
.constructor-object-settings {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.4fr) minmax(180px, 1fr) minmax(170px, 0.8fr);
  gap: 12px;
  align-items: end;
}

.constructor-object-settings {
  margin-bottom: 0;
}

.front-visual-key-control {
  grid-column: span 2;
  display: grid;
  gap: 6px;
}

.front-visual-key-control > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.front-visual-key-selects {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.front-visual-key-selects label {
  min-width: 0;
}

.slug-input {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  background: #fff;
  overflow: hidden;
}

.slug-input span {
  border-right: 1px solid var(--line);
  background: #fbfdf8;
  color: var(--muted);
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 800;
}

.slug-input input {
  border: 0;
  border-radius: 0;
}

.constructor-topline {
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(260px, auto);
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.constructor-topline > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.object-select-link {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  background: #fff;
  color: var(--text);
  padding: 8px 14px;
  font-weight: 900;
}

.route-version-select {
  color: #1f2b3a;
  font-size: 14px;
  font-weight: 800;
}

.constructor-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.constructor-key-panel {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.constructor-key-panel > div > span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.one-time-key {
  border: 1px solid rgba(85, 185, 0, 0.35);
  border-radius: var(--radius);
  background: var(--green-pale);
  color: var(--green-ink);
  margin: 0 0 10px;
  padding: 10px;
}

.one-time-key strong,
.one-time-key small {
  display: block;
}

.one-time-key strong {
  font-size: 22px;
}

.key-list {
  display: grid;
  gap: 8px;
}

.key-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
}

.key-row span {
  color: var(--muted);
  font-size: 13px;
}

.constructor-screen-form {
  display: grid;
  gap: 14px;
}

.constructor-workbench {
  display: grid;
  grid-template-columns: minmax(560px, 1fr);
  gap: 16px;
  align-items: start;
}

.map-and-table {
  position: relative;
  min-width: 0;
}

.map-toolbar {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
}

.osm-upload-control {
  cursor: pointer;
  gap: 7px;
}

.osm-file-name {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.map-toolbar + .map-frame {
  min-height: 420px;
}

.route-points-panel {
  margin-top: 12px;
  max-height: none;
}

.route-points-panel h2 {
  margin-bottom: 12px;
  font-size: 18px;
}

.route-points-table {
  min-width: 760px;
}

.route-point-row {
  cursor: pointer;
}

.route-point-row.selected {
  box-shadow: inset 4px 0 0 var(--green);
  background: var(--green-pale);
}

.route-point-row.row-dragging {
  opacity: 0.72;
  outline: 2px solid rgba(85, 185, 0, 0.28);
}

.drag-cell {
  width: 34px;
  color: #8da0ae;
  font-weight: 900;
  letter-spacing: 0;
}

.drag-handle {
  width: 28px;
  min-height: 28px;
  border: 0;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: transparent;
  color: #617382;
  cursor: grab;
  padding: 0;
  touch-action: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.drag-handle .ui-icon {
  width: 17px;
  height: 17px;
}

.point-drawer-backdrop {
  display: none;
}

.point-drawer-backdrop.is-open {
  display: block;
}

.constructor-point-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  width: min(560px, calc(100vw - 24px));
  max-height: none;
  border-radius: 0;
  margin: 0;
  overflow: auto;
  box-shadow: -18px 0 42px rgba(8, 22, 30, 0.2);
  transform: translateX(100%);
  visibility: hidden;
  pointer-events: none;
}

.constructor-point-drawer.is-open {
  visibility: visible;
  pointer-events: auto;
  animation: drawerSlideIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.constructor-point-drawer.is-closing {
  animation: drawerSlideOut 0.2s ease forwards;
}

.point-editor-pane {
  display: none;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
}

.point-editor-pane.is-selected {
  display: grid;
  gap: 10px;
  border: 0;
  box-shadow: none;
}

.point-drawer-titlebar {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.96);
  margin: -18px -18px 16px;
  padding: 14px 18px;
}

.point-drawer-titlebar h2 {
  margin: 0;
  color: var(--green-ink);
  font-size: 18px;
}

.map-coords {
  display: none;
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 10px;
}

.photo-card {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  overflow: hidden;
  background: #fff;
  color: var(--text);
  padding: 0;
}

.photo-select {
  width: 100%;
  min-height: 0;
  border: 0;
  display: grid;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  min-height: 24px;
  border: 1px solid rgba(15, 35, 29, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.photo-card.active {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(85, 185, 0, 0.14);
}

.photo-card img {
  width: 100%;
  height: 100%;
  border-radius: 7px;
  object-fit: cover;
}

.photo-card span {
  display: none;
}

.constructor-telegram-action {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}

.constructor-telegram-action span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 1160px) {
  .summary-grid,
  .route-version-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-workspace,
  .split.wide,
  .constructor-layout,
  .constructor-workbench,
  .admin-filter-panel,
  .constructor-key-panel,
  .front-visual-key-control,
  .constructor-object-settings,
  .constructor-object-form,
  .constructor-topline {
    grid-template-columns: 1fr;
  }

  .map-panel,
  .detail-panel {
    position: static;
    max-height: none;
  }

  .front-visual-key-control {
    grid-column: auto;
  }
}

@media (max-width: 860px) {
  .public-wrap,
  .public-top,
  .admin-content,
  .admin-topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .public-home-wrap {
    padding: 0;
  }

  .admin-body,
  .split,
  .summary-grid,
  .route-version-bar,
  .point-field-grid,
  .detail-metrics,
  .front-visual-key-control,
  .front-visual-key-selects,
  .constructor-object-settings,
  .constructor-object-form,
  .constructor-key-panel,
  .constructor-workbench,
  .admin-filter-panel,
  .key-row,
  .constructor-topline {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    justify-content: stretch;
  }

  .filter-actions > * {
    flex: 1;
  }

  .admin-nav {
    position: static;
    height: auto;
    gap: 12px;
  }

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

  .admin-menu a {
    min-width: 0;
  }

  .admin-topbar,
  .page-head,
  .section-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .public-controls {
    justify-content: flex-start;
  }

  .periods {
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .public-object-head {
    padding: 16px;
  }

  .constructor-layout {
    display: block;
  }

  .photo-editor {
    max-width: 280px;
  }
}

@media (max-width: 560px) {
  .admin-menu {
    grid-template-columns: 1fr;
  }

  .home-placeholder {
    min-height: 100vh;
  }

  .home-placeholder img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

  .home-placeholder h1 {
    max-width: calc(50vw - 36px);
    margin-left: 12px;
    overflow: hidden;
    font-size: 20px;
    text-overflow: ellipsis;
  }

  .page-head h1 {
    font-size: 25px;
  }

  .metric-card strong,
  .summary-grid strong {
    font-size: 24px;
  }

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

  .public-url,
  .soft-pill,
  .object-chip {
    white-space: normal;
  }
}
