:root {
  --violet: #784b84;
  --violet-dark: #53305e;
  --yellow: #ffde59;
  --lavender: #f3eaf6;
  --ink: #2a2a2a;
  --muted: #666;
  --danger: #b3261e;
  --white: #fff;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; color: var(--ink); font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { background: #faf8fb; }
a { color: var(--violet-dark); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 22px; background: var(--violet); color: var(--white); }
.topbar h1 { margin: 0; font: 700 clamp(20px, 3vw, 30px)/1.1 Georgia, serif; }
.topbar a { color: var(--white); text-decoration: none; }
.badge { padding: 6px 11px; border-radius: 999px; background: var(--yellow); color: var(--ink); font-weight: 800; }
.map-layout { display: grid; grid-template-columns: minmax(250px, 330px) 1fr; height: calc(100vh - 62px); }
.sidebar { z-index: 600; overflow: auto; padding: 18px; background: var(--white); border-right: 1px solid #e6dce9; }
.sidebar h2 { margin: 0 0 8px; font: 700 24px/1.15 Georgia, serif; color: var(--violet-dark); }
.sidebar p { color: var(--muted); }
#map { width: 100%; height: 100%; min-height: 500px; }
input, textarea, select, button { width: 100%; border: 1px solid #cfc3d3; border-radius: 9px; padding: 10px 12px; font: inherit; color: inherit; background: var(--white); }
textarea { min-height: 100px; resize: vertical; }
button, .button { cursor: pointer; border: 0; background: var(--violet); color: var(--white); font-weight: 750; text-decoration: none; text-align: center; }
button:hover, .button:hover { background: var(--violet-dark); }
.secondary { background: #eee7f0; color: var(--violet-dark); }
.danger { background: var(--danger); }
.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 750; color: #4f4053; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; }
.actions > * { flex: 1; }
.notice { padding: 10px 12px; margin: 10px 0; border-radius: 9px; background: var(--lavender); }
.notice.error { color: var(--danger); background: #fdebea; }
.cards { display: grid; gap: 10px; }
.card { padding: 13px; background: var(--white); border: 1px solid #eadfed; border-radius: 12px; box-shadow: 0 2px 8px #45284d10; }
.card h3 { margin: 0 0 6px; color: var(--violet-dark); }
.card p { margin: 0; white-space: pre-wrap; }
.admin-layout { display: grid; grid-template-columns: minmax(310px, 420px) 1fr; min-height: calc(100vh - 62px); }
.admin-panel { padding: 20px; background: var(--white); border-right: 1px solid #e6dce9; }
.admin-list { padding: 20px; min-width: 0; }
.admin-list-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.admin-list-tools input { max-width: 480px; }
.table-wrap { overflow: auto; max-height: calc(100vh - 145px); background: var(--white); border: 1px solid #e7dce9; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; border-bottom: 1px solid #eee7f0; text-align: left; vertical-align: top; }
th { position: sticky; top: 0; z-index: 1; background: var(--lavender); }
td.actions-cell { white-space: nowrap; }
td button { width: auto; padding: 7px 10px; }
.login-box { width: min(420px, calc(100% - 32px)); margin: 10vh auto; padding: 26px; background: var(--white); border-radius: 16px; box-shadow: 0 12px 36px #40204726; }
.login-box h1 { color: var(--violet-dark); font-family: Georgia, serif; }
.leaflet-popup-content { min-width: 210px; }
.leaflet-popup-content h3 { margin: 0 0 6px; color: var(--violet-dark); }
.stage-icon { object-fit: contain; filter: drop-shadow(0 2px 2px #0005); }
@media (max-width: 850px) {
  .map-layout, .admin-layout { grid-template-columns: 1fr; height: auto; }
  .sidebar { max-height: 38vh; border-right: 0; border-bottom: 1px solid #e6dce9; }
  #map { height: 62vh; }
  .admin-panel { border-right: 0; border-bottom: 1px solid #e6dce9; }
  .table-wrap { max-height: none; }
}
