/* Admin tidy layer: shared primitives (unlayered, so it wins over @layer legacy).
   Scale: text 11 / 12 / 13 / 14 / 16 / 20 / 24 px; spacing 4 / 8 / 12 / 16 / 24 px;
   controls 36 px (compact 30 px), radius 10 px (compact 8 px). One orange primary per screen. */
:root {
  --t-11: 11px; --t-12: 12px; --t-13: 13px; --t-14: 14px; --t-16: 16px; --t-20: 20px; --t-24: 24px;
  --ctl-h: 36px; --ctl-h-sm: 30px; --ctl-r: 10px; --ctl-r-sm: 8px;
  --focus-ring: 0 0 0 3px rgba(201, 71, 10, 0.22);
}

/* Buttons: one height per size, no giant or tiny variants. */
.button:not(.icon-action):not(.cc-icon) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--ctl-h);
  height: auto;
  padding: 0 14px;
  border-radius: var(--ctl-r);
  font-size: var(--t-14);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
}
.button.compact:not(.icon-action):not(.cc-icon) {
  min-height: var(--ctl-h-sm);
  padding: 0 11px;
  border-radius: var(--ctl-r-sm);
  font-size: var(--t-13);
}
.button.large-action:not(.icon-action) { min-height: 40px; padding: 0 18px; }
.button svg, .button i[data-lucide] { width: 16px; height: 16px; flex: none; }
.button.compact svg, .button.compact i[data-lucide] { width: 15px; height: 15px; }
.button.danger:not(:hover) { background: #ffffff; }
.button[disabled], .button:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.button:focus-visible, button:focus-visible, a:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Form controls: same height and text size everywhere in the workspace. */
.main input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
.main select {
  min-height: var(--ctl-h);
  font-size: var(--t-14);
  border-radius: var(--ctl-r-sm);
}
.main textarea { font-size: var(--t-14); line-height: 1.5; border-radius: var(--ctl-r-sm); }
.main input:focus-visible, .main select:focus-visible, .main textarea:focus-visible { outline: none; border-color: var(--orange-action, #c9470a); box-shadow: var(--focus-ring); }
.main input[type="checkbox"], .main input[type="radio"] { width: 16px; height: 16px; accent-color: var(--orange-action, #c9470a); }
.main ::placeholder { font-weight: 400; color: #8a939a; }

/* Headings inside the workspace: no 32-px banners, no 900 weights. */
.main h1 { font-size: var(--t-24); line-height: 1.2; font-weight: 750; letter-spacing: -0.01em; }
.main h2 { line-height: 1.25; font-weight: 700; letter-spacing: -0.005em; }
.main h3 { line-height: 1.3; font-weight: 700; }

/* Keyboard key caps */
kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border: 1px solid #d3d9dd; border-bottom-width: 2px; border-radius: 5px;
  background: #f6f8f9; color: #46525a;
  font: 600 11px/1 Inter, "Segoe UI", Arial, sans-serif; letter-spacing: 0; white-space: nowrap;
}

/* Sidebar: search entry under the logo */
.sidebar-search {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 36px; margin: 4px 0 12px; padding: 0 8px 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 10px;
  background: rgba(255, 255, 255, 0.06); color: #c9d1d6;
  font: 600 13px/1.2 Inter, "Segoe UI", Arial, sans-serif; text-align: left; cursor: pointer;
}
.sidebar-search:hover { background: rgba(255, 255, 255, 0.11); color: #ffffff; }
.sidebar-search svg { width: 16px; height: 16px; flex: none; }
.sidebar-search span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-search kbd { border-color: rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.08); color: #c9d1d6; }

/* Phones and narrow windows.
   Main desk and bots: the search button took the second grid column, so the section menu fell into the 54 px logo
   column and its labels ran over the account block. Row 1: logo, search, account icons; row 2: the sections as a
   full-width row of tabs. */
@media (max-width: 900px) {
  /* the header keeps its own height: on a tall screen with a short page it used to take a share of the free space */
  .app-shell:not(.is-site-workspace) { grid-template-rows: auto minmax(0, 1fr); }
  .app-shell:not(.is-site-workspace) .sidebar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand search account" "nav nav nav";
    align-content: start;
    gap: 8px 10px;
  }
  .app-shell:not(.is-site-workspace) .sidebar > .brand { grid-area: brand; }
  .app-shell:not(.is-site-workspace) .sidebar > .sidebar-search { grid-area: search; margin: 0; }
  .app-shell:not(.is-site-workspace) .sidebar > .nav-block {
    grid-area: nav; display: flex; justify-content: stretch; gap: 6px; min-width: 0; margin: 0;
  }
  .app-shell:not(.is-site-workspace) .sidebar > .nav-block .nav-button {
    flex: 1 1 0; width: auto; min-width: 0; min-height: 44px; justify-content: center;
    padding: 4px 8px; font-size: var(--t-12);
  }
  .app-shell:not(.is-site-workspace) .sidebar > .nav-block .nav-button-leading { min-width: 0; gap: 7px; }
  /* «Рабочий стол», «Сайты компании»: two short lines on a phone instead of a cut word */
  .app-shell:not(.is-site-workspace) .sidebar > .nav-block .nav-button-leading > span {
    min-width: 0; white-space: normal; line-height: 1.15; text-align: left;
  }
  .app-shell:not(.is-site-workspace) .sidebar > .nav-block .nav-button svg { flex: none; }
  .app-shell:not(.is-site-workspace) .sidebar > .sidebar-account {
    grid-area: account; display: flex; align-items: center; gap: 2px; margin: 0; border-top: 0; padding: 0;
  }
  .app-shell:not(.is-site-workspace) .sidebar-account__identity { display: contents; }
  .app-shell:not(.is-site-workspace) .sidebar-account__avatar,
  .app-shell:not(.is-site-workspace) .sidebar-account .staff-profile,
  .app-shell:not(.is-site-workspace) .sidebar-account__access > span,
  .app-shell:not(.is-site-workspace) .sidebar-account .sidebar-account__chevron { display: none; }
  .app-shell:not(.is-site-workspace) .sidebar-account button {
    width: 36px; height: 38px; min-height: 38px; margin: 0; padding: 0; justify-content: center;
  }
}
/* A site on a phone: the search is an icon, so the section tabs get the width; the key hint means nothing there. */
@media (max-width: 680px) {
  .app-shell.is-site-workspace .sidebar-search {
    flex: 0 0 38px; width: 38px; min-height: 38px; margin: 0; padding: 0; justify-content: center;
  }
  .app-shell.is-site-workspace .sidebar-search span { display: none; }
  .sidebar-search kbd { display: none; }
}
@media (hover: none) { .sidebar-search kbd { display: none; } }

/* The round «Команда» button sits in the bottom right corner over the save bar: keep the bar's buttons clear of it. */
body:has(.team-widget:not(.is-open)) .builder-save-dock.is-visible { padding-right: 78px; }
@media (max-width: 680px) {
  body:has(.team-widget:not(.is-open)) .builder-save-dock.is-visible { padding-right: 66px; }
}

/* Ctrl+K palette and shortcut help */
.cmdk {
  width: min(680px, calc(100vw - 32px)); max-height: min(620px, calc(100vh - 96px));
  margin: 72px auto auto; padding: 0;
  border: 1px solid #d6dde1; border-radius: 14px;
  background: #ffffff; color: #1f262b;
  box-shadow: 0 24px 70px rgba(18, 26, 32, 0.28);
  overflow: hidden;
}
.cmdk::backdrop { background: rgba(17, 23, 28, 0.42); }
.cmdk__box { display: flex; flex-direction: column; max-height: inherit; }
.cmdk__field { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid #e6eaed; }
.cmdk__field svg { width: 18px; height: 18px; color: #6b7780; flex: none; }
.cmdk__field input {
  flex: 1; min-width: 0; height: 32px; padding: 0; border: 0; outline: none; box-shadow: none !important;
  background: transparent; color: #1f262b; font: 500 16px/1.3 Inter, "Segoe UI", Arial, sans-serif;
}
.cmdk__field input::-webkit-search-cancel-button { display: none; }
.cmdk__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cmdk__list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; overscroll-behavior: contain; }
.cmdk__group h3 { margin: 8px 10px 4px; color: #77828a; font: 700 11px/1.3 Inter, "Segoe UI", Arial, sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.cmdk__item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 6px 10px;
  border: 0; border-radius: 9px; background: transparent; color: inherit; text-align: left; cursor: pointer;
}
.cmdk__item svg { width: 17px; height: 17px; flex: none; color: #6b7780; }
.cmdk__item.is-active { background: #fff1e9; }
.cmdk__item.is-active svg { color: #c9470a; }
.cmdk__text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.cmdk__text strong { overflow: hidden; font: 600 14px/1.3 Inter, "Segoe UI", Arial, sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.cmdk__text small { overflow: hidden; color: #6b7780; font: 400 12px/1.3 Inter, "Segoe UI", Arial, sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.cmdk__hint { flex: none; }
.cmdk__empty { margin: 18px 14px; color: #6b7780; font-size: 14px; }
.cmdk__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 9px 14px; border-top: 1px solid #e6eaed; background: #f8fafb; color: #6b7780; font-size: 12px; }
.cmdk__foot span { display: inline-flex; align-items: center; gap: 4px; }
.cmdk__status { margin-left: auto; }
.cmdk--help { width: min(760px, calc(100vw - 32px)); }
.cmdk__help-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid #e6eaed; }
.cmdk__help-head h2 { margin: 0; font-size: 20px; }
.cmdk__help { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 28px; padding: 8px 18px 4px; overflow-y: auto; }
.cmdk__help h3 { margin: 12px 0 6px; color: #77828a; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.cmdk__help dl { display: grid; gap: 6px; margin: 0; }
.cmdk__help dl div { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 10px; }
.cmdk__help dt { display: flex; gap: 4px; }
.cmdk__help dd { margin: 0; color: #2c353b; font-size: 13px; }
.cmdk__help-note { margin: 10px 18px 16px; color: #6b7780; font-size: 12px; }
@media (max-width: 720px) { .cmdk__help { grid-template-columns: 1fr; } .cmdk { margin-top: 24px; } }

/* Main desk: today's work first */
.desk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 4px 4px 0; }
.desk-head h1 { margin: 6px 0 4px; }
.desk-head p { margin: 0; font-size: 14px; }
.desk-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.desk-today { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin: 20px 0; }
.desk-site { display: grid; gap: 12px; padding: 16px; border: 1px solid #dfe4e7; border-radius: 14px; background: #ffffff; }
.desk-site header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.desk-site h2 { margin: 0; font-size: 16px; }
.desk-site__error { color: #b9382a; font-size: 12px; }
.desk-site__tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.desk-tile {
  display: grid; gap: 2px; align-content: start; min-height: 74px; padding: 10px 12px;
  border: 1px solid #e3e8eb; border-radius: 10px; background: #f8fafb; color: #1f262b; text-align: left; cursor: pointer;
}
.desk-tile:hover { border-color: #c4ccd1; background: #ffffff; }
.desk-tile strong { font-size: 24px; line-height: 1.1; }
.desk-tile span { color: #5f6972; font-size: 12px; line-height: 1.3; }
.desk-tile.has-items.is-orders, .desk-tile.has-items.is-inquiries { border-color: rgba(201, 71, 10, 0.35); background: #fff6f1; }
.desk-tile.has-items.is-orders strong, .desk-tile.has-items.is-inquiries strong { color: #c9470a; }
.desk-site > .button { justify-self: start; }

/* Site desk: a light header like every other section (was a dark banner). */
.manager-dashboard__hero {
  min-height: 0; padding: 16px 20px; border: 1px solid #dfe4e7; border-radius: 12px;
  background: #ffffff; color: #1f262b; box-shadow: none;
}
.manager-dashboard__hero h1 { margin: 4px 0 4px; color: #1f262b; font-size: var(--t-24); }
.manager-dashboard__hero p { color: #5f6972; font-size: var(--t-13); }
.manager-dashboard__hero .constructor-kicker { color: #c9470a; }
.manager-dashboard__hero-actions { max-width: none; align-items: center; }
.manager-dashboard__hero-actions .button:not(.primary) { color: #1f262b; background: #ffffff; border-color: #ced5d9; }
.manager-dashboard__hero-actions .button:not(.primary):hover { background: #f5f7f8; }
.manager-page-head p, .manager-attention__head p { font-size: var(--t-13); }

/* Desk project cards: compact, no decorative circles */
.project-grid .card { min-height: 0; padding: 16px 18px; border-radius: 12px; }
.project-grid .card::before, .project-grid .card::after { display: none; }
.project-grid .card-title { font-size: var(--t-16); }
.project-grid .card p { font-size: var(--t-13); }

/* Messages sit above the dark save dock (app.js notify() lifts them above it) and close on click. */
.toast { z-index: 60; cursor: pointer; }

/* Аналитика: Конструктор и база знаний (2026-11-12) */
.analytics-constructor-card, .analytics-kb-card { margin-top: 18px; }
.analytics-funnel-row strong small { margin-left: 6px; color: var(--muted, #6b7378); font-size: 12px; font-weight: 500; }
.analytics-kb-card .analytics-product-row { grid-template-columns: minmax(240px, 1fr) repeat(5, 96px); }
.analytics-product-row.analytics-row-2 { grid-template-columns: minmax(0, 1fr) 90px; min-height: 40px; }
.analytics-product-row.analytics-row-3 { grid-template-columns: minmax(0, 1fr) 120px 80px; min-height: 42px; }
.analytics-kb-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-top: 18px; }
.analytics-kpis--small { margin: 6px 0 16px; }
.analytics-kpis--small article { min-height: 96px; padding: 14px; }
.analytics-kpis--small strong { font-size: 22px; }
.analytics-chart--kb { height: 120px; }
@media (max-width: 900px) {
  .analytics-kb-card .analytics-product-row { grid-template-columns: minmax(0, 1fr) repeat(2, 70px); }
  .analytics-kb-card .analytics-product-row > :nth-child(n+4) { display: none; }
  .analytics-kpis--small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* «Компания и контакты» → «Команда»: one card per photo of the company page block. */
.team-editor { display: grid; gap: 12px; margin: 8px 0 12px; }
.team-editor__card {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  gap: 16px;
  margin: 0;
  padding: 12px 14px 14px;
  border: 1px solid #e1e5e6;
  border-radius: var(--ctl-r);
  background: #ffffff;
}
.team-editor__card legend { padding: 0 6px; font-size: var(--t-13); font-weight: 700; }
.team-editor__card .image-field { margin: 0; }
.team-editor__fields { display: grid; align-content: start; gap: 10px; }
.team-editor__fields .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.team-editor__note { padding: 8px 12px; border-radius: var(--ctl-r-sm); background: #fff6e8; color: #7a4a00; }
.team-editor__warning { color: #b42318; }
@media (max-width: 760px) { .team-editor__card { grid-template-columns: minmax(0, 1fr); } }

/* Контент → Главная → «Новогоднее оформление» (new-year-admin.js) */
.new-year-admin .section-row { align-items: flex-start; }
.new-year-admin__status { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 30px; padding: 4px 12px; border-radius: 999px; font-size: var(--t-13); font-weight: 700; color: #5d676b; background: #eef1f2; }
.new-year-admin__status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #9aa5a9; }
.new-year-admin__status.is-on { color: #0d6b5f; background: #e2f5f1; }
.new-year-admin__status.is-on::before { background: #17a58f; box-shadow: 0 0 0 3px rgba(23, 165, 143, 0.18); }
.new-year-admin__card { display: grid; gap: 18px; }
.new-year-admin__modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.new-year-admin__mode { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid #dfe4e6; border-radius: var(--ctl-r); cursor: pointer; background: #fff; }
.new-year-admin__mode.is-active { border-color: var(--orange-action, #c9470a); box-shadow: var(--focus-ring); }
.new-year-admin__mode span, .new-year-admin__part span { display: grid; gap: 2px; }
.new-year-admin__mode strong, .new-year-admin__part strong { font-size: var(--t-14); }
.new-year-admin__mode small, .new-year-admin__part small { color: #6a7579; font-size: var(--t-12); line-height: 1.4; }
.new-year-admin__mode input, .new-year-admin__part input { margin-top: 2px; flex: none; }
.new-year-admin__parts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.new-year-admin__part { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.new-year-admin__gifts { display: grid; gap: 12px; padding-top: 16px; border-top: 1px solid #eceff0; }
.new-year-admin__gifts > label { display: grid; gap: 6px; font-size: var(--t-13); font-weight: 600; }
.new-year-admin__preview code { padding: 1px 5px; border-radius: 4px; background: #f1f3f4; font-size: var(--t-12); }
@media (max-width: 900px) {
  .new-year-admin__modes, .new-year-admin__parts { grid-template-columns: 1fr; }
}
