/* Fieldbook — стилі */
:root {
  --green-900: #1E3B2F;
  --green-800: #2F5443;
  --green-700: #2E6B4A;
  --green-600: #2E7D4F;
  --green-100: #EEF4EC;
  --lime: #CFE3A5;
  --bg: #F4F3EE;
  --card: #FFFFFF;
  --line: #E8E6DE;
  --line-2: #ECEAE2;
  --input-line: #C9C6BA;
  --text: #1C2A22;
  --muted: #5F6B63;
  --muted-2: #4A5A50;
  --sand: #C9A15A;
  --warn-bg: #FCF0DC; --warn: #8A5A12;
  --bad-bg: #FBE9E4; --bad: #A3321F;
  --radius: 16px;
  --sidebar-w: 248px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: Manrope, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
a { color: var(--green-700); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 800; }
.strong { font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 12px; }
.pad-top { padding-top: 10px; }
.grow { flex: 1; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Заставка / вхід ---------- */
.splash { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 16px; padding: 24px; }
.splash.col { flex-direction: column; }
.logo-mark { height: 44px; padding: 0 2px; border-radius: 12px; background: transparent; display: flex; align-items: center; justify-content: center; flex: none; }
.logo-mark img { height: 28px; width: auto; display: block; }
.splash .logo-mark { height: 84px; padding: 0 18px; border-radius: 22px; background: var(--green-900); }
.splash .logo-mark img { height: 52px; }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--green-900); }
.login-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 22px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: 24px; margin-top: 6px; }
.login-card .brand-name { color: var(--text); }
.login-card .brand-sub { color: var(--muted); }

/* ---------- Каркас ---------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--green-900); color: #E8F0EA;
  padding: 24px 14px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; color: inherit; }
.brand-name { font-weight: 800; font-size: 17px; color: #fff; }
.brand-sub { font-size: 11px; letter-spacing: 0.08em; color: #A9C2B2; white-space: nowrap; }
.brand > div:last-child { min-width: 0; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-size: 11px; letter-spacing: 0.1em; color: #A9C2B2; padding: 0 12px 6px; text-transform: uppercase; font-weight: 600; }
.nav-title.dark { color: var(--muted); padding-left: 2px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #E8F0EA; text-decoration: none; font-size: 14px; font-weight: 600; }
.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-link.active { background: var(--green-800); color: #fff; font-weight: 700; }
.main { margin-left: var(--sidebar-w); min-width: 0; }
.bottomnav { display: none; }
.page { max-width: 1320px; margin: 0 auto; padding: 32px 40px 64px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; justify-content: space-between; }
.eyebrow { font-size: 14px; color: var(--muted); font-weight: 600; }
.eyebrow a { color: var(--muted); text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.show-mobile { display: none !important; }

/* ---------- Кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; background: none; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-primary { background: var(--green-900); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-800); }
.btn-ghost { background: var(--card); border-color: var(--input-line); color: var(--text); }
.btn-ghost:hover { border-color: var(--green-700); }
.btn-danger-ghost { color: var(--bad); border-color: #E9C2B8; background: var(--card); }
.btn-sm { height: 38px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); display: inline-flex; align-items: center; justify-content: center; color: var(--muted-2); cursor: pointer; flex: none; text-decoration: none; }
.icon-btn:hover { color: var(--text); border-color: var(--input-line); }
.icon-btn.small { width: 32px; height: 32px; }
.icon-btn.tinted { background: var(--green-100); border-color: transparent; color: var(--green-900); width: 44px; height: 44px; border-radius: 12px; }
.link-btn { background: none; border: 0; color: var(--green-700); font-weight: 700; padding: 12px 0 4px; cursor: pointer; text-align: left; }
.check-btn { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--input-line); background: var(--card); color: var(--green-700); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.check-btn:hover { background: var(--green-100); border-color: var(--green-700); }
.fab { display: none; }

/* ---------- Картки, KPI ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.kpis { display: flex; flex-wrap: wrap; gap: 14px; }
.kpi { flex: 1 1 170px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.kpis.compact .kpi { flex-basis: 130px; padding: 12px 16px; }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 30px; font-weight: 800; margin-top: 4px; line-height: 1.1; }
.kpis.compact .kpi-value { font-size: 24px; }
.kpi-value.muted { color: #9AA39C; }
.kpi-of { font-size: 18px; color: var(--muted); }
.kpi-sub { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi.warn { background: #FFF6EC; border-color: #F1DFC5; }
.kpi.warn .kpi-label, .kpi.warn .kpi-value, .kpi.warn .kpi-sub { color: var(--warn); }
.progress { height: 6px; border-radius: 6px; background: var(--line-2); margin-top: 10px; overflow: hidden; }
.progress > div { height: 100%; background: var(--green-600); border-radius: 6px; }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col-main { flex: 2 1 520px; min-width: 0; }
.col-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.cols-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.onboarding { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--green-100); border-color: #CFE0D2; }
.empty { text-align: center; padding: 28px 12px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-title { font-weight: 800; font-size: 16px; }
.empty-text { color: var(--muted); font-size: 14px; max-width: 420px; }
.soon { text-align: center; padding: 40px 24px; }
.soon-icon { width: 64px; height: 64px; border-radius: 18px; background: var(--green-100); color: var(--green-900); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-end { display: flex; justify-content: flex-end; margin-top: 12px; }

/* ---------- Значки ---------- */
.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; color: var(--muted-2); background: #EEF1EC; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.badge.p1 { color: var(--bad); background: var(--bad-bg); font-weight: 700; }
.badge.p2 { color: var(--warn); background: var(--warn-bg); font-weight: 700; }
.badge.p3 { color: var(--muted-2); background: #EEF1EC; }
.badge.p4 { color: var(--muted); background: #F4F3EE; }
.badge.warn { color: var(--warn); background: var(--warn-bg); font-weight: 700; }
.badge.ok { color: var(--green-700); background: var(--green-100); font-weight: 700; }
.days { font-weight: 800; white-space: nowrap; }
.days.warn { color: var(--warn); }
.days.bad { color: var(--bad); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- Задачі ---------- */
.task-row { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line-2); }
.task-row:first-of-type { border-top: 0; }
.task-row.compact { padding: 10px 0; }
.task-when { width: 50px; flex: none; font-weight: 800; padding-top: 2px; font-variant-numeric: tabular-nums; }
.task-when.warn { color: var(--warn); font-size: 13px; }
.task-bar { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }
.task-body { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; }
.task-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.task-title .strong { font-size: 16px; font-weight: 800; }
.task-goal { margin-top: 6px; font-size: 14px; }
.task-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.done-line { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--green-100); color: var(--green-700); font-size: 13px; font-weight: 600; }
.sub-h { font-size: 14px; color: var(--muted); font-weight: 700; margin: 18px 0 2px; text-transform: uppercase; letter-spacing: 0.06em; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line-2); text-decoration: none; color: inherit; }
.list-row:first-of-type { border-top: 0; }
.list-row.link:hover .strong { color: var(--green-700); }
.bday { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.bday-row { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--bg); border-radius: 12px; font-size: 13px; }
.bday-row span { flex: 1; }

/* ---------- Форми ---------- */
.input { width: 100%; height: 44px; border: 1px solid var(--input-line); border-radius: 12px; padding: 0 12px; background: #fff; font-size: 15px; outline: none; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(46,107,74,0.15); }
.input-sm { height: 38px; border-radius: 10px; font-size: 14px; }
.input.num { text-align: right; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 700; color: var(--muted-2); }
.field-hint { font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.field-wide { grid-column: 1 / -1; }
.form-error { color: var(--bad); background: var(--bad-bg); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented button { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--input-line); background: #fff; font-weight: 700; font-size: 14px; cursor: pointer; }
.segmented button.on { background: var(--green-900); border-color: var(--green-900); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: #F1F0EA; font-size: 14px; font-weight: 600; border: 0; }
.chip.on { background: var(--green-100); color: var(--green-900); cursor: pointer; }
.chip-x { border: 0; background: none; padding: 2px; cursor: pointer; color: var(--muted); display: inline-flex; }
.picker { border: 1px solid var(--input-line); border-radius: 12px; overflow: hidden; margin-top: 6px; }
.picker-search, .search { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 44px; color: var(--muted); }
.picker-search { border-bottom: 1px solid var(--line); }
.picker-search input, .search input { border: 0; outline: 0; flex: 1; background: transparent; font-size: 15px; color: var(--text); min-width: 0; }
.search { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: #fff; }
.picker-list { max-height: 240px; overflow-y: auto; }
.picker-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line-2); cursor: pointer; font-size: 14px; }
.picker-row span:nth-child(2) { flex: 1; }
.picker-row input { width: 18px; height: 18px; accent-color: var(--green-700); }
.picker-row.depth-1 { padding-left: 28px; }
.picker-row.depth-2 { padding-left: 44px; }
.picker-row.depth-3 { padding-left: 60px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 34px; height: 34px; border-radius: 10px; border: 2px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--text); box-shadow: inset 0 0 0 2px #fff; }
.swatch-input { width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: none; cursor: pointer; flex: none; }
.add-row { display: flex; gap: 8px; margin-top: 12px; }
.add-row.wrap { flex-wrap: wrap; }
.add-row.wrap > * { flex: 1 1 180px; }
.add-row.wrap > .btn { flex: 0 0 auto; }
.dict-row { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.brand-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.brand-item { display: flex; gap: 8px; align-items: center; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.table td { padding: 6px; border-bottom: 1px solid var(--line-2); }
.table input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green-700); }

/* ---------- Модальні вікна ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,32,26,0.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal { background: var(--card); border-radius: 20px; width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal-wide { max-width: 720px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 18px 20px 10px; }
.modal-body { padding: 8px 20px 16px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; background: var(--green-900); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; z-index: 80; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.toast.error { background: var(--bad); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--green-700); animation: spin 0.8s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Клієнти ---------- */
.tabs { display: inline-flex; background: #E8E6DE; border-radius: 12px; padding: 4px; gap: 2px; align-self: flex-start; }
.tabs a { padding: 8px 16px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted-2); text-decoration: none; }
.tabs a.on { background: #fff; color: var(--text); font-weight: 800; }
.split { display: flex; gap: 20px; align-items: flex-start; }
.split-left { flex: 0 0 340px; min-width: 0; position: sticky; top: 20px; }
.split-right { flex: 1; min-width: 0; }
.tree { padding: 14px; }
.tree-body, .tree-results { max-height: calc(100vh - 260px); overflow-y: auto; }
.tree-row { display: flex; align-items: center; gap: 2px; border-radius: 10px; }
.tree-row.on { background: var(--green-100); }
.tree-row.depth-1 { padding-left: 18px; }
.tree-row.depth-2 { padding-left: 36px; }
.tree-row.depth-3 { padding-left: 54px; }
.tree-caret { width: 32px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--muted); cursor: pointer; flex: none; }
.tree-link { flex: 1; display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 0; text-decoration: none; color: var(--text); min-width: 0; }
.tree-row.depth-0 .tree-name { font-weight: 800; }
.tree-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tree-meta { font-size: 12px; color: var(--muted); }
.detail { display: flex; flex-direction: column; gap: 16px; }
.detail-head { display: flex; flex-direction: column; gap: 8px; }
.detail-title { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.detail-title h1 { font-size: 28px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.notes { white-space: pre-wrap; background: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.kid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.kid { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; text-decoration: none; color: var(--text); }
.kid:hover { border-color: var(--green-700); }
.person { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-2); }
.person:first-of-type { border-top: 0; }
.person-body { flex: 1; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; min-width: 0; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; text-decoration: none; color: var(--green-700); padding: 6px 0; }

/* ---------- Усі розділи (мобільне «Ще») ---------- */
.more-group { display: flex; flex-direction: column; gap: 8px; }
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.more-tile { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--text); font-weight: 700; }
.more-tile svg { color: var(--green-700); }
.more-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 8px; }

/* ---------- Планшет / телефон ---------- */
@media (max-width: 1100px) {
  .page { padding: 24px 24px 56px; }
  .split-left { flex-basis: 290px; }
}
@media (max-width: 899px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: calc(84px + var(--safe-b)); }
  .page { padding: 18px 16px 24px; gap: 16px; }
  h1 { font-size: 26px; }
  .hide-mobile { display: none !important; }
  .show-mobile { display: inline-flex !important; }
  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: #fff; border-top: 1px solid #E2E0D7; padding: 6px 4px calc(6px + var(--safe-b));
    justify-content: space-around;
  }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; min-width: 60px; padding: 6px 0; }
  .bottomnav a.active { color: var(--green-900); font-weight: 800; }
  .fab { display: flex; position: fixed; right: 18px; bottom: calc(88px + var(--safe-b)); width: 60px; height: 60px; border-radius: 20px; border: 0; background: var(--lime); color: var(--green-900); box-shadow: 0 8px 20px rgba(30,59,47,0.25); align-items: center; justify-content: center; z-index: 25; cursor: pointer; }
  .card { padding: 16px; border-radius: 16px; }
  .kpi { flex-basis: 140px; padding: 12px 14px; }
  .kpi-value { font-size: 24px; }
  .split { display: block; }
  .split-left { position: static; }
  .split.has-selection .split-left { display: none; }
  .split:not(.has-selection) .split-right { display: none; }
  .tree-body, .tree-results { max-height: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-width: none; border-radius: 20px 20px 0 0; max-height: 92vh; }
  .modal-foot { padding-bottom: calc(14px + var(--safe-b)); }
  .task-actions .btn { display: none; }
  .toast { bottom: calc(92px + var(--safe-b)); }
}

/* ===================== Етап 3: СПП і аналітика ===================== */
.tiny { font-size: 11px; }
.muted-2 { color: var(--muted-2); font-weight: 600; }
.input-narrow { width: auto; min-width: 100px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar > select.input { width: auto; min-width: 200px; }
.toolbar .tabs { align-self: auto; }
.season-pick { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 2px; }
.season-pick .strong { min-width: 48px; text-align: center; font-size: 16px; }
.season-pick .icon-btn { border: 0; }

.spp-layout { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.spp-table-card { flex: 3 1 640px; min-width: 0; padding: 0; overflow: hidden; }
.spp-side { flex: 1 1 360px; min-width: 0; position: sticky; top: 20px; }
.spp-table { min-width: 0; }
.spp-table th, .spp-table td { white-space: nowrap; }
.spp-table thead th { background: #F7F6F1; padding: 12px 8px; font-size: 11px; letter-spacing: 0.03em; text-transform: uppercase; }
.spp-table tbody th { text-align: left; padding: 8px 14px; font-weight: 700; min-width: 140px; }
.spp-table td.cell { padding: 4px; min-width: 96px; vertical-align: top; }
.spp-table td.num { padding: 8px 14px; }
.p-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green-600); margin-left: 4px; vertical-align: middle; }
.cell-input { width: 100%; height: 36px; border: 1px solid transparent; border-radius: 8px; text-align: right; padding: 0 8px; font-variant-numeric: tabular-nums; font-size: 14px; background: transparent; outline: none; }
.cell-input:hover { border-color: var(--line); }
.cell-input:focus { border-color: var(--green-700); background: #fff; box-shadow: 0 0 0 3px rgba(46,107,74,0.15); }
.cell-input::placeholder { color: #A3AAA4; }
td.cell.edited .cell-input { background: #FFF8E6; font-weight: 700; }
td.cell.selected .cell-input { border-color: var(--green-600); background: #F1F8F2; }
.cell-share { font-size: 10px; color: var(--green-700); font-weight: 700; text-align: right; padding: 0 8px; }
.parent-row { background: var(--green-100); }
.parent-row .cell-input { font-weight: 800; }
.unalloc-row { background: #FFF6EC; color: var(--warn); font-size: 13px; }
.unalloc-row th { color: var(--warn); }
.row-link { color: var(--text); text-decoration: none; }
.row-link:hover { color: var(--green-700); text-decoration: underline; }
.table-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 12px 16px; border-top: 1px solid var(--line); }

.hyb-panel { display: flex; flex-direction: column; gap: 10px; }
.hyb-panel h2 { font-size: 19px; }
.stack-bar { display: flex; height: 12px; border-radius: 8px; overflow: hidden; background: var(--line-2); }
.c-pioneer { color: var(--green-700); }
.inherited { background: var(--bg); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.hyb-rows { display: flex; flex-direction: column; gap: 8px; }
.hyb-row { border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.hyb-row.is-p { border-color: #BFD8C6; background: #F7FBF8; }
.hyb-line { display: flex; gap: 6px; align-items: center; }
.hyb-line select, .hyb-line input { flex: 1 1 0; min-width: 0; }
.hyb-nums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.hyb-nums label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); font-weight: 700; }
.input.hinted { color: var(--green-700); font-style: italic; background: #F1F8F2; }
.hint-line { font-size: 11px; color: var(--green-700); }
.hyb-add { display: flex; gap: 8px; flex-wrap: wrap; }
.hyb-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; }

/* Звітні графіки */
.fig-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 20px; }
.figure { margin: 0; display: flex; flex-direction: column; gap: 14px; }
.figure.wide { grid-column: 1 / -1; }
.fig-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.fig-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.fig-actions { display: flex; gap: 6px; }
.fig-body { display: flex; flex-direction: column; gap: 12px; }
.fig-foot { font-size: 10px; color: #A3AAA4; text-align: right; letter-spacing: 0.06em; }
.present-backdrop { position: fixed; inset: 0; background: rgba(20,32,26,0.6); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }
.figure.present { width: min(1100px, 100%); max-height: calc(100vh - 48px); overflow: auto; padding: 32px 36px; font-size: 17px; }
.figure.present h2 { font-size: 26px; }
.kpi.dark { background: var(--green-900); border-color: var(--green-900); color: #fff; }
.kpi.dark .kpi-label, .kpi.dark .kpi-sub { color: var(--lime); }
a.kpi.link { text-decoration: none; color: inherit; }
a.kpi.link:hover { border-color: var(--green-700); }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 56px; gap: 12px; align-items: center; background: none; border: 0; padding: 2px 0; text-align: left; cursor: pointer; }
.bar-row.static { cursor: default; }
.bar-row:hover .strong { color: var(--green-700); }
.bar-label { min-width: 0; overflow: hidden; }
.bar-label .strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-val { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.stack { display: flex; height: 20px; border-radius: 6px; overflow: hidden; background: #E4E1D6; }
.stack.thin { height: 8px; }
.stack > div { height: 100%; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.donut-wrap { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.donut { width: 200px; height: 200px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; }
.donut-hole { width: 128px; height: 128px; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-val { font-size: 30px; font-weight: 800; color: var(--green-700); }
.donut-legend { display: flex; flex-direction: column; gap: 14px; flex: 1; min-width: 180px; }
.donut-legend > div { display: flex; gap: 10px; align-items: flex-start; }
.sw { width: 12px; height: 12px; border-radius: 3px; margin-top: 5px; flex: none; }
.columns { display: flex; align-items: flex-end; gap: 18px; height: 220px; padding: 0 6px; border-bottom: 1px solid #DAD7CC; }
.col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; position: relative; padding-bottom: 22px; }
.col-val { font-weight: 800; font-size: 14px; }
.col-bar { width: 100%; max-width: 64px; border-radius: 8px 8px 0 0; }
.col-label { position: absolute; bottom: 0; font-size: 13px; color: var(--muted); font-weight: 700; }
.hyb-table { display: flex; flex-direction: column; font-size: 14px; }
.ht-head, .ht-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) 70px 60px; gap: 10px; align-items: center; padding: 8px 0; }
.ht-head { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.ht-row { border-bottom: 1px solid var(--line-2); }
.ht-row.comp { color: var(--muted-2); }
.ht-bar { display: flex; align-items: center; gap: 8px; }
.ht-bar span { height: 14px; border-radius: 4px; min-width: 2px; }
.ht-bar b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.note-ok { padding: 12px 14px; border-radius: 12px; background: var(--green-100); font-size: 14px; }
.mini-shares { display: flex; flex-direction: column; gap: 12px; }
.mini-share { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 5px; }
.mini-share:hover .strong { color: var(--green-700); }
.spp-mini { display: flex; flex-direction: column; }
.spp-mini-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 80px 60px 70px; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-2); }
.spp-mini-row:first-child { border-top: 0; }

@media (max-width: 899px) {
  .fig-grid { grid-template-columns: minmax(0, 1fr); }
  .spp-side { position: static; flex-basis: 100%; }
  .spp-table-card { flex-basis: 100%; }
  .toolbar > select.input { flex: 1 1 100%; }
  .bar-row { grid-template-columns: 96px minmax(0, 1fr) 46px; gap: 8px; }
  .donut { width: 160px; height: 160px; }
  .donut-hole { width: 104px; height: 104px; }
  .spp-mini-row { grid-template-columns: minmax(0, 1fr) 70px 54px; }
  .spp-mini-row .stack, .spp-mini-row > :last-child { display: none; }
  .ht-head, .ht-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 56px 46px; gap: 6px; font-size: 13px; }
  .figure.present { padding: 20px; }
  .hyb-line { flex-wrap: wrap; }
  .hyb-line input { flex: 1 1 calc(50% - 30px); }
}

/* ===================== Етап 4: планер, візити, роздатка ===================== */
.self-start { align-self: flex-start; }
.warn-text { color: var(--warn); }
.grow-2 { flex: 2 1 220px; margin-bottom: 0; }
.toolbar > .input:not(.input-narrow) { width: auto; min-width: 220px; flex: 1 1 220px; }
.period-title { font-size: 16px; }
.link-btn.tight { padding: 0 8px; }
.btn-visit { background: var(--green-100); color: var(--green-900); border-color: #BFD8C6; }
.btn-visit:hover { background: #DDEBDF; }
.task-row.done .task-title .strong { color: var(--muted); }
.task-row.done .task-bar { opacity: 0.4; }
.today-card { border-color: #BFD8C6; box-shadow: inset 4px 0 0 var(--green-600); }
.quick-grid { display: grid; gap: 10px; padding-bottom: 8px; }
.quick-tile { display: flex; gap: 14px; align-items: center; text-align: left; padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.quick-tile span { display: flex; flex-direction: column; }
.quick-tile small { color: var(--muted); font-size: 13px; }
.quick-tile.primary { background: var(--green-900); color: #fff; border-color: var(--green-900); }
.quick-tile.primary small { color: var(--lime); }
.pct-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pct { min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--input-line); background: #fff; font-weight: 800; cursor: pointer; }
.pct.on { background: var(--green-900); border-color: var(--green-900); color: #fff; }
.pct-input { width: 70px; }
.time-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.time-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.gift-row { display: grid; grid-template-columns: minmax(0, 2fr) 70px minmax(0, 1.4fr) 32px; gap: 6px; align-items: center; margin-bottom: 6px; }
.next-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; background: var(--green-100); border: 1px solid #CFE0D2; }
.next-grid { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.next-grid > input { width: auto; flex: 0 1 170px; }
.cal { padding: 0; overflow: hidden; }
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: #F7F6F1; font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-head div { padding: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-day { min-height: 110px; border-top: 1px solid var(--line-2); border-left: 1px solid var(--line-2); padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal.week .cal-day { min-height: 320px; }
.cal-day:nth-child(7n+1) { border-left: 0; }
.cal-day.out { background: #FAFAF7; }
.cal-day.out .cal-date { color: #A3AAA4; }
.cal-day.today { background: #F1F8F2; }
.cal-date { background: none; border: 0; text-align: left; font-weight: 800; font-size: 13px; padding: 4px 6px; border-radius: 8px; cursor: pointer; }
.cal-date:hover { background: var(--green-100); }
.cal-chip { text-align: left; font-size: 12px; padding: 4px 6px; border-radius: 6px; border: 0; border-left: 3px solid #3B6FB6; background: #F1F0EA; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip.p1 { background: var(--bad-bg); }
.cal-chip.done { opacity: 0.55; text-decoration: line-through; }
.visit-day { display: flex; flex-direction: column; gap: 10px; }
.visit-card { text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px; width: 100%; font: inherit; color: inherit; }
.visit-card:hover { border-color: #BFD8C6; }
.visit-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.strong.big { font-size: 17px; font-weight: 800; }
.visit-comment { font-size: 14px; color: var(--muted-2); white-space: pre-wrap; }
.visit-metrics { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: flex-end; margin-top: 4px; }
.vm-goal { flex: 1 1 200px; max-width: 280px; }
.vm-goal .progress { margin-top: 0; }
.vm-goal b { margin-left: 8px; }
.visit-list { display: flex; flex-direction: column; gap: 4px; }
.visit-list .visit-card { padding: 12px 14px; }
.link-plain { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.stock-bal { font-weight: 800; padding: 2px 8px; border-radius: 6px; background: var(--green-100); color: var(--green-900); }
.stock-bal.low { background: var(--warn-bg); color: var(--warn); }
.stock-bal.zero { background: var(--bad-bg); color: var(--bad); }
@media (max-width: 899px) {
  .cal-head div { padding: 6px 4px; text-align: center; }
  .cal-day { min-height: 64px; padding: 2px; }
  .cal.week .cal-day { min-height: 140px; }
  .cal-chip { font-size: 10px; padding: 2px 3px; }
  .cal-chip b { display: none; }
  .gift-row { grid-template-columns: minmax(0, 1fr) 60px 32px; }
  .gift-row select:nth-of-type(2) { grid-column: 1 / 3; }
  .task-actions .btn-visit { display: inline-flex; }
  .task-actions .btn-visit span { display: none; }
  .toolbar > .input:not(.input-narrow) { flex-basis: 100%; }
}

/* Вибір зі структури */
.upick { position: relative; min-width: 0; }
.toolbar > .upick { flex: 1 1 260px; }
.upick-btn { display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; }
.upick-btn svg { margin-left: auto; color: var(--muted); flex: none; }
.upick-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upick-val.placeholder { color: var(--muted-2); }
.upick-path { color: var(--muted); font-weight: 500; font-size: 13px; }
.upick-backdrop { position: fixed; inset: 0; z-index: 64; }
.upick-pop { position: absolute; left: 0; right: 0; top: calc(100% + 6px); min-width: 280px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(20,32,26,0.18); z-index: 65; overflow: hidden; }
.upick-list { max-height: 340px; overflow-y: auto; padding: 4px; }
.upick-row { width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: left; font-size: 14px; }
.upick-row:hover { background: #F4F3EE; }
.upick-row.on { background: var(--green-100); }
.upick-row.holding .upick-name { font-weight: 800; }
.upick-row.empty { color: var(--muted-2); font-weight: 600; }
.upick-row.d1 { padding-left: 26px; }
.upick-row.d2 { padding-left: 46px; }
.upick-row.d3 { padding-left: 66px; }
.upick-branch { width: 8px; height: 8px; border-left: 2px solid #CFCBBE; border-bottom: 2px solid #CFCBBE; border-radius: 0 0 0 3px; flex: none; margin-top: -6px; }
.upick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.upick-type { font-size: 11px; color: var(--muted); text-transform: lowercase; flex: none; }
@media (max-width: 899px) {
  .upick-pop { position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(8px + var(--safe-b)); min-width: 0; border-radius: 18px; }
  .upick-list { max-height: 55vh; }
  .upick-backdrop { background: rgba(20,32,26,0.35); }
  .upick-row { padding: 12px 10px; font-size: 15px; }
}

/* Дедлайни і навігація періодом */
.period-nav { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 2px; }
.period-nav .icon-btn { border: 0; }
.period-nav .period-title { min-width: 190px; text-align: center; font-weight: 800; font-size: 15px; padding: 0 6px; }
.badge.due { color: var(--muted-2); background: #EEF1EC; }
.badge.bad { color: var(--bad); background: var(--bad-bg); font-weight: 700; }
.badge.soft { color: #7A6A4E; background: #F4EFE4; }
.task-when.warn { color: var(--warn); }
.task-when.bad { color: var(--bad); }
.when-due { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.cal-chip.due { background: #FFF6EC; border-left-style: dashed; }
@media (max-width: 899px) {
  .period-nav { flex: 1 1 100%; justify-content: space-between; }
  .period-nav .period-title { min-width: 0; }
}

/* Візит vs задача */
.kind-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kind-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--input-line); background: #fff; font-weight: 800; cursor: pointer; }
.kind-btn.on { background: var(--green-900); border-color: var(--green-900); color: #fff; }
.kind-ico { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex: none; margin-top: 1px; }
.kind-ico.visit { background: var(--green-100); color: var(--green-700); }
.kind-ico.task { background: #F1F0EA; color: var(--muted); }
.badge.kind-visit { background: var(--green-100); color: var(--green-700); }

/* ===================== Етап 5: охоплення й ефективність ===================== */
.tabs button { padding: 8px 16px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted-2); background: none; border: 0; cursor: pointer; }
.tabs button.on { background: #fff; color: var(--text); font-weight: 800; }
.check-label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--muted-2); background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; height: 44px; cursor: pointer; }
.check-label input { width: 18px; height: 18px; accent-color: var(--green-700); }
.cov-summary { font-size: 15px; color: var(--muted-2); }
.cov-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; min-width: 860px; }
.cov-table thead th { font-size: 12px; color: var(--muted); font-weight: 700; padding: 8px 2px; text-align: center; border-bottom: 1px solid var(--line); }
.cov-table thead th.cur { color: var(--green-700); }
.cov-table th.cov-name { text-align: left; padding: 10px 12px 10px 0; min-width: 170px; font-weight: 700; border-bottom: 1px solid var(--line-2); }
.cov-table thead th.cov-name { padding-left: 0; }
.cov-table td { padding: 6px 2px; text-align: center; border-bottom: 1px solid var(--line-2); }
.cov-title { display: flex; align-items: center; gap: 8px; }
.cov-title a { color: var(--text); text-decoration: none; }
.cov-title a:hover { color: var(--green-700); text-decoration: underline; }
.heat { width: 36px; height: 34px; border-radius: 8px; border: 0; font-weight: 800; font-size: 13px; cursor: pointer; font-variant-numeric: tabular-nums; }
.heat:disabled { cursor: default; }
.heat.h0 { background: #F1F0EA; color: #A3AAA4; }
.heat.h1 { background: #D3E8D8; color: var(--green-900); }
.heat.h2 { background: #8FBF9C; color: #0F2A1C; }
.heat.h3 { background: var(--green-600); color: #fff; }
.heat.future.h0 { background: #FAFAF7; color: #D0CFC8; }
.heat-sum { min-width: 36px; height: 34px; border: 0; background: none; font-weight: 800; font-size: 15px; cursor: pointer; }
.heat-sum:disabled { color: var(--muted); cursor: default; }
.cov-table td.cov-last { text-align: left; padding-left: 14px; white-space: nowrap; font-size: 13px; min-width: 130px; }
.cov-legend { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); }
.cov-scale { display: inline-flex; align-items: center; gap: 6px; }
.cov-scale i { width: 16px; height: 16px; border-radius: 4px; display: inline-block; }
.cov-scale i.h0 { background: #F1F0EA; } .cov-scale i.h1 { background: #D3E8D8; } .cov-scale i.h2 { background: #8FBF9C; } .cov-scale i.h3 { background: var(--green-600); }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.5fr) 96px; gap: 12px; align-items: center; font-size: 14px; }
.hbar-track { height: 10px; border-radius: 6px; background: #F1F0EA; overflow: hidden; display: block; }
.hbar-track span { display: block; height: 100%; border-radius: 6px; }
.hbar-val { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ht-head.g4, .ht-row.g4 { grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); }
.ht-head.g5, .ht-row.g5 { grid-template-columns: minmax(0, 1.8fr) repeat(4, minmax(0, 1fr)); }
@media (max-width: 899px) {
  .hbar { grid-template-columns: minmax(0, 1fr) 80px; }
  .hbar-track { grid-column: 1 / -1; grid-row: 2; }
  .check-label { flex: 1 1 100%; }
}

/* Охоплення деревом */
.cov-caret { width: 24px; height: 24px; border: 0; background: none; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted-2); cursor: pointer; flex: none; }
.cov-caret:hover { background: var(--green-100); color: var(--green-900); }
.cov-caret-sp { width: 24px; flex: none; }
.cov-type { font-size: 11px; color: var(--muted); font-weight: 600; }
.cov-sub { padding-left: 32px; }
.cov-table tr.lvl0 th.cov-name { font-weight: 800; }
.cov-table tr.lvl0 td, .cov-table tr.lvl0 th { background: #FAFAF7; }
.cov-table tr.lvl1 th.cov-name { font-weight: 700; }
.cov-table tr.lvl2 th.cov-name, .cov-table tr.lvl3 th.cov-name { font-weight: 600; }

/* ===================== Етап 6: ДЕМО ===================== */
.nowrap { white-space: nowrap; }
.demo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.demo-card { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 8px; }
.demo-card:hover { border-color: #BFD8C6; }
.demo-card h3 { font-size: 19px; font-weight: 800; }
.demo-counts { display: flex; gap: 16px; align-items: baseline; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--line-2); margin-top: 4px; }
.demo-counts b { font-size: 20px; }
.coords { display: flex; gap: 8px; flex-wrap: wrap; }
.coords .input { flex: 1 1 140px; }
.demo-rows { display: flex; flex-direction: column; gap: 10px; }
.demo-row { border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.demo-row.is-p { border-color: #BFD8C6; background: #F7FBF8; }
.demo-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; align-items: end; }
.demo-nums label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 700; }
.demo-basis { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); font-weight: 700; padding: 0 4px; }
.demo-basis b { font-size: 20px; color: var(--text); }
.demo-basis small { font-size: 12px; font-weight: 800; }
.up { color: var(--green-700); }
.down { color: var(--bad); }
.npks { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; background: var(--green-100); padding: 10px 14px; border-radius: 12px; margin-bottom: 8px; font-size: 14px; }
.op-row { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line-2); padding: 10px 0; cursor: pointer; font: inherit; color: inherit; }
.op-row:hover .op-main b { color: var(--green-700); }
.op-date { width: 90px; flex: none; font-weight: 700; font-size: 13px; }
.op-main { flex: 1; min-width: 0; }
.npk-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.npk-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 800; }
.note-add { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.note-row { display: grid; grid-template-columns: 100px minmax(0, 1fr) 32px; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-2); align-items: start; }
.note-text { white-space: pre-wrap; }
.stock-table td { vertical-align: middle; }
.lot-detail td { background: #FAFAF7; }
.rank-table { display: flex; flex-direction: column; font-size: 14px; overflow-x: auto; }
.rk-head, .rk-row { display: grid; grid-template-columns: 28px minmax(150px, 1.5fr) 50px 64px minmax(170px, 2fr) 80px 70px; gap: 10px; align-items: center; padding: 8px 0; min-width: 680px; }
.rk-head { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.rk-row { border-bottom: 1px solid var(--line-2); }
.rk-row.is-p { background: #F7FBF8; }
.rk-name { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.idx { display: flex; align-items: center; gap: 8px; }
.idx-track { position: relative; flex: 1; height: 12px; background: #F1F0EA; border-radius: 6px; }
.idx-100 { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #9AA39C; }
.idx-bar { position: absolute; top: 0; bottom: 0; border-radius: 6px; }
.idx-bar.up { background: var(--green-600); }
.idx-bar.down { background: #D98C76; }
.h2h-pick { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.h2h-pick select { flex: 1 1 160px; width: auto; }
.h2h { display: flex; flex-direction: column; gap: 10px; }
.h2h-title { font-size: 16px; }
.big-badge { font-size: 14px; padding: 6px 12px; align-self: flex-start; }
.h2h-stats { display: flex; gap: 24px; flex-wrap: wrap; }
.h2h-stats div { display: flex; flex-direction: column; }
.h2h-stats b { font-size: 22px; }
.h2h-pairs .list-row { text-decoration: none; color: inherit; }
.scatter { width: 100%; height: auto; }
@media (max-width: 899px) {
  .note-add { grid-template-columns: minmax(0, 1fr); }
  .npk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stock-table .btn-sm { padding: 0 8px; }
}

/* ===================== Телефон: зона годинника (iPhone) і панель вибору ===================== */
:root { --safe-t: env(safe-area-inset-top, 0px); }
.main { padding-top: var(--safe-t); }
.sidebar { padding-top: calc(24px + var(--safe-t)); }
.app::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: var(--safe-t); background: rgba(244, 243, 238, 0.94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); z-index: 45; pointer-events: none; }
.login, .splash { padding-top: calc(20px + var(--safe-t)); }
.present-backdrop { padding-top: calc(24px + var(--safe-t)); }
.modal { max-height: calc(100vh - 40px - var(--safe-t)); }

.usheet-backdrop { position: fixed; inset: 0; background: rgba(20, 32, 26, 0.45); z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
.usheet { background: #fff; width: 100%; max-width: 640px; max-height: calc(88vh - var(--safe-t)); border-radius: 20px 20px 0 0; display: flex; flex-direction: column; overflow: hidden; padding-bottom: var(--safe-b); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2); }
.usheet-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 12px 6px 18px; font-size: 17px; }
.usheet .picker-search { border-top: 1px solid var(--line); }
.usheet .upick-list { max-height: none; flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px; }
.usheet .upick-row { padding: 14px 12px; font-size: 16px; }
.usheet .upick-row.d1 { padding-left: 30px; }
.usheet .upick-row.d2 { padding-left: 50px; }
.usheet .upick-row.d3 { padding-left: 70px; }

@media (max-width: 899px) {
  .modal { max-height: calc(92vh - var(--safe-t)); }
  .page-head { gap: 10px; }
  .page-head .head-actions { width: 100%; }
  .page-head .head-actions .btn { flex: 1 1 auto; }
}

/* ---------- 0.7: ДЕМО — гібриди, урожай, графік, ЗЗР, склад ---------- */
.hyb-list { display: flex; flex-direction: column; gap: 8px; }
.hyb-item { display: grid; grid-template-columns: 22px 10px minmax(0, 1fr) auto; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.hyb-item.is-p { border-color: #BFD8C6; background: #F7FBF8; }
.hyb-num { font-size: 12px; font-weight: 800; color: var(--muted); text-align: center; }
.hyb-inputs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
.hyb-stock { grid-column: 3 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; }

.res-toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin: 4px 0 10px; }
.res-date { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 700; }
.res-list { display: flex; flex-direction: column; gap: 10px; }
.res-row { border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.res-row.is-p { border-color: #BFD8C6; background: #F7FBF8; }
.res-name { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.res-idx { margin-left: auto; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 8px; background: #F1F0EA; }
.res-idx.up { color: var(--green-700); background: var(--green-100); }
.res-idx.down { color: #A0522D; background: #FBEFE6; }
.res-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; align-items: end; }
.res-nums label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 700; }
.card-head .segmented { flex: 0 1 auto; }

.ychart-wrap { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.check-line { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; padding-left: 4px; cursor: pointer; }
.ychart { --vw: 92px; --gap: 14px; --lwc: var(--lw); display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.yc-row { display: grid; grid-template-columns: var(--lwc) minmax(0, 1fr) repeat(var(--nc), var(--vw)); align-items: center; column-gap: var(--gap); min-height: 36px; }
.yc-head { min-height: 26px; color: var(--muted); font-size: 13px; }
.yc-label { text-align: right; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yc-row.p .yc-label, .yc-row.p .yc-v { font-weight: 800; }
.yc-track { position: relative; height: 36px; display: flex; align-items: center; border-left: 1px solid #9AA09B; }
.yc-bar { display: block; height: 22px; border-radius: 0 3px 3px 0; }
/* лінія середнього — один елемент на всю висоту смуг (без стиків між рядками) */
.yc-bars { position: relative; }
.yc-mean { position: absolute; top: 2px; bottom: 2px; width: 2px; margin-left: -1px; z-index: 1; pointer-events: none;
  left: calc(var(--lwc) + var(--gap) + (100% - var(--lwc) - var(--nc) * var(--vw) - (var(--nc) + 1) * var(--gap)) * var(--mp));
  background: radial-gradient(circle, #4F5A53 0.9px, transparent 1.1px) center top / 2px 5px repeat-y; }
.yc-head .yc-v { font-size: 13px; color: var(--muted); }
.yc-v { text-align: right; font-size: 14px; }
.yc-short { display: none; }
.yc-foot { margin-top: 8px; font-weight: 800; }
.yc-foot .yc-v { font-weight: 800; }
.yc-mean-label { font-size: 14px; }
.figure.present .yc-row { min-height: 44px; }
.figure.present .yc-track { height: 44px; }
.figure.present .yc-label, .figure.present .yc-v, .figure.present .yc-mean-label { font-size: 17px; }

.fert-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -6px; }
.fert-chips .chip { cursor: pointer; font-size: 13px; padding: 5px 9px; }
.zzr-list { display: flex; flex-direction: column; gap: 6px; }
.zzr-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) 84px 86px auto; gap: 6px; align-items: center; }
.zzr-n { font-size: 12px; font-weight: 800; color: var(--muted); text-align: center; }
.zzr-add { align-self: flex-start; margin-top: 6px; }

.lot-list { display: flex; flex-direction: column; gap: 10px; }
.lot-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.lot-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.lot-name { text-align: left; }
.lot-avail { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.lot-avail .stock-bal { font-size: 18px; }
.lot-nums { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.lot-nums b { color: var(--text); }
.lot-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.lot-history { border-top: 1px solid var(--line-2); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.dest-list { display: flex; flex-direction: column; }
.dest-row { border-top: 1px solid var(--line-2); padding: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.dest-row:first-child { border-top: 0; }
.dest-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dest-total { font-size: 16px; }
.dest-lots { display: flex; flex-wrap: wrap; gap: 6px; }

@media (max-width: 899px) {
  .hyb-item { grid-template-columns: 16px 10px minmax(0, 1fr) auto; padding: 8px; }
  .hyb-inputs { grid-template-columns: minmax(0, 1fr); }
  .hyb-stock { grid-column: 1 / -1; }
  .res-nums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-head:has(.segmented) { flex-wrap: wrap; }
  .ychart { --vw: 40px; --gap: 6px; --lwc: min(var(--lw), 30%); }
  .yc-row { min-height: 28px; }
  .yc-foot .yc-label { display: none; }
  .yc-foot .yc-mean-label { grid-column: 1 / 3; }
  .yc-track { height: 28px; }
  .yc-bar { height: 17px; }
  .yc-label, .yc-v, .yc-mean-label { font-size: 12px; }
  .yc-head .yc-v { font-size: 11px; }
  .yc-full { display: none; }
  .yc-short { display: inline; }
  .ychart .yc-label { font-size: 11.5px; }
  .zzr-row { grid-template-columns: minmax(0, 1fr) 84px auto; }
  .zzr-n { display: none; }
  .zzr-row .zzr-prod { grid-column: 1 / -1; }
  .lot-actions .btn { flex: 1 1 auto; }
}

/* ---------- Калькулятор ---------- */
.calc-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.calc-result { position: sticky; top: calc(var(--safe-t) + 16px); display: flex; flex-direction: column; gap: 14px; }
.calc-input { position: relative; display: flex; align-items: center; }
.calc-input .input { width: 100%; padding-right: 74px; font-size: 17px; font-weight: 700; }
.calc-unit { position: absolute; right: 12px; font-size: 13px; color: var(--muted); font-weight: 700; pointer-events: none; white-space: nowrap; }
.calc-crops { flex-wrap: wrap; }
.calc-big { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.calc-big-label { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.calc-big-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.15; font-variant-numeric: tabular-nums; }
.calc-big-value small { font-size: 14px; color: var(--muted); font-weight: 700; }
.calc-big-sub { font-size: 13px; color: var(--muted); }
.calc-big.calc-main { background: var(--green-900); color: #fff; border-radius: 16px; padding: 16px 18px; }
.calc-big.calc-main .calc-big-label, .calc-big.calc-main .calc-big-sub, .calc-big.calc-main .calc-big-value small { color: #CFE3A5; }
.calc-big.calc-main .calc-big-value { color: #fff; font-size: 38px; }
.calc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.calc-note { background: var(--green-100); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.count-list { display: flex; flex-direction: column; gap: 6px; }
.count-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.count-row .calc-input .input { padding-right: 40px; }
.count-n { font-size: 12px; font-weight: 800; color: var(--muted); text-align: center; }
.count-each { display: flex; flex-wrap: wrap; gap: 6px; }
.econ-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; border-top: 1px solid var(--line-2); }
.econ-col { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.econ-name { font-weight: 800; font-size: 16px; }
.econ-name.p { border-color: #BFD8C6; background: #F7FBF8; color: var(--green-700); }
.econ-col .calc-input .input { padding-right: 70px; }
.econ-table td, .econ-table th { padding: 8px 6px; }
.econ-total td { font-weight: 800; border-top: 2px solid var(--line); }
@media (max-width: 899px) {
  .calc-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .calc-result { position: static; }
  .calc-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .calc-big.calc-main .calc-big-value { font-size: 32px; }
  .calc-big-value { font-size: 22px; }
  .econ-cols { gap: 10px; }
  .econ-col .calc-input .input { padding-right: 62px; font-size: 16px; }
  .econ-col .calc-unit { font-size: 11px; right: 8px; }
}
.calc-result > .calc-big.calc-main { align-self: stretch; width: 100%; box-sizing: border-box; }
.econ-page { display: flex; flex-direction: column; gap: 16px; }
.econ-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.econ-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.econ-card.p { border-color: #BFD8C6; background: #F7FBF8; }
.econ-card.ref { box-shadow: inset 0 0 0 2px #9AA09B; }
.econ-card .field-label { font-size: 12px; }
.econ-card .calc-input .input { padding-right: 70px; font-size: 16px; }
.econ-card .calc-unit { font-size: 11.5px; }
.econ-card-head { display: flex; gap: 6px; align-items: center; }
.econ-card-head .econ-name { flex: 1 1 auto; min-width: 0; }
.econ-flags { display: flex; gap: 6px; flex-wrap: wrap; }
.econ-flags .chip { cursor: pointer; font-size: 12.5px; padding: 4px 9px; }
.econ-mini { font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line-2); padding-top: 8px; }
.econ-mini b { color: var(--text); }
.econ-add { border: 1.5px dashed #C9CEC6; border-radius: 14px; background: none; min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; }
.econ-add:hover { border-color: var(--green-600); color: var(--green-700); }
.econ-table th.p { color: var(--green-700); }
.econ-table td.up, .ec-diff.up { color: var(--green-700); }
.econ-table td.down, .ec-diff.down { color: #B24A2A; }
.ec-diff.ref { color: var(--muted); font-weight: 600; }
.ec-diff { font-weight: 800; }
.ec-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.ec-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.ec-stack { display: flex; height: 22px; border-radius: 0 3px 3px 0; overflow: hidden; }
.ec-seg { display: block; height: 100%; min-width: 2px; }
.ec-seg + .ec-seg { box-shadow: inset 1px 0 0 rgba(255,255,255,0.7); }
.ec-notes { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line-2); padding-top: 10px; }
.ec-notes b { color: var(--text); }
@media (max-width: 899px) {
  .econ-cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .econ-card { padding: 10px; gap: 8px; }
  .econ-card .calc-input .input { padding-right: 58px; font-size: 15px; }
  .econ-card .calc-unit { font-size: 10.5px; right: 8px; }
  .econ-card .field-label { font-size: 11px; }
  .ec-stack { height: 17px; }
}
.econ-flags .chip.on { background: var(--green-900); color: #fff; }
.econ-table th > div { font-weight: 600; }
@media (max-width: 899px) {
  .ychart.has-area { --nc: 2 !important; }
  .ychart.has-area.oil { --nc: 3 !important; }
  .ychart.has-area .yc-area { display: none; }
}
.login-card .logo-mark { background: var(--green-900); padding: 0 8px; }
