:root {
  /* Цветовете идват от дизайн системата LXVNT (виж PLAN.md). */
  --gold: #8f6d23;
  --ink: #292725;
  --line: #e1dcd3;
  --paper: #fff;
  --bg: #f5f5f3;
  --ink-muted: #6c6760;
  --line-strong: #8a8175;
  --paper-sunk: #f1efeb;
  --gold-deep: #764f0f;
  --gold-soft: #ede0c5;
  --gold-ink: #725526;
  --gold-line: #d0c19e;
  --cream: #faf9f7;
  --blush: #f6dfd8;
  --ink-on-blush: #5e5953;
  --blush-line: #e3c9c0;
  --rose: #a8475c;
  --mint: #dfeae3;
  --sage: #7f9f8c;
  --success: #2f6f62;
  --danger: #b42318;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font:
    16px/1.5 'Montserrat', 'Segoe UI',
    Arial,
    sans-serif;
}
header {
  padding: 20px 4%;
  background: white;
  display: flex;
  gap: 32px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
header img {
  width: 190px;
}
header > span {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--gold);
}
header > div {
  margin-left: auto;
  display: flex;
  gap: 10px;
}
button,
.button {
  border: 1px solid var(--line-strong);
  background: white;
  color: var(--ink);
  border-radius: 6px;
  padding: 11px 16px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  display: inline-block;
}
button:hover,
.button:hover {
  background: var(--paper-sunk);
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--gold-deep);
  outline-offset: 2px;
}
.primary {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
.primary:hover {
  background: var(--ink);
}
main {
  max-width: 1450px;
  margin: auto;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 5%;
  padding: 35px 4%;
}
.intro small {
  color: var(--gold);
  letter-spacing: 2px;
  font-size: 12px;
}
h1 {
  font:
    38px/1.15 'Lora', Georgia,
    serif;
  margin: 12px 0 16px;
}
h1 em {
  color: var(--gold);
  font-weight: normal;
}
.intro p,
.muted {
  color: var(--ink-muted);
  font-size: 14px;
}
nav {
  display: flex;
  border-bottom: 1px solid var(--line);
  gap: 4px;
  margin: 26px 0;
}
nav button {
  background: none;
  border: 0;
  border-radius: 0;
  flex: 1;
  padding: 13px 5px;
  color: var(--ink-muted);
}
nav button.active {
  border-bottom: 3px solid var(--gold);
  color: var(--gold);
  font-weight: 600;
}
h2 {
  font:
    23px 'Lora', Georgia,
    serif;
  margin: 26px 0 17px;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.wide {
  grid-column: 1/-1;
}
label {
  display: block;
  font-size: 14px;
  font-weight: 500;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  font:
    16px 'Montserrat', 'Segoe UI',
    sans-serif;
  padding: 11px;
  margin-top: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
}
textarea {
  resize: vertical;
}
aside {
  min-width: 0;
}
.preview-head {
  display: flex;
  justify-content: space-between;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 1.4px;
  margin: 10px 0 16px;
}
.preview-head {
  align-items: center;
  gap: 14px;
}
.preview-head #count {
  margin-left: auto;
}
.preview-head .preview-print {
  padding: 6px 12px;
  font-size: 12px;
  letter-spacing: 0.3px;
}
article {
  background: white;
  padding: 35px;
  border: 1px solid var(--line);
  box-shadow: 0 6px 30px #30281b08;
}
article .brand {
  display: block;
  width: 200px;
  margin: 0 auto 32px;
}
article h2 {
  font-size: 25px;
}
article h3 {
  font: 20px 'Lora', Georgia;
  margin: 22px 0 9px;
}
article p {
  font-size: 14px;
  white-space: pre-line;
}
.empty {
  padding: 32px 0;
  color: var(--ink-muted);
  text-align: center;
}
.line-item {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.line-item strong {
  white-space: nowrap;
}
.total {
  background: var(--paper-sunk);
  padding: 17px;
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  font-weight: 600;
  color: var(--gold-ink);
}
.export {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.export button {
  flex: 1;
}
.privacy {
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 25px;
}
.service {
  background: #fff;
  border: 1px solid var(--line);
  padding: 18px;
  margin: 18px 0;
  border-radius: 8px;
}
.service .grid {
  gap: 10px;
}
.service .top {
  display: flex;
  gap: 10px;
  align-items: center;
}
.service .top input {
  font-weight: 600;
}
.remove {
  border: 0;
  color: #99503f;
}
.service textarea {
  font-size: 14px;
}
.add {
  display: flex;
  gap: 10px;
}
.add select {
  margin: 0;
}
.service-image {
  max-height: 120px;
  max-width: 100%;
  margin: 10px 0;
}
.offer-image {
  max-width: 100%;
  max-height: 270px;
  display: block;
  margin: 15px auto;
}
.check {
  display: flex;
  gap: 9px;
  align-items: center;
  margin: 14px 0;
}
.check input {
  width: auto;
  margin: 0;
}
#print {
  display: none;
}
#status {
  font-size: 14px;
  color: #85531d;
}
@media (max-width: 850px) {
  main {
    grid-template-columns: 1fr;
    gap: 35px;
  }
  header {
    flex-wrap: wrap;
  }
  header > span {
    display: none;
  }
  header > div {
    margin-left: 0;
  }
  article {
    padding: 22px;
  }
  .grid {
    gap: 12px;
  }
  h1 {
    font-size: 32px;
  }
}
@media print {
  /* Празните полета горе/долу спират колонтитулите на браузъра (дата, заглавие, линк). */
  @page {
    size: A4;
    margin: 18mm;
    @top-left {
      content: '';
    }
    @top-right {
      content: '';
    }
    @bottom-left {
      content: '';
    }
    @bottom-right {
      content: '';
    }
  }
  /* Офертата: полетата са в самия лист (padding, повтаря се на всяка страница с box-decoration-break), а не в
     @page — така остават и когато в прозореца за печат е избрано „Полета: Няма“ или браузърът не зачита @page. */
  @page offer-sheet {
    size: A4;
    margin: 0;
    @top-left {
      content: '';
    }
    @top-right {
      content: '';
    }
    @bottom-left {
      content: '';
    }
    @bottom-right {
      content: '';
    }
  }
  body {
    background: white;
  }
  body > header,
  body > main {
    display: none !important;
  }
  #print {
    display: block;
  }
  #print article {
    border: 0;
    box-shadow: none;
    padding: 18mm;
    page: offer-sheet;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }
  #print .line-item,
  #print img,
  #print .total {
    break-inside: avoid;
  }
  #print h3 {
    break-after: avoid;
  }
  #print .brand {
    width: 180px;
  }
}
[hidden] {
  display: none !important;
}
.service .top .wide {
  flex: 1;
  min-width: 0;
}
dialog {
  width: min(1100px, 94vw);
  max-height: 90vh;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  color: var(--ink);
  background: var(--bg);
}
dialog::backdrop {
  background: #29272588;
}
.admin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.admin-heading h2 {
  margin: 5px 0;
}
.admin-heading small {
  color: var(--gold);
  letter-spacing: 2px;
}
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0;
}
.admin-item {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.admin-item p {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 4px 0 9px;
}
.admin-item button {
  padding: 6px 10px;
  margin-right: 6px;
}
@media (max-width: 750px) {
  dialog {
    padding: 18px;
  }
  header > div {
    flex-wrap: wrap;
  }
}
@media print {
  dialog {
    display: none !important;
  }
}
/* Логото в заглавната лента води към началната страница. */
.brand-home {
  display: block;
  line-height: 0;
  flex-shrink: 0;
}
/* Съобщенията (message()) — известие горе в средата на екрана. */
#portal-status:not(:empty) {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 1000;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 32px));
  margin: 0;
  padding: 12px 18px;
  border-radius: 12px;
  background: #3d3122;
  color: #fffaf0;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  white-space: pre-line;
  box-shadow: 0 10px 30px #2a1f1040;
  cursor: pointer;
  animation: status-in 0.2s ease-out;
}
@keyframes status-in {
  from {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
}
@media (prefers-reduced-motion: reduce) {
  #portal-status:not(:empty) {
    animation: none;
  }
}
/* ===== Мобилно меню (assets/mobile-menu.js) — само на тесен екран ===== */
.menu-toggle,
#mobile-drawer,
.drawer-backdrop {
  display: none;
}
@media screen and (max-width: 760px) {
  /* Горната лента: лого вляво, известия и ☰ вдясно. */
  body > header {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 12px 16px !important;
  }
  body > header > .brand-home {
    margin-right: auto;
  }
  body > header > .brand-home img {
    width: 150px !important;
  }
  body > header > span,
  body > header #header-intro,
  body > header > div > :not(#notifications-open),
  body > #main-menu,
  body > .catalog-main-menu {
    display: none !important;
  }
  body > header > div {
    display: flex !important;
    gap: 8px;
    margin: 0 !important;
  }
  .menu-toggle:not([hidden]) {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 10px;
  }
  .drawer-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 900;
    background: #1d160e66;
    animation: drawer-fade 0.2s ease-out;
  }
  #mobile-drawer:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 901;
    width: min(320px, 86vw);
    padding: 14px 18px 24px;
    overflow-y: auto;
    background: var(--cream);
    box-shadow: -10px 0 40px #2a1f1033;
    animation: drawer-in 0.22s ease-out;
  }
  body.drawer-open {
    overflow: hidden;
  }
  .drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .drawer-head img {
    width: 130px;
  }
  .drawer-close {
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
  }
  #mobile-drawer #header-intro {
    display: block !important;
    margin: 0 !important;
    padding: 0 0 14px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--line) !important;
  }
  #mobile-drawer #main-menu,
  #mobile-drawer .catalog-main-menu {
    display: block !important;
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
  }
  #mobile-drawer .main-menu-links,
  #mobile-drawer .main-menu-actions,
  #mobile-drawer .catalog-main-menu {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin: 0 !important;
    padding: 0 !important;
  }
  #mobile-drawer .main-menu-actions {
    margin-top: 6px !important;
  }
  #mobile-drawer a.button,
  #mobile-drawer .drawer-actions > * {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-height: 48px;
    margin: 0 !important;
    padding: 10px 14px;
    font-size: 16px;
    text-align: left;
  }
  /* Бутоните само с иконка получават и текст в менюто. */
  #mobile-drawer #main-menu .main-menu-links,
  #mobile-drawer #main-menu .main-menu-actions {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    justify-self: stretch !important;
    width: 100% !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
  }
  #mobile-drawer #main-menu .main-menu-actions > * {
    width: 100% !important;
    margin-left: 0 !important;
  }
  #mobile-drawer #main-menu #search-toggle,
  #mobile-drawer #settings-open {
    display: flex;
    flex: none !important;
    align-items: center;
    justify-content: flex-start !important;
    gap: 10px;
    width: 100% !important;
    height: auto !important;
    min-height: 48px !important;
    padding: 10px 14px !important;
    font-size: 16px;
  }
  #mobile-drawer .header-back {
    display: none !important;
  }
  #mobile-drawer #search-toggle::after {
    content: 'Търси оферта';
  }
  #mobile-drawer #settings-open::after {
    content: 'Настройки';
  }
  #mobile-drawer #offer-search-bar input {
    width: 100%;
  }
  .drawer-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--line);
  }
}
@keyframes drawer-in {
  from {
    transform: translateX(100%);
  }
}
@keyframes drawer-fade {
  from {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  #mobile-drawer,
  .drawer-backdrop {
    animation: none !important;
  }
}
/* Мобилно меню: изсветляване и плъзгане при затваряне. */
.drawer-backdrop.is-closing {
  animation: drawer-dim-out 0.22s ease-in forwards !important;
}
#mobile-drawer.is-closing {
  animation: drawer-out 0.22s ease-in forwards !important;
}
@keyframes drawer-dim-out {
  to {
    opacity: 0;
  }
}
@keyframes drawer-out {
  to {
    transform: translateX(100%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .drawer-backdrop.is-closing,
  #mobile-drawer.is-closing {
    animation: none !important;
  }
}
/* Редактор: избраният получател на плащането (само за преглед). */
.profile-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 18px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--cream);
}
.profile-card:empty {
  display: none;
}
.profile-card dt {
  font-size: 12px;
  color: var(--ink-muted);
}
.profile-card dd {
  margin: 2px 0 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
/* Редактор: „График за деня“ — точки час + описание (стъпка „3. График за деня“). */
.schedule-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold-line);
  border-radius: 10px;
  background: white;
}
.schedule-row input {
  margin: 0;
}
.schedule-remove {
  padding: 8px 12px;
  border-color: transparent;
  background: transparent;
  color: var(--ink-muted);
}
.schedule-remove:hover {
  border-color: #e3c9c0;
  background: var(--blush);
  color: var(--danger);
}
/* Редактор, „Услуги“: „Добави от каталога“ и „Услуга по ваш избор“ — под услугите;
   без добавени услуги стоят в празно поле с кратко обяснение. */
.service-add {
  margin-top: 16px;
}
.service-add-empty {
  display: none;
}
.service-add-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.service-add-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex: 1 1 200px;
  padding: 13px 18px;
  font-weight: 600;
}
.service-add-actions svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}
#custom,
.service-add-actions .dashed {
  border-style: dashed;
  background: transparent;
}
#custom:hover,
.service-add-actions .dashed:hover {
  border-style: solid;
  background: var(--cream);
}
#rows:empty + .service-add,
#schedule-rows:empty + .service-add {
  padding: 34px 24px;
  border: 1.5px dashed var(--gold-line);
  border-radius: 14px;
  background: var(--cream);
  text-align: center;
}
#rows:empty + .service-add .service-add-empty,
#schedule-rows:empty + .service-add .service-add-empty {
  display: block;
  margin: 0 0 18px;
  color: var(--ink-muted);
  font-size: 14px;
}
#rows:empty + .service-add .service-add-empty strong,
#schedule-rows:empty + .service-add .service-add-empty strong {
  display: block;
  margin-bottom: 4px;
  font:
    20px 'Lora', Georgia,
    serif;
  font-weight: normal;
  color: var(--ink);
}
#rows:empty + .service-add .service-add-actions,
#schedule-rows:empty + .service-add .service-add-actions {
  justify-content: center;
  max-width: 520px;
  margin: 0 auto;
}
