:root {
  --flora-green: #087443;
  --flora-green-strong: #075d37;
  --flora-green-soft: #e8f5ed;
  --flora-bg: #f3f5f2;
  --flora-surface: rgba(255, 255, 255, .88);
  --flora-surface-solid: #fff;
  --flora-surface-muted: #f6f8f6;
  --flora-text: #17201b;
  --flora-muted: #69736d;
  --flora-line: rgba(24, 49, 35, .09);
  --flora-danger: #bd3d3d;
  --flora-shadow: 0 18px 54px rgba(24, 55, 38, .09);
  --flora-shadow-strong: 0 25px 75px rgba(16, 58, 35, .16);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
  color: var(--flora-text);
  background: var(--flora-bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--flora-bg); }
body {
  min-width: 320px;
  margin: 0;
  color: var(--flora-text);
  background:
    radial-gradient(circle at 88% -8%, rgba(65, 180, 117, .15), transparent 29rem),
    radial-gradient(circle at -8% 92%, rgba(95, 151, 240, .08), transparent 26rem),
    var(--flora-bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--flora-green); }
h1, h2, h3 { letter-spacing: -.035em; }
.muted { color: var(--flora-muted) !important; }

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
  width: 100%;
  color: var(--flora-text);
  background: var(--flora-surface-muted);
  border: 1px solid var(--flora-line);
  border-radius: 14px;
  outline: 0;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select { min-height: 46px; padding: 0 14px; }
textarea { padding: 12px 14px; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  background: #fff;
  border-color: rgba(8, 116, 67, .36);
  box-shadow: 0 0 0 4px rgba(8, 116, 67, .08);
}
label { color: var(--flora-muted); }

button[type="submit"],
.primaryButton,
.primary,
.kbChatSend,
.formActions > button:not(.secondaryButton) {
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--flora-green), #15945d);
  box-shadow: 0 9px 24px rgba(8, 116, 67, .18);
  font-weight: 700;
  min-height: 44px;
  padding: 10px 17px;
  cursor: pointer;
}
button[type="submit"]:hover, .primaryButton:hover, .primary:hover { transform: translateY(-1px); }
.secondaryButton, .secondary {
  color: var(--flora-text);
  background: var(--flora-surface-solid);
  border: 1px solid var(--flora-line);
  border-radius: 14px;
  min-height: 42px;
  padding: 9px 15px;
  font-weight: 650;
}

/* Общая оболочка административных страниц */
.staffAdmin, .trainingApp, .devicesApp, .operatorApp, .photoShell {
  width: min(1440px, calc(100% - 36px));
  margin: 0 auto;
  padding: 26px 0 54px;
}
.staffHeader, .pageHeader, .devicesHeader, .operatorHeader, .queueHeader {
  min-height: 78px;
  border: 1px solid var(--flora-line);
  border-radius: 24px;
  background: var(--flora-surface);
  box-shadow: var(--flora-shadow);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
  padding: 15px 18px;
}
.staffHeader img, .pageHeader img, .operatorHeader img, .devicesHeader img,
.queueHeader .brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 16px;
  background: #fff;
}
.staffHeader h1, .pageHeader h1, .devicesHeader h1, .operatorHeader h1,
.queueHeader h1 { color: var(--flora-text); margin: 0; }
.staffHeader p, .pageHeader p, .devicesHeader p, .operatorHeader p,
.queueHeader p { color: var(--flora-muted); }
.staffHeader a, .pageHeader a, .devicesHeader a, .operatorHeader a,
.headerActions a {
  color: var(--flora-green);
  background: var(--flora-green-soft);
  border: 0;
  border-radius: 12px;
  text-decoration: none;
  padding: 10px 13px;
  font-weight: 650;
}

.staffPanel, .contentPanel, .summaryBand, .cardPanel, .devicesList,
.photoPanel, .panel, .editor, .queue {
  border-color: var(--flora-line) !important;
  background: var(--flora-surface) !important;
  box-shadow: var(--flora-shadow);
}
.staffPanel, .contentPanel, .summaryBand, .cardPanel, .photoPanel, .panel {
  border-radius: 24px !important;
}
.staffTabs, .programPicker, .sectionTabs, .adminTabs, .queueTabs {
  gap: 7px;
  padding: 6px;
  border: 1px solid var(--flora-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .62);
}
.staffTabs button, .programPicker button, .sectionTabs button,
.adminTabs button, .queueTabs button {
  border: 0 !important;
  border-radius: 13px !important;
  background: transparent !important;
  color: var(--flora-muted) !important;
}
.staffTabs button.active, .programPicker button.active, .sectionTabs button.active,
.adminTabs button.active, .queueTabs button.active {
  color: var(--flora-green) !important;
  background: var(--flora-green-soft) !important;
  box-shadow: none !important;
}

/* PWA сотрудника */
.mobileApp {
  width: min(920px, calc(100% - 28px));
  min-height: calc(100vh - 28px);
  margin: 14px auto;
  padding: 14px;
  border: 1px solid var(--flora-line);
  border-radius: 30px;
  background: rgba(246, 248, 246, .72);
  box-shadow: var(--flora-shadow-strong);
}
.appHeader {
  min-height: 86px;
  padding: 14px 16px;
  border: 1px solid var(--flora-line);
  border-radius: 22px;
  background: var(--flora-surface-solid);
  box-shadow: 0 10px 30px rgba(31, 61, 44, .06);
}
.appHeader img { width: 54px; height: 54px; object-fit: contain; }
.appHeader h1 { margin: 0; color: var(--flora-text); font-size: 27px; }
.appHeader p { color: var(--flora-muted); }
.logoutButton { border-radius: 13px; color: var(--flora-green); background: var(--flora-green-soft); }
.screen { margin-top: 14px; }
.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border-radius: 18px;
  background: var(--flora-surface-solid);
  border: 1px solid var(--flora-line);
}
.tabs button { min-height: 46px; border: 0; border-radius: 13px; background: transparent; color: var(--flora-muted); }
.tabs button.active { color: var(--flora-green); background: var(--flora-green-soft); }
.tabPanel, .loginChoice, .ticketDialog {
  border: 1px solid var(--flora-line) !important;
  border-radius: 22px !important;
  background: var(--flora-surface-solid) !important;
  box-shadow: none !important;
}
.tabPanel {
  padding: 18px;
}
#pairingView {
  max-width: 560px;
  margin: 14px auto 0;
  display: grid;
  gap: 12px;
}
.pairingCard { border: 1px solid var(--flora-line); border-radius: 24px; background: var(--flora-surface-solid); overflow: hidden; box-shadow: var(--flora-shadow); }
.pairingCard .loginChoice { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
.loginChoice { padding: 22px !important; }
.loginChoice h2 { margin-top: 0; color: var(--flora-text); font-size: 24px; }
.loginChoice > p { color: var(--flora-muted); }
.loginChoice > button { width: 100%; min-height: 50px; border-radius: 15px; }
.loginChoice:first-child { background: linear-gradient(145deg, #fafffc, #edf8f1) !important; }
.qrScanVisual { min-height: 110px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 13px; padding: 18px; border-radius: 18px; color: var(--flora-green); background: var(--flora-green-soft); }
.qrScanVisual span { height: 1px; background: rgba(8, 116, 67, .2); }
.qrScanVisual strong { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 16px; background: #fff; font-size: 14px; box-shadow: 0 8px 22px rgba(8, 116, 67, .1); }
.authDivider { display: flex; align-items: center; gap: 10px; padding: 0 22px; color: var(--flora-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.authDivider::before, .authDivider::after { content: ""; height: 1px; flex: 1; background: var(--flora-line); }
.appMessages, .notificationsList, .ticketsList, .lessonList, .questionList, .resultList { scrollbar-color: #bfd9c9 transparent; }
.assistantMessage, .messageBody, .notificationCard, .ticketCard, .lessonCard,
.questionCard, .resultCard { border-radius: 17px !important; border-color: var(--flora-line) !important; }
.appComposer { padding: 7px !important; border: 1px solid var(--flora-line); border-radius: 18px !important; background: #fff !important; }
.appComposer textarea { border: 0 !important; box-shadow: none !important; background: transparent !important; }
.appComposer button { min-width: 46px; min-height: 46px; border-radius: 14px !important; }

/* Вход администратора */
.loginShell {
  min-height: 100vh;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, .95fr);
  place-items: stretch;
  gap: 0;
  background: var(--flora-bg);
}
.loginBrandPanel { min-height: calc(100vh - 56px); border-radius: 30px 0 0 30px; padding: 48px; color: #fff; background: linear-gradient(145deg, #075d37, #15945d); display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.loginBrandPanel strong { font-size: 20px; }
.loginBrandPanel h2 { max-width: 620px; margin: 25px 0; font-size: clamp(38px, 5vw, 72px); line-height: 1.02; letter-spacing: -.055em; }
.loginBrandPanel img { width: min(280px, 52%); align-self: flex-end; filter: drop-shadow(0 22px 24px rgba(0, 50, 25, .25)); }
.loginPanel {
  width: 100%;
  padding: 38px;
  border: 1px solid var(--flora-line);
  border-left: 0;
  border-radius: 0 30px 30px 0;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--flora-shadow-strong);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.loginLogo { width: 62px; height: 62px; border-radius: 19px; }
.loginPanel h1 { font-size: 34px; color: var(--flora-text); }
.loginPanel > p { color: var(--flora-muted); }
.loginForm { gap: 16px; }
.loginForm label { gap: 7px; }
.loginForm button { min-height: 50px; border-radius: 15px; }

/* Фото букета */
.uploadShell {
  min-height: 100vh;
  padding: max(70px, 10vh) 14px 28px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.uploadShell .photoPanel { width: min(520px, 100%); padding: 24px; }
.photoHeader { gap: 13px; }
.photoHeader img { width: 58px; height: 58px; border-radius: 17px; background: #fff; }
.photoHeader h1 { color: var(--flora-text); letter-spacing: -.04em; }
.photoHeader p { color: var(--flora-muted); }
.photoPicker { border: 0 !important; padding: 0 !important; }
.photoPicker legend { color: var(--flora-muted); margin-bottom: 9px; }
.pickerButton { min-height: 52px; border-radius: 15px !important; background: var(--flora-green) !important; color: #fff !important; }
.pickerButton.secondary { color: var(--flora-green) !important; background: #fff !important; border: 1px solid rgba(8, 116, 67, .45) !important; }
.photoForm > button { width: 100%; min-height: 52px; border-radius: 15px; }
.statusBox { border-radius: 14px !important; }

/* Wiki и база знаний */
.wikiApp { background: transparent !important; }
.wikiSidebar { background: rgba(248, 250, 248, .88) !important; border-color: var(--flora-line) !important; }
.wikiBrand img { width: 50px; height: 50px; border-radius: 16px; background: #fff; }
.wikiBrand h1, .readerHeader h2 { color: var(--flora-text); }
.wikiBrand p, .readerHeader p, .emptyText { color: var(--flora-muted); }
.wikiTree button, .wikiTree a { border-radius: 13px !important; }
.wikiTree .active { color: var(--flora-green) !important; background: var(--flora-green-soft) !important; }
.wikiReader { background: transparent !important; }
.readerHeader, .readerContent { background: var(--flora-surface) !important; border-color: var(--flora-line) !important; }
.readerHeader { border-radius: 23px 23px 0 0; }
.readerContent { border-radius: 0 0 23px 23px; }
.readerActions { display: flex; align-items: center; gap: 8px; }
.portalLink { margin-left: auto; color: var(--flora-green); text-decoration: none; font-weight: 700; padding: 9px 12px; border-radius: 12px; background: var(--flora-green-soft); }

/* РМК и веб-чат */
.rmkShell, .app { color: var(--flora-text); }
.rmkHeader, .topbar { background: var(--flora-surface) !important; border-color: var(--flora-line) !important; box-shadow: var(--flora-shadow); }
.rmkHeader { border-radius: 22px; }
.rmkTitle h1, .topbar h1 { color: var(--flora-text) !important; }
.quickQuestions button { border-color: var(--flora-line) !important; border-radius: 13px !important; background: var(--flora-surface-solid) !important; color: var(--flora-green) !important; }
.rmkComposer, .composer { border-color: var(--flora-line) !important; border-radius: 20px !important; background: var(--flora-surface-solid) !important; box-shadow: var(--flora-shadow); }
.rmkComposer textarea, .composer textarea { border: 0 !important; background: transparent !important; box-shadow: none !important; }
.bubble { border-radius: 19px !important; }

/* Таблицы, списки и служебные блоки */
table { border-collapse: collapse; }
th { color: var(--flora-muted); font-weight: 650; }
th, td { border-color: var(--flora-line) !important; }
.filters, .statusFilter, .questionSearch, .adminForm, .staffForm { color: var(--flora-muted); }
.workArea, .filters, .resultStats { border-color: var(--flora-line) !important; }
.tokenItem, .deviceCard, .staffItem, .storeStaffItem, .ticketItem {
  border-color: var(--flora-line) !important;
  border-radius: 17px !important;
  background: var(--flora-surface-solid) !important;
}

@media (max-width: 760px) {
  .staffAdmin, .trainingApp, .devicesApp, .operatorApp, .photoShell { width: calc(100% - 20px); padding-top: 10px; }
  .staffHeader, .pageHeader, .devicesHeader, .operatorHeader, .queueHeader { border-radius: 20px; padding: 13px; }
  .staffHeader nav, .pageHeader nav, .devicesHeader nav, .headerActions { overflow-x: auto; max-width: 100%; }
  .mobileApp { width: 100%; min-height: 100vh; margin: 0; border: 0; border-radius: 0; padding: 10px; box-shadow: none; }
  .appHeader { min-height: 78px; border-radius: 20px; }
  .tabs { grid-template-columns: repeat(2, 1fr); }
  .tabs button { min-height: 44px; }
  .tabPanel { padding: 14px; }
  .loginShell { display: block; padding: 16px; background: var(--flora-bg); }
  .loginBrandPanel { display: none; }
  .loginPanel { width: min(440px, 100%); margin: max(36px, 8vh) auto 0; padding: 27px 21px; border: 1px solid var(--flora-line); border-radius: 27px; }
  .programPicker, .sectionTabs, .staffTabs, .adminTabs, .queueTabs { overflow-x: auto; flex-wrap: nowrap !important; }
  .photoShell { display: grid; }
  .photoPanel { padding: 18px !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
