  /* Layout: рабочая сетка-РНП — шапка с месяцем, широкая таблица дней с липкой колонкой показателей, под ней раскрывающийся день с заметками. */
  :root {
    --bg: #f5f5ef; --surface: #ffffff; --ink: #1e2214; --muted: #6a6f5a; --faint: #a3a68f;
    --line: #e2e3d6; --accent: #56661f; --accent-ink: #ffffff; --accent-soft: #edf0dc;
    --weekend: #f3f3ec; --today: #56661f; --danger: #a33b2b; --conv: #f9f1df; --conv-ink: #85601c;
    --s1: #56661f; --s2: #3f7fa8; --s3: #b07a2a; --s4: #8a4f9e; --s5: #2f8f7a; --s6: #b0473a; --s7: #4a5bb0; --s8: #7a6a55;
    --font: "Golos Text", "Segoe UI", system-ui, -apple-system, sans-serif;
    color-scheme: light;
  }
  [hidden] { display: none !important; }
  .popover { position: fixed; z-index: 50; width: min(380px, calc(100vw - 24px)); max-height: min(70vh, 560px); overflow: auto; box-shadow: 0 10px 30px rgba(30, 34, 20, .18); border-color: var(--faint); }
  .popover .panel-head h2 { font-size: 15px; }
  .popover textarea { min-height: 60px; }
  th.has-note { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); color: var(--ink); }
  th.has-note.we { background: color-mix(in srgb, var(--accent) 22%, var(--weekend)); }
  th.sel-date { box-shadow: inset 0 -2px 0 var(--ink); }
  .note-mark { display: inline-block; margin-left: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); vertical-align: 2px; }
  thead th[data-key]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; }
  .wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 24px 40px; display: grid; gap: 16px; max-width: 1600px; margin-inline: auto; }
  header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; }
  h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
  .sub { margin: 4px 0 0; color: var(--muted); max-width: 68ch; line-height: 1.45; }
  .controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
  .month { display: flex; align-items: center; gap: 8px; }
  .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
  .seg-btn { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; color: var(--muted); }
  .seg-btn + .seg-btn { border-left: 1px solid var(--line); }
  .seg-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
  .seg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  th.wk, td.wk { min-width: 96px; max-width: 96px; }
  th.mo, td.mo { min-width: 88px; max-width: 88px; }
  tr.conv td.lab { color: var(--muted); font-style: italic; font-weight: 400; padding-left: 30px; }
  tr.conv td { background: var(--conv); color: var(--conv-ink); }
  tr.conv td.we { background: color-mix(in srgb, var(--conv) 75%, var(--weekend)); }
  tr.conv td.lab { color: var(--conv-ink); }
  .note-date { font-size: 12px; color: var(--accent); font-weight: 600; }
  .filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .fgroup { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .flabel { color: var(--muted); font-size: 12px; margin-right: 2px; }
  .chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 13px; color: var(--ink); }
  .chip:hover { border-color: var(--faint); }
  .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
  .chip.quick { border-style: dashed; }
  .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
  .fsep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
  .ftitle { font-size: 13px; color: var(--muted); }
  .ftitle b { color: var(--ink); font-weight: 600; }
  .type-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
  .t-paid { background: var(--accent); } .t-organic { background: #3f7fa8; } .t-partners { background: #b07a2a; } .t-none { background: var(--faint); }
  .chgrid { display: grid; gap: 14px; }
  .chtype h3 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
  .chtype h3 span { color: var(--muted); font-weight: 400; font-size: 12px; }
  .chrow { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .chrow.arch { opacity: .55; }
  .chname { font-weight: 500; overflow-wrap: anywhere; }
  .chrule { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
  .chform { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: 8px; align-items: end; }
  .chform label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
  .chform input, .chform select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
  .chk { display: flex !important; grid-auto-flow: column; align-items: center; gap: 6px; }
  .tabs { display: flex; gap: 4px; margin-top: 10px; }
  .tab { border: 0; border-bottom: 2px solid transparent; background: none; padding: 4px 2px; margin-right: 14px; cursor: pointer; color: var(--muted); font-weight: 500; }
  .tab[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); }
  .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .page { display: grid; gap: 16px; }
  .cross-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .cross-bar .msg { margin: 0; }
  .cp { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
  #cp-label { min-width: 13rem; }
  .date-in { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
  #cross-q { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; min-width: min(16rem, 100%); }
  table.cross thead th { top: 0; height: 36px; }
  table.cross td, table.cross th { min-width: 84px; }
  table.cross th.lab, table.cross td.lab { min-width: 280px; max-width: 340px; }
  table.cross th.st, table.cross td.st { min-width: 76px; text-align: center; }
  .sort-btn { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
  .sort-btn:hover { color: var(--accent); }
  .sort-ind { color: var(--accent); }
  table.cross tr.total td { font-weight: 700; background: var(--accent-soft); }
  table.cross tr.grp td { font-weight: 600; background: var(--bg); }
  table.cross tr.ad td.lab { padding-left: 46px; color: var(--muted); }
  table.cross tr.ad td { color: var(--muted); }
  .ch-tag { margin-left: 8px; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; white-space: nowrap; }
  .pill { display: inline-block; font-size: 11px; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--muted); }
  .pill.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
  .tumbler { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
  .tumbler.on { background: #2e9e4f; box-shadow: 0 0 0 3px rgba(46, 158, 79, .18); }
  .tumbler.off { background: #d24b3e; box-shadow: 0 0 0 3px rgba(210, 75, 62, .16); }
  td.good { color: var(--accent); font-weight: 600; }
  td.bad { color: var(--danger); font-weight: 600; }
  @media (max-width: 760px) { table.cross .opt { display: none; } }
  table.plan-table { width: 100%; }
  table.plan-table th { position: sticky; top: 0; height: 36px; color: var(--muted); font-weight: 500; font-size: 12px; text-align: right; white-space: normal; line-height: 1.2; }
  table.plan-table td, table.plan-table th { padding: 0 12px; min-width: 110px; }
  table.plan-table td { height: 44px; }
  table.plan-table th.lab, table.plan-table td.lab { min-width: 240px; text-align: left; }
  td.plan-in { white-space: nowrap; }
  td.plan-in input { width: 9rem; font: inherit; text-align: right; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font-variant-numeric: tabular-nums; }
  td.plan-in input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
  td.plan-in input::placeholder { color: var(--faint); }
  .unit { margin-left: 6px; color: var(--muted); font-size: 12px; }
  th.bar-col, td.bar-col { min-width: 150px; }
  td.bar-col { white-space: nowrap; }
  .pbar { display: inline-block; width: 90px; height: 6px; border-radius: 999px; background: var(--line); vertical-align: middle; overflow: hidden; }
  .pfill { height: 100%; background: var(--accent); border-radius: 999px; }
  .pfill.warn { background: #c48a1c; } .pfill.bad { background: var(--danger); }
  .ppct { margin-left: 8px; font-variant-numeric: tabular-nums; }
  td.fc { white-space: nowrap; color: var(--muted); }
  td.fc.ok { color: #2e7d3e; } td.fc.warn { color: #9a6a10; } td.fc.bad { color: var(--danger); }
  .sdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
  .sdot.ok { background: #2e9e4f; } .sdot.warn { background: #d49a22; } .sdot.bad { background: #d24b3e; }
  .plan-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
  .plan-foot .msg { margin: 0; }
  .lg-fact { background: var(--accent); height: 3px; width: 16px; border-radius: 2px; }
  .lg-plan { width: 16px; height: 0; border-top: 1.5px dashed var(--ink); opacity: .6; border-radius: 0; }
  .lg-fc { width: 16px; height: 0; border-top: 2px dotted var(--accent); border-radius: 0; }
  .sec-title { margin: 0; font-size: 15px; font-weight: 600; }
  .tp-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
  tr.tpr td { background: color-mix(in srgb, var(--s2) 7%, var(--surface)); color: var(--s2); font-variant-numeric: tabular-nums; }
  tr.tpr td.lab { padding-left: 30px; font-weight: 400; }
  .tp-lift { margin-left: 8px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
  .tp-lift.up { color: var(--accent); } .tp-lift.down { color: var(--danger); }
  tr.off td { opacity: .55; }
  td.tp-grp { white-space: nowrap; }
  .tp-lead { margin: 0 14px 10px; }
  .nosrc { display: inline-block; margin-left: 8px; font-size: 11px; font-style: normal; font-weight: 400; color: var(--faint); border: 1px dashed var(--line); border-radius: 999px; padding: 0 7px; white-space: nowrap; }
  .real-note { margin: 0 0 14px; padding: 12px 14px; }
  #page-cross > section { display: none; }
  .tp-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; padding: 0 14px 14px; }
  .tp-kpi { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
  .tp-kpi-l { font-size: 12px; color: var(--muted); }
  .tp-kpi-v { font-size: 20px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
  td.tp-act { white-space: nowrap; text-align: right; }
  .month-name { min-width: 10.5rem; text-align: center; font-weight: 600; font-size: 16px; }
  button { font: inherit; color: inherit; }
  .btn { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 6px 10px; cursor: pointer; }
  .btn:hover { border-color: var(--faint); }
  .btn:focus-visible, .cell-btn:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
  .btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
  .btn-primary:disabled { opacity: .5; cursor: default; }
  .card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
  .scroll { overflow: auto; max-height: 72vh; border-radius: 8px; }
  table { border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
  th, td { height: 30px; padding: 0 8px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); white-space: nowrap; background: var(--surface); text-align: right; font-size: 13px; }
  thead th { position: sticky; z-index: 3; color: var(--muted); font-weight: 500; font-size: 12px; }
  thead tr:nth-child(1) th { top: 0; }
  thead tr:nth-child(2) th { top: 31px; }
  th.lab, td.lab { position: sticky; left: 0; z-index: 2; text-align: left; min-width: 260px; max-width: 300px; white-space: normal; line-height: 1.25; }
  thead th.lab { z-index: 5; }
  th.fix, td.fix { min-width: 84px; }
  th.day, td.day { min-width: 58px; max-width: 58px; }
  .we { background: var(--weekend); }
  th.today { color: var(--today); font-weight: 700; box-shadow: inset 0 -2px 0 var(--today); }
  td.today { box-shadow: inset 2px 0 0 var(--today), inset -2px 0 0 var(--today); }
  th.partial, td.partial { background-image: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--accent) 7%, transparent) 6px 12px); }
  th.partial { color: var(--accent); }
  tr.conv td.partial, tr.tpr td.partial { background-image: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--accent) 7%, transparent) 6px 12px); }
  .chart-delta-note { color: var(--muted); }
  .pnote { font-size: 10.5px; font-weight: 600; color: var(--accent); line-height: 1.1; }
  .hint { color: var(--faint); font-size: 11px; }
  tr.sec td { background: var(--bg); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; height: 26px; }
  tr.stage td.lab { font-weight: 600; cursor: default; }
  tr.stage.has-kids td.lab { cursor: pointer; }
  tr.kid td.lab { padding-left: 30px; color: var(--muted); font-weight: 400; }
  tr.pct td.lab { color: var(--muted); font-style: italic; }
  .tog { display: inline-block; width: 18px; color: var(--faint); font-weight: 400; border: 0; background: none; padding: 0; cursor: pointer; text-align: left; }
  span.tog { cursor: default; }
  .lab-link { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; font: inherit; color: inherit; line-height: 1.25; }
  .lab-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
  .lab-link:focus-visible, .tog:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 3px; }
  tr.charted td { background: var(--accent-soft); }
  .cost-link { border: 0; background: none; padding: 2px 4px; margin: 0 -4px; border-radius: 4px; cursor: pointer; font: inherit; color: inherit; font-variant-numeric: tabular-nums; }
  .cost-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
  .cost-link.on { color: var(--accent); font-weight: 600; }
  .cost-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
  tr.charted td.we { background: color-mix(in srgb, var(--accent-soft) 80%, var(--weekend)); }
  tr.charted .lab-link { color: var(--accent); }
  th.spark, td.spark { min-width: 88px; max-width: 88px; text-align: center; padding: 0 6px; }
  td.spark svg { display: block; margin: auto; }
  .chart-card { padding: 16px; display: grid; gap: 8px; }
  .chart-sub { margin: 0; color: var(--muted); font-size: 12px; }
  .chart-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
  .lg-item { display: inline-flex; align-items: center; gap: 6px; }
  .lg-sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
  .lg-dash { width: 16px; height: 0; border-top: 1.5px dashed var(--ink); opacity: .6; border-radius: 0; }
  .chart-box { position: relative; min-height: 240px; }
  .chart-box svg { display: block; }
  .chart-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.12); padding: 6px 10px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; z-index: 6; display: grid; gap: 2px; }
  .tip-h { color: var(--muted); }
  .tip-l { display: flex; align-items: center; gap: 6px; }
  tr.notes td { height: 34px; }
  tr.notes td.lab { font-weight: 600; color: var(--accent); }
  tr.notes td.day { padding: 0; }
  .cell-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: 100%; height: 33px; border: 0; background: transparent; cursor: pointer; padding: 0 4px; }
  .cell-btn:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
  .cell-btn.has { background: color-mix(in srgb, var(--accent) 45%, transparent); }
  .cell-btn.has:hover { background: color-mix(in srgb, var(--accent) 60%, transparent); }
  .cell-btn.sel { box-shadow: inset 0 0 0 2px var(--ink); }
  .cell-btn.has.sel { background: var(--accent); }
  .badge { display: inline-block; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 999px; padding: 2px 10px; margin-top: 8px; }
  td.num { color: var(--ink); }
  td.fix.num { font-weight: 600; }
  td.calc { color: var(--muted); }
  .panel { padding: 16px; display: grid; gap: 12px; }
  .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
  .panel-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
  .panel-nav { display: flex; gap: 6px; }
  .list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
  .note { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; padding: 10px 12px; display: grid; gap: 6px; }
  .note-text { white-space: pre-wrap; line-height: 1.45; overflow-wrap: anywhere; }
  .note-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; align-items: center; }
  .del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 4px; border-radius: 4px; }
  .del.armed { color: var(--danger); font-weight: 600; }
  .empty { color: var(--muted); margin: 0; }
  .form { display: grid; gap: 8px; }
  textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; min-height: 72px; resize: vertical; }
  .form-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
  .msg { color: var(--muted); font-size: 12px; }
  details { color: var(--muted); }
  summary { cursor: pointer; font-weight: 500; color: var(--ink); }
  dl { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: 6px 16px; margin: 12px 0 0; }
  dt { color: var(--ink); font-weight: 500; }
  dd { margin: 0; line-height: 1.4; }
  @media (max-width: 640px) { dl { grid-template-columns: 1fr; } dd { margin-bottom: 6px; } th.lab, td.lab { min-width: 170px; } }
