/* CRM СИН. Оформление — по эталону design/dashboard.html и design/mobile.html: только тёмно-синий и серебро. */
@font-face { font-family: "SinSans"; font-weight: 400; src: url("/static/fonts/NotoSans-Regular.ttf"); }
@font-face { font-family: "SinSans"; font-weight: 600; src: url("/static/fonts/NotoSans-SemiBold.ttf"); }
@font-face { font-family: "SinSans"; font-weight: 700; src: url("/static/fonts/NotoSans-Bold.ttf"); }
:root {
  --navy: #0B1E3B;
  --s1: #EEF0F4; --s2: #C9CED6; --s3: rgba(201,206,214,.62); --s4: rgba(201,206,214,.38);
  --line: rgba(201,206,214,.16); --panel: rgba(255,255,255,.035); --panel2: rgba(255,255,255,.06);
  --grad: linear-gradient(90deg, #8E97A7, #F2F4F7);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body { background: var(--navy); color: var(--s2); font-family: "SinSans", sans-serif; font-size: 13.5px; font-variant-numeric: tabular-nums;
       -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; cursor: pointer; }
[hidden] { display: none !important; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- каркас ---------- */
.shell { display: flex; min-height: 100vh; }
aside { width: 248px; flex: none; background: rgba(0,0,0,.2); border-right: 1px solid var(--line); display: flex; flex-direction: column;
        padding: 24px 16px 18px; position: sticky; top: 0; height: 100vh; }
.brand { padding: 2px 10px 22px; }
.brand img { width: 152px; display: block; }
nav.side { display: flex; flex-direction: column; gap: 3px; }
nav.side a { display: flex; align-items: center; gap: 13px; height: 39px; padding: 0 12px; border-radius: 9px; color: var(--s3); font-size: 14px; }
nav.side a:hover { color: var(--s2); background: var(--panel); }
nav.side a.on { background: linear-gradient(90deg, rgba(201,206,214,.22), rgba(201,206,214,.08)); color: var(--s1); font-weight: 600;
                box-shadow: inset 0 0 0 1px rgba(201,206,214,.22); }
.n { margin-left: auto; min-width: 24px; height: 19px; padding: 0 7px; border-radius: 10px; background: var(--s2); color: var(--navy);
     font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.who { margin-top: auto; display: flex; align-items: center; gap: 11px; padding: 14px 8px 0; border-top: 1px solid var(--line); }
.av { width: 36px; height: 36px; border-radius: 9px; border: 1px solid rgba(201,206,214,.45); display: grid; place-items: center; color: var(--s1);
      font-weight: 600; font-size: 12.5px; letter-spacing: .04em; flex: none; }
.who b { display: block; color: var(--s1); font-size: 13px; font-weight: 600; line-height: 1.25; }
.who span { font-size: 11.5px; color: var(--s3); }
.who .out { margin-left: auto; color: var(--s3); padding: 6px; border-radius: 8px; background: none; border: 0; cursor: pointer; }
.who .out:hover { color: var(--s1); background: var(--panel); }
main { flex: 1; min-width: 0; padding: 24px 28px 40px; display: flex; flex-direction: column; gap: 14px; }
.mtop, .tab { display: none; }

header.page { display: flex; align-items: center; gap: 12px; min-height: 50px; flex-wrap: wrap; }
header.page h1 { font-size: 24px; font-weight: 700; color: var(--s1); line-height: 1.15; }
header.page p { font-size: 13px; color: var(--s3); margin-top: 2px; }
header.page .r { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--s3); font-size: 13px; margin-bottom: 4px; }
.back .ico { width: 14px; height: 14px; transform: rotate(180deg); }

.pill { height: 34px; padding: 0 13px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); display: inline-flex;
        align-items: center; gap: 8px; font-size: 13px; color: var(--s2); white-space: nowrap; }
.pill.dim { color: var(--s3); border-style: dashed; }
.pill .ico { width: 15px; height: 15px; }
select.month { background: transparent; border: 0; color: var(--s2); color-scheme: dark; outline: none; cursor: pointer; }
select.month option { background: var(--navy); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.h { font-size: 15px; font-weight: 600; color: var(--s1); }
.h i { font-style: normal; font-weight: 400; color: var(--s3); font-size: 13px; }
.sec { padding: 16px 18px; }
.sec > .top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.sec > .top .r { margin-left: auto; display: flex; gap: 8px; }
.muted { color: var(--s3); }
.empty { color: var(--s3); padding: 14px 2px; font-size: 13px; }

/* кнопки */
.btn { height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid rgba(201,206,214,.4); background: transparent; color: var(--s1);
       font-weight: 600; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.btn:hover { background: var(--panel2); }
.btn.main { background: var(--s2); color: var(--navy); border-color: var(--s2); }
.btn.main:hover { background: var(--s1); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn .ico { width: 15px; height: 15px; }
.btn[disabled] { opacity: .5; cursor: default; }

/* показатели */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.kpi { min-height: 100px; padding: 15px 15px; display: flex; gap: 12px; align-items: center; }
.kpi .ib { width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center; color: var(--navy);
           background: linear-gradient(145deg, #F2F4F7, #9BA4B3); }
.kpi .ib .ico { width: 20px; height: 20px; stroke-width: 1.8; }
.kpi .t { font-size: 12px; color: var(--s3); }
.kpi .v { font-size: 21px; font-weight: 700; color: var(--s1); line-height: 1.3; white-space: nowrap; }
.kpi .d { font-size: 11.5px; color: var(--s2); white-space: nowrap; }
.kpi .d i { font-style: normal; color: var(--s3); }

.row2 { display: grid; grid-template-columns: 1.02fr 1fr; gap: 14px; }
.pfl { display: grid; grid-template-columns: 24px 92px minmax(0,1fr) 64px 124px; align-items: center; column-gap: 10px; padding: 9px 0; }
.pfl .ico { width: 22px; height: 22px; color: var(--s2); }
.pfl .nm { font-size: 14px; font-weight: 600; color: var(--s1); }
.pfl .cap { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--s3); margin-bottom: 6px; gap: 8px; }
.tr { height: 8px; border-radius: 4px; background: rgba(201,206,214,.14); overflow: hidden; }
.tr b { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--grad); }
.pfl .pc { font-size: 13.5px; font-weight: 600; color: var(--s1); text-align: right; padding-top: 16px; }
.df { height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 600; white-space: nowrap; padding: 0 6px; }
.pfl .df { margin-top: 16px; }
.df.up { background: var(--s2); color: var(--navy); }
.df.dn { border: 1px solid rgba(201,206,214,.45); color: var(--s2); }
.tag { height: 24px; padding: 0 10px; border-radius: 7px; background: var(--s2); color: var(--navy); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; white-space: nowrap; }
.tag.ol { background: transparent; border: 1px solid rgba(201,206,214,.45); color: var(--s2); }
.chart { width: 100%; height: 190px; }
.ax { font-size: 10.5px; fill: rgba(201,206,214,.6); font-family: "SinSans"; }

.dgrid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; }
.dir { background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px 10px; min-width: 0; }
.dir .a { display: flex; gap: 9px; align-items: center; }
.sq { width: 30px; height: 30px; border-radius: 8px; border: 1px solid rgba(201,206,214,.4); display: grid; place-items: center; color: var(--s1); flex: none; }
.sq .ico { width: 16px; height: 16px; }
.dir .nm { font-size: 12px; color: var(--s2); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dir .v { font-size: 13.5px; font-weight: 700; color: var(--s1); white-space: nowrap; }
.dir .d { font-size: 11px; color: var(--s3); margin: 6px 0 0 39px; }

.row4 { display: grid; grid-template-columns: 520px minmax(0,1fr); gap: 14px; }
.str .in { display: flex; align-items: center; gap: 22px; padding: 6px 0 4px; }
.donut { position: relative; width: 180px; height: 180px; flex: none; }
.donut .c { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut .c b { display: block; font-size: 15px; color: var(--s1); font-weight: 700; white-space: nowrap; }
.donut .c span { font-size: 11.5px; color: var(--s3); }
.leg { flex: 1; min-width: 0; display: grid; row-gap: 8px; font-size: 12px; }
.leg div { display: grid; grid-template-columns: 10px minmax(0,1fr) 50px auto; column-gap: 9px; align-items: center; }
.leg i { width: 10px; height: 10px; border-radius: 3px; background: #E9ECF0; }
.leg span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leg .p { text-align: right; color: var(--s3); }
.leg .s { text-align: right; color: var(--s1); font-weight: 600; }

.mods { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.mod { position: relative; padding: 15px 16px 14px; display: flex; flex-direction: column; overflow: hidden; min-height: 126px; cursor: pointer; }
.mod:hover { background: var(--panel2); }
.mod .ico { width: 24px; height: 24px; color: var(--s1); }
.mod .big { position: absolute; right: -6px; top: -4px; width: 92px; height: 92px; color: rgba(201,206,214,.13); stroke-width: 1.1; fill: none;
            stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.mod .nm { margin-top: 9px; font-size: 15px; font-weight: 600; color: var(--s1); }
.mod .ds { font-size: 12.5px; color: var(--s3); margin-top: 4px; white-space: nowrap; }
.mod .ds b { color: var(--s1); font-weight: 600; margin-left: 5px; }

/* итоговые плитки на карточках */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { padding: 13px 15px; }
.tile .t { font-size: 12px; color: var(--s3); }
.tile .v { font-size: 19px; font-weight: 700; color: var(--s1); white-space: nowrap; margin-top: 2px; }

/* списки (таблица на компьютере, карточки на телефоне) */
.list { display: flex; flex-direction: column; }
.li { display: grid; align-items: center; column-gap: 12px; padding: 11px 4px; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li.head { color: var(--s3); font-size: 12px; padding-top: 2px; padding-bottom: 8px; }
.li.link { cursor: pointer; border-radius: 8px; }
.li.link:hover { background: var(--panel2); }
.li .main { color: var(--s1); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.li .sub { font-size: 12px; color: var(--s3); font-weight: 400; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .num { text-align: right; white-space: nowrap; color: var(--s1); }
.li .act { display: flex; gap: 6px; justify-content: flex-end; }
.li.void { opacity: .45; }
.li.void .main { text-decoration: line-through; }
.l-obj { grid-template-columns: minmax(0,2.2fr) minmax(0,1fr) 110px repeat(4, 130px); }
.l-con { grid-template-columns: minmax(0,2fr) 110px 130px 130px 130px 130px 110px; }
.l-work { grid-template-columns: 92px minmax(0,2.4fr) 110px 120px 130px 110px 190px; }
.l-work .act { flex-wrap: wrap; row-gap: 6px; }
.l-pay { grid-template-columns: 92px minmax(0,2.2fr) 140px 140px 140px 110px; }
.l-crew { grid-template-columns: minmax(0,2fr) minmax(0,1.2fr) 140px 140px 140px; }
.l-acc { grid-template-columns: 92px minmax(0,2.4fr) 120px 140px 110px; }
.l-ppl { grid-template-columns: minmax(0,2fr) 160px 170px 140px 240px; }
.l-jr { grid-template-columns: 150px 180px minmax(0,1fr); }
.st { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; border: 1px solid rgba(201,206,214,.4); color: var(--s2); white-space: nowrap; display: inline-block; }
.st.f { background: var(--s2); color: var(--navy); border-color: var(--s2); font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: 12.5px; }
.seg a { padding: 6px 13px; color: var(--s3); }
.seg a.on { background: var(--s2); color: var(--navy); font-weight: 700; }

/* формы и окно */
.veil { position: fixed; inset: 0; background: rgba(4,12,26,.72); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 18px; }
.dlg { width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; background: #0E2445; border: 1px solid rgba(201,206,214,.25); border-radius: 16px; padding: 20px 20px 18px; }
.dlg h2 { font-size: 18px; color: var(--s1); font-weight: 700; margin-bottom: 14px; }
.dlg .note { font-size: 12.5px; color: var(--s3); margin: -6px 0 12px; line-height: 1.45; }
.fld { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.fld label { font-size: 12px; color: var(--s3); }
.fld input, .fld select, .fld textarea { height: 40px; border-radius: 9px; border: 1px solid rgba(201,206,214,.3); background: rgba(0,0,0,.18); padding: 0 12px;
       color: var(--s1); outline: none; color-scheme: dark; width: 100%; }
.fld textarea { height: 72px; padding: 9px 12px; resize: vertical; }
.fld input:focus, .fld select:focus, .fld textarea:focus { border-color: var(--s2); }
.fld select option { background: var(--navy); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.err { color: var(--s1); border: 1px solid rgba(201,206,214,.5); border-radius: 9px; padding: 9px 12px; font-size: 13px; margin-bottom: 12px; }
.err::before { content: "Не получилось. "; font-weight: 700; }
.dlg .bar { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.code { font-size: 40px; font-weight: 700; color: var(--s1); letter-spacing: .18em; text-align: center; padding: 14px 0 6px; }
.calc { font-size: 12.5px; color: var(--s2); margin: -4px 0 12px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--s2); color: var(--navy); font-weight: 600;
         padding: 10px 16px; border-radius: 10px; z-index: 60; font-size: 13px; max-width: 90vw; }

/* вход */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login .box { width: 100%; max-width: 380px; }
.login .box img { width: 180px; display: block; margin: 0 auto 30px; }
.login h1 { font-size: 20px; color: var(--s1); margin-bottom: 6px; text-align: center; }
.login p { font-size: 13px; color: var(--s3); text-align: center; margin-bottom: 20px; line-height: 1.45; }
.login .btn { width: 100%; justify-content: center; height: 42px; }
.login .alt { margin-top: 10px; }
.foot { margin-top: 28px; font-size: 11px; color: var(--s4); text-align: center; line-height: 1.5; }

/* ---------- узкий экран ---------- */
@media (max-width: 1500px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .row4 { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 1100px) {
  .row2 { grid-template-columns: minmax(0,1fr); }
  .mods { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .shell { display: block; }
  aside { display: none; }
  .mtop { display: flex; position: sticky; top: 0; z-index: 20; height: 60px; align-items: center; padding: 0 14px 0 16px; background: var(--navy);
          border-bottom: 1px solid var(--line); }
  .mtop img { width: 116px; display: block; }
  .mtop .r { margin-left: auto; display: flex; gap: 10px; align-items: center; }
  main { padding: 12px 12px 100px; gap: 10px; }
  header.page h1 { font-size: 21px; }
  header.page p { font-size: 11.5px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { min-height: 84px; padding: 10px 12px; flex-direction: column; align-items: flex-start; gap: 4px; }
  .kpi .ib { width: 22px; height: 22px; border-radius: 7px; position: absolute; }
  .kpi { position: relative; }
  .kpi .ib .ico { width: 13px; height: 13px; stroke-width: 2; }
  .kpi .t { padding-left: 30px; line-height: 22px; }
  .kpi .v { font-size: 18px; }
  .pfl { grid-template-columns: 22px minmax(0,1fr) auto 104px; row-gap: 6px; }
  .pfl .bar { grid-column: 1 / -1; order: 5; }
  .pfl .pc, .pfl .df { padding-top: 0; margin-top: 0; }
  .dgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .str .in { gap: 14px; }
  .donut { width: 132px; height: 132px; }
  .donut .c b { font-size: 12px; }
  .leg div { grid-template-columns: 9px minmax(0,1fr) auto; }
  .leg .s { display: none; }
  .mods { gap: 8px; }
  .mod { min-height: 92px; padding: 11px 12px; }
  .mod .big { display: none; }
  .mod .nm { margin-top: 5px; font-size: 14px; }
  .sec { padding: 12px 12px; }
  .li { grid-template-columns: minmax(0,1fr) auto !important; row-gap: 4px; padding: 11px 2px; }
  .li.head { display: none; }
  .li.head + .li { border-top: 0; }
  .kpi .d { white-space: normal; }
  .kpi .d i { display: none; }
  .li > .x { display: none; }
  .li .num { font-size: 13px; }
  .li .act { grid-column: 1 / -1; justify-content: flex-start; }
  .two { grid-template-columns: 1fr; }
  .veil { align-items: flex-end; padding: 0; }
  .dlg { max-width: none; border-radius: 16px 16px 0 0; max-height: 88vh; padding-bottom: 26px; }
  .tab { display: grid; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: 74px; border-top: 1px solid var(--line);
         background: #091A33; grid-template-columns: repeat(5, 1fr); padding: 9px 6px 14px; }
  .tab a { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10.5px; color: var(--s3); position: relative; }
  .tab a .ico { width: 22px; height: 22px; }
  .tab a.on { color: var(--s1); font-weight: 600; }
  .tab a.on::before { content: ""; position: absolute; top: -10px; width: 30px; height: 3px; border-radius: 0 0 3px 3px; background: var(--s1); }
  .tab a .n { position: absolute; top: -4px; left: 50%; margin-left: 5px; min-width: 19px; height: 16px; padding: 0 5px; font-size: 10px; }
  .more { position: fixed; right: 10px; bottom: 82px; z-index: 31; min-width: 200px; background: #0E2445; border: 1px solid rgba(201,206,214,.25);
          border-radius: 12px; padding: 6px; display: flex; flex-direction: column; }
  .more a { padding: 11px 12px; border-radius: 8px; color: var(--s2); display: flex; gap: 10px; align-items: center; }
  .more a:hover { background: var(--panel2); }
}
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.chk { display: flex; height: auto; min-height: 38px; padding: 8px 12px; margin-bottom: 6px; cursor: pointer; white-space: normal; }
.chk input { width: 16px; height: 16px; flex: none; }
select.pill { appearance: auto; color-scheme: dark; }
select.pill option { background: var(--navy); }
.nm-w { min-width: 0; }

/* ---------- производство и склад ---------- */
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.l-day { grid-template-columns: minmax(0,1.1fr) minmax(0,1.6fr) 100px 90px 120px; }
.l-day .main .sub { display: none; }
.l-line { grid-template-columns: minmax(0,1fr) 90px 70px; }
.l-stk { grid-template-columns: minmax(0,1fr) auto; }
.l-rep { grid-template-columns: 92px minmax(0,2.6fr) 110px 90px 90px 110px; }
.l-mv { grid-template-columns: 92px minmax(0,2.6fr) 130px 130px 110px; }
.list.sep { margin-top: 10px; padding-top: 4px; border-top: 1px solid var(--line); }
@media (max-width: 1300px) { .row3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .l-day .main .sub { display: block; }
  .row3 { gap: 10px; }
}

.wnote { font-size: 12px; font-weight: 400; color: var(--s2); margin: 3px 0 2px; }
.wnote summary { cursor: pointer; color: var(--s3); }
.wnote[open] { white-space: pre-line; }
.onote p { white-space: pre-line; margin: 6px 0 0; font-size: 13px; color: var(--s2); }
.dlg textarea { width: 100%; }
.dlg textarea[rows] { height: auto; min-height: 160px; }
.l-task { grid-template-columns: 92px minmax(0,2.4fr) minmax(0,1fr) minmax(0,1fr) 130px; }
.l-ev { grid-template-columns: 110px minmax(0,1fr); }
.l-ev .main .sub { display: none; }
@media (max-width: 900px) { .l-ev .main .sub { display: block; } }
.l-ev .evt { white-space: pre-line; font-weight: 400; color: var(--s2); font-size: 13px; margin: 4px 0 0; }
.tact { display: flex; flex-wrap: wrap; gap: 8px; }
.tile .v.sm { font-size: 15px; white-space: normal; overflow-wrap: anywhere; }
.l-fund { grid-template-columns: minmax(0,2.4fr) 150px 140px 140px 150px; }
.l-fund .num .sub { text-align: right; }
.l-fmv { grid-template-columns: 92px minmax(0,2.6fr) 150px 110px; }
.l-cli { grid-template-columns: minmax(0,2.4fr) 150px 150px 150px; }
.l-chk { grid-template-columns: minmax(0,1fr); }
.l-chk .main .st { margin-right: 6px; vertical-align: 1px; }
.l-chk .evt { white-space: pre-line; font-weight: 400; color: var(--s2); font-size: 13px; margin: 4px 0 0; }
.l-cw { grid-template-columns: 92px minmax(0,2.4fr) 110px 120px 130px; }
.l-cp { grid-template-columns: 92px minmax(0,2.4fr) 150px; }
