/* Sofia Sans by Botio Nikoltchev (Lettersoup), served from this site */
@font-face { font-family: "Sofia Sans"; font-weight: 400; font-display: swap; src: url(/vendor/fonts/sofia-sans-cyrillic-400.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Sofia Sans"; font-weight: 500; font-display: swap; src: url(/vendor/fonts/sofia-sans-cyrillic-500.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Sofia Sans"; font-weight: 600; font-display: swap; src: url(/vendor/fonts/sofia-sans-cyrillic-600.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Sofia Sans"; font-weight: 700; font-display: swap; src: url(/vendor/fonts/sofia-sans-cyrillic-700.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Sofia Sans"; font-weight: 800; font-display: swap; src: url(/vendor/fonts/sofia-sans-cyrillic-800.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Sofia Sans"; font-weight: 400; font-display: swap; src: url(/vendor/fonts/sofia-sans-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Sofia Sans"; font-weight: 600; font-display: swap; src: url(/vendor/fonts/sofia-sans-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Sofia Sans"; font-weight: 700; font-display: swap; src: url(/vendor/fonts/sofia-sans-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Sofia Sans"; font-weight: 800; font-display: swap; src: url(/vendor/fonts/sofia-sans-latin-800.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Sofia Sans Extra Condensed"; font-weight: 700; font-display: swap; src: url(/vendor/fonts/sofia-sans-xc-cyrillic-700.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Sofia Sans Extra Condensed"; font-weight: 800; font-display: swap; src: url(/vendor/fonts/sofia-sans-xc-cyrillic-800.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Sofia Sans Extra Condensed"; font-weight: 800; font-display: swap; src: url(/vendor/fonts/sofia-sans-xc-latin-800.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }

/* Shared styles for the public map and the admin area */

:root {
  /* Brand palette: керемидено червено, пясъчно бежово, тъмнокафяво, златисто */
  --linen: #FAF6EF;
  --paper: #FFFDF9;
  --ink: #3E322A;
  --ink-2: #6A5D52;
  --ink-3: #978A7D;
  --line: #E9DFCB;
  --line-2: #F2EBDD;
  --red: #A83227;
  --red-soft: #F5E2DD;
  --ochre: #C9A962;
  --sand: #D8C9A6;
  --green: #2F6B4F;
  --indigo: #2C3E7A;

  --k-sabor: #A83227;
  --k-pazar: #2F6B4F;
  --k-panair: #B08A3E;
  --k-festival: #2C3E7A;
  --k-kukeri: #7A2E5A;
  --k-bazar: #1F7A74;
  --k-kurban: #8C5A2B;

  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 8px 24px rgba(60, 40, 20, .08);
  --radius: 14px;
  --font: "Sofia Sans", system-ui, sans-serif;
  --font-display: "Sofia Sans Extra Condensed", "Sofia Sans", sans-serif;
  color-scheme: light;
}

/* The theme is set on <html data-theme> at boot from the saved choice or the OS preference */
:root[data-theme="dark"] {
  --linen: #191411;
  --paper: #221B16;
  --ink: #F2E9DC;
  --ink-2: #C9BBA9;
  --ink-3: #94867A;
  --line: #3A2F27;
  --line-2: #2D241E;
  --red: #D9574A;
  --red-soft: #3B1F1A;
  --ochre: #D4B673;
  --sand: #B8A57C;
  --k-sabor: #D9574A;
  --k-pazar: #4FA37C;
  --k-panair: #E0AA45;
  --k-festival: #7C8FD6;
  --k-kukeri: #C46A9C;
  --k-bazar: #3FB0A8;
  --k-kurban: #C98A55;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--linen);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
input, select { font: inherit; color: inherit; }

/* ---------- App frame ---------- */
.app {
  display: grid;
  grid-template-rows: 64px 18px 1fr auto;
  /* minmax(0, …): no child may widen the page past the screen */
  grid-template-columns: minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

/* ---------- Header ---------- */
.header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  background: var(--paper);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 300px; }
.brand__mark { width: 44px; height: 44px; }
.brand__name {
  font-family: var(--font);
  font-weight: 800;
  font-size: 27px;
  letter-spacing: -.01em;
  line-height: 1;
  color: var(--ink);
}
.brand__tag { font-size: 10px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; color: var(--ochre); margin-top: 4px; }

.search {
  flex: 1;
  max-width: 460px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  background: var(--linen);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.search input { border: 0; background: none; outline: none; flex: 1; min-width: 0; }
.search svg { color: var(--ink-3); flex: none; }
.search:focus-within { border-color: var(--red); }

.when { display: flex; gap: 4px; padding: 4px; background: var(--linen); border: 1px solid var(--line); border-radius: 999px; }
.when button {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}
.when button:hover { color: var(--ink); }
.when button.is-on { background: var(--red); color: #fff; }

.header__spacer { flex: 1; }
.tabs { display: flex; gap: 2px; }
.tabs button {
  padding: 8px 14px;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-2);
  border-radius: 10px;
  display: flex; align-items: center; gap: 6px;
}
.tabs button.is-on { color: var(--red); background: var(--red-soft); }
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--ink-2);
}
.icon-btn:hover { background: var(--line-2); color: var(--ink); }

/* Шевица band */
.band {
  background-color: var(--paper);
  background-repeat: repeat-x;
  background-position: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  image-rendering: pixelated;
}

/* ---------- Map view ---------- */
.view { display: none; min-height: 0; }
.view.is-on { display: grid; }
.view--map { grid-template-columns: 360px minmax(0, 1fr); min-height: 0; position: relative; }
.seg, .when__filters { display: none; }

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--paper);
  border-right: 1px solid var(--line);
}
.filters { padding: 16px 18px 6px; display: flex; flex-direction: column; gap: 14px; }
.label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.label button { text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 12px; color: var(--red); }

.kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.kind {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  background: var(--paper);
  transition: background .15s, border-color .15s;
}
.kind i {
  width: 10px; height: 10px;
  background: var(--c);
  transform: rotate(45deg);
  border-radius: 1px;
}
.kind b { font-weight: 600; color: var(--ink-3); font-size: 12px; }
.kind.is-off { opacity: .45; }
.kind.is-off i { background: transparent; outline: 1.5px solid var(--c); outline-offset: -1.5px; }
.kind:not(.is-off) { border-color: color-mix(in srgb, var(--c) 40%, var(--line)); background: color-mix(in srgb, var(--c) 8%, var(--paper)); }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}
.statuses { display: flex; flex-wrap: wrap; gap: 6px; }
.status-toggle {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.status-toggle.is-on { border-color: var(--ink-2); color: var(--ink); background: var(--line-2); }

.active-day {
  display: none;
  align-items: center; justify-content: space-between;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 700;
  font-size: 14px;
}
.active-day.is-on { display: flex; }

.list-head {
  padding: 12px 18px 8px;
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.list-head h2 { font-family: var(--font-display); font-size: 22px; font-weight: 800; }
.list-head span { font-size: 13px; color: var(--ink-3); }

.list { overflow-y: auto; padding: 0 10px 16px; flex: 1; min-height: 0; }
.list::-webkit-scrollbar { width: 8px; }
.list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.list__day {
  position: sticky; top: 0; z-index: 1;
  padding: 10px 8px 6px;
  font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3);
  background: var(--paper);
}
.card {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.card:hover { background: var(--linen); }
.card.is-sel { background: var(--linen); border-color: var(--line); }
.card__date {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 52px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--c) 10%, var(--paper));
  color: var(--c);
  border: 1px solid color-mix(in srgb, var(--c) 25%, transparent);
}
.card__date b { font-family: var(--font-display); font-size: 26px; line-height: .9; font-weight: 800; }
.card__date small { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.card__date.is-weekly b { font-size: 15px; line-height: 1.1; }
.card__title { font-weight: 700; font-size: 15px; line-height: 1.25; }
.card__meta { font-size: 13px; color: var(--ink-2); margin-top: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card.is-cancelled .card__title { text-decoration: line-through; color: var(--ink-3); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: .02em;
}
.badge--confirmed { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.badge--announced { background: color-mix(in srgb, var(--indigo) 12%, transparent); color: var(--indigo); }
.badge--expected { border: 1px dashed var(--ink-3); color: var(--ink-2); }
.badge--cancelled { background: var(--line-2); color: var(--ink-3); text-decoration: line-through; }
:root[data-theme="dark"] .badge--confirmed { color: #6FC79C; }
:root[data-theme="dark"] .badge--announced { color: #9FB0EE; }

.empty { padding: 30px 16px; text-align: center; color: var(--ink-3); font-size: 14px; }

/* ---------- Map ---------- */
/* isolation: Leaflet's own z-indexes stay inside the map, under the drawer and the phone list */
.map-wrap { position: relative; min-height: 0; overflow: hidden; isolation: isolate; }
#map { position: absolute; inset: 0; background: var(--linen); }
.leaflet-container { font-family: var(--font); }
.leaflet-control-attribution { font-size: 10px; background: color-mix(in srgb, var(--paper) 80%, transparent) !important; color: var(--ink-3); }
.leaflet-control-attribution a { color: var(--ink-2); }
.leaflet-control-zoom { border: 0 !important; box-shadow: var(--shadow) !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-control-zoom a { background: var(--paper) !important; color: var(--ink) !important; border-color: var(--line) !important; }

.legend {
  position: absolute; left: 16px; bottom: 16px; z-index: 500;
  background: var(--paper);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--ink-2);
  display: flex; gap: 14px; align-items: center;
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .pin { position: static; transform: none; }
.legend .lg-pin { width: 12px; height: 12px; transform: rotate(45deg); border-radius: 2px; background: var(--ink-2); }
.legend .lg-pin--hollow { background: transparent; border: 1.5px dashed var(--ink-2); }
.legend .lg-halo { width: 16px; height: 16px; border-radius: 50%; border: 1.5px dashed var(--ink-3); display: grid; place-items: center; }
.legend .lg-halo::after { content: ""; width: 6px; height: 6px; transform: rotate(45deg); background: var(--ink-2); }

/* OSM tiles keep Cyrillic place names; a filter mutes them to linen so the pins carry the colour */
.leaflet-tile-pane { filter: grayscale(1) sepia(.18) contrast(.88) brightness(1.04); }
:root[data-theme="dark"] .leaflet-tile-pane { filter: grayscale(1) invert(1) sepia(.12) brightness(.82) contrast(.92); }

.sample-note {
  position: absolute; left: 60px; top: 16px; z-index: 500;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px; font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  opacity: .85;
}

/* Rhombus pins */
.pin-icon { background: none; border: 0; }
.pin {
  position: relative;
  width: 22px; height: 22px;
  display: grid; place-items: center;
}
.pin__body {
  width: 16px; height: 16px;
  transform: rotate(45deg);
  background: var(--c);
  border: 2px solid var(--paper);
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  display: grid; place-items: center;
  transition: transform .15s;
}
.pin__body::after { content: ""; width: 4px; height: 4px; background: var(--paper); border-radius: 1px; }
.pin--expected .pin__body { background: var(--paper); border: 2px dashed var(--c); }
.pin--expected .pin__body::after { background: var(--c); }
.pin--cancelled .pin__body { background: var(--ink-3); opacity: .7; }
.pin--approx::before {
  content: "";
  position: absolute; inset: -9px;
  border-radius: 50%;
  border: 1.5px dashed color-mix(in srgb, var(--c) 70%, transparent);
  background: color-mix(in srgb, var(--c) 8%, transparent);
}
.pin:hover .pin__body, .pin.is-sel .pin__body { transform: rotate(45deg) scale(1.3); }
.pin.is-sel .pin__body { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 30%, transparent), 0 2px 6px rgba(0,0,0,.3); }

/* Rosette clusters */
.rosette-icon { background: none; border: 0; }
.rosette { position: relative; display: grid; place-items: center; filter: drop-shadow(0 2px 4px rgba(0,0,0,.2)); }
.rosette svg { position: absolute; inset: 0; }
.rosette b {
  position: relative;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  color: var(--red);
}

.leaflet-tooltip.tip {
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 8px;
  padding: 5px 9px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--shadow);
}
.leaflet-tooltip.tip::before { display: none; }
.leaflet-tooltip.tip small { display: block; font-weight: 500; opacity: .75; font-size: 12px; }

/* ---------- Drawer ---------- */
.drawer {
  position: absolute; top: 12px; right: 12px; bottom: 12px;
  max-width: calc(100% - 24px);
  width: 400px;
  z-index: 600;
  background: var(--paper);
  border-radius: 18px;
  box-shadow: var(--shadow), 0 0 0 1px var(--line);
  display: flex; flex-direction: column;
  transform: translateX(calc(100% + 24px));
  transition: transform .25s cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
}
.drawer.is-open { transform: none; }
.drawer__hero {
  position: relative;
  padding: 20px 22px 18px;
  background: color-mix(in srgb, var(--c) 9%, var(--paper));
  border-bottom: 1px solid var(--line);
}
.drawer__hero::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 6px;
  background: var(--c);
  -webkit-mask: var(--stitch) repeat-x;
          mask: var(--stitch) repeat-x;
}
.drawer__close { position: absolute; top: 14px; right: 14px; }
.drawer__kind { display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 800; color: var(--c); text-transform: uppercase; letter-spacing: .06em; }
.drawer__title { font-family: var(--font-display); font-size: 34px; line-height: 1; font-weight: 800; margin: 8px 40px 10px 0; }
.drawer__when { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 16px; }
.drawer__holiday { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.drawer__body { overflow-y: auto; padding: 6px 22px 22px; flex: 1; }
.drawer__actions { display: flex; gap: 8px; padding: 14px 0 6px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border-radius: 10px;
  font-weight: 700; font-size: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
}
.btn:hover { border-color: var(--ink-3); }
.btn--primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn--primary:hover { filter: brightness(1.08); border-color: var(--red); }
.btn--sm { height: 30px; padding: 0 10px; font-size: 13px; }

.section { padding: 16px 0 4px; border-top: 1px solid var(--line-2); margin-top: 12px; }
.section:first-of-type { border-top: 0; margin-top: 0; }
.section h3 { font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.facts { display: grid; grid-template-columns: 22px 1fr; gap: 10px 10px; font-size: 14px; }
.facts svg { color: var(--ink-3); margin-top: 1px; }
.facts small { display: block; color: var(--ink-3); font-size: 12px; }
.program { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.program li { display: grid; grid-template-columns: 50px 1fr; gap: 8px; }
.program b { font-family: var(--font-display); font-size: 18px; color: var(--c); line-height: 1.1; }

.source {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 13px;
}
.source__head { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 13px; }
.source__head span { color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.source blockquote {
  margin-top: 8px;
  padding: 6px 0 6px 12px;
  border-left: 3px solid var(--ochre);
  color: var(--ink-2);
  font-size: 14px;
}
.source blockquote mark { background: color-mix(in srgb, var(--ochre) 28%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
.source__type { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-top: 6px; }
.report { font-size: 13px; color: var(--ink-3); margin-top: 16px; display: flex; gap: 6px; align-items: center; }
.report a { color: var(--red); font-weight: 700; text-decoration: none; }

/* ---------- Holiday strip ---------- */
.strip {
  background: var(--paper);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
}
.strip__title { padding: 10px 18px; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.strip__title h3 { font-family: var(--font-display); font-size: 22px; font-weight: 800; line-height: 1; }
.strip__title p { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.strip__days { display: flex; overflow-x: auto; padding: 8px 10px 6px; gap: 2px; scrollbar-width: thin; min-width: 0; }
.day {
  flex: none;
  width: 34px;
  display: flex; flex-direction: column; align-items: center;
  gap: 2px;
  padding: 4px 0 4px;
  border-radius: 9px;
  position: relative;
}
.day:hover { background: var(--line-2); }
.day.is-sel { background: var(--red); color: #fff; }
.day.is-sel .day__wd, .day.is-sel .day__hol { color: #fff; }
.day.is-sel .day__bar span { background: #fff; }
.day__bar { height: 30px; width: 10px; display: flex; align-items: flex-end; }
.day__bar span { width: 100%; background: color-mix(in srgb, var(--red) 55%, var(--line)); border-radius: 3px 3px 1px 1px; min-height: 2px; }
.day__wd { font-size: 10px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; }
.day__n { font-family: var(--font-display); font-size: 18px; font-weight: 800; line-height: 1; }
.day.is-weekend .day__n { color: var(--red); }
.day.is-sel.is-weekend .day__n { color: #fff; }
.day.is-today::after { content: ""; position: absolute; bottom: 1px; width: 4px; height: 4px; border-radius: 50%; background: var(--red); }
.day__hol {
  position: absolute; top: -2px; left: 50%;
  transform: translateX(-50%);
  width: 8px; height: 8px;
  background: var(--ochre);
  transform: translateX(-50%) rotate(45deg);
}
.day.has-hol .day__bar span { background: var(--ochre); }
.month-sep {
  flex: none;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--red);
  padding: 4px 4px;
  border-left: 1px dashed var(--line);
  margin: 0 4px;
}
.holidays-line { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.holiday-chip { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: color-mix(in srgb, var(--ochre) 18%, transparent); color: color-mix(in srgb, var(--ochre) 60%, var(--ink)); }

/* ---------- Admin view ---------- */
.app--admin { grid-template-rows: 64px 18px 1fr; }
.app--admin .tabs { margin-left: 24px; }
.tabs .count { font-size: 11px; background: var(--red); color: #fff; border-radius: 999px; padding: 0 6px; }
.user { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.user[hidden], .tabs[hidden], .login[hidden], .login__card[hidden] { display: none; }
.user__avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--red-soft); color: var(--red); font-weight: 800; font-size: 12px; }

.login { display: grid; place-items: center; padding: 24px 16px; overflow-y: auto; }
.login__card {
  width: min(400px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px 28px 22px;
  display: flex; flex-direction: column; gap: 14px;
  position: relative;
  overflow: hidden;
}
.login__card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--red); -webkit-mask: var(--stitch) repeat-x; mask: var(--stitch) repeat-x; }
.login__card h1 { font-family: var(--font-display); font-size: 34px; font-weight: 800; line-height: 1; }
.login__sub { color: var(--ink-2); font-size: 14px; margin-top: -6px; }
.login__note { font-size: 12px; color: var(--ink-3); text-align: center; }
.login__alt { font-size: 13px; text-align: center; }
.login__alt a { color: var(--red); font-weight: 600; text-decoration: none; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.field input:not([type]), .field input[type="password"] {
  height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--linen); color: var(--ink); font-size: 15px; font-weight: 500;
  outline: none;
}
.field input:focus { border-color: var(--red); }
.btn--block { width: 100%; justify-content: center; height: 42px; }
.otp { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp input {
  width: 100%; min-width: 0;
  height: 54px; text-align: center;
  font-family: var(--font-display); font-size: 30px; font-weight: 800;
  border: 1px solid var(--line); border-radius: 10px; background: var(--linen); outline: none;
}
.otp input:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-2); }

.col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.span-2 { grid-column: 1 / -1; }
.log-head { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.log-head + .log { margin-top: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.queue--grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.audit { list-style: none; font-size: 13px; }
.audit li { padding: 8px 0 8px 12px; border-top: 1px solid var(--line-2); border-left: 3px solid var(--green); margin-bottom: 2px; }
.audit li.audit--warn { border-left-color: var(--ochre); }
.audit .t { color: var(--ink-3); margin-right: 8px; font-variant-numeric: tabular-nums; }
.sources-table small { color: var(--ink-3); }
code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--line-2); padding: 1px 5px; border-radius: 4px; }

.view--admin {
  overflow-y: auto;
  padding: 24px;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 20px;
  align-content: start;
}
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.panel h2 { font-family: var(--font-display); font-size: 26px; font-weight: 800; line-height: 1; }
.panel__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel__sub { color: var(--ink-3); font-size: 13px; margin-top: 4px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; color: var(--green); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { padding: 12px 14px; border-radius: 12px; background: var(--linen); }
.stat b { font-family: var(--font-display); font-size: 30px; font-weight: 800; display: block; line-height: 1; }
.stat span { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.stat--red b { color: var(--red); }

.progress { height: 6px; border-radius: 6px; background: var(--line-2); overflow: hidden; margin: 6px 0 16px; }
.progress span { display: block; height: 100%; background: var(--red); border-radius: 6px; }

.steps { list-style: none; display: flex; flex-direction: column; }
.step { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.step small { display: block; color: var(--ink-3); font-size: 12px; }
.step__icon { width: 18px; height: 18px; transform: rotate(45deg); border-radius: 3px; border: 2px solid var(--line); margin-left: 3px; }
.step--done .step__icon { background: var(--green); border-color: var(--green); }
.step--run .step__icon { border-color: var(--red); border-style: dashed; animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(405deg); } }
.step__right { font-size: 13px; color: var(--ink-2); font-weight: 600; text-align: right; }

.log {
  margin-top: 18px;
  background: #1D1A16;
  color: #E9E1D4;
  border-radius: 12px;
  padding: 12px 14px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  height: 220px;
  overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  gap: 3px;
}
.log div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: fadein .4s; }
.log .t { color: #8E867B; margin-right: 8px; }
.log .ok { color: #7FD1A4; }
.log .warn { color: #E6B65C; }
.log .who { color: #F08A7E; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }

.queue { display: flex; flex-direction: column; gap: 12px; }
.qcard { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.qcard__type { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.qcard__type--warn { color: var(--ochre); }
.qcard__type--dup { color: var(--indigo); }
.qcard__type--noaddr { color: var(--red); }
.qcard__type--cancel { color: var(--ink-3); }
.qcard h4 { font-size: 16px; margin: 6px 0 4px; }
.qcard p { font-size: 13px; color: var(--ink-2); }
.qcard .cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.qcard .cmp div { background: var(--linen); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.qcard .cmp b { display: block; font-size: 15px; }
.qcard .cmp small { color: var(--ink-3); }
.qcard__actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

.sources-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sources-table th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 6px 4px; border-bottom: 1px solid var(--line); }
.sources-table td { padding: 8px 4px; border-bottom: 1px solid var(--line-2); }
.health { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

/* ---------- Phones and small tablets ---------- */
.sheet, .sheet-backdrop { display: none; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap .sources-table { min-width: 520px; }

@media (max-width: 900px) {
  .app { grid-template-rows: auto 10px minmax(0, 1fr) auto; }

  /* Header: logo, map/list switch and theme on one row; search; then the date chips, which scroll sideways */
  .header { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 8px; padding: 8px 12px 10px; align-items: center; }
  .brand { min-width: 0; gap: 8px; }
  .brand__mark { width: 34px; height: 34px; }
  .brand__name { font-size: 22px; }
  .brand__tag { display: none; }
  .header__spacer { display: none; }
  .header > .seg { grid-row: 1; grid-column: 2; }
  .header > #themeBtn { grid-row: 1; grid-column: 3; }
  .seg { display: flex; background: var(--linen); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
  .seg button { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
  .seg button.is-on { background: var(--ink); color: var(--paper); }
  .icon-btn { width: 36px; height: 36px; }
  .search { grid-column: 1 / -1; max-width: none; height: 40px; }
  .search input { font-size: 16px; }   /* 16px keeps iOS from zooming into the field */
  .when {
    grid-column: 1 / -1; min-width: 0; overflow-x: auto; scrollbar-width: none;
    background: none; border: 0; padding: 0; gap: 6px;
  }
  .when::-webkit-scrollbar { display: none; }
  .when button { flex: none; border: 1px solid var(--line); background: var(--paper); padding: 6px 12px; }
  .when button.is-on { border-color: var(--red); }
  .when__filters { display: inline-flex; align-items: center; gap: 5px; }
  .when__filters b { background: var(--red); color: #fff; border-radius: 999px; font-size: 11px; min-width: 18px; padding: 0 5px; line-height: 18px; text-align: center; }
  .band { background-size: auto 10px; }

  /* Map and list share the space; the list covers the map when chosen */
  .view--map { display: block; position: relative; min-height: 0; }
  .view--map.is-on { display: block; }
  .map-wrap { position: absolute; inset: 0; }
  .sidebar { position: absolute; inset: 0; z-index: 650; display: none; border-right: 0; }
  .view--map.show-list .sidebar { display: flex; }
  .list-head { margin-top: 0; border-top: 0; padding: 12px 14px 6px; }
  .list { padding: 0 6px 12px; }
  .card { grid-template-columns: 48px 1fr; padding: 10px 8px; }
  .card__date { height: 48px; }
  .legend, .leaflet-control-zoom { display: none; }

  /* Filters in a bottom sheet */
  .sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 940; background: rgba(20, 14, 10, .35); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .sheet { display: flex; flex-direction: column; position: fixed; left: 0; right: 0; bottom: 0; z-index: 950; max-height: 82dvh;
    background: var(--paper); border-radius: 20px 20px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, .18);
    transform: translateY(100%); transition: transform .25s cubic-bezier(.2,.8,.2,1); padding-bottom: env(safe-area-inset-bottom); }
  .sheet[hidden] { display: none; }
  body.sheet-open .sheet { transform: none; }
  body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
  .sheet__head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; font-size: 17px; }
  .sheet__head::before { content: ""; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line); }
  #filterSlot { overflow-y: auto; padding-bottom: 12px; }
  #filterSlot .filters { padding: 8px 16px 16px; }
  .kind { padding: 7px 12px 7px 10px; }
  .status-toggle { padding: 7px 12px; }
  .select { height: 42px; font-size: 16px; }

  /* The event as a bottom sheet over map or list */
  .drawer { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; height: min(82dvh, 720px); z-index: 900;
    border-radius: 20px 20px 0 0; transform: translateY(105%); box-shadow: 0 -8px 30px rgba(0, 0, 0, .2), 0 0 0 1px var(--line); }
  .drawer.is-open { transform: none; }
  .drawer__hero { padding: 18px 16px 14px; }
  .drawer__title { font-size: 28px; margin-right: 44px; }
  .drawer__body { padding: 4px 16px calc(20px + env(safe-area-inset-bottom)); }
  .drawer__actions .btn { flex: 1 1 auto; justify-content: center; }

  /* A slimmer holiday strip */
  .strip { grid-template-columns: minmax(0, 1fr); }
  .strip__title { display: none; }
  .strip__days { padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .day { width: 32px; }
  .day__bar { height: 20px; }

  /* Admin */
  .app--admin .header { grid-template-columns: minmax(0, 1fr) auto auto; }
  .app--admin .tabs { grid-column: 1 / -1; grid-row: 2; margin: 0; overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
  .app--admin .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: none; white-space: nowrap; }
  .user { gap: 6px; }
  .user__name { display: none; }
  .view--admin { grid-template-columns: minmax(0, 1fr); padding: 12px; gap: 12px; }
  .col { gap: 12px; }
  .panel { padding: 14px; }
  .panel__head { flex-wrap: wrap; }
  .form-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat b { font-size: 26px; }
  .queue--grid { grid-template-columns: minmax(0, 1fr); }
  .log { height: 200px; font-size: 11.5px; }
  /* Events as cards: title, then date and status, then sources and publishing, then the buttons */
  .table-wrap .ev-table { min-width: 0; }
  .col--first-on-phone { order: -1; }
  .ev-table thead { display: none; }
  .ev-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
  .ev-table td { display: block; padding: 0; border: 0; }
  .ev-table td:first-child, .ev-table td.row { grid-column: 1 / -1; }
  .ev-table td:nth-child(4)::before { content: "източници: "; color: var(--ink-3); }
  .panel__head .row { width: 100%; }
  .panel__head .row .select { flex: 1; width: auto !important; }
  .login { padding: 16px 12px; align-items: start; }
  .login__card { padding: 22px 18px 18px; }
  .field input:not([type]), .field input[type="password"] { font-size: 16px; }
  .otp { gap: 6px; }
  .otp input { height: 50px; }
}

@media (max-width: 380px) {
  .brand__name { font-size: 19px; }
  .seg button { padding: 6px 9px; }
}

/* ---------- Additions for the live site ---------- */
a.brand { color: inherit; text-decoration: none; }
.source__head a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.source__head a:hover { color: var(--red); text-decoration: underline; }
.source blockquote + blockquote { margin-top: 6px; }
.report-form { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--ink-2); }
.report-form textarea {
  width: 100%; resize: vertical; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--linen); color: var(--ink); font: inherit; font-size: 14px;
}
.report-form textarea:focus { outline: none; border-color: var(--red); }
.report-form__msg { font-size: 13px; color: var(--ink-2); }
.error-note { color: var(--red); font-size: 13px; font-weight: 600; min-height: 1em; }
.recovery { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.recovery span { background: var(--linen); border-radius: 6px; padding: 6px 8px; text-align: center; }
.qr { background: #fff; border-radius: 12px; padding: 10px; width: 200px; align-self: center; }
.qr svg { display: block; width: 100%; height: auto; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all; text-align: center; color: var(--ink-2); }
.empty-hint { color: var(--ink-3); font-size: 13px; padding: 8px 0; }
.ev-table td .badge { white-space: nowrap; }
.warn-box { background: color-mix(in srgb, var(--ochre) 14%, var(--paper)); border: 1px solid color-mix(in srgb, var(--ochre) 40%, var(--line)); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--ink-2); }
.steps-list { margin: 4px 0 12px 18px; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.steps-list a { color: var(--red); font-weight: 700; }
.link-strong { color: var(--red); font-weight: 700; text-decoration: none; }
.link-strong:hover { text-decoration: underline; }
textarea.ask {
  width: 100%; resize: vertical; min-height: 96px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--linen); color: var(--ink); font: inherit; font-size: 15px; line-height: 1.4;
}
textarea.ask:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.ask-examples { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.ask-examples .chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px dashed var(--line); color: var(--ink-2); text-align: left; }
.ask-examples .chip:hover { border-color: var(--red); color: var(--red); }
.ask-quote { margin: 4px 0 12px; padding: 10px 12px; border-left: 3px solid var(--ochre); background: var(--linen); border-radius: 0 10px 10px 0; font-size: 14px; white-space: pre-wrap; }
.ask-quote b, .plan-box b { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.plan-box { margin: 0 0 14px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--green) 35%, var(--line)); background: color-mix(in srgb, var(--green) 6%, var(--paper)); border-radius: 12px; font-size: 14px; }
.plan-box p { white-space: pre-wrap; margin-bottom: 10px; }
