@font-face { font-family: "Inter"; src: url("/static/fonts/InterVariable.woff2") format("woff2"); font-weight: 100 900;
             font-display: swap; }
:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #0d1726; --ink2: #344054; --muted: #667085; --faint: #98a2b3; --line: #e4e7ec;
  --line2: #f0f2f5; --tint: #f3f6fa; --brand: #10243f; --brand2: #1b365d; --on-brand: #e8eef7; --on-brand2: #9fb2cc;
  --pos: #067647; --neg: #b42318; --warn: #b54708; --warn-soft: #fef6ee;
  --c1: #1b365d; --c2: #8ba2c2; --c3: #d3dbe6; --c4: #b54708;
  --radius: 10px; --scrim: rgba(13, 23, 38, .42);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f18; --panel: #111826; --ink: #e8edf4; --ink2: #c3ccd9; --muted: #8b97a8; --faint: #5d6878; --line: #222c3b;
    --line2: #1a2230; --tint: #16213a; --brand: #0d1a2e; --brand2: #18294a; --on-brand: #dfe7f2; --on-brand2: #8193ad;
    --pos: #3ccb7f; --neg: #f97066; --warn: #f79009; --warn-soft: #2b1d0e;
    --c1: #7fa3d6; --c2: #4b6286; --c3: #2a3a55; --c4: #f79009; --scrim: rgba(0, 0, 0, .6);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-feature-settings: "tnum" 1, "cv11" 1, "ss01" 1;
       -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; }

/* каркас: боковая панель и основная колонка */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh;
       background: linear-gradient(to right, var(--brand) 240px, var(--bg) 240px); }
.side { background: var(--brand); color: var(--on-brand); display: flex; flex-direction: column; padding: 22px 16px 18px;
        position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 12px; padding: 0 8px 20px; margin-bottom: 14px; border-bottom: 1px solid rgba(255, 255, 255, .09);
        font-weight: 650; font-size: 15px; letter-spacing: .01em; }
.side > .logo .mark { width: 36px; height: 36px; border-radius: 9px; font-size: 17px; }
.mark { width: 28px; height: 28px; border-radius: 7px; background: var(--on-brand); color: var(--brand); display: grid;
        place-items: center; font-size: 14px; font-weight: 750; letter-spacing: -.03em; }
.org { min-width: 0; }
.company { margin: -4px 8px 16px; padding: 7px 9px; border-radius: 7px; border: 1px solid rgba(255, 255, 255, .14); background: var(--brand2);
  color: var(--on-brand); font: inherit; font-size: 13px; cursor: pointer; }
.company[hidden] { display: none; }
.viewas { display: flex; align-items: center; gap: 2px; margin: -6px 8px 16px; padding: 3px; border-radius: 8px;
  background: rgba(255, 255, 255, .06); font-size: 12.5px; }
.viewas[hidden] { display: none; }
.viewas span { color: var(--on-brand2); padding: 0 8px 0 7px; }
.viewas button { flex: 1; border: 0; background: transparent; color: var(--on-brand2); font: inherit; font-weight: 500;
  padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.viewas button:hover { color: var(--on-brand); }
.viewas button.on { background: var(--brand2); color: var(--on-brand); }
.org .name { font-size: 17px; font-weight: 650; line-height: 1.2; }
.org .meta { font-size: 12px; color: var(--on-brand2); margin-top: 2px; font-weight: 400; letter-spacing: 0; }
.powered { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--on-brand2); opacity: .8; }
.powered .mark { width: 18px; height: 18px; border-radius: 5px; font-size: 10px; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 7px; color: var(--on-brand2);
         text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--on-brand); background: rgba(255, 255, 255, .05); }
.nav a.on { color: var(--on-brand); background: var(--brand2); }
.nav a[hidden], .controls[hidden] { display: none; }
.nav .soon { display: flex; align-items: center; gap: 10px; padding: 9px 10px; color: rgba(159, 178, 204, .45); cursor: default; }
.nav .soon small { margin-left: auto; font-size: 10.5px; letter-spacing: .04em; }
.side-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255, 255, 255, .09); font-size: 12px;
             color: var(--on-brand2); display: grid; gap: 8px; }
.side-foot a { color: var(--on-brand); text-decoration: none; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.main { min-width: 0; padding: 26px 32px 40px; max-width: 1320px; }

/* заголовок страницы и фильтры */
.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 22px; }
.top h1 { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 650; letter-spacing: -.02em; }
.top .sub { color: var(--muted); margin-top: 4px; font-size: 13.5px; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.seg, .stepper { display: inline-flex; align-items: center; background: var(--panel); border: 1px solid var(--line);
                 border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); font-weight: 500; font-size: 13px; padding: 6px 12px;
              border-radius: 6px; cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--ink); color: var(--panel); }
.seg.small button { padding: 4px 9px; font-size: 12px; }
.stepper button { border: 0; background: transparent; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; color: var(--ink2);
                  display: grid; place-items: center; }
.stepper button:hover:not(:disabled) { background: var(--tint); }
.stepper button:disabled { color: var(--faint); cursor: default; }
.stepper .m { min-width: 150px; text-align: center; font-weight: 600; font-size: 13.5px; }
.badge { display: inline-block; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 1px 6px;
         border-radius: 4px; color: var(--warn); border: 1px solid currentColor; margin-left: 8px; vertical-align: 1px; }

/* итоги месяца — одна полоса */
.band { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--panel); border: 1px solid var(--line);
        border-radius: var(--radius); margin-bottom: 26px; }
.kpi { padding: 18px 22px 16px; border-left: 1px solid var(--line); min-width: 0; }
.kpi:first-child { border-left: 0; }
.k-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.k-value { font-size: 30px; font-weight: 650; letter-spacing: -.025em; line-height: 1.15; margin: 8px 0 6px; white-space: nowrap; }
.k-value span { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 2px; }
.k-delta { font-size: 12.5px; font-weight: 600; }
.k-delta span { color: var(--muted); font-weight: 400; margin-left: 4px; }
.k-note { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.up { color: var(--pos); } .down { color: var(--neg); } .flat { color: var(--muted); }
svg.spark { width: 100%; height: 30px; margin-top: 12px; display: block; overflow: visible; }

/* разделы */
.sec { margin-bottom: 26px; }
.sec-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; margin-bottom: 10px; }
.sec-h h2 { margin: 0; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--ink2); }
.sec-h .note { color: var(--muted); font-size: 12.5px; }
.sec-h .tools { display: flex; align-items: center; gap: 8px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.panel.flush { padding: 0; overflow: hidden; }
.panel h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: baseline;
            gap: 10px; }
.panel h3 small { color: var(--muted); font-weight: 400; font-size: 12px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.stack { display: grid; gap: 16px; align-content: start; }
.foot { color: var(--muted); font-size: 12px; margin-top: 12px; line-height: 1.5; }
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink2); font-weight: 500; font-size: 12.5px; padding: 5px 11px;
       border-radius: 7px; cursor: pointer; text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--tint); color: var(--ink); }
.more { border: 0; background: none; color: var(--c1); font-weight: 600; font-size: 12.5px; padding: 10px 0 0; cursor: pointer; }
.more:hover { text-decoration: underline; text-underline-offset: 3px; }
.empty { color: var(--muted); font-size: 13px; padding: 6px 0; }

/* структура расходов */
.exp { display: grid; grid-template-columns: minmax(150px, 1.3fr) minmax(70px, 2fr) 56px 50px; align-items: center; gap: 14px;
       padding: 8px 0; border-top: 1px solid var(--line2); cursor: pointer; }
.exp:first-child { border-top: 0; }
.exp:hover .n { color: var(--c1); }
.exp .n { font-weight: 500; line-height: 1.3; }
.exp .n small { display: block; color: var(--faint); font-weight: 400; font-size: 11.5px; }
.track { position: relative; height: 6px; background: var(--line2); border-radius: 3px; }
.fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--c1); border-radius: 3px; }
.avg { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--c4); border-radius: 1px; }
.exp .pct { text-align: right; font-weight: 600; }
.exp .chg { text-align: right; font-size: 12px; font-weight: 600; }
.avgmark { display: inline-block; width: 2px; height: 11px; background: var(--c4); vertical-align: -1px; margin-right: 5px; }

/* графики */
.chart { width: 100%; height: 250px; }
.chart.short { height: 210px; }

/* таблицы */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.t th, table.t td { padding: 8px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line2); }
table.t thead th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
                   border-bottom: 1px solid var(--line); background: var(--panel); vertical-align: bottom; }
table.t th:first-child, table.t td:first-child { text-align: left; position: sticky; left: 0; background: var(--panel); z-index: 1; }
table.t td.l, table.t th.l { text-align: left; }
table.t tbody tr:hover td { background: var(--tint); }
table.t tr.sub td { color: var(--muted); font-size: 13px; }
table.t tr.sub td:first-child { padding-left: 28px; }
table.t tr.subtotal td { font-weight: 650; border-top: 1px solid var(--ink2); }
table.t tr.total td { font-weight: 700; font-size: 14.5px; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); }
table.t td.sel, table.t th.sel { background: var(--tint); }
table.t thead th.sel { color: var(--ink); }
table.t td.neg { color: var(--neg); }
table.t td.pos { color: var(--pos); }
table.t td.click { cursor: pointer; }
table.t td.click:hover { text-decoration: underline; text-underline-offset: 3px; color: var(--c1); }
table.t td.sep, table.t th.sep { border-left: 1px solid var(--line); }
table.t tr.muted td { color: var(--faint); }
.panel.flush table.t th:first-child, .panel.flush table.t td:first-child { padding-left: 20px; }
.panel.flush table.t th:last-child, .panel.flush table.t td:last-child { padding-right: 20px; }
.panel.flush .foot { padding: 0 20px 16px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; vertical-align: 0; }

/* списки */
.li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 14px; padding: 10px 0; border-top: 1px solid var(--line2); }
.li:first-child { border-top: 0; }
.li .a { font-weight: 550; min-width: 0; overflow-wrap: anywhere; }
.li .b { text-align: right; font-weight: 650; white-space: nowrap; }
.li .c { color: var(--muted); font-size: 12.5px; grid-column: 1 / -1; overflow-wrap: anywhere; }
.tag { display: inline-block; font-size: 11px; font-weight: 500; padding: 0 6px; border-radius: 4px; border: 1px solid var(--line);
       color: var(--muted); margin-left: 8px; vertical-align: 1px; }
.tag.bad { color: var(--neg); border-color: currentColor; }
.stars { color: var(--c4); letter-spacing: 1px; }
.summary-line { font-size: 13px; color: var(--ink2); margin-bottom: 8px; }
.summary-line b { color: var(--ink); }

/* расшифровка — панель справа */
.drawer { position: fixed; inset: 0; background: var(--scrim); z-index: 50; display: flex; justify-content: flex-end; }
.drawer[hidden] { display: none; }
.sheet { background: var(--panel); width: min(560px, 100%); height: 100%; display: flex; flex-direction: column;
         box-shadow: -20px 0 50px rgba(0, 0, 0, .18); }
.sheet .sh { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 22px 24px 16px;
             border-bottom: 1px solid var(--line); }
.sheet .sh .k-label { margin-bottom: 4px; }
.sheet .sh h3 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
.sheet .sh .meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.sheet .close { border: 1px solid var(--line); background: var(--panel); width: 32px; height: 32px; border-radius: 7px; cursor: pointer;
                display: grid; place-items: center; flex: none; color: var(--ink2); }
.sheet .sb { overflow-y: auto; padding: 4px 24px 24px; -webkit-overflow-scrolling: touch; }

footer { color: var(--faint); font-size: 12px; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.loading { color: var(--muted); padding: 80px 0; text-align: center; }

/* вход */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login .brandside { background: var(--brand); color: var(--on-brand); padding: 40px 48px; display: flex; flex-direction: column; }
.login .brandside .claim { margin-top: auto; margin-bottom: auto; max-width: 420px; }
.login .brandside h1 { font-size: 30px; line-height: 1.2; font-weight: 650; letter-spacing: -.02em; margin: 0 0 12px; }
.login .brandside p { color: var(--on-brand2); font-size: 15px; margin: 0; }
.login .brandside .fine { font-size: 12px; color: var(--on-brand2); }
.login .formside { display: grid; place-items: center; padding: 32px 20px; }
.login form { width: min(360px, 100%); }
.login form h2 { margin: 0 0 4px; font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.login form .sub { color: var(--muted); margin-bottom: 20px; }
.login label { display: block; font-size: 12px; color: var(--ink2); font-weight: 600; margin: 14px 0 6px; }
.login input { width: 100%; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 10px 12px;
               font: inherit; font-size: 15px; }
.login input:focus { outline: 2px solid var(--brand2); outline-offset: -1px; }
.login button { width: 100%; margin-top: 22px; border: 0; background: var(--brand); color: #fff; border-radius: 8px; padding: 11px;
                font-weight: 600; cursor: pointer; }
.login .err { margin-top: 12px; color: var(--neg); font-size: 13px; }

@media (max-width: 1100px) {
  .band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); background: var(--bg); }
  .side { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0 12px;
          padding: 10px 14px 0; }
  .logo { padding: 0; margin: 0; border: 0; }
  .side > .logo .mark { width: 28px; height: 28px; font-size: 14px; border-radius: 7px; }
  .org .meta, .powered { display: none; }
  .org .name { font-size: 15px; }
  .company { margin: 0; padding: 5px 7px; max-width: 46vw; }
  .viewas { margin: 0; } .viewas span { display: none; }
  .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .side-foot .upd { display: none; }
  .nav { order: 5; flex-basis: 100%; display: flex; gap: 18px; margin-top: 8px; overflow-x: auto; }
  .nav a { padding: 8px 0 10px; border-radius: 0; background: none; border-bottom: 2px solid transparent; }
  .nav a.on { background: none; border-bottom-color: var(--on-brand); }
  .nav a svg, .nav .soon { display: none; }
  .main { padding: 18px 14px 32px; }
  .top { align-items: stretch; flex-direction: column; }
  .controls { flex-direction: column; align-items: stretch; }
  .seg { display: flex; } .seg button { flex: 1; }
  .stepper { justify-content: space-between; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login .brandside { padding: 24px 22px; }
  .login .brandside .claim { margin: 28px 0 8px; }
  .login .brandside h1 { font-size: 22px; }
}
@media (max-width: 520px) {
  .kpi { padding: 14px 14px 12px; }
  .k-value { font-size: 22px; }
  .k-value span { font-size: 12px; }
  .panel { padding: 14px; }
  .panel.flush table.t th:first-child, .panel.flush table.t td:first-child { padding-left: 14px; }
  .exp { grid-template-columns: minmax(0, 1.3fr) minmax(36px, 1fr) 44px 38px; gap: 8px; }
  .exp .n { font-size: 13px; }
  .sheet .sh { padding: 18px 16px 12px; } .sheet .sb { padding: 4px 16px 20px; }
}

/* кликабельное, отметки фактур, служебная страница */
.kpi.click { cursor: pointer; }
.kpi.click:hover { background: var(--tint); }
.kpi.click:first-child:hover { border-radius: var(--radius) 0 0 var(--radius); }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td:first-child { color: var(--c1); text-decoration: underline; text-underline-offset: 3px; }
.mini { border: 1px solid var(--line); background: var(--panel); color: var(--ink2); font-size: 11.5px; font-weight: 600; padding: 1px 8px;
        border-radius: 5px; cursor: pointer; margin-left: 8px; vertical-align: 1px; }
.mini:hover { border-color: var(--ink2); color: var(--ink); }
.markform { grid-column: 1 / -1; margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--tint);
            display: grid; gap: 10px; }
.markform .seg { justify-self: start; flex-wrap: wrap; }
.markform .note { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 7px; padding: 7px 10px; font: inherit;
                  font-size: 13px; }
.markform .row { display: flex; gap: 8px; }
.btn.primary { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.btn.primary:hover { background: var(--ink2); color: var(--panel); }
.st { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.st.ok { color: var(--pos); border-color: currentColor; }
.st.bad { color: var(--neg); border-color: currentColor; }
.sub2 { color: var(--muted); font-size: 12px; font-weight: 400; white-space: normal; max-width: 340px; }
.err2 { color: var(--neg); font-size: 12px; white-space: normal; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
table.t.nights th, table.t.nights td { padding: 6px 8px; text-align: center; }
table.t.nights th:first-child, table.t.nights td:first-child { text-align: left; }
code { font-size: 12px; background: var(--tint); padding: 1px 5px; border-radius: 4px; }
