:root{
  color-scheme:light;
  --bg1:#f4f0e8;
  --bg2:#e8e1d6;
  --bg3:#dfe6e2;
  --card:#fbfaf7;
  --solid:#fffdf9;
  --tx:#202522;
  --mut:#68706c;
  --bd:#d5d3ca;
  --ac:#a45d35;
  --onac:#fffaf4;
  --hi:#b8443d;
  --mid:#a87318;
  --low:#27745a;
  --ok:#27745a;
  --bad:#b8443d;
  --warn:#9b641d;
  --chip:#ebe7de;
  --or:#a45d35;
  --bl:#55758a;
  --sh:0 14px 38px rgba(38,34,27,.075);
  --font-base:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;
  --font-display:"Iowan Old Style",Baskerville,Georgia,"Times New Roman",serif;
  --obj-d2:#a45d35;
  --obj-sk:#55758a;
  --obj-p2:#27745a;
  --obj-p3:#a87318;
}

:root[data-theme="light"]{
  color-scheme:light;
  --bg1:#f4f0e8;
  --bg2:#e8e1d6;
  --bg3:#dfe6e2;
  --card:#fbfaf7;
  --solid:#fffdf9;
  --tx:#202522;
  --mut:#68706c;
  --bd:#d5d3ca;
  --ac:#a45d35;
  --onac:#fffaf4;
  --hi:#b8443d;
  --mid:#a87318;
  --low:#27745a;
  --ok:#27745a;
  --bad:#b8443d;
  --warn:#9b641d;
  --chip:#ebe7de;
  --sh:0 14px 38px rgba(38,34,27,.075);
  --obj-d2:#a45d35;
  --obj-sk:#55758a;
  --obj-p2:#27745a;
  --obj-p3:#a87318;
}

:root[data-theme="dark"]{
  color-scheme:dark;
  --bg1:#171a18;
  --bg2:#222823;
  --bg3:#20282b;
  --card:#202420;
  --solid:#252a25;
  --tx:#f2efe8;
  --mut:#aab0a8;
  --bd:#414841;
  --ac:#ca8050;
  --onac:#171a18;
  --hi:#e06d63;
  --mid:#d2a04b;
  --low:#65b38d;
  --ok:#65b38d;
  --bad:#e06d63;
  --warn:#d2a04b;
  --chip:#303630;
  --sh:0 18px 46px rgba(0,0,0,.28);
  --obj-d2:#d18a59;
  --obj-sk:#83a8ba;
  --obj-p2:#65b38d;
  --obj-p3:#d2a04b;
}

@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]):not([data-theme="dark"]){
    color-scheme:dark;
    --bg1:#171a18;
    --bg2:#222823;
    --bg3:#20282b;
    --card:#202420;
    --solid:#252a25;
    --tx:#f2efe8;
    --mut:#aab0a8;
    --bd:#414841;
    --ac:#ca8050;
    --onac:#171a18;
    --hi:#e06d63;
    --mid:#d2a04b;
    --low:#65b38d;
    --ok:#65b38d;
    --bad:#e06d63;
    --warn:#d2a04b;
    --chip:#303630;
    --sh:0 18px 46px rgba(0,0,0,.28);
    --obj-d2:#d18a59;
    --obj-sk:#83a8ba;
    --obj-p2:#65b38d;
    --obj-p3:#d2a04b;
  }
}

*,
*::before,
*::after{box-sizing:border-box}

html{
  min-width:320px;
  background:var(--bg1);
  scroll-behavior:smooth;
}

body{
  min-width:320px;
  max-width:100%;
  margin:0;
  overflow-x:hidden;
  color:var(--tx);
  background:
    linear-gradient(180deg,var(--bg1) 0,var(--bg1) 72%,var(--bg2) 100%);
  font:15px/1.5 var(--font-base);
  letter-spacing:.005em;
}

button,
input,
select,
textarea{font:inherit}

button,
input,
select,
textarea{
  max-width:100%;
  color:var(--tx);
  background:var(--solid);
  border:1px solid var(--bd);
  border-radius:9px;
}

button,
input,
select{min-height:44px}

button{
  padding:9px 15px;
  cursor:pointer;
  transition:
    background-color 200ms ease,
    border-color 200ms ease,
    color 200ms ease,
    box-shadow 200ms ease,
    transform 180ms ease;
}

button:hover{
  border-color:var(--ac);
  box-shadow:0 4px 12px rgba(38,34,27,.09);
}

button:active{transform:translateY(1px)}

button.on,
.pri{
  color:var(--onac);
  background:var(--ac);
  border-color:var(--ac);
}

input,
select{padding:9px 12px}

textarea{
  padding:11px 13px;
  line-height:1.45;
  resize:vertical;
}

::placeholder{
  color:var(--mut);
  opacity:.8;
}

:focus-visible{
  outline:2px solid var(--ac);
  outline-offset:3px;
}

.hid{display:none!important}

.w{
  width:min(1180px,100%);
  margin:0 auto;
  padding:28px 22px 72px;
}

.g{
  position:relative;
  border:1px solid var(--bd);
  border-radius:14px;
  background:var(--card);
  box-shadow:var(--sh);
}

.g::before{display:none}

header{
  display:block;
  width:100%;
  margin:0 0 24px;
  padding:0 2px 18px;
  border-bottom:1px solid var(--bd);
}

header>div:first-child{
  display:block;
  width:100%;
  min-width:0;
  margin:0 0 16px;
}

header>div:last-child{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  flex-wrap:wrap;
  gap:8px;
  width:100%;
  min-width:0;
}

header>div:last-child>#objSwitch{
  order:-1;
  flex:0 0 100%;
  width:100%;
  max-width:100%;
  margin:0 0 4px;
}

#hi{
  margin:0 0 6px;
  color:var(--mut);
  font-size:11px;
  font-weight:700;
  letter-spacing:.13em;
  text-transform:uppercase;
}

#hi b{
  display:block;
  color:var(--tx);
  font-size:11px;
  font-weight:700;
}

h1{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
  margin:0;
  overflow-wrap:anywhere;
  color:var(--tx);
  font:600 clamp(30px,5vw,48px)/1.04 var(--font-display);
  letter-spacing:-.04em;
}

h1 svg{
  width:30px;
  height:30px;
  flex:none;
}

h1[data-obj="Дом 2"]{color:var(--obj-d2)}
h1[data-obj="Сколково"]{color:var(--obj-sk)}
h1[data-obj="Переделкино-2"]{color:var(--obj-p2)}
h1[data-obj="Переделкино-3"]{color:var(--obj-p3)}

#objSwitch{
  display:flex;
  flex-direction:row;
  flex-wrap:nowrap;
  align-items:stretch;
  gap:4px;
  padding:4px;
  border:1px solid var(--bd);
  border-radius:10px;
  background:var(--chip);
}

#objSwitch button{
  flex:1 1 0;
  min-width:0;
  min-height:40px;
  padding:8px 12px;
  overflow:hidden;
  border:0;
  border-radius:7px;
  background:transparent;
  color:var(--mut);
  font-size:12px;
  font-weight:750;
  text-overflow:ellipsis;
  white-space:nowrap;
}

#objSwitch button:hover{
  color:var(--tx);
  box-shadow:none;
}

#objSwitch button.on{
  color:var(--tx);
  background:var(--solid);
  box-shadow:0 2px 8px rgba(38,34,27,.12);
}

#objSwitch button svg{
  width:16px;
  height:16px;
}

#logout{
  min-height:44px;
  font-size:13px;
}

#addTask{font-weight:750}
#lang,
#th{
  min-width:44px;
  padding-inline:11px;
}

.sum{
  display:grid;
  grid-template-columns:minmax(180px,.8fr) minmax(0,2fr);
  gap:18px;
  margin:0 0 14px;
  padding:18px;
}

.gauge{
  min-height:170px;
  padding:4px 10px;
  border-right:1px solid var(--bd);
}

.gauge svg{
  width:min(150px,100%);
  max-height:120px;
}

.gauge b{
  margin-top:2px;
  font-size:34px;
  letter-spacing:-.05em;
}

.gauge span{
  margin-top:2px;
  color:var(--mut);
  font-size:11px;
}

.gb{stroke:var(--chip)}
.gf{
  stroke:var(--ac);
  transition:stroke-dasharray 220ms ease;
}

.tiles{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
}

.kpi{
  min-height:104px;
  padding:13px;
  border:1px solid var(--bd);
  border-radius:10px;
  background:var(--solid);
}

.kpi b{
  font-size:27px;
  letter-spacing:-.045em;
}

.kpi span,
.kh{
  color:var(--mut);
  font-size:11px;
}

.kpi .mb{
  height:4px;
  background:var(--chip);
}

.kpi .mb i{background:var(--ac)}

.kpi.on{
  color:var(--onac);
  background:var(--ac);
  border-color:var(--ac);
}

.kpi.on span,
.kpi.on .kh{color:inherit}

.kpi.on .mb{background:rgba(255,255,255,.3)}
.kpi.on .mb i{background:currentColor}

.row2{
  display:grid;
  grid-template-columns:1.15fr .85fr;
  gap:14px;
  margin:0 0 16px;
}

.pan{padding:17px}

.ph{
  margin-bottom:13px;
  padding-bottom:10px;
  border-bottom:1px solid var(--bd);
}

.ph b{
  font-size:14px;
  letter-spacing:.02em;
}

.ph span{
  color:var(--mut);
  font-size:11px;
}

.segs{gap:10px 7px}
.sg{min-width:76px}
.sb{height:25px}
.sb i{
  border-radius:2px;
  background:var(--bl);
}

.lgd{
  margin-top:12px;
  font-size:11px;
}

.tabs{
  display:flex;
  gap:4px;
  width:max-content;
  max-width:100%;
  margin:0 0 13px;
  padding:4px;
  overflow:auto hidden;
  border-radius:9px;
  box-shadow:none;
}

.tabs button{
  min-height:40px;
  border:0;
  border-radius:6px;
  background:transparent;
  font-weight:700;
  white-space:nowrap;
}

.tabs button.on{
  color:var(--solid);
  background:var(--tx);
}

.stk{
  position:sticky;
  top:8px;
  z-index:5;
  margin-bottom:12px;
  padding:12px;
  background:var(--card);
}

.fl{
  display:grid;
  grid-template-columns:minmax(180px,2fr) repeat(3,minmax(105px,1fr));
  gap:7px;
}

.fl input,
.fl select{min-width:0}

#chips{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:9px;
}

.c{
  position:relative;
  margin:10px 0;
  overflow:hidden;
  border-radius:12px;
  box-shadow:0 5px 17px rgba(38,34,27,.055);
}

.c::before{
  width:4px;
  border-radius:0;
}

.c>summary{padding:14px 16px 14px 19px}

.id{
  padding:3px 8px;
  border-radius:5px;
  background:var(--chip);
  font-size:11px;
}

.t{font-weight:750}
.z{
  color:var(--mut);
  font-size:12px;
}

.b{
  border-radius:5px;
  font-size:11px;
}

.dn{
  min-height:44px;
  padding:7px 13px;
  border-radius:8px;
}

.bd{
  padding:10px 16px 16px 19px;
  border-top:1px solid var(--bd);
}

.bd dt{
  color:var(--mut);
  font-size:11px;
}

.bd dd{margin-bottom:5px}

.pills{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

.pp{
  min-height:40px;
  border-radius:7px;
}

.acts{
  display:flex;
  flex-wrap:wrap;
  gap:7px;
}

.acts button{min-height:44px}

.note{
  color:var(--mut);
  font-size:12px;
}

.note.pend{
  color:#634b12;
  background:#f1e0a9;
  border-color:#c7a84e;
}

.gh{
  margin:24px 3px 6px;
  font-size:15px;
}

.gh span{
  color:var(--mut);
  font-size:12px;
}

#v2{
  padding:17px;
  overflow:hidden;
}

#v2 #buy,
#team .tw{
  display:block;
  width:100%;
  max-width:100%;
  overflow-x:auto;
  overscroll-behavior-inline:contain;
  -webkit-overflow-scrolling:touch;
}

table{
  min-width:560px;
  border-collapse:collapse;
}

th{
  color:var(--mut);
  font-size:11px;
  font-weight:750;
  letter-spacing:.04em;
  text-transform:uppercase;
}

td,
th{
  padding:10px 8px;
  border-bottom:1px solid var(--bd);
  text-align:left;
}

#team table{min-width:410px}
#team td,
#team th{font-size:12px}

.cp{
  min-height:44px;
  border-radius:8px;
  font-weight:750;
}

.info{
  min-width:44px;
  border-radius:50%;
}

#foot.show{
  display:block;
  margin-top:24px;
}

dialog{
  width:min(720px,calc(100vw - 28px));
  max-width:calc(100vw - 20px);
  max-height:90vh;
  padding:0;
  overflow:hidden;
  color:var(--tx);
  background:var(--solid);
  border:1px solid var(--bd);
  border-radius:14px;
  box-shadow:0 25px 80px rgba(0,0,0,.25);
}

dialog::backdrop{background:rgba(20,24,21,.52)}

dialog form{
  max-height:90vh;
  overflow:auto;
}

dialog h2{
  margin:0;
  padding:20px 24px 12px;
  font:22px/1.2 var(--font-display);
}

.mf{
  display:grid;
  padding:11px 24px;
  gap:15px;
}

.ff{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.ff label,
.ff .lb{
  color:var(--mut);
  font-size:11px;
  font-weight:750;
  letter-spacing:.03em;
}

.ff input:not([type="checkbox"]),
.ff select,
.ff textarea{
  width:100%;
  border-radius:8px;
}

.ma{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  padding:14px 24px 18px;
  border-top:1px solid var(--bd);
}

#loginScreen{
  min-height:100vh;
  background:var(--bg1);
}

#loginBox{
  width:min(410px,calc(100vw - 30px));
  padding:34px;
  border:1px solid var(--bd);
  border-radius:14px;
  background:var(--solid);
  box-shadow:var(--sh);
}

#loginBox h2{
  margin:0 0 25px;
  color:var(--tx);
  font:28px/1.2 var(--font-display);
}

#loginBox input{
  width:100%;
  border-radius:8px;
}

#loginBox button{
  width:100%;
  border-radius:8px;
}

#toast{
  max-width:min(420px,calc(100vw - 24px));
}

@media (max-width:800px){
  .w{padding:20px 14px 60px}

  .sum{
    grid-template-columns:1fr;
    gap:14px;
  }

  .gauge{
    min-height:0;
    padding:0 0 15px;
    border-right:0;
    border-bottom:1px solid var(--bd);
  }

  .gauge svg{
    width:118px;
    max-height:92px;
  }

  .row2{grid-template-columns:1fr}

  .fl{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .fl input{grid-column:1/-1}
}

@media (max-width:520px){
  body{font-size:14px}

  .w{
    width:100%;
    padding:14px 10px 52px;
  }

  header{
    margin-bottom:18px;
    padding-bottom:15px;
  }

  header>div:first-child{
    margin-bottom:13px;
  }

  h1{
    font-size:29px;
    line-height:1.06;
  }

  header>div:last-child{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:7px;
  }

  header>div:last-child>#objSwitch{
    grid-column:1/-1;
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:4px;
    width:100%;
    margin:0 0 1px;
  }

  #objSwitch button{
    flex:none;
    width:100%;
    min-width:0;
    padding-inline:5px;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  #addTask{
    grid-column:1/-1;
    width:100%;
    margin:0!important;
  }

  #lang,
  #th,
  #logout{
    width:100%;
    margin:0;
  }

  .sum{
    gap:13px;
    padding:13px;
  }

  .tiles{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:7px;
  }

  .kpi{
    min-height:91px;
    padding:11px;
  }

  .kpi b{font-size:24px}

  .fl{
    grid-template-columns:1fr;
  }

  .fl input{grid-column:auto}

  .stk{padding:9px}

  .c>summary{
    padding:13px 12px 13px 17px;
  }

  .t{flex-basis:100%}

  .dn{
    width:100%;
  }

  .bd{
    padding-right:12px;
    padding-left:17px;
  }

  .tabs{
    width:100%;
  }

  .tabs button{
    flex:1 1 0;
  }

  #v2{padding:13px}

  dialog{
    width:calc(100vw - 20px);
    max-width:calc(100vw - 20px);
  }

  dialog h2{
    padding:18px 17px 10px;
  }

  .mf{padding:10px 17px}

  .ma{
    padding:12px 17px 15px;
  }

  .ma button{
    flex:1 1 120px;
  }

  #loginBox{
    padding:28px 20px;
  }
}

@media (max-width:374px){
  .w{padding-inline:8px}

  h1{font-size:27px}

  #objSwitch button{
    font-size:11px;
  }

  .kpi b{font-size:22px}
}

@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto!important}

  *,
  *::before,
  *::after{
    animation-duration:.01ms!important;
    animation-iteration-count:1!important;
    scroll-behavior:auto!important;
    transition-duration:.01ms!important;
  }
}

@media print{
  body{
    color:#000;
    background:#fff;
  }

  .w{
    width:100%;
    padding:0;
  }

  .g{
    background:#fff;
    box-shadow:none;
  }

  header{border-bottom:1px solid #999}

  .row2,
  .stk,
  #chips,
  .tabs,
  #th,
  #lang,
  .dn,
  .acts,
  .pills,
  #info,
  dialog,
  #toast,
  #objSwitch{
    display:none!important;
  }

  .c{break-inside:avoid}
}
@keyframes rise-in{
  from{opacity:0;transform:translateY(6px)}
  to{opacity:1;transform:none}
}

.w{
  animation:rise-in 220ms ease-out both;
}

.row2{
  grid-template-columns:minmax(0,1.15fr) minmax(0,.85fr);
}

.row2>*,
.sum>*,
.tiles>*,
.fl>*{
  min-width:0;
}

#v2,
#team,
#prog{
  min-width:0;
}

#v2 #buy,
#team .tw{
  min-width:0;
  max-width:100%;
  overflow:auto;
  overscroll-behavior:contain;
}

@media (max-width:600px){
  header>div:last-child{
    gap:5px;
  }

  header>div:last-child>#objSwitch{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:3px;
  }

  #objSwitch button{
    min-height:36px;
    padding:5px 4px;
    overflow:visible;
    font-size:11px;
    line-height:1.15;
    text-overflow:clip;
    white-space:normal;
  }

  #addTask,
  #lang,
  #th,
  #logout{
    min-height:36px;
    padding:6px 9px;
  }

  #addTask{
    font-size:14px!important;
    padding:6px 10px!important;
  }

  .gauge{
    display:grid;
    grid-template-columns:auto 1fr;
    align-items:center;
    column-gap:10px;
    padding:0 0 10px;
  }

  .gauge svg{
    display:none;
  }

  .gauge b{
    margin:0;
    font-size:36px;
    line-height:1;
  }

  .gauge span{
    margin:0;
    line-height:1.2;
  }

  .gauge .smalllegend,
  .gauge .glg{
    grid-column:1/-1;
  }

  .smalllegend,
  .gauge .smalllegend{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:4px 8px;
    margin-top:7px;
  }

  .glg{
    min-width:0;
    display:flex;
    align-items:baseline;
    gap:4px;
    white-space:nowrap;
  }

  .glg b{
    font-size:16px;
    line-height:1.1;
  }

  .glg span{
    font-size:10px;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  #team .tw,
  #v2 #buy{
    scrollbar-width:thin;
  }
}/* Coordinator integration fixes: measured 375px label overflow and touch target floor. */
.ph{flex-wrap:wrap;gap:6px}.ph>*{min-width:0;max-width:100%;white-space:normal}
#objSwitch button{min-height:44px}
.glg li{gap:4px}.glg li b{margin-left:4px}
