/* Mise. Аналитика ресторана. Светлая тема: травяной зеленый, шафран, томат. */

@font-face {
  font-family: 'Manrope';
  src: url('fonts/manrope-cyr.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope';
  src: url('fonts/manrope-lat.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20BD, U+2122, U+2212;
}

:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #f8faf7;
  --ink: #17211c;
  --ink-2: #5f6d65;
  --ink-3: #909b94;
  --line: #e3e8e2;
  --line-2: #eef2ed;
  --herb: #1e6b4f;
  --herb-hover: #175a42;
  --herb-soft: #e7f2ec;
  --herb-mid: #b9dac8;
  --saffron: #b7791f;
  --saffron-bar: #e3a13b;
  --saffron-soft: #fdf3e1;
  --tomato: #c43d33;
  --tomato-soft: #fbe9e6;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;
  --shadow: 0 1px 2px rgba(23, 33, 28, .04), 0 6px 20px rgba(23, 33, 28, .04);
  --shadow-pop: 0 12px 40px rgba(23, 33, 28, .16);
  --rail: 244px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', system-ui, 'Segoe UI', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
body.lock { overflow: hidden; }

h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 28px; font-weight: 800; line-height: 1.15; }
h2 { font-size: 18px; font-weight: 800; }
h3 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 10px; }
a { color: var(--herb); }
ul { margin: 6px 0 0; padding-left: 18px; }
li { margin-bottom: 5px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.nowrap { white-space: nowrap; }

/* ---------- каркас ---------- */

.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }

.rail {
  position: sticky; top: 0; height: 100vh; overflow: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 18px 14px 18px;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; text-decoration: none; color: var(--ink); }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand b { font-size: 22px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.brand small { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 600; letter-spacing: 0; margin-top: 3px; }

.switch {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2);
  position: relative;
}
.switch .ava { width: 30px; height: 30px; border-radius: 9px; background: var(--herb); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.switch div { min-width: 0; flex: 1; }
.switch div small { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.switch div b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch select { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.switch:focus-within { outline: 2px solid var(--herb); outline-offset: 1px; }

.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; margin-bottom: 2px;
  border-radius: var(--r-sm);
  color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14.5px;
  cursor: pointer;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--herb-soft); color: var(--herb); font-weight: 700; }
.nav a .count { margin-left: auto; font-size: 12px; font-weight: 700; background: var(--tomato); color: #fff; border-radius: 99px; padding: 0 7px; line-height: 19px; }
.nav .sep { height: 1px; background: var(--line-2); margin: 12px 8px; }

.rail .ask {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 12px; border-radius: var(--r-md);
  background: linear-gradient(135deg, #1e6b4f, #2b8a66); color: #fff; border: none;
  font-weight: 700; text-align: left;
}
.rail .ask:hover { filter: brightness(1.06); background: linear-gradient(135deg, #1e6b4f, #2b8a66); }
.rail .ask small { display: block; font-weight: 500; opacity: .8; font-size: 12px; }

.topbar { display: none; }

main { padding: 30px 36px 100px; max-width: 1380px; width: 100%; min-width: 0; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .t { min-width: 0; flex: 1 1 420px; }
.page-head p { color: var(--ink-2); max-width: 76ch; margin: 8px 0 0; font-size: 14.5px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.eyebrow { font-size: 13px; color: var(--ink-3); font-weight: 600; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- поверхности ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card > h2 { margin-bottom: 4px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { flex: 1; min-width: 180px; }
.sub { color: var(--ink-2); font-size: 13.5px; margin: 2px 0 16px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid.wide-left { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.grid > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 18px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { align-items: flex-end; }
.spacer { flex: 1; }

/* ---------- KPI ---------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px; box-shadow: var(--shadow); position: relative; min-width: 0;
}
.kpi .lbl { font-size: 13px; color: var(--ink-2); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 27px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; margin-top: 8px; white-space: nowrap; }
.kpi .val span { font-size: 16px; font-weight: 700; color: var(--ink-3); margin-left: 3px; letter-spacing: 0; }
.kpi .note { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; line-height: 1.4; }
.kpi.good .val { color: var(--herb); }
.kpi.warn .val { color: var(--saffron); }
.kpi.bad .val { color: var(--tomato); }
.chip-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.chip-delta.bad { background: var(--tomato-soft); color: var(--tomato); }
.chip-delta.good { background: var(--herb-soft); color: var(--herb); }
.chip-delta.warn { background: var(--saffron-soft); color: var(--saffron); }

/* ---------- кнопки и поля ---------- */

button, .btn {
  font: inherit; font-weight: 700; font-size: 14px; line-height: 1.3;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--herb); background: var(--herb); color: #fff;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
button:hover, .btn:hover { background: var(--herb-hover); border-color: var(--herb-hover); }
button.ghost, .btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
button.ghost:hover, .btn.ghost:hover { background: var(--surface-2); border-color: #cfd8d0; }
button.danger { background: var(--surface); color: var(--tomato); border-color: #efc9c4; }
button.danger:hover { background: var(--tomato-soft); }
button.danger.solid { background: var(--tomato); color: #fff; border-color: var(--tomato); }
button.link { background: none; border: none; color: var(--herb); padding: 3px 4px; font-weight: 700; }
button.link:hover { background: none; text-decoration: underline; }
button.icon { padding: 8px; background: transparent; border-color: transparent; color: var(--ink-2); }
button.icon:hover { background: var(--surface-2); color: var(--ink); border-color: transparent; }
button.sm, .btn.sm { padding: 6px 11px; font-size: 13px; }
button:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--herb); outline-offset: 2px; }
main:focus, main:focus-visible { outline: none; }

input, select, textarea {
  font: inherit; font-size: 14.5px; color: var(--ink);
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); max-width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
input:hover, select:hover, textarea:hover { border-color: #cfd8d0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--herb); box-shadow: 0 0 0 3px var(--herb-soft); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235f6d65' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
textarea { width: 100%; min-height: 84px; resize: vertical; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--herb); padding: 0; }
label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
label.check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; margin: 0; cursor: pointer; }
.field { margin-bottom: 14px; min-width: 0; }
.field input, .field select, .field textarea { width: 100%; }
.field .hint { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 16px; height: 16px; }
.search input { padding-left: 34px; width: 290px; }

/* ---------- сегменты, вкладки, фильтры ---------- */

.seg { display: inline-flex; padding: 3px; background: #e9ede8; border-radius: 11px; gap: 2px; flex-wrap: wrap; max-width: 100%; }
.seg button { background: transparent; border: none; color: var(--ink-2); padding: 7px 13px; border-radius: 8px; font-size: 13.5px; }
.seg button:hover { background: rgba(255, 255, 255, .6); color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(23, 33, 28, .1); }
.seg button .n { font-weight: 600; color: var(--ink-3); margin-left: 2px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: none; color: var(--ink-2); padding: 11px 14px; border-radius: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { background: none; color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--herb); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.chips button:hover { background: var(--surface-2); color: var(--ink); }
.chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- метки ---------- */

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.bad { background: var(--tomato-soft); color: var(--tomato); }
.pill.warn { background: var(--saffron-soft); color: var(--saffron); }
.pill.good { background: var(--herb-soft); color: var(--herb); }
.pill.plain::before { display: none; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); margin: 0 4px 4px 0; white-space: nowrap; }
.tag.warn { background: var(--saffron-soft); color: var(--saffron); }
.tag.bad { background: var(--tomato-soft); color: var(--tomato); }
.tag.good { background: var(--herb-soft); color: var(--herb); }

/* ---------- таблицы ---------- */

.tbl-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.tbl { overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.tbl.tall { max-height: 680px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); text-align: left;
  font-weight: 700; font-size: 12.5px; color: var(--ink-2);
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
thead th.sort { cursor: pointer; user-select: none; }
thead th.sort:hover { color: var(--ink); }
thead th.sort::after { content: ''; display: inline-block; width: 0; height: 0; margin-left: 6px; vertical-align: 2px; border: 4px solid transparent; opacity: .35; border-top-color: currentColor; }
thead th.asc::after { border-top-color: transparent; border-bottom-color: currentColor; vertical-align: 5px; opacity: 1; }
thead th.desc::after { opacity: 1; }
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--surface-2); }
tbody tr.open td { background: var(--surface-2); border-bottom-color: transparent; }
tbody tr.detail td { background: var(--surface-2); padding: 4px 14px 18px; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.name { font-weight: 700; min-width: 200px; }
td.name.tight { min-width: 0; }
td.name small, td small { display: block; color: var(--ink-3); font-size: 12.5px; font-weight: 500; margin-top: 2px; }
td.lead { width: 4px; padding: 0 0 0 0; }
td .bar-ind { display: block; width: 4px; height: 26px; border-radius: 4px; background: transparent; }
tr.bad td .bar-ind { background: var(--tomato); }
tr.warn td .bar-ind { background: var(--saffron-bar); }
.fcbar { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.fcbar i { display: block; width: 46px; height: 6px; border-radius: 4px; background: var(--line-2); position: relative; overflow: hidden; }
.fcbar i b { position: absolute; inset: 0 auto 0 0; background: var(--herb); border-radius: 4px; }
.fcbar i b.warn { background: var(--saffron-bar); }
.fcbar i b.bad { background: var(--tomato); }
.more { text-align: center; padding: 12px; }

.detail-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 20px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.detail-grid h3 { font-size: 13px; color: var(--ink-3); font-weight: 700; margin-bottom: 6px; }
.detail-grid dl { display: grid; grid-template-columns: auto auto; gap: 4px 14px; margin: 0; font-size: 13.5px; }
.detail-grid dt { color: var(--ink-2); }
.detail-grid dd { margin: 0; text-align: right; font-weight: 600; }

/* ---------- списки дел и заметки ---------- */

.todo { display: flex; flex-direction: column; }
.todo a {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px;
  border-bottom: 1px solid var(--line-2); text-decoration: none; color: var(--ink); cursor: pointer;
}
.todo a:last-child { border-bottom: none; }
.todo a:hover .go { color: var(--herb); transform: translateX(2px); }
.todo .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.todo .ic.bad { background: var(--tomato-soft); color: var(--tomato); }
.todo .ic.warn { background: var(--saffron-soft); color: var(--saffron); }
.todo .ic.good { background: var(--herb-soft); color: var(--herb); }
.todo .tx { flex: 1; min-width: 0; font-size: 14px; }
.todo .tx small { display: block; color: var(--ink-2); font-size: 13px; }
.todo .go { color: var(--ink-3); transition: transform .12s, color .12s; }

.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); font-size: 14px; margin: 10px 0; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.callout svg { margin-top: 2px; }
.callout b { color: var(--ink); }
.callout.warn { background: var(--saffron-soft); border-color: #f1dcb1; color: #6d4c14; }
.callout.warn svg { color: var(--saffron); }
.callout.bad { background: var(--tomato-soft); border-color: #f1c9c4; color: #7a2620; }
.callout.bad svg { color: var(--tomato); }
.callout.good { background: var(--herb-soft); border-color: var(--herb-mid); color: #1d4a38; }
.callout.good svg { color: var(--herb); }
.callout .grow { flex: 1; min-width: 0; }

/* ---------- загрузка файлов ---------- */

.drop {
  border: 1.5px dashed #c7d3ca; border-radius: var(--r-lg);
  background: var(--surface-2);
  padding: 30px 20px; text-align: center; color: var(--ink-2);
  cursor: pointer; font-size: 14px; transition: border-color .12s, background .12s;
}
.drop:hover, .drop.on { border-color: var(--herb); background: var(--herb-soft); }
.drop .ic { width: 46px; height: 46px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; margin: 0 auto 10px; color: var(--herb); }
.drop b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 3px; }
.files { margin-top: 12px; display: grid; gap: 8px; }
.file { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); font-size: 14px; min-width: 0; }
.file .ic { width: 34px; height: 34px; border-radius: 9px; background: var(--herb-soft); color: var(--herb); display: grid; place-items: center; flex: none; }
.file .ic.bad { background: var(--tomato-soft); color: var(--tomato); }
.file .nm { flex: 1; min-width: 0; }
.file .nm b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .nm small { color: var(--ink-3); font-size: 12.5px; }

.kit { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kit div { display: flex; gap: 10px; padding: 11px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); line-height: 1.4; }
.kit div svg { color: var(--ink-3); margin-top: 1px; }
.kit div.req svg { color: var(--herb); }
.kit div b { display: block; color: var(--ink); font-size: 13.5px; }

/* ---------- карточки рекомендаций и идей ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.rec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.rec .top { padding: 16px 18px 0; }
.rec .meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; margin-bottom: 8px; flex-wrap: wrap; }
.rec h3 { font-size: 17px; line-height: 1.3; margin-bottom: 10px; }
.rec .effect { margin: 0 18px; padding: 12px 14px; border-radius: var(--r-md); background: var(--herb-soft); color: #1d4a38; }
.rec .effect b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--herb); line-height: 1.2; }
.rec .effect b.neg { color: var(--tomato); }
.rec .effect span { display: block; font-size: 13.5px; font-weight: 600; margin-top: 2px; }
.rec .effect small { display: block; font-size: 12.5px; margin-top: 3px; color: #3b6653; }
.rec .effect.none { background: var(--surface-2); color: var(--ink-2); }
.rec .effect.none b { color: var(--ink-2); font-size: 15px; }
.rec .body { padding: 14px 18px 4px; font-size: 14px; }
.rec .body div { margin-bottom: 10px; }
.rec .body u { display: block; text-decoration: none; font-size: 12.5px; color: var(--ink-3); font-weight: 700; margin-bottom: 2px; }
.rec .facts { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 18px 14px; }
.rec .foot { margin-top: auto; border-top: 1px solid var(--line-2); padding: 12px 18px; background: var(--surface-2); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rec .foot select, .rec .foot input { font-size: 13.5px; padding: 7px 10px; }
.rec .foot select { padding-right: 30px; }
.rec .foot .grow { flex: 1; min-width: 120px; }
.rec .fact { padding: 0 18px 14px; }
.rec .fact input { width: 100%; }

/* ---------- матрица и графики ---------- */

.matrix { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.matrix button {
  display: block; text-align: left; white-space: normal;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: 14px 16px; min-height: 124px; font-weight: 500;
}
.matrix button:hover { background: var(--surface); border-color: var(--line); }
.matrix button.on { background: var(--herb-soft); border-color: var(--herb-mid); }
.matrix .m-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.matrix .m-top h3 { font-size: 14px; }
.matrix .m-top b { font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
.matrix small { color: var(--ink-2); display: block; font-size: 12.5px; margin-top: 2px; }
.matrix ul { margin: 8px 0 0; padding-left: 16px; font-size: 12.5px; color: var(--ink-2); }
.matrix ul li { margin-bottom: 2px; }
.axis { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--ink-3); margin-top: 8px; }

.bars { display: grid; gap: 9px; }
.bar { display: grid; grid-template-columns: minmax(90px, 170px) 1fr 58px; gap: 12px; align-items: center; font-size: 13.5px; }
.bar > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bar .track { height: 8px; background: var(--line-2); border-radius: 6px; position: relative; }
.bar .track i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--herb); border-radius: 6px; }
.bar .track i.over { background: var(--saffron-bar); }
.bar .track .goal { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 2px; }
.bar > span:last-child { text-align: right; font-weight: 700; }
.chart-note { font-size: 12.5px; color: var(--ink-3); margin: 12px 0 0; }

/* ---------- календарь ---------- */

.events { display: flex; flex-direction: column; }
.event { display: flex; gap: 16px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line-2); }
.event:last-child { border-bottom: none; }
.event .date { width: 56px; text-align: center; flex: none; border-radius: var(--r-md); border: 1px solid var(--line); padding: 6px 0; background: var(--surface); }
.event .date b { display: block; font-size: 20px; font-weight: 800; line-height: 1.1; }
.event .date small { font-size: 11.5px; color: var(--ink-2); font-weight: 700; }
.event .tx { flex: 1; min-width: 0; }
.event .tx b { display: block; }
.event .tx small { color: var(--ink-2); font-size: 13px; }
.event.done { opacity: .5; }
.event.done .tx b { text-decoration: line-through; }

/* ---------- мастер ---------- */

.wizard { max-width: 620px; }
.progress-steps { display: flex; gap: 8px; margin-bottom: 20px; }
.progress-steps div { flex: 1; }
.progress-steps i { display: block; height: 4px; border-radius: 4px; background: var(--line); margin-bottom: 8px; }
.progress-steps div.on i { background: var(--herb); }
.progress-steps small { font-size: 12.5px; color: var(--ink-3); font-weight: 700; }
.progress-steps div.on small { color: var(--ink); }
.danger-zone { border-color: #f1d3cf; }

.progress { height: 6px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--herb); border-radius: 6px; transition: width .4s ease; }

/* ---------- пустые состояния и загрузка ---------- */

.empty { text-align: center; padding: 56px 24px; color: var(--ink-2); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-lg); }
.empty .ic { width: 52px; height: 52px; border-radius: 16px; background: var(--herb-soft); color: var(--herb); display: grid; place-items: center; margin: 0 auto 14px; }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 6px; }
.empty p { max-width: 52ch; margin: 0 auto 16px; }
.skel { border-radius: var(--r-lg); background: linear-gradient(90deg, #eceFeb 0%, #f5f7f4 50%, #eceFeb 100%); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: currentColor; border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px; }
.ghost .spin, .card .spin, .answer .spin { border-color: var(--line); border-top-color: var(--herb); }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- панели, модалки, уведомления ---------- */

.scrim { position: fixed; inset: 0; background: rgba(23, 33, 28, .28); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.on { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 10px; right: 10px; bottom: 10px; width: min(480px, calc(100% - 20px));
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; z-index: 60;
  transform: translateX(calc(100% + 20px)); visibility: hidden;
  transition: transform .24s ease, visibility 0s linear .24s;
}
.drawer.on { transform: none; visibility: visible; transition: transform .24s ease; }
.drawer header { padding: 16px 18px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; }
.drawer header h2 { flex: 1; font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer .body { flex: 1; overflow: auto; padding: 18px; font-size: 14.5px; }
.drawer footer { border-top: 1px solid var(--line-2); padding: 12px 14px; }

.chat { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 92%; padding: 11px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; }
.msg.q { align-self: flex-end; background: var(--herb); color: #fff; border-bottom-right-radius: 4px; }
.msg.a { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line-2); border-bottom-left-radius: 4px; }
.ask-hello { text-align: center; padding: 18px 8px 8px; color: var(--ink-2); font-size: 14px; }
.ask-hello .ic { width: 48px; height: 48px; border-radius: 15px; margin: 0 auto 10px; display: grid; place-items: center; background: linear-gradient(135deg, #1e6b4f, #2b8a66); color: #fff; }
.ask-hello b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.suggest { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.suggest button { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-md); text-align: left; white-space: normal; font-weight: 600; font-size: 13.5px; justify-content: flex-start; }
.suggest button:hover { background: var(--herb-soft); border-color: var(--herb-mid); }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 46px; max-height: 160px; resize: none; }
.composer button { height: 46px; width: 46px; padding: 0; border-radius: 12px; }

.modal {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -48%) scale(.98);
  width: min(520px, calc(100% - 24px)); max-height: calc(100vh - 40px); overflow: auto;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-pop); z-index: 70;
  opacity: 0; pointer-events: none; transition: opacity .16s, transform .16s;
}
.modal.on { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
.modal .mh { padding: 20px 22px 4px; }
.modal .mh h2 { font-size: 19px; }
.modal .mb { padding: 10px 22px 6px; color: var(--ink-2); font-size: 14.5px; }
.modal .mf { padding: 14px 22px 20px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .18s, transform .18s;
  max-width: calc(100% - 40px);
}
.toast.on { opacity: 1; transform: none; }
.toast svg { color: #7fd1a9; }
.toast.err svg { color: #ff9c92; }

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

/* ---------- адаптив ---------- */

@media (max-width: 1100px) {
  .grid.two, .grid.wide-left { grid-template-columns: minmax(0, 1fr); }
  .detail-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); height: 100vh;
    transform: translateX(-100%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; box-shadow: var(--shadow-pop);
    z-index: 58;
  }
  body.nav-open .rail { visibility: visible; transition: transform .22s ease; }
  body.lock .fab { display: none; }
  .card-head h2 { min-width: 0; }
  body.nav-open .rail { transform: none; }
  .topbar {
    display: flex; align-items: center; gap: 8px;
    position: sticky; top: 0; z-index: 25;
    background: rgba(244, 246, 243, .92); backdrop-filter: blur(10px);
    padding: 10px 12px; border-bottom: 1px solid var(--line);
  }
  .topbar .brand { padding: 0; }
  .topbar .brand b { font-size: 19px; }
  .topbar .brand svg { width: 28px; height: 28px; }
  .topbar .where { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-2); font-weight: 600; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  main { padding: 20px 16px 96px; }
  h1 { font-size: 24px; }
  .search input { width: 100%; }
  .search { flex: 1 1 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .fab {
    position: fixed; right: 16px; bottom: 16px; z-index: 40;
    width: 54px; height: 54px; border-radius: 18px; padding: 0;
    background: linear-gradient(135deg, #1e6b4f, #2b8a66); border: none; box-shadow: var(--shadow-pop);
  }
  .fab svg { width: 22px; height: 22px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .matrix { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi .val { font-size: 22px; }
  .bar { grid-template-columns: 96px 1fr 52px; }
  .drawer { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 88vh; border-radius: 20px 20px 0 0; transform: translateY(100%); }
  .toast { left: 16px; right: 16px; bottom: 84px; }
}
@media (min-width: 901px) { .fab { display: none; } }

/* ---------- v2.1: методика меню, задачи, график, помощник ---------- */

:root { --sky: #2f6fa8; --sky-soft: #e6eff8; }
.tag.info, .pill.info { background: var(--sky-soft); color: var(--sky); }
.kpi.info .val { color: var(--sky); }
.callout.info { background: var(--sky-soft); border-color: #cddff0; }
.callout.info > svg { color: var(--sky); }
.callout.good { background: var(--herb-soft); border-color: var(--herb-mid); }
.tag .x { background: none; border: none; padding: 0 0 0 4px; color: inherit; font-size: 14px; line-height: 1; height: auto; min-height: 0; cursor: pointer; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); vertical-align: 2px; }
.dot.good { background: var(--herb); }

button.kpi { text-align: left; font: inherit; color: inherit; display: block; width: 100%; height: auto; cursor: pointer; white-space: normal; }
button.kpi:hover { border-color: var(--herb-mid); box-shadow: 0 0 0 3px var(--herb-soft); }
button.kpi .lbl, button.kpi .note { font-weight: 600; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; }
.dd { position: relative; }
.dd > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13.5px; font-weight: 700; padding: 7px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); }
.dd > summary::-webkit-details-marker { display: none; }
.dd > summary .n { background: var(--ink); color: #fff; border-radius: 99px; padding: 0 7px; font-size: 12px; }
.dd-pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: 300px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: 12px; }
.dd-list { max-height: 280px; overflow: auto; display: grid; gap: 6px; }
.dd-list label.check { font-size: 13.5px; }
.chips.wrap { flex-wrap: wrap; }

.matrix button.s-good b { color: var(--herb); }
.matrix button.s-info b { color: var(--sky); }
.matrix button.s-warn b { color: var(--saffron); }
.matrix button.s-bad b { color: var(--tomato); }
.fcbar i em { position: absolute; top: -2px; bottom: -2px; width: 1px; background: rgba(23, 33, 28, .45); }
.fcbar i b.info { background: var(--sky); }
.fcbar i b.good { background: var(--herb); }
button.bar { background: none; border: none; padding: 2px 0; height: auto; min-height: 0; color: inherit; font: inherit; font-size: 13.5px; text-align: left; border-radius: 6px; width: 100%; font-weight: 400; }
button.bar:hover { background: var(--surface-2); }

select.mini, input.mini { height: 32px; padding: 4px 8px; font-size: 13px; border-radius: 8px; min-width: 0; }
input.mini.num { text-align: right; width: 96px; }
tr.muted-row td { opacity: .55; }

.plan { display: grid; gap: 2px; }
.plan-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto auto; gap: 12px; align-items: start; padding: 10px 8px; border-radius: 10px; cursor: pointer; margin: 0; color: var(--ink); font-size: 14px; }
.plan-row:hover { background: var(--surface-2); }
.plan-row input { margin-top: 3px; }
.plan-row .tx small { display: block; color: var(--ink-2); font-size: 12.5px; margin-top: 2px; }
.plan-row.done { opacity: .6; }
.sticky-bar { position: sticky; bottom: 12px; z-index: 20; display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; box-shadow: var(--shadow-pop); }

.insp { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 10px; }
.insp.off { opacity: .6; }
.insp-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.insp-h b { flex: 1; min-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insp-h select { width: auto; height: 36px; }
.insp-h .ic { color: var(--herb); }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0 14px; margin-top: 10px; }
.map-grid .field { margin-bottom: 10px; }
.map-grid .hint { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hist { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.hist > div { min-width: 150px; border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; }
.hist > div.cur { border-color: var(--herb-mid); background: var(--herb-soft); }
.hist small { display: block; color: var(--ink-2); font-size: 12px; }
.hist b { display: block; font-size: 18px; color: var(--tomato); margin: 2px 0; }
.hist span { font-size: 12.5px; color: var(--ink-2); }
.mini-hist { display: inline-flex; gap: 3px; align-items: center; }
.mini-hist span { width: 9px; height: 9px; border-radius: 3px; background: var(--line); }
.mini-hist span.bad { background: var(--tomato); }
.mini-hist span.good { background: var(--herb); }
.mini-hist span.cur { outline: 2px solid var(--ink-3); outline-offset: 1px; }

.sched table { font-size: 12.5px; }
.sched th, .sched td { padding: 6px 4px; text-align: center; }
.sched th small { display: block; font-weight: 500; color: var(--ink-3); }
.sched td.name, .sched th:first-child { text-align: left; padding-left: 10px; min-width: 150px; }
.sched .pk { background: var(--saffron-soft); }
.sched td.on { font-weight: 800; color: var(--herb); }
.sched td.bad-t b { color: var(--tomato); }
.fields.three { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* помощник: панель справа, не перекрывает работу */
.chat-panel .msg.a { white-space: normal; max-width: 100%; }
.msg.a p { margin: 0 0 8px; }
.msg.a p:last-child { margin-bottom: 0; }
.msg.a ul, .msg.a ol { margin: 4px 0 8px; padding-left: 20px; }
.msg.a h4 { margin: 10px 0 6px; font-size: 14.5px; }
.msg.a code { background: var(--line-2); border-radius: 4px; padding: 0 4px; font-size: 13px; }
.md-table { margin: 8px 0; }
.md-table .tbl { max-height: 320px; margin-bottom: 6px; }
.md-table table { font-size: 12.5px; }
.md-table th, .md-table td { padding: 6px 8px; }
.msg .tools { margin-top: 8px; font-size: 11.5px; color: var(--ink-3); display: flex; gap: 5px; align-items: center; }
.msg .tools svg { width: 13px; height: 13px; }
@media (min-width: 901px) {
  .chat-panel { top: 0; right: 0; bottom: 0; border-radius: 0; width: 440px; box-shadow: -1px 0 0 var(--line), var(--shadow); }
  body.chat-open .shell { margin-right: 440px; }
  body.chat-open .ask { background: var(--herb); color: #fff; }
}
@media (min-width: 901px) and (max-width: 1280px) {
  body.chat-open .shell { margin-right: 0; }
  .chat-panel { box-shadow: var(--shadow-pop); }
}
@media (max-width: 900px) {
  .plan-row { grid-template-columns: 22px minmax(0, 1fr); }
  .plan-row > .tag, .plan-row > .faint, .plan-row > .pill { grid-column: 2; justify-self: start; }
  .dd-pop { width: min(300px, 86vw); }
}

/* ---------- вход и пользователи ---------- */
.auth { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; place-items: center; padding: 20px; overflow: auto; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 28px; }
.auth-card .brand { display: flex; gap: 10px; align-items: center; margin-bottom: 22px; text-decoration: none; color: var(--ink); }
.auth-card .brand svg { width: 34px; height: 34px; }
.auth-card .brand b { font-size: 21px; display: block; }
.auth-card .brand small { color: var(--ink-3); font-size: 12px; }
.auth-card h1 { font-size: 24px; margin: 0 0 6px; }
body.authed-out .shell, body.authed-out .topbar, body.authed-out .fab { visibility: hidden; }
.ubox { display: flex; align-items: center; gap: 4px; margin: auto 0 10px; padding: 8px 6px 8px 10px; border-top: 1px solid var(--line-2); }
.ubox-tx { flex: 1; min-width: 0; }
.ubox-tx b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ubox-tx small { display: block; color: var(--ink-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[hidden] { display: none !important; }
