*{box-sizing:border-box}
body{margin:0;background:#F3F5F8;color:#1B2430;font:14px/1.35 Inter,"Segoe UI",system-ui,sans-serif}
a{color:#1F5FBF}a:hover{color:#163F80}
.layout{display:flex;min-height:100vh;flex-wrap:wrap}
.side{width:216px;background:#1B2430;color:#E8ECF2;padding:18px 12px;display:flex;flex-direction:column;gap:4px}
.side .brand{font-weight:700;font-size:17px;color:#fff;padding:0 8px}
.side .sub{font-size:12px;color:#A9B4C4;padding:0 8px 14px}
.side a{display:flex;align-items:center;min-height:38px;padding:0 10px;border-radius:7px;color:#E8ECF2;text-decoration:none;font-weight:500}
.side a.on{background:#fff;color:#1B2430;font-weight:700}
.side .me{margin-top:auto;border-top:1px solid #3A4658;padding:10px 8px 0;font-size:12px;color:#A9B4C4}
.side .me a{display:inline;min-height:0;padding:0;color:#A9B4C4;text-decoration:underline}
main{flex:999 1 560px;min-width:0;padding:16px 22px;display:flex;flex-direction:column;gap:12px}
h1{margin:0;font-size:22px}
.card{background:#fff;border:1px solid #E1E6EE;border-radius:8px;padding:10px 12px}
.muted{color:#4A5668;font-size:12px}
.t{width:100%;border-collapse:collapse;font-size:13px}
.t th{text-align:left;font-weight:600;color:#4A5668;font-size:11px;text-transform:uppercase;letter-spacing:.03em;padding:4px 8px;border-bottom:2px solid #D5DBE3;white-space:nowrap}
.t td{padding:3px 8px;border-bottom:1px solid #E6EAF0;white-space:normal;overflow-wrap:break-word;line-height:19px;max-width:420px;vertical-align:top}
.t td.n,.t td:first-child,.t td.nw{white-space:nowrap;overflow-wrap:normal}
.clamp{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.t tr.hid td{color:#8A96A8}
.t tr:hover td{background:#F7F9FC}
.n{text-align:right;font-variant-numeric:tabular-nums}
input,select{height:28px;border:1px solid #C9D1DC;border-radius:5px;padding:0 6px;font:inherit;background:#fff;color:#1B2430;max-width:100%}
input:focus,select:focus{outline:2px solid #1F5FBF;outline-offset:-1px}
.btn{display:inline-flex;align-items:center;height:30px;padding:0 12px;border-radius:6px;border:1px solid #1F5FBF;background:#fff;color:#1F5FBF;font:600 13px inherit;font-family:inherit;cursor:pointer;text-decoration:none;white-space:nowrap}
.btn.p{background:#1F5FBF;color:#fff}
.btn.s{height:24px;padding:0 8px;font-size:12px;border-color:#C9D1DC;color:#1B2430}
.err{background:#FFF4E5;border:1px solid #B54708;color:#7A3205;border-radius:6px;padding:6px 10px;font-weight:600}
.tabs{display:flex;flex-wrap:wrap;gap:4px}
.tabs a{display:inline-flex;align-items:center;height:30px;padding:0 12px;border-radius:6px;border:1px solid #C9D1DC;background:#fff;color:#1B2430;text-decoration:none;font-size:13px}
.tabs a.on{background:#1B2430;color:#fff;border-color:#1B2430;font-weight:600}
.row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.login{max-width:340px;margin:12vh auto;display:flex;flex-direction:column;gap:10px}
.login input{height:40px;font-size:15px}
.edit td{background:#EAF1FB !important;overflow:visible}
.shares{display:flex;gap:4px;flex-wrap:wrap}
.shares select{width:170px}.shares input{width:46px}
@media (max-width:700px){.side{width:100%}main{padding:10px}}

[hidden]{display:none !important}
table.t thead th:not(.nosort){cursor:pointer;user-select:none}
table.t thead th.s-asc::after{content:" ▲";font-size:9px}
table.t thead th.s-desc::after{content:" ▼";font-size:9px}
.pm{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border:1px solid #8A96A8;border-radius:4px;background:#fff;font:700 14px/1 Inter,sans-serif;color:#1B2430;cursor:pointer;padding:0;vertical-align:middle}
.pm:focus-visible{outline:2px solid #1F5FBF}
tr.child td{background:#F7F9FC;font-size:12px;color:#4A5668}
tr.fixed td{background:#1B2430;color:#fff;font-weight:700}
tfoot td{font-weight:700;border-top:2px solid #1B2430;padding:4px 8px;white-space:nowrap}
.pm-all{font-size:12px}

/* всплывающее окно правки */
.modal{position:fixed;inset:0;background:rgba(27,36,48,.45);display:flex;align-items:flex-start;justify-content:center;z-index:50;padding:8vh 12px;overflow:auto}
.modal-box{background:#fff;border-radius:10px;box-shadow:0 12px 40px rgba(0,0,0,.25);width:min(560px,100%);padding:16px 18px}
.modal-box h2{font-size:16px;margin:0 0 4px}
.modal-box .op{background:#F4F6F9;border-radius:6px;padding:8px 10px;font-size:13px;color:#4A5668;margin:8px 0 12px;white-space:normal;overflow-wrap:anywhere}
.modal-box .op b{color:#1B2430}
.modal-box{width:min(680px,100%)}
.modal-box .fld{display:grid;grid-template-columns:110px 1fr 64px;gap:8px;align-items:center;margin-bottom:8px}
.modal-box [data-shares] .fld{grid-template-columns:110px 1fr 64px auto}
.qp{display:flex;gap:3px}
.qp button{border:1px solid #C9D1DC;background:#fff;border-radius:5px;height:26px;padding:0 6px;cursor:pointer;font:inherit;font-size:12px;color:#1F5FBF}
.qp button:hover{background:#E8F0FC}
.modal-box .fld select{width:100%}
.modal-box .fld input{width:100%;text-align:right}
.modal-box .actions{display:flex;gap:8px;align-items:center;margin-top:14px;flex-wrap:wrap}
.modal-box .sum{text-align:right;font-weight:700;margin:2px 0 6px}
.modal-box .sum.bad{color:#B54708}
.pick{background:none;border:0;padding:0;font:inherit;color:#1F5FBF;cursor:pointer;text-decoration:underline dotted;text-align:left}
.pick.need{color:#B54708;font-weight:700;text-decoration:underline}

/* календарь */
.dp{display:inline-flex;vertical-align:middle}
.dp-btn{height:28px;min-width:118px;border:1px solid #C9D1DC;border-radius:5px;background:#fff;color:#1B2430;font:inherit;padding:0 26px 0 8px;cursor:pointer;text-align:left;position:relative;white-space:nowrap}
.dp-btn::after{content:"";position:absolute;right:7px;top:7px;width:12px;height:11px;border:1.5px solid #4A5668;border-top-width:3px;border-radius:2px;box-sizing:border-box}
.dp-btn.dp-on{border-color:#1F5FBF;color:#1F5FBF;font-weight:600}
.dp-pop{position:absolute;z-index:60;background:#fff;border:1px solid #C9D1DC;border-radius:8px;box-shadow:0 10px 30px rgba(0,0,0,.18);padding:10px;width:268px;font-size:13px}
.dp-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:6px}
.dp-head button{border:1px solid #C9D1DC;background:#fff;border-radius:5px;width:28px;height:26px;cursor:pointer;font-size:16px;line-height:1}
.dp-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:2px}
.dp-wd{text-align:center;color:#8A96A8;font-size:11px;padding:2px 0}
.dp-grid button{height:30px;border:0;border-radius:5px;background:none;cursor:pointer;font:inherit;color:#1B2430}
.dp-grid button.we{color:#B54708}
.dp-grid button:hover:not(:disabled){background:#E8F0FC}
.dp-grid button.today{box-shadow:inset 0 0 0 1px #1F5FBF}
.dp-grid button.mid{background:#E8F0FC;border-radius:0}
.dp-grid button.sel{background:#1F5FBF;color:#fff;font-weight:700}
.dp-grid button:disabled{color:#C9D1DC;cursor:default}
.dp-foot{display:flex;flex-wrap:wrap;gap:4px;margin-top:8px;border-top:1px solid #E6EAF0;padding-top:8px}
.dp-foot button{border:1px solid #C9D1DC;background:#fff;border-radius:5px;height:26px;padding:0 8px;cursor:pointer;font:inherit;font-size:12px;color:#1F5FBF}
.dp-hint{flex-basis:100%;color:#4A5668;font-size:12px;margin-bottom:2px}
/* выбор файла без подсказки браузера */
.file{display:inline-flex;align-items:center;gap:8px}
.file input[type=file]{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}

/* «Деньги на утро» — компактно, чтобы помещалось в левую колонку */
.t.mm{font-size:12.5px;width:100%}
.t.mm th,.t.mm td{padding:3px 4px}
.t.mm th{font-size:10px;letter-spacing:0}
.t.mm td:first-child,.t.mm th:first-child{width:22px;padding-right:0}
.t.mm input.mmi{width:78px;height:22px;text-align:right;padding:0 3px;font:inherit;font-size:12px;box-sizing:border-box}
.t.mm tr.child td{font-size:12px}
.t.mm .stale{display:block;font-size:11px;line-height:13px}
.t.mm input.mmi.saved{border-color:#1F5FBF;background:#E8F0FC}
.t.mm input.mmi.bad{border-color:#B54708;background:#FFF4E5}

/* питомец */
.pet{position:fixed;right:14px;bottom:12px;z-index:70}
.pet-body{width:62px;height:62px;border:0;background:none;padding:0;cursor:pointer;filter:drop-shadow(0 3px 6px rgba(0,0,0,.18));transition:transform .15s}
.pet-body:hover{transform:translateY(-3px) scale(1.05)}
.pet-body svg,.pet-grid svg{width:100%;height:100%;display:block}
.pet .eyes{animation:blink 5s infinite;transform-origin:center 28px;transform-box:view-box}
@keyframes blink{0%,94%,100%{transform:scaleY(1)}96%{transform:scaleY(.1)}}
.pet .tail{animation:wag 2.4s ease-in-out infinite;transform-origin:44px 48px;transform-box:view-box}
@keyframes wag{0%,100%{transform:rotate(0)}50%{transform:rotate(-10deg)}}
.pet.busy .pet-body{animation:bob .5s ease-in-out infinite}
@keyframes bob{50%{transform:translateY(-6px)}}
.pet-menu,.pet-choose{position:absolute;right:0;bottom:70px;background:#fff;border:1px solid #C9D1DC;border-radius:8px;box-shadow:0 10px 30px rgba(0,0,0,.18);padding:6px;min-width:210px}
.pet-menu button{display:block;width:100%;text-align:left;border:0;background:none;padding:8px 10px;border-radius:5px;cursor:pointer;font:inherit}
.pet-menu button:hover{background:#E8F0FC}
.pet-choose{width:250px;padding:10px}
.pet-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-top:6px}
.pet-grid button{border:2px solid transparent;background:#F4F6F9;border-radius:8px;padding:4px;cursor:pointer;font:inherit;font-size:12px}
.pet-grid button svg{height:52px}
.pet-grid button.on{border-color:#1F5FBF;background:#E8F0FC;font-weight:700}
.pet-show{position:fixed;right:10px;bottom:10px;z-index:70;width:30px;height:30px;border-radius:50%;border:1px solid #C9D1DC;background:#fff;cursor:pointer;opacity:.7}
@media print{.pet,.pet-show{display:none!important}}
/* редактор «Сообщить об ошибке» */
.fb{position:fixed;inset:0;z-index:90;background:rgba(27,36,48,.6);display:flex;align-items:center;justify-content:center;padding:12px}
.fb-box{background:#fff;border-radius:10px;width:min(1400px,100%);height:min(940px,100%);display:flex;flex-direction:column;overflow:hidden}
.fb-tools{display:flex;flex-wrap:wrap;gap:6px;align-items:center;padding:8px 10px;border-bottom:1px solid #E6EAF0}
.fb-tools button{border:1px solid #C9D1DC;background:#fff;border-radius:5px;height:30px;padding:0 10px;cursor:pointer;font:inherit}
.fb-tools button.on{background:#1F5FBF;border-color:#1F5FBF;color:#fff;font-weight:600}
.fb-tools button.c i{display:inline-block;width:12px;height:12px;border-radius:50%;margin-right:5px;vertical-align:-1px;border:1px solid #fff}
.fb-sep{width:1px;height:22px;background:#E6EAF0;margin:0 4px}
.fb-stage{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;background:#E9EDF2;padding:2px}
.fb-stage canvas{box-shadow:0 2px 10px rgba(0,0,0,.2);cursor:crosshair;touch-action:none;background:#fff}
.fb-foot{display:flex;gap:10px;padding:10px;border-top:1px solid #E6EAF0;align-items:stretch}
.fb-foot textarea{flex:1;font:inherit;padding:6px 8px;border:1px solid #C9D1DC;border-radius:6px;resize:vertical}
.fb-act{display:flex;flex-direction:column;gap:6px}
.fb-textin{position:fixed;z-index:95;font:600 16px system-ui,Segoe UI,Arial;padding:4px 6px;border:2px solid currentColor;border-radius:4px;min-width:200px}
.toast{position:fixed;right:90px;bottom:20px;z-index:100;background:#1B2430;color:#fff;padding:10px 14px;border-radius:8px;box-shadow:0 6px 20px rgba(0,0,0,.25);max-width:380px}
.toast.bad{background:#7A3306}
.ok{background:#E8F0FC;border:1px solid #1F5FBF;color:#174A94;padding:6px 10px;border-radius:6px;margin:6px 0}
.ver{background:none;border:0;padding:0;font:inherit;color:inherit;text-decoration:underline dotted;cursor:pointer}
.ver-new{background:#E59A2F;color:#1B2430;font-weight:700;font-size:10px;border-radius:8px;padding:1px 6px;margin-left:6px}
.chg-list{margin:0 0 6px 34px;padding-left:16px}
.chg-list li{margin:3px 0}

/* шапка таблиц всегда видна: таблица прокручивается внутри своей рамки */
.scrollbox{overflow:auto;position:relative}
.scrollbox thead th{position:sticky;top:0;z-index:3;background:#fff;box-shadow:inset 0 -2px 0 #D5DCE5}
.scrollbox .g thead th{background:#F7F9FC}
.scrollbox .g thead th.off{background:#E3E6EC}
.scrollbox tfoot td{position:sticky;bottom:0;z-index:2;background:#fff;box-shadow:inset 0 2px 0 #1B2430}

.upl label.btn{position:relative;overflow:hidden;cursor:pointer}
.upl input[type=file]{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
.drop{position:fixed;inset:0;z-index:120;background:rgba(31,95,191,.12);border:4px dashed #1F5FBF;display:flex;align-items:center;justify-content:center;pointer-events:none}
.drop b{background:#fff;color:#1F5FBF;font-size:22px;padding:18px 26px;border-radius:12px;box-shadow:0 10px 30px rgba(0,0,0,.18)}

.side a{display:flex;align-items:center;gap:10px}
.side a .mi{width:20px;height:20px;flex:none;opacity:.9}

/* v0.6.2: полосы и перекрестие во всех таблицах; значки счетов */
.t tbody tr.z:not([style*="background"]):not(.child){background:#F3F5F8}
.t td.xr,.t th.xr{box-shadow:inset 0 2px 0 #2F6FDB,inset 0 -2px 0 #2F6FDB}
.t td.xc,.t th.xc{box-shadow:inset 2px 0 0 #2F6FDB,inset -2px 0 0 #2F6FDB}
.t td.xr.xc{box-shadow:inset 0 0 0 2px #1D4FA8;background:#D6E4FA !important}
.t thead th.xc{background:#E4EDFB !important;box-shadow:inset 2px 0 0 #2F6FDB,inset -2px 0 0 #2F6FDB,inset 0 -2px 0 #D5DCE5}
.t tbody td{cursor:cell}
.t tbody td button,.t tbody td a,.t tbody td input,.t tbody td select{cursor:pointer}
.t tbody td input{cursor:text}
.ab{display:inline-flex;align-items:center;justify-content:center;min-width:22px;height:22px;padding:0 5px;border-radius:11px;
    font:700 10.5px/1 system-ui,sans-serif;letter-spacing:.2px;margin-right:6px;vertical-align:middle;box-shadow:0 1px 2px rgba(0,0,0,.18)}
.ab.ab-s{font-size:9.5px;padding:0 4px}
.ab-cash{background:#3F4A5A;color:#fff;padding:0}
.ab svg{width:14px;height:14px}
.ab-card{display:inline-flex;vertical-align:middle;margin:0 6px 0 -3px;color:#5B6B82}
.ab-card svg{width:15px;height:15px}
.g tbody tr.z td:not(.off):not(.per){background:#F3F5F8}
.g td.xr{box-shadow:inset 0 2px 0 #2F6FDB,inset 0 -2px 0 #2F6FDB}
.g td.xc,.g th.xc{box-shadow:inset 2px 0 0 #2F6FDB,inset -2px 0 0 #2F6FDB}
.g thead th.xc{background:#DCE8FB !important}
.g td.xr.xc{box-shadow:inset 0 0 0 2px #1D4FA8}
.toast.undo{display:flex;gap:10px;align-items:center}
.toast.undo .btn{background:#fff;color:#1B2430}

/* v0.6.3 */
.tip{position:fixed;z-index:200;background:#1B2430;color:#fff;font-size:12px;line-height:16px;padding:6px 9px;border-radius:6px;
     max-width:320px;white-space:pre-line;box-shadow:0 4px 14px rgba(0,0,0,.25);pointer-events:none}
.t.mm td.mmacc{padding-left:0}
.t.mm input.mmi{width:74px}
.mmgrand{display:inline-block;font-size:15px;font-weight:800;color:#0E3A82;background:#E4EDFB;border:2px solid #1F5FBF;
         border-radius:6px;padding:2px 7px;margin:-3px -4px -3px 0}
.pm-add{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border:1px solid #1F5FBF;border-radius:4px;background:#E8F0FC;font:700 15px/1 Inter,sans-serif;color:#1F5FBF;cursor:pointer;padding:0}
@keyframes tfSaved{0%{background:#CFE0FA}100%{background:transparent}}
.t tr.just-saved td{animation:tfSaved 1.6s ease-out}
/* v0.6.5 */
.t tr.fixed td,.t tr.fixed:hover td,.t tbody tr.fixed.z td{background:#1B2430 !important;color:#fff}
.t td.stack div{line-height:18px;white-space:nowrap}
.t input.sal{width:96px;height:24px;text-align:right;font:inherit;padding:0 4px;box-sizing:border-box}
.t .cellbtn{font:inherit;text-align:right}
.tip{max-width:420px}

/* ===================== v0.7.0: телефон (до 760 px) ===================== */
.mbar,.mbar-shade{display:none}
@media (max-width:760px){
  body{font-size:15px}
  .mbar{display:flex;align-items:center;gap:10px;position:sticky;top:0;z-index:60;background:#1B2430;color:#fff;padding:8px 10px;min-height:44px}
  .mbar-menu{width:40px;height:40px;border:1px solid #3A4658;border-radius:8px;background:#263142;color:#fff;font-size:20px;cursor:pointer}
  .mbar-title{font-size:16px;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .mbar-month{font-size:13px;color:#A9B4C4;white-space:nowrap}
  .layout{display:block}
  .side{position:fixed;top:0;left:0;bottom:0;width:min(300px,84vw);z-index:80;overflow-y:auto;transform:translateX(-105%);transition:transform .2s}
  body.menu-open .side{transform:none;box-shadow:0 0 40px rgba(0,0,0,.4)}
  body.menu-open .mbar-shade{display:block;position:fixed;inset:0;z-index:75;background:rgba(0,0,0,.4)}
  .side a{min-height:46px}
  main{padding:8px;gap:10px}
  h1{font-size:19px;margin:4px 0}
  .card{padding:10px;border-radius:10px}
  .row{flex-wrap:wrap}
  .btn{min-height:38px}
  .btn.s{min-height:34px}
  select,input:not([type=checkbox]):not([type=hidden]):not(.mmi):not(.c):not(.sal){min-height:38px;font-size:15px}
  .modal{padding:0;align-items:stretch}
  .modal-box{width:100%;min-height:100%;border-radius:0;padding:14px 12px 80px;box-sizing:border-box}
  .modal-box .fld,.modal-box [data-shares] .fld{grid-template-columns:1fr 80px}
  .modal-box .fld label{grid-column:1 / -1}
  .pet{right:8px;bottom:8px}
  .pet-body{width:44px;height:44px}
  .toast{right:8px;left:8px;bottom:60px;max-width:none}
  .scrollbox{max-height:none!important;overflow:visible}
  .scrollbox thead th{position:static}
  .scrollbox tfoot td{position:static}
  .tip{max-width:92vw}

  /* --- главная --- */
  main > .row > aside,main aside{flex:1 1 100%!important;min-width:0!important}
  main > .row > section,main > .row > div{flex:1 1 100%;min-width:0}
  .t.mm th:nth-child(3),.t.mm th:nth-child(4),.t.mm th:nth-child(6),
  .t.mm tr[data-org] td:nth-child(3),.t.mm tr[data-org] td:nth-child(4),.t.mm tr[data-org] td:nth-child(6),
  .t.mm tfoot td:nth-child(3),.t.mm tfoot td:nth-child(4),.t.mm tfoot td:nth-child(6){display:none}
  .t.mm{font-size:14px}
  .t.mm tr[data-org] td:nth-child(5){font-size:15px}
  .t.mm tr.child:not([hidden]){display:grid;grid-template-columns:1fr 1fr;gap:4px 10px;padding:6px 4px 10px 26px;border-bottom:1px solid #E6EAF0}
  .t.mm tr.child td{border:0;padding:0;display:block;text-align:left}
  .t.mm tr.child td:first-child{display:none}
  .t.mm tr.child td:nth-child(2){grid-column:1 / -1;font-size:14px;color:#1B2430}
  .t.mm tr.child td:nth-child(3)::before{content:"На счёте";display:block;font-size:11px;color:#6B778A}
  .t.mm tr.child td:nth-child(4)::before{content:"Депозит";display:block;font-size:11px;color:#6B778A}
  .t.mm tr.child td:nth-child(5)::before{content:"Всего";display:block;font-size:11px;color:#6B778A}
  .t.mm tr.child td:nth-child(6)::before{content:"На налоги";display:block;font-size:11px;color:#6B778A}
  .t.mm tr.child td:nth-child(5){padding-top:2px;font-weight:700}
  .t.mm input.mmi{width:100%;height:38px;font-size:15px}
  #dirs th:nth-child(4),#dirs th:nth-child(5),#dirs th:nth-child(6),
  #dirs > tbody > tr:not(.child) > td:nth-child(4),#dirs > tbody > tr:not(.child) > td:nth-child(5),#dirs > tbody > tr:not(.child) > td:nth-child(6),
  #dirs tfoot td:nth-child(4),#dirs tfoot td:nth-child(5),#dirs tfoot td:nth-child(6){display:none}
  #dirs td,#dirs th{padding:6px 4px}
  #debts table{max-width:none!important}
  #debts form{flex-wrap:wrap;padding:8px 4px!important;border-bottom:1px solid #E6EAF0}
  #debts form > input[name=object]{flex:1 1 100%!important}
  #debts form > input[name=debt],#debts form > input[name=reserved]{flex:1 1 40%;width:auto!important}
  #debts thead{display:none}
  #debts tfoot div{flex-wrap:wrap}

  /* --- банк: операция — карточка --- */
  #bank-filters,#upload-form{width:100%}
  #bank-filters > select,#bank-filters > input[name=q],#bank-filters .dp{flex:1 1 46%;width:auto!important;min-width:0}
  #bank-filters > input[name=q]{flex-basis:100%}
  #upload-form{margin:0!important}
  #upload-form .btn{flex:1;justify-content:center}
  #bank-sum .card{flex:1 1 44%;min-width:0}
  #bank-sum b{font-size:16px!important}
  #bank thead{display:none}
  #bank,#bank tbody{display:block;width:100%}
  #bank tbody > tr:not(.child){display:grid;grid-template-columns:auto auto 1fr auto auto;
    grid-template-areas:"date org . amt amt" "cp cp cp cp cp" "info info info info info" "art art art type type" "dir dir dir pm ed";
    gap:3px 8px;padding:10px 8px;border-bottom:6px solid #F3F5F8;background:#fff}
  #bank tbody > tr:not(.child) > td{display:block;border:0;padding:0;max-width:none!important}
  #bank td:nth-child(1){grid-area:pm;align-self:end}
  #bank td:nth-child(2){grid-area:date;font-weight:700}
  #bank td:nth-child(3){grid-area:org;color:#4A5668}
  #bank td:nth-child(4){display:none!important}
  #bank td:nth-child(5){grid-area:cp;font-weight:600}
  #bank td:nth-child(6){grid-area:info;font-size:13px}
  #bank td:nth-child(7),#bank td:nth-child(8){grid-area:amt;font-size:16px;text-align:right}
  #bank td:nth-child(7):not(:empty)::before{content:"+ "}
  #bank td:nth-child(8):not(:empty)::before{content:"− "}
  #bank td:nth-child(9){grid-area:type;text-align:right;color:#4A5668;font-size:13px;align-self:center}
  #bank td:nth-child(10){grid-area:art}
  #bank td:nth-child(10):not(:empty)::before{content:"Статья: ";color:#6B778A;font-size:12px}
  #bank td:nth-child(11){grid-area:dir}
  #bank td:nth-child(11):not(:empty)::before{content:"Направление: ";color:#6B778A;font-size:12px}
  #bank td:nth-child(12){grid-area:ed;align-self:end}
  #bank .pick{min-height:32px;text-align:left}
  #bank tr.child:not([hidden]){display:block;padding:0 8px 10px;background:#fff;border-bottom:6px solid #F3F5F8;margin-top:-6px}
  #bank tr.child td{display:block;border:0;padding:0;font-size:13px}
  #bank tr.child td:first-child{display:none}
  #bank tfoot{display:block}
}
.mlbl{display:none}
.tsm{display:none}
@media (max-width:760px){
  .modal{z-index:90}
  .mlbl{display:inline;font-size:12px;color:#6B778A;font-weight:400}
  #debts form{display:grid!important;grid-template-columns:1fr 1fr;gap:4px 8px!important}
  #debts form > input[name=object]{grid-column:1 / -1}
  #debts form > label.mlbl{display:block;margin-bottom:-2px}
  #debts form > label.mlbl:nth-of-type(1){grid-column:1;grid-row:2}
  #debts form > label.mlbl:nth-of-type(2){grid-column:2;grid-row:2}
  #debts form > input[name=debt]{grid-column:1;grid-row:3;width:100%!important}
  #debts form > input[name=reserved]{grid-column:2;grid-row:3;width:100%!important}
  #debts form > .dleft{grid-column:1;width:auto!important;text-align:left!important;align-self:center}
  #debts form > span:has(.dp){grid-column:2;width:auto!important}
  #debts form > span:last-child{grid-column:1 / -1;width:auto!important}
  #debts tr#debt-new form > span:empty{display:none}
  #debts .dtot{display:grid!important;grid-template-columns:1fr 1fr}
  #debts .dtot span{width:auto!important;text-align:left!important}
  /* деньги на утро — блоками */
  .t.mm,.t.mm tbody,.t.mm tfoot{display:block;width:100%}
  .t.mm thead{display:none}
  .t.mm tr[data-org],.t.mm tfoot tr{display:grid;grid-template-columns:34px 1fr auto;align-items:center;border-bottom:1px solid #E6EAF0;padding:4px 0}
  .t.mm tr[data-org] td,.t.mm tfoot td{border:0;padding:2px 4px}
  .t.mm tr.child:not([hidden]){padding-left:34px}
  .t.mm tr.child td:nth-child(2){display:flex!important;align-items:center;flex-wrap:wrap;gap:0 4px}
  .t.mm tr.child td .stale{display:inline;margin-left:6px}
  /* направления — по ширине экрана */
  #dirs{table-layout:fixed;width:100%;font-size:13.5px}
  #dirs th:nth-child(1){width:32px}
  #dirs th:nth-child(3),#dirs th:nth-child(7){width:31%}
  #dirs > tbody > tr > td{overflow-wrap:anywhere}
  /* банк — мелочи */
  #bank-sum .card b{display:block}
  #bank-area .card > .muted:first-child{display:none}
  #bank td:nth-child(1),#bank td:nth-child(12){align-self:center}
  #bank .pm{width:34px;height:34px}
}
@media (max-width:760px){
  .deskonly{display:none}
  #dirs > tbody > tr:not(.child) > td:nth-child(2){overflow-wrap:normal;word-break:normal;hyphens:auto}
}
@media (max-width:760px){
  /* --- касса --- */
  form.quick{flex:1 1 100%!important}
  form.quick .row > label,form.quick > label{flex:1 1 100%}
  form.quick select,form.quick input[name=amount],form.quick input[name=comment],form.quick input[name^=pct]{width:100%!important;box-sizing:border-box}
  form.quick label:has(input[name^=pct]){flex:0 0 30%}
  form.quick label:has(select[name^=direction]){flex:1 1 60%}
  form.quick .btn.p{height:auto!important;min-height:44px;flex:1 1 100%}
  form.quick .row > .muted{flex:1 1 100%}
  #cash-filters > select,#cash-filters .dp{flex:1 1 46%;width:auto!important;min-width:0}
  #cash-filters > input[name=q]{flex:1 1 100%;width:auto!important}
  #cash-sum .card{flex:1 1 44%;min-width:0}
  #cash-sum b{display:block;font-size:16px!important}
  #cash-area .card > .muted:first-child,#cash-area .card > .row:first-child > .muted{font-size:13px}
  #cash thead{display:none}
  #cash,#cash tbody{display:block;width:100%}
  #cash tbody > tr{display:grid;grid-template-columns:auto 1fr auto;
    grid-template-areas:"date box amt" "type type type" "cm cm cm" "art art art" "dir dir del" "per per per";
    gap:3px 8px;padding:10px 8px;border-bottom:6px solid #F3F5F8;background:#fff}
  #cash tbody > tr > td{display:block;border:0;padding:0;max-width:none!important}
  #cash td:nth-child(1){grid-area:date;font-weight:700}
  #cash td:nth-child(2){grid-area:box;color:#4A5668}
  #cash td:nth-child(3){grid-area:type;font-size:13px;color:#4A5668}
  #cash td:nth-child(4){grid-area:cm}
  #cash td:nth-child(5){grid-area:art}
  #cash td:nth-child(5):not(:empty)::before{content:"Статья: ";color:#6B778A;font-size:12px}
  #cash td:nth-child(6){grid-area:dir}
  #cash td:nth-child(6):not(:empty)::before{content:"Направление: ";color:#6B778A;font-size:12px}
  #cash td:nth-child(7){grid-area:per;font-size:12px;color:#6B778A}
  #cash td:nth-child(7):not(:empty)::before{content:"Период: "}
  #cash td:nth-child(8),#cash td:nth-child(9){grid-area:amt;font-size:16px;text-align:right}
  #cash td:nth-child(8):not(:empty)::before{content:"+ "}
  #cash td:nth-child(9):not(:empty)::before{content:"− "}
  #cash td:nth-child(10){grid-area:del;align-self:end}
  #cash .pick{min-height:32px;text-align:left}
  #cash tfoot{display:block}
  details table.t th:nth-child(2),details table.t th:nth-child(3),details table.t th:nth-child(4),
  details table.t td:nth-child(2),details table.t td:nth-child(3),details table.t td:nth-child(4){display:none}
  details{flex:1 1 100%!important}

  /* --- табель: на телефоне — сотрудник и список дней --- */
  .tsm{display:block}
  #grid{display:none}
  #grid + *{display:none}
  #panel #p-help,#panel #p-sel{display:none!important}
  .tsm-tot{display:flex;flex-wrap:wrap;gap:4px 12px;margin:8px 0;font-size:13px}
  .tsm-head,.tsm-day{display:grid;grid-template-columns:46px repeat(5,1fr);gap:4px;align-items:center}
  .tsm-head{font-size:11px;color:#6B778A;text-align:center;position:sticky;top:44px;background:#fff;padding:4px 0;z-index:5}
  .tsm-day{padding:3px 0;border-bottom:1px solid #EEF1F5}
  .tsm-day.off{background:#E9ECF1}
  .tsm-day b{font-size:15px}
  .tsm-day small{display:block;font-weight:400;font-size:11px;color:#6B778A}
  .tsm-day input.c{width:100%;height:40px;box-sizing:border-box;text-align:center;font-size:16px;border:1px solid #C9D1DC;border-radius:6px;background:#fff}
  .tsm-day input.c.bad{border-color:#B54708;background:#FFF4E5}
  .tsm-day input.c.saved{border-color:#1F5FBF;background:#E8F0FC}
  .tsm-day .per{grid-column:span 5;text-align:center;color:#1F5FBF;font-weight:700;font-size:12px}

  /* --- зарплата: сотрудник — карточка --- */
  form[action="/payroll/settings"] label{flex:1 1 30%}
  form[action="/payroll/settings"] input{width:100%!important;box-sizing:border-box}
  #pay thead{display:none}
  #pay,#pay tbody,#pay tfoot{display:block;width:100%}
  #pay tr.fixed{display:block;padding:8px;border-radius:6px;margin-top:8px}
  #pay tr.fixed td{display:inline-block;border:0;padding:0 6px 0 0;background:transparent!important}
  #pay tr.fixed td:nth-child(n+2):nth-child(-n+4){display:none}
  #pay tr.fixed{background:#1B2430}
  #pay tr.fixed td:nth-child(6)::before{content:"к выдаче ";font-weight:400;opacity:.8}
  #pay tbody > tr[id]{display:grid;grid-template-columns:1fr 1fr;gap:4px 10px;padding:10px 8px;border-bottom:6px solid #F3F5F8;background:#fff}
  #pay tbody > tr[id] > td{display:block;border:0;padding:0;text-align:left;max-width:none!important}
  #pay tbody > tr[id] > td:nth-child(1){display:none}
  #pay tbody > tr[id] > td:nth-child(2){grid-column:1 / -1;font-size:16px}
  #pay tbody > tr[id] > td:nth-child(3){display:none}
  #pay tbody > tr[id] > td:nth-child(4){grid-column:1 / -1;font-size:13px}
  #pay tbody > tr[id] > td:nth-child(n+5)::before{display:block;font-size:11px;color:#6B778A;font-weight:400}
  #pay tbody > tr[id] > td:nth-child(5)::before{content:"Оклад"}
  #pay tbody > tr[id] > td:nth-child(6)::before{content:"Ставка ч"}
  #pay tbody > tr[id] > td:nth-child(7)::before{content:"Часы"}
  #pay tbody > tr[id] > td:nth-child(8)::before{content:"Начислено"}
  #pay tbody > tr[id] > td:nth-child(9)::before{content:"Доплаты"}
  #pay tbody > tr[id] > td:nth-child(10)::before{content:"Итог ЗП"}
  #pay tbody > tr[id] > td:nth-child(11)::before{content:"НДФЛ"}
  #pay tbody > tr[id] > td:nth-child(12)::before{content:"Удержания"}
  #pay tbody > tr[id] > td:nth-child(13)::before{content:"На карту"}
  #pay tbody > tr[id] > td:nth-child(14)::before{content:"К выдаче"}
  #pay tbody > tr[id] > td:nth-child(14){font-size:18px}
  #pay tbody > tr[id] > td:nth-child(15){grid-column:1 / -1}
  #pay tbody > tr[id] > td:nth-child(7) div{display:inline;margin-right:8px}
  #pay input.sal{width:100%;height:38px;font-size:15px;text-align:left}
  #pay .cellbtn{text-align:left;min-height:30px}
  #pay tr.child:not([hidden]){display:block;padding:8px;background:#fff;margin-top:-6px;border-bottom:6px solid #F3F5F8}
  #pay tr.child td{display:block;border:0;padding:0}
  #pay tr.child td:first-child{display:none}
  #pay tfoot tr{display:grid;grid-template-columns:1fr 1fr;padding:8px;gap:4px}
  #pay tfoot td{border:0;padding:0;text-align:left}
  #pay tfoot td:first-child,#pay tfoot td:last-child{display:none}
  #pay tfoot td:nth-child(2){grid-column:1 / -1}
  #pay tfoot td:nth-child(3)::before{content:"Итог ЗП ";font-weight:400}
  #pay tfoot td:nth-child(4)::before{content:"НДФЛ ";font-weight:400}
  #pay tfoot td:nth-child(5)::before{content:"Удержания ";font-weight:400}
  #pay tfoot td:nth-child(6)::before{content:"На карту ";font-weight:400}
  #pay tfoot td:nth-child(7)::before{content:"К выдаче ";font-weight:400}
}
@media (max-width:760px){
  #pay tbody > tr[id] > td:nth-child(1){display:block!important;order:98;grid-column:auto}
  #pay tbody > tr[id] > td:nth-child(15){order:99;grid-column:auto;align-self:center}
  #pay tbody > tr[id] > td:nth-child(1) .pm{width:34px;height:34px}
}
@media (max-width:760px){
  form.quick .row > label.btn{flex:1 1 28%;justify-content:center;text-align:center}
  #pay tr.fixed td:nth-child(5){display:none}
  main > .row > h1{flex:1 1 100%!important}
  #panel:has(#p-msg:empty){display:none}
  #panel #p-who,#panel #p-info{display:none}
}
@media (max-width:760px){
  .scrollbox{overflow-x:auto!important;overflow-y:visible}
  .card:not(.tsm):not(#mm){overflow-x:auto}
  .card > .t,.scrollbox > .t{min-width:100%}
  #hist th:nth-child(2),#hist td:nth-child(2){display:none}
  #hist td{min-width:90px}
  #hist td:nth-child(5),#hist td:nth-child(6){min-width:200px}
  main > .card[style*="display:flex"]{flex-direction:column}
  main > .card[style*="display:flex"] img{width:100%!important}
  .dict-tabs,.tabs{flex-wrap:wrap}
}

.mobonly,.mobonly-t{display:none}
@media (max-width:760px){
  .mobonly{display:inline}
  table.mobonly-t{display:table;width:100%}
  table.deskonly-t{display:none!important}
  .t.mm input.mmi{display:none}
  .t.mm tr.child td .mobonly{display:block;font-size:15px;font-weight:600}
  .t.mm tr.child td:nth-child(5){font-weight:700}
  /* «На налоги» у юрлица и в итоге */
  .t.mm tr[data-org] td:nth-child(6),.t.mm tfoot td:nth-child(6){display:block!important;font-size:12px;color:#4A5668;text-align:right}
  .t.mm tr[data-org] td:nth-child(6)::before,.t.mm tfoot td:nth-child(6)::before{content:"на налоги ";color:#6B778A}
  .t.mm tr[data-org],.t.mm tfoot tr{grid-template-columns:34px 1fr auto}
  .t.mm tr[data-org] td:nth-child(6),.t.mm tfoot td:nth-child(6){grid-column:2 / -1}
  .t.mm tfoot td:nth-child(1){display:block}
  /* итог за месяц — по ширине экрана */
  .card.itog{overflow-x:visible}
  .card.itog .t{width:100%;table-layout:fixed}
  .card.itog .t td:first-child{white-space:normal;overflow-wrap:break-word}
  .card.itog .t td.n{width:42%;white-space:nowrap}
  /* направления: раскрытие */
  #dirs > tbody > tr.child > td:first-child{display:none}
  #dirs > tbody > tr.child > td:nth-child(2){padding:6px 0}
  #dirs tr.child .row > div{flex:1 1 100%!important}
  #dirs tr.child .t{width:100%;table-layout:auto;font-size:12px}
  #dirs tr.child .t td{display:table-cell!important;overflow-wrap:anywhere;white-space:normal;padding:3px 4px}
  #dirs tr.child .t td:nth-child(3){display:none!important}
  #debts .mobonly-t td:first-child{white-space:normal}
}
@media (max-width:760px){
  #dirs{table-layout:auto!important}
  #dirs th:nth-child(1){width:auto}
  #dirs th:nth-child(3),#dirs th:nth-child(7){width:auto}
  #dirs > tbody > tr:not(.child) > td.n,#dirs tfoot td.n{white-space:nowrap}
  #dirs > tbody > tr:not(.child) > td:nth-child(2){hyphens:manual}
  #dirs tr.child .t td.n{white-space:nowrap}
}
@media (max-width:760px){
  #dirs tr.child .row{width:calc(100vw - 48px);max-width:calc(100vw - 48px)}
  #dirs tr.child .t{table-layout:auto!important}
  #dirs tr.child .t td:first-child{width:38px}
  #dirs tr.child .t td.n{width:86px}
  #dirs tr.child .t td{max-width:none!important}
}
@media (max-width:760px){
  #dirs{font-size:12.5px}
  #dirs th{white-space:normal;font-size:10px}
  #dirs td,#dirs th{padding:5px 3px!important}
  #dirs .pm{width:22px;height:22px}
}
@media (max-width:760px){
  #dirs tfoot td{font-size:13px!important}
  #dirs > tbody > tr:not(.child) > td:nth-child(2),#dirs tfoot td:nth-child(2){overflow-wrap:anywhere}
}
@media (max-width:760px){ #debts table.mobonly-t thead{display:table-header-group} }
/* v0.8.0: «Смотреть как…» */
.viewas{display:flex;flex-wrap:wrap;gap:8px;align-items:center;font-size:13px;color:#4A5668;margin:-4px 0 2px}
.viewas select{height:28px;max-width:260px}
.viewas.on{background:#FFF1E0;border:2px solid #B54708;color:#7A3205;border-radius:8px;padding:8px 10px;font-size:14px;margin:0}
@media (max-width:760px){.viewas{font-size:14px}.viewas select{height:38px;max-width:100%;flex:1}.viewas label{display:flex;gap:6px;align-items:center;width:100%}}
.sw{display:inline-flex;gap:4px;align-items:center;cursor:pointer}
.sw input{width:18px;height:18px}
.sw span{font-size:12px;color:#4A5668}
details.rem summary{cursor:pointer;padding:2px 0}
.remf{display:flex;flex-direction:column;gap:8px;margin-top:8px}
.remf label.day,.remf .day{display:inline-flex;gap:3px;align-items:center;margin-right:8px;white-space:nowrap}
