/* UNFRM CRM — светлый «воздушный» стиль: мягкий фон, белые скруглённые карточки, чёрные пилюли, оранжевый акцент */
:root {
  --bg: #EEEEEA; --panel: #FFFFFF; --panel-2: #F6F6F3; --ink: #121212; --muted: #7A7A75; --line: #E6E5E0;
  --accent: #FF5100; --accent-ink: #121212; --accent-soft: #FFE3D3;
  --lime: #D8F64B; --dark: #161616; --dark-ink: #F5F5F2;
  --good: #158A43; --bad: #D92D20; --warn: #B76E00;
  --good-bg: #E3F6E8; --bad-bg: #FDE8E6; --warn-bg: #FFF1D6;
  /* пастель этапов — как карточки в референсе Salesforce */
  --s0: #FFFFFF; --s1: #FFF4C7; --s2: #FFE3D3; --s3: #ECE6FF; --s4: #DDEBFF; --s5: #DDF5E3;
  --s0-ink: #5F6168; --s1-ink: #8A6400; --s2-ink: #A6431A; --s3-ink: #5B3FC4; --s4-ink: #1D5BD8; --s5-ink: #15803D;
  --r-xl: 24px; --r-lg: 18px; --r-md: 12px; --r-sm: 9px;
  --shadow: 0 1px 2px rgba(17, 17, 17, .04), 0 6px 20px rgba(17, 17, 17, .04);
  --font: "Manrope", "Segoe UI", Roboto, Arial, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #0F1012; --panel: #18191C; --panel-2: #202125; --ink: #F1F1EE; --muted: #9A9A96; --line: #2A2B30;
  --accent-soft: #3A2117; --dark: #F1F1EE; --dark-ink: #121212;
  --good: #4ADE80; --bad: #F87171; --warn: #FBBF24; --good-bg: #12301D; --bad-bg: #351616; --warn-bg: #33270F;
  --s0: #1E1F23; --s1: #2E2A17; --s2: #33221A; --s3: #26213F; --s4: #182A45; --s5: #15301F;
  --s0-ink: #C9C9C4; --s1-ink: #F5C451; --s2-ink: #F8A77A; --s3-ink: #B7A8FF; --s4-ink: #8DB4FF; --s5-ink: #6FDC8C;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* каркас: узкая панель иконок + основная часть */
.app { display: flex; height: 100%; }
.rail { width: 76px; flex: 0 0 76px; display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 18px 0; }
.logo { width: 44px; height: 44px; border-radius: 14px; background: #FF5100; color: #121212; display: grid; place-items: center;
        font-family: "Archivo", var(--font); font-stretch: 125%;
        font-weight: 800; font-size: 20px; letter-spacing: -.5px; }
.rail-nav { display: flex; flex-direction: column; gap: 8px; background: var(--panel); padding: 8px; border-radius: 999px; box-shadow: var(--shadow); }
.navbtn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: none; display: grid; place-items: center; cursor: pointer;
          color: var(--muted); position: relative; }
.navbtn span { display: none; }
.navbtn:hover { background: var(--panel-2); color: var(--ink); }
.navbtn.active { background: var(--dark); color: var(--dark-ink); }
.me { margin-top: auto; width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center;
      font-weight: 700; font-size: 13px; }
.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 14px 18px 0 0; }

/* шапка */
.top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 6px 2px 12px; }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 600; }
h1 { margin: 2px 0 0; font-size: 28px; line-height: 1.1; font-weight: 800; letter-spacing: -.6px; }
.tools { display: flex; gap: 8px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; background: var(--panel); border-radius: 999px; padding: 0 14px; height: 42px;
          box-shadow: var(--shadow); min-width: 260px; }
.search svg { width: 18px; height: 18px; color: var(--muted); }
.search input { border: 0; outline: 0; background: none; height: 100%; flex: 1; min-width: 0; }

.btn { border: 0; background: var(--panel); border-radius: 999px; padding: 0 18px; height: 42px; cursor: pointer; font-weight: 700;
       box-shadow: var(--shadow); white-space: nowrap; }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.round { width: 42px; padding: 0; font-size: 18px; }
.btn.ghost { background: none; box-shadow: none; color: var(--muted); }
.btn.plus { background: var(--good-bg); color: var(--good); box-shadow: none; }
.btn.minus { background: var(--bad-bg); color: var(--bad); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* фильтры-пилюли */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding-bottom: 12px; }
.seg { display: inline-flex; background: var(--panel); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.seg button { border: 0; background: none; border-radius: 999px; padding: 0 14px; height: 34px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--dark); color: var(--dark-ink); }
.pill-select { height: 42px; border: 0; border-radius: 999px; padding: 0 36px 0 16px; background: var(--panel); box-shadow: var(--shadow);
               font-weight: 600; cursor: pointer; }
select, input[type=search], input[type=text], input[type=number], input[type=date], input:not([type]), textarea {
  background: var(--panel-2); border: 1px solid transparent; border-radius: var(--r-sm); padding: 8px 12px; min-height: 40px; outline: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: var(--panel); }
.search input, .search input:focus { border: 0; background: none; min-height: 0; padding: 0; }
.chip.st.st0 { background: var(--panel-2); }

/* KPI над доской */
.kpi-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; padding-bottom: 14px; }
.kcard { background: var(--panel); border-radius: var(--r-lg); padding: 14px 18px; box-shadow: var(--shadow); min-width: 0; }
.kl { color: var(--muted); font-size: 12px; font-weight: 600; }
.kv { font-size: 26px; font-weight: 800; letter-spacing: -.6px; margin-top: 2px; white-space: nowrap; }
.ks { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kcard.accent { background: var(--accent); color: #fff; }
.kcard.accent .kl, .kcard.accent .ks { color: rgba(255, 255, 255, .8); }
.kcard.dark { background: var(--dark); color: var(--dark-ink); }
.kcard.dark .kl, .kcard.dark .ks { color: rgba(245, 245, 242, .65); }
:root[data-theme="dark"] .kcard.dark .kl, :root[data-theme="dark"] .kcard.dark .ks { color: rgba(18, 18, 18, .6); }

.views { flex: 1; min-height: 0; position: relative; }

/* канбан */
.board { height: 100%; display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden; padding-bottom: 14px; scroll-snap-type: x proximity; }
.col { flex: 0 0 300px; background: rgba(255, 255, 255, .45); border-radius: var(--r-xl); display: flex; flex-direction: column;
       max-height: 100%; scroll-snap-align: start; }
:root[data-theme="dark"] .col { background: rgba(255, 255, 255, .03); }
.col-head { padding: 12px 14px 8px; display: flex; align-items: center; gap: 8px; }
.col-head h2 { font-size: 14px; margin: 0; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-head .n { background: var(--panel); border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 700; color: var(--muted); }
.col-head .sum { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.av { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 800; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 12px; border: 2px solid currentColor; }
.col-body { padding: 4px 10px 12px; overflow-y: auto; flex: 1; min-height: 60px; display: flex; flex-direction: column; gap: 10px; }
.col.drop .col-body { outline: 2px dashed var(--accent); outline-offset: -4px; border-radius: var(--r-lg); }

.card { background: var(--s0); border-radius: var(--r-lg); padding: 12px 14px; cursor: pointer; border: 1px solid transparent;
        user-select: none; -webkit-user-select: none; touch-action: pan-y; transition: transform .08s ease, box-shadow .08s ease; box-shadow: var(--shadow); }
.card:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(17, 17, 17, .08); }
.card.sb1 { background: var(--s1); } .card.sb2 { background: var(--s2); } .card.sb3 { background: var(--s3); }
.card.sb4 { background: var(--s4); } .card.sb5 { background: var(--s5); }
.card.late { border-color: var(--bad); }
.card.arch { opacity: .62; } .card.arch:hover { opacity: 1; }
.card .t { font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .c { color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.chip { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .75); color: var(--ink); white-space: nowrap; font-weight: 600; }
:root[data-theme="dark"] .chip { background: rgba(255, 255, 255, .08); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.muted { background: rgba(0, 0, 0, .05); color: var(--muted); }
.chip.st { background: var(--panel); }
.st0 { color: var(--s0-ink); } .st1 { color: var(--s1-ink); } .st2 { color: var(--s2-ink); }
.st3 { color: var(--s3-ink); } .st4 { color: var(--s4-ink); } .st5 { color: var(--s5-ink); }
.money { margin-left: auto; font-size: 13px; font-weight: 800; white-space: nowrap; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.card.ghost { position: fixed; z-index: 50; pointer-events: none; opacity: .96; transform: rotate(2deg); box-shadow: 0 16px 36px rgba(0, 0, 0, .18); }
.placeholder { border: 2px dashed var(--accent); border-radius: var(--r-lg); flex: 0 0 auto; }
.card.dragging-src { opacity: .3; }

/* окно проекта */
.scrim { position: fixed; inset: 0; background: rgba(20, 20, 18, .35); backdrop-filter: blur(2px); z-index: 20; }
.drawer { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(820px, calc(100vw - 32px)); height: min(90vh, 920px);
          background: var(--bg); z-index: 30; border-radius: 28px; display: flex; flex-direction: column; overflow: hidden;
          box-shadow: 0 30px 80px rgba(0, 0, 0, .3); animation: pop .15s ease-out; }
.drawer.small { width: min(520px, calc(100vw - 32px)); height: auto; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%) scale(.98); } }
.d-head { padding: 18px 20px 12px; background: var(--panel); }
.d-head .line1 { display: flex; gap: 8px; align-items: flex-start; }
.d-h { margin: 6px 0; font-size: 20px; font-weight: 800; flex: 1; }
.d-title { flex: 1; font-size: 21px; font-weight: 800; letter-spacing: -.3px; border: 1px solid transparent; border-radius: var(--r-md);
           padding: 4px 8px; margin-left: -8px; background: none; resize: none; overflow: hidden; }
.d-title:hover { border-color: var(--line); }
.d-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.d-grid label, .f label, .tform label, .fld, .calc label {
  display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); font-weight: 700; min-width: 0; }
.d-grid label > *, .f label > *, .tform label > *, .fld > *, .calc label > * { font-size: 14px; color: var(--ink); font-weight: 500; width: 100%; min-width: 0; }
.d-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpi { background: var(--panel); border-radius: var(--r-lg); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.kpi .l { font-size: 11px; color: var(--muted); font-weight: 700; }
.kpi .v { font-size: 19px; font-weight: 800; margin-top: 2px; white-space: nowrap; letter-spacing: -.3px; }
.kpi .s { font-size: 11px; color: var(--muted); margin-top: 2px; }
.quick { display: flex; gap: 10px; margin: 12px 0; }
.quick .btn { flex: 1; height: 50px; font-size: 15px; }
.f { background: var(--panel); border-radius: var(--r-lg); padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; box-shadow: var(--shadow); }
.f .full { grid-column: 1 / -1; }
.f .amount input { font-size: 24px; font-weight: 800; }
.f .acts, .newp .acts { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.newp .d-body { display: flex; flex-direction: column; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.subtabs { display: inline-flex; gap: 4px; background: var(--panel); padding: 4px; border-radius: 999px; margin: 6px 0 14px; box-shadow: var(--shadow); }
.subtabs button { border: 0; background: none; padding: 0 16px; height: 36px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 700; }
.subtabs button.active { background: var(--dark); color: var(--dark-ink); }
.cats { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; background: var(--panel); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--shadow); }
.cat { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; font-size: 13px; }
.cat .bar, .o-op .bar { grid-column: 1 / -1; height: 6px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.cat .bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.cat.sub { color: var(--muted); padding-left: 12px; font-size: 12px; }
.feed { display: flex; flex-direction: column; background: var(--panel); border-radius: var(--r-lg); padding: 4px 14px; box-shadow: var(--shadow); }
.op { display: grid; grid-template-columns: 64px 1fr auto; gap: 2px 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.op:last-child { border-bottom: 0; }
.op .d { color: var(--muted); font-size: 12px; font-weight: 600; }
.op .a { font-weight: 800; white-space: nowrap; text-align: right; }
.op .cat-name { font-weight: 700; font-size: 13px; }
.op .desc { grid-column: 2 / 4; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.op .meta { grid-column: 2 / 4; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; row-gap: 4px; min-width: 0; }
.op .del { margin-left: auto; border: 0; background: none; color: var(--bad); cursor: pointer; font-size: 12px; font-weight: 700; }
.empty { color: var(--muted); padding: 28px 0; text-align: center; }
.labor { background: var(--dark); color: var(--dark-ink); border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 5px; }
.labor-h { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 15px; }
.labor-h span, .labor .hint-s { color: rgba(245, 245, 242, .6); font-size: 12px; }
:root[data-theme="dark"] .labor-h span, :root[data-theme="dark"] .labor .hint-s { color: rgba(18, 18, 18, .6); }
.hint-s { color: var(--muted); font-size: 12px; margin-top: 4px; font-weight: 500; }

/* тайминг */
.tform { display: grid; grid-template-columns: 1.3fr .8fr 1.3fr; gap: 12px; background: var(--panel); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--shadow); }
.tform .dates { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.banner { border-radius: var(--r-md); padding: 11px 14px; margin: 12px 0; font-weight: 700; }
.banner.ok { background: var(--good-bg); color: var(--good); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.info { background: var(--panel); color: var(--muted); font-weight: 500; }
.gantt { display: flex; flex-direction: column; gap: 10px; background: var(--panel); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--shadow); }
.g-row { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: center; }
.g-name { font-size: 13px; font-weight: 700; }
.g-name small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; }
.g-track { position: relative; height: 28px; background: var(--panel-2); border-radius: 999px; }
.g-bar { position: absolute; top: 3px; bottom: 3px; background: var(--dark); border-radius: 999px; color: var(--dark-ink); font-size: 11px; font-weight: 700;
         display: flex; align-items: center; padding: 0 9px; white-space: nowrap; overflow: hidden; min-width: 8px; }
.g-bar.now { background: var(--accent); color: #fff; }
.g-today { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--accent); }

/* нормы */
.norms { height: 100%; overflow: auto; padding-bottom: 24px; }
.norms h2 { margin: 6px 0 4px; font-size: 18px; font-weight: 800; }
.norms p.hint { color: var(--muted); margin: 0 0 14px; max-width: 780px; }
.ntable { border-collapse: separate; border-spacing: 0; background: var(--panel); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 22px; }
.ntable th, .ntable td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: center; }
.ntable tr:last-child td { border-bottom: 0; }
.ntable th { background: var(--panel-2); font-size: 12px; color: var(--muted); font-weight: 700; }
.ntable td:first-child, .ntable th:first-child { text-align: left; font-weight: 700; position: sticky; left: 0; background: var(--panel); }
.ntable th:first-child { background: var(--panel-2); }
.ntable input { width: 60px; min-height: 32px; padding: 4px 6px; text-align: center; }
.ntable input:disabled { opacity: .6; }
.ntable .pair { display: flex; gap: 4px; justify-content: center; }
.ntable .sub { font-size: 10px; color: var(--muted); font-weight: 600; }
.norms .save { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 35%); }
.wdays { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.wd { background: var(--panel); border-radius: 999px; padding: 8px 16px; cursor: pointer; box-shadow: var(--shadow); font-weight: 700; }
label.chk { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); font-weight: 600; cursor: pointer; }
label.chk input { width: auto; min-height: 0; accent-color: var(--accent); }

/* калькулятор сроков */
.norms { display: flex; flex-direction: column; gap: 14px; }
.norms > * { flex-shrink: 0; }
.norms h3, .panel h3 { margin: 0 0 6px; font-size: 16px; font-weight: 800; }
.norms-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; align-items: start; }
.chead, .crow { display: grid; grid-template-columns: minmax(0, 1fr) 90px 150px 42px; gap: 8px; align-items: center; }
.chead { font-size: 11px; color: var(--muted); font-weight: 700; margin: 14px 0 6px; }
.crow { margin-bottom: 8px; }
.crow select, .crow input { width: 100%; min-width: 0; }
.copts { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; margin: 14px 0 6px; }
.copts .fld { width: 190px; }
.cres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.cres > div { background: var(--dark); color: var(--dark-ink); border-radius: var(--r-lg); padding: 12px 16px; }
.cres > div:first-child { background: var(--accent); color: #fff; }
.cres.bad > div:first-child { background: var(--bad); }
.cres .kl { color: inherit; opacity: .75; }
.big { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.big small { font-size: 13px; font-weight: 600; opacity: .7; }
.g-det { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.est { background: var(--warn-bg); color: var(--warn); border-radius: 999px; padding: 0 7px; font-weight: 700; font-size: 10.5px; }
.notes { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
.ntable.small input { width: 64px; }
.ntable.small select { min-height: 32px; padding: 4px 8px; }
.more { margin-top: 10px; } .more summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.ntable-wrap { overflow-x: auto; }
.norms-t { width: 100%; }
.norms-t td:first-child { min-width: 230px; }
.norms-t tr.grp td { background: var(--panel-2); font-size: 11px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .4px; padding: 6px 10px; position: static; }
.norms-t input { width: 76px; }
.norms-t input::placeholder { color: #B8B7B1; font-style: italic; }
.norms-t input.copy { border-color: var(--accent); background: var(--accent-soft); }
.legend-copy { display: inline-block; width: 12px; height: 12px; border-radius: 4px; border: 1px solid var(--accent); background: var(--accent-soft); vertical-align: -1px; }
.ntable .sub { display: block; }
@media (max-width: 1100px) { .norms-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .chead, .crow { grid-template-columns: minmax(0, 1fr) 70px 42px; }
  .chead span:nth-child(3), .crow .cd { grid-column: 1 / 3; }
  .cres { grid-template-columns: 1fr 1fr; } .big { font-size: 20px; }
}

/* цех */
.sew { height: 100%; overflow: auto; display: flex; flex-direction: column; gap: 14px; padding-bottom: 24px; }
.sew > * { flex-shrink: 0; }
.sew h2 { margin: 0; font-size: 20px; font-weight: 800; }
.sew h3 { margin: 0 0 12px; font-size: 16px; font-weight: 800; display: flex; gap: 8px; align-items: baseline; }
.sew-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.sew-head h2 { display: none; }
.sew-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sew-kpis .kpi { border-radius: var(--r-lg); padding: 16px 18px; }
.sew-kpis .kpi .v { font-size: 24px; }
.sew-kpis .kpi:nth-child(2) { background: var(--accent); color: #fff; }
.sew-kpis .kpi:nth-child(2) .l, .sew-kpis .kpi:nth-child(2) .s { color: rgba(255, 255, 255, .8); }
.sew-kpis .kpi:nth-child(4) { background: var(--dark); color: var(--dark-ink); }
.sew-kpis .kpi:nth-child(4) .l, .sew-kpis .kpi:nth-child(4) .s { color: rgba(245, 245, 242, .65); }
.sew-kpis .kpi:nth-child(4) .v.warn { color: var(--lime); }
.warn { color: var(--warn); }
.sew-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
.panel { background: var(--panel); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 700; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.off td { opacity: .5; }
.tbl.map td { white-space: normal; }
.tbl.map select { width: 100%; max-width: 440px; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 28px; width: 96px; }
.spark i { flex: 1; background: var(--accent); border-radius: 3px 3px 1px 1px; }
.spark i:nth-last-child(n+2) { opacity: .45; }
.calc { display: grid; grid-template-columns: 1fr 120px; gap: 12px; align-items: end; margin-bottom: 10px; }
.calc .btn { width: 100%; padding: 0 10px; }
.calc .chk { grid-column: 1; }
.orders { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.order { background: var(--panel-2); border-radius: var(--r-lg); padding: 14px; }
.o-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.o-prod { color: var(--muted); font-size: 12px; }
.o-proj { font-size: 12px; color: var(--muted); margin: 6px 0 10px; }
.lnk { color: var(--accent); cursor: pointer; font-weight: 700; text-decoration: none; }
.lnk:hover { text-decoration: underline; }
.o-ops { display: flex; flex-direction: column; gap: 6px; }
.o-op { display: grid; grid-template-columns: 150px 1fr 74px; gap: 8px; align-items: center; font-size: 12px; font-weight: 600; }
.o-op .bar { grid-column: auto; background: var(--panel); }
.o-op .bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.o-op .bar i.full { background: var(--good); }
.o-op .n { text-align: right; color: var(--muted); }
.map-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 12px 0; flex-wrap: wrap; }

/* траты на проверке */
.btn.review { background: var(--lime); color: #121212; }
.btn.review b { background: #121212; color: var(--lime); border-radius: 999px; padding: 1px 8px; margin-left: 4px; }
.rv { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.rv:last-child { border-bottom: 0; }
.rv-top { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 16px; }
.rv-desc { font-size: 13px; }
.rv-f { display: grid; grid-template-columns: 1.6fr 1fr auto; gap: 8px; }
.rv-f select { width: 100%; min-width: 0; }
@media (max-width: 700px) { .rv-f { grid-template-columns: 1fr; } }

/* «Не разнесено»: деньги без проекта */
#btnUnas { background: var(--warn-bg); color: var(--warn); }
#btnUnas b { background: var(--warn); color: #fff; border-radius: 999px; padding: 1px 8px; margin-left: 6px; }
#btnUnas .ico { display: none; font-weight: 800; }
.un-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.un-filters .pill-select { max-width: 100%; min-width: 0; }
.rv-f.un { grid-template-columns: 1fr auto auto; }
.sgs { display: flex; gap: 6px; flex-wrap: wrap; }
.sg { border: 0; cursor: pointer; text-align: left; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--accent);
      background: color-mix(in srgb, var(--accent) 11%, transparent); border-radius: 12px; padding: 6px 11px; max-width: 100%; }
.sg small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; }
.sg:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.rv.gone { opacity: 0; transition: opacity .25s; }
.op .edt { margin-left: auto; border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 12px; font-weight: 700; }
.op .edt + .unl { margin-left: 8px; }
.op.editing { display: block; }
.op.editing .f { margin: 0; }
.op .unl { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; }
.op .unl + .del { margin-left: 8px; }
.chip.warn { background: var(--warn-bg); color: var(--warn); }

/* «Навести порядок» */
button.kcard { border: 0; text-align: left; font: inherit; cursor: pointer; width: 100%; }
.kcard.tidy:hover { filter: brightness(1.15); }
.tidy-sec { margin-bottom: 14px; }
.tidy-sec > summary { cursor: pointer; font-size: 16px; padding: 6px 0; list-style: none; display: flex; gap: 8px; align-items: center; }
.tidy-sec > summary::-webkit-details-marker { display: none; }
.tidy-sec > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.tidy-sec[open] > summary::before { transform: rotate(90deg); }
.tidy-sec > summary .n { background: var(--panel); border-radius: 999px; padding: 1px 9px; font-size: 13px; font-weight: 700; box-shadow: var(--shadow); }
.tidy-sec > .hint-s { margin: 0 0 8px; }
.tidy-sec .acts { margin-top: 10px; display: flex; justify-content: flex-end; }
.trow { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.trow:last-child { border-bottom: 0; }
.tmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
button.lnk { border: 0; background: none; padding: 0; font: inherit; }
.tmain .lnk { text-align: left; font-weight: 700; font-size: 14px; }
.tctl { display: flex; gap: 6px; flex-shrink: 0; }
.tctl select, .tctl input { min-width: 0; max-width: 190px; }
.trow.done { background: var(--good-bg); border-radius: 10px; padding-left: 8px; padding-right: 8px; }
.trow.gone { opacity: .35; }
label.trow { cursor: pointer; }
.trow input[type=checkbox] { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--accent); }
@media (max-width: 700px) { .trow { flex-wrap: wrap; } .tctl { width: 100%; } .tctl select, .tctl input { max-width: none; flex: 1; } }

/* ТЗ и заявка в карточке проекта */
.brief { background: var(--panel); border-radius: var(--r-lg); padding: 10px 14px; box-shadow: var(--shadow); margin-top: 10px; }
.brief > summary { cursor: pointer; font-weight: 700; font-size: 13px; }
.brief textarea { width: 100%; margin-top: 8px; font: inherit; font-size: 13px; line-height: 1.45; resize: vertical; min-height: 60px; }

/* что можно менеджерам */
.acc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.fld.acc .hint-s { font-weight: 500; font-size: 12px; }
@media (max-width: 700px) { .acc-grid { grid-template-columns: 1fr; } }

/* двойники: банковская операция уже внесена вручную */
.twin { background: var(--warn-bg); color: var(--ink); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.twin > b { color: var(--warn); }
.twin-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.twin-row i { display: block; font-style: normal; color: var(--muted); font-size: 12px; }
.twin .tw-no { align-self: flex-start; }
.op.replaced { opacity: .55; }
.op.replaced .a { text-decoration: line-through; }

/* договор и долг в карточке проекта */
.contract { display: grid; grid-template-columns: 210px 1fr; gap: 16px; align-items: center; background: var(--panel); border-radius: var(--r-lg);
            padding: 12px 14px; box-shadow: var(--shadow); margin-top: 10px; }
.c-in { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); font-weight: 700; }
.c-in input { font-size: 17px; font-weight: 800; color: var(--ink); width: 100%; min-width: 0; }
.c-bar { height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.c-bar i { display: block; height: 100%; background: var(--good); border-radius: 999px; }
.c-l { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 6px 0 2px; font-size: 13px; font-weight: 600; }
.kcard.debt .kv { color: var(--warn); }

/* команда */
.team td { white-space: normal; }
.team input, .team select { width: 100%; min-width: 120px; }
.team .tn { min-width: 200px; }
.two-line { display: grid; grid-template-columns: 2fr 1fr 1.2fr 1.2fr auto; gap: 12px; align-items: end; margin: 8px 0; }
.chip.ok { background: var(--good-bg); color: var(--good); }
.team .tt { min-width: 110px; } .team .tu { min-width: 140px; }
@media (max-width: 700px) { .two-line { grid-template-columns: 1fr; } }

/* экран входа / нет доступа */
.gate { max-width: 460px; margin: 12vh auto 0; padding: 32px 24px; background: var(--panel); border-radius: 28px; box-shadow: var(--shadow); text-align: center; }
.gate .logo { margin: 0 auto 18px; }
.gate h1 { font-size: 24px; }
.gate p { color: var(--muted); }
.gate-id { font-size: 28px; font-weight: 800; letter-spacing: 1px; background: var(--panel-2); border-radius: var(--r-lg); padding: 14px; margin: 16px 0; user-select: all; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--dark); color: var(--dark-ink);
         padding: 12px 18px; border-radius: 999px; z-index: 60; max-width: 90vw; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }

/* планшет и телефон */
@media (max-width: 1100px) { .kpi-row, .sew-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sew-grid { grid-template-columns: 1fr; }
  .kpi-row .kcard.debt { grid-column: span 2; } }
@media (max-width: 700px) {
  .app { flex-direction: column-reverse; }
  .rail { width: 100%; flex: 0 0 auto; flex-direction: row; padding: 8px 12px; justify-content: center; }
  .logo, .me { display: none; }
  .rail-nav { flex-direction: row; }
  .main { padding: 10px 12px 0; }
  h1 { font-size: 22px; }
  .tools { width: 100%; margin-left: 0; flex-wrap: nowrap; }
  #btnNew { width: 42px; padding: 0; font-size: 20px; flex: 0 0 42px; }
  #btnNew span { display: none; }
  .search { flex: 1; min-width: 0; }
  #btnUnas .lbl { display: none; } #btnUnas .ico { display: inline; } #btnUnas { padding: 0 10px; flex: 0 0 auto; }
  .contract { grid-template-columns: 1fr; gap: 10px; }
  .rv-f.un { grid-template-columns: 1fr 1fr; } .rv-f.un .up { grid-column: 1 / 3; }
  .kpi-row { gap: 8px; padding-bottom: 10px; } .kcard { padding: 10px 12px; } .kv { font-size: 20px; } .ks { display: none; }
  .filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 10px; }
  .filters > * { flex-shrink: 0; }
  .eyebrow { display: none; }
  .col { flex-basis: calc(100vw - 40px); }
  .drawer { top: 0; left: 0; transform: none; width: 100vw; height: 100%; border-radius: 0; animation: none; }
  .drawer.small { width: 100vw; height: 100%; }
  .d-grid, .kpis, .tform, .two { grid-template-columns: 1fr 1fr; }
  .g-row { grid-template-columns: 96px 1fr; }
  .panel { overflow-x: auto; padding: 14px; }
}

/* задачи проекта */
.tasks .task { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--line, rgba(127,127,127,.15)); cursor: pointer; }
.tasks .task .tt { flex: 1; }
.tasks .task .td { font-size: 12px; opacity: .7; white-space: nowrap; }
.tasks .task.done .tt { text-decoration: line-through; opacity: .5; }
.tasks .task.late .td { color: #d9534f; opacity: 1; font-weight: 600; }
.tasks .task.today .td { color: #e08a00; opacity: 1; font-weight: 600; }
.tasks .late-n { color: #d9534f; font-weight: 600; font-size: 12px; margin-left: 6px; }
.task-add { display: flex; gap: 6px; margin-top: 8px; }
.task-add #taskTitle { flex: 1; min-width: 0; }
.task-add #taskDue { width: 130px; }

/* вход из браузера по коду */
.gate .login { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.gate .login input { font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line, rgba(127,127,127,.3)); background: var(--panel-2); color: inherit; text-align: center; }
.gate .login-err { color: #d9534f; min-height: 18px; font-size: 14px; }
.gate .login-note { font-size: 13px; margin-top: 14px; }

/* обложки проектов */
.card.has-cover { padding-top: 0; overflow: hidden; }
.card .cover { display: block; width: calc(100% + 28px); margin: 0 -14px 10px; height: 120px; object-fit: cover; background: var(--panel-2); pointer-events: none; }
.d-cover { position: relative; margin-bottom: 12px; border-radius: var(--r-lg); overflow: hidden; background: var(--panel-2); }
.d-cover img { display: block; width: 100%; max-height: 260px; object-fit: cover; cursor: zoom-in; }
.d-cover .cover-btns { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; }
.d-cover .cover-btns .btn { background: rgba(255,255,255,.92); color: #111; font-size: 12px; padding: 6px 10px; }
.cover-add { width: 100%; margin-bottom: 12px; border: 1px dashed var(--line, rgba(127,127,127,.35)); }

/* «Мой день» */
.day { padding: 4px 0 24px; }
.day-team { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.day-team .pill { border: 1px solid var(--line, rgba(127,127,127,.25)); background: var(--panel); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: inherit; }
.day-team .pill.active { background: var(--ink, #111); color: var(--panel, #fff); }
.day-team .pill .no { color: #d9534f; font-size: 12px; }
.day-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .day-grid { grid-template-columns: 1fr; } }
.day-col h3 { font-size: 15px; margin: 0 0 6px; display: flex; gap: 8px; align-items: center; }
.day-col .cnt { font-size: 12px; opacity: .6; font-weight: 600; }
.day-col .day-proj { font-size: 12px; opacity: .7; margin-left: 4px; color: inherit; }
.day-col .x { border: 0; background: none; font-size: 18px; line-height: 1; opacity: .4; cursor: pointer; color: inherit; padding: 0 4px; }
.day-col .x:hover { opacity: 1; }
.day-col .task-add textarea { flex: 1; min-width: 0; font: inherit; font-size: 13px; border-radius: 10px; padding: 8px; resize: vertical; }

/* обсуждение в проекте */
.chat { max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 0 8px; }
.chat .msg { background: var(--panel-2); border-radius: 14px; padding: 8px 12px; max-width: 88%; }
.chat .msg.mine { align-self: flex-end; background: var(--s1, #eef3ff); }
.chat .who { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.chat .who span { font-weight: 400; opacity: .6; margin-left: 6px; }
.chat .txt { font-size: 14px; line-height: 1.4; word-wrap: break-word; }
.chat-add { display: flex; gap: 8px; align-items: flex-end; margin-top: 6px; }
.chat-add textarea { flex: 1; min-width: 0; font: inherit; font-size: 14px; border-radius: 12px; padding: 8px 10px; resize: vertical; }
.chat-hint { font-size: 12px; margin-top: 6px; }

/* ссылка на бриф в «Мой день» */
.brief-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 0 14px; padding: 12px 16px; border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); font-size: 14px; }

/* «Мой день»: статусы дел */
.tasks .task.plan { align-items: flex-start; cursor: default; flex-wrap: wrap; }
.tasks .task.plan input[type=checkbox] { margin-top: 3px; }
.tasks .task.plan .tt { min-width: 0; }
.tasks .task.plan.done .tt .pnote { text-decoration: none; }
.tasks .task.plan .carry { font-size: 11px; color: var(--muted); white-space: nowrap; }
.tasks .task.plan .pnote { display: block; width: 100%; margin-top: 3px; border: 0; border-bottom: 1px dashed transparent; background: none;
  font: inherit; font-size: 12px; color: var(--muted); padding: 2px 0; outline: none; }
.tasks .task.plan .pnote:hover, .tasks .task.plan .pnote:focus { border-bottom-color: var(--line); color: var(--ink); }
.tasks .task.plan .pnote-ro { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.tasks .task.plan .pst { font: inherit; font-size: 12px; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 3px 6px; max-width: 128px; }
.tasks .task.plan.st-wait .pst { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.tasks .task.plan.st-partial .pst { background: var(--s4); color: var(--s4-ink); border-color: transparent; }
.tasks .task.plan.st-later .pst { background: var(--panel-2); color: var(--muted); }
.tasks .task.plan.st-done .pst { background: var(--good-bg); color: var(--good); border-color: transparent; }

/* трата: правка заметна и на телефоне — нажатие на строку тоже открывает правку */
.op.can-edit { cursor: pointer; }
.op.can-edit:hover { background: var(--panel-2); }
.op .edt { white-space: nowrap; }

/* ---------- «Мои заметки» ---------- */
.notes { max-width: 780px; padding-bottom: 90px; }
.notes [hidden] { display: none !important; }
.notes .nlock { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.notes .ncard { background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 12px; margin-top: 12px; }
.notes textarea, .notes input[type=search] { width: 100%; font: inherit; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; outline: none; }
.notes textarea { min-height: 70px; resize: vertical; }
.notes textarea:focus, .notes input:focus { border-color: var(--accent); }
.notes .nrow { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.notes .nsp { flex: 1; }
.notes .nsearch { display: flex; gap: 8px; align-items: center; padding: 8px; }
.notes .npend, .notes .nfiles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.notes .nfiles img { width: 64px; height: 64px; object-fit: cover; border-radius: 9px; cursor: pointer; background: var(--panel-2); }
.notes .nchip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 5px 8px; font-size: 13px; max-width: 100%; cursor: pointer; }
.notes .nchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.notes .nchip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 0; }
.notes .ntabs { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.notes .ntabs button { font: inherit; font-weight: 700; border: 0; border-radius: 999px; padding: 8px 14px; cursor: pointer; background: var(--panel); color: var(--muted); }
.notes .ntabs button[aria-selected="true"] { background: var(--dark); color: var(--dark-ink); }
.notes .nflt { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.notes .nflt button { font: inherit; font-size: 13px; font-weight: 700; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.notes .nflt button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.notes .ndayh { font-size: 12px; font-weight: 800; color: var(--muted); margin: 16px 4px 2px; }
.notes .nnote { display: flex; gap: 10px; background: var(--panel); border-radius: 14px; padding: 12px 14px; margin-top: 8px; box-shadow: var(--shadow); }
.notes .nnote.pin { box-shadow: inset 3px 0 0 var(--accent), var(--shadow); }
.notes .nnote.sel, .notes .nnote.hit { outline: 2px solid var(--accent); }
.notes .nck { width: 22px; height: 22px; margin-top: 2px; accent-color: #FF5100; flex: 0 0 auto; }
.notes .nbody { flex: 1; min-width: 0; }
.notes .nwhen { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.notes .nacts { display: inline-flex; gap: 2px; }
.notes .nacts button { width: 30px; height: 26px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; font-size: 15px; }
.notes .nacts button:hover { background: var(--panel-2); color: var(--ink); }
.notes .ntxt { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; font-size: 14px; }
.notes .ntxt a, .notes .nfile a, .notes .nans a { color: var(--accent); font-weight: 600; }
.notes mark { background: var(--accent-soft); color: inherit; border-radius: 4px; padding: 0 2px; }
.notes .ned { margin-top: 6px; min-height: 90px; }
.notes .nsent { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.notes .nbadge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; border-radius: 8px; padding: 3px 8px; }
.notes .nbadge.mika { background: var(--accent-soft); color: #A33A00; }
.notes .nbadge.project { background: var(--s4); color: var(--s4-ink); }
.notes .nbadge button { border: 0; background: none; color: inherit; opacity: .7; cursor: pointer; font-size: 13px; padding: 0 0 0 2px; }
.notes .nempty { color: var(--muted); text-align: center; padding: 24px; }
.notes .nfile { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 14px; padding: 10px 12px; margin-top: 8px; box-shadow: var(--shadow); }
.notes .nic { width: 44px; height: 44px; border-radius: 10px; background: var(--panel-2); display: grid; place-items: center; font-size: 11px; font-weight: 800; color: var(--muted); flex: 0 0 auto; overflow: hidden; }
.notes .nic img { width: 100%; height: 100%; object-fit: cover; }
.notes .nnm { flex: 1; min-width: 0; }
.notes .nnm b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.notes .nnm small { color: var(--muted); font-size: 12px; }
.notes .nhint, .notes .nmuted { color: var(--muted); font-size: 13px; margin-top: 8px; }
.notes .nwho { font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.notes .nselbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px; width: min(740px, calc(100% - 24px)); z-index: 30;
  display: flex; align-items: center; gap: 5px; background: #121212; color: #f5f5f2; border-radius: 16px; padding: 8px 8px 8px 12px; }
.notes .nselbar b { flex: 1; font-size: 14px; white-space: nowrap; }
.notes .nselbar .btn { background: #2a2a2a; color: #f5f5f2; padding: 7px 10px; white-space: nowrap; }
.notes .nselbar .btn.primary { background: #FF5100; color: #121212; }
.nviewer { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 60; display: grid; place-items: center; padding: 16px; }
.nviewer img { max-width: 100%; max-height: 90vh; border-radius: 12px; }
.nsheet { background: var(--panel); color: var(--ink); border-radius: 18px; padding: 18px; width: min(440px, 100%); display: grid; gap: 8px; }
.nsheet b { font-size: 17px; }
.nsheet .nlbl { color: var(--muted); font-size: 12px; }
.nsheet input, .nsheet select { font: inherit; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; width: 100%; }
.nsheet .btn.dark { background: var(--dark); color: var(--dark-ink); }

/* корзина удалённых операций (директор и администратор) */
.trash { margin-top: 14px; background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 10px 14px; }
.trash > summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--muted); }
.trash-body { margin-top: 8px; font-size: 13px; }
.trow-del { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.trow-del small { color: var(--muted); grid-column: 1; }
.trow-del .btn { grid-row: 1 / 3; grid-column: 2; }
.trow-del.back { opacity: .6; }

/* ---------- подсветка «требует внимания», закрытие проекта, источник ---------- */
.card.attn { box-shadow: inset 0 -3px 0 #E0A100, var(--shadow); }
.chip.att.stale { background: var(--warn-bg); color: var(--warn); }
.chip.att.soon { background: var(--bad-bg); color: var(--bad); }
.chip.att.notask { background: var(--panel-2); color: var(--muted); }
.chip.ok { background: var(--good-bg); color: var(--good); }
.cl-row { display: flex; gap: 4px; align-items: center; }
.cl-row input { flex: 1; min-width: 0; }
.cl-info { padding: 0 8px; height: 32px; font-size: 15px; }
.d-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.closed { margin-top: 8px; padding: 8px 12px; border-radius: 12px; font-size: 13px; font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.closed.won { background: var(--good-bg); color: var(--good); }
.closed.lost { background: var(--bad-bg); color: var(--bad); }
/* ---------- окна ---------- */
.xback { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 80; display: grid; place-items: center; padding: 14px; }
.xmodal { background: var(--panel); color: var(--ink); border-radius: 18px; padding: 18px; width: min(480px, 100%); max-height: 92vh; overflow: auto; display: grid; gap: 10px; }
.xmodal.wide { width: min(760px, 100%); }
.xmodal h3 { margin: 0; font-size: 18px; } .xmodal h4 { margin: 8px 0 0; }
.xmodal label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.xmodal input, .xmodal select, .xmodal textarea { font: inherit; font-size: 14px; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 100%; }
.xmuted { color: var(--muted); font-size: 13px; margin: 0; }
.xwarn { background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 8px 12px; font-size: 13px; }
.xwarn a { color: inherit; font-weight: 700; }
.xchoice, .xbtns { display: flex; gap: 8px; flex-wrap: wrap; }
.xgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.xseg { display: inline-flex; background: var(--panel-2); border-radius: 999px; padding: 3px; gap: 2px; }
.xseg button { font: inherit; font-size: 13px; font-weight: 700; border: 0; background: none; color: var(--muted); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.xseg button.on { background: var(--accent); color: var(--accent-ink); }
.xkpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.xkpis div { background: var(--panel-2); border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; }
.xkpis span { font-size: 12px; color: var(--muted); } .xkpis b { font-size: 16px; }
.xlist { display: grid; }
.xrow { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 2px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 13px; }
.xrow small { display: block; color: var(--muted); font-size: 12px; }
.xlines { width: 100%; border-collapse: collapse; font-size: 13px; }
.xlines th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 4px; }
.xlines td { padding: 3px 4px; } .xlines td.r { text-align: right; white-space: nowrap; }
.xlines td:first-child { width: 50%; } .xlines td:nth-child(2) { width: 70px; } .xlines td:nth-child(3) { width: 110px; }
.xtotal { text-align: right; font-weight: 800; }
.xlog { display: grid; }
.xlrow { display: grid; grid-template-columns: 110px 1fr; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.xlrow .xwhen { color: var(--muted); font-size: 12px; } .xlrow s { color: var(--muted); }
/* ---------- отчёты и календарь ---------- */
.xrepv, .xcalv { display: grid; gap: 12px; padding-bottom: 30px; }
.xrepv h3 { margin: 10px 0 0; font-size: 15px; }
.xrep-top, .xcal-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.xrep { width: 100%; background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.xrep a { color: var(--accent); font-weight: 600; }
.xcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.xcal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.xdow { font-size: 12px; color: var(--muted); font-weight: 700; padding: 0 4px; }
.xday { background: var(--panel); border-radius: 10px; min-height: 92px; padding: 4px; display: grid; align-content: start; gap: 2px; overflow: hidden; }
.xday.empty { background: none; } .xday.past { opacity: .7; } .xday.today { outline: 2px solid var(--accent); }
.xd { font-size: 12px; font-weight: 800; color: var(--muted); }
.xev { display: block; font-size: 11px; line-height: 1.25; padding: 2px 5px; border-radius: 6px; color: var(--ink); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--panel-2); }
.xev.st0 { background: var(--s0); } .xev.st1 { background: var(--s1); } .xev.st2 { background: var(--s2); } .xev.st3 { background: var(--s3); }
.xev.st4 { background: var(--s4); } .xev.st5 { background: var(--s5); }
.xev.fin { opacity: .75; font-style: italic; } .xev.late { outline: 1px solid var(--bad); color: var(--bad); } .xev.other { opacity: .55; }
.xmore { font-size: 11px; color: var(--muted); }
@media (max-width: 700px) {
  /* 8 кнопок меню помещаются без прокрутки: кнопки чуть меньше (прокрутка обрезала панель и по высоте) */
  .rail-nav { gap: 3px; padding: 5px; max-width: calc(100vw - 16px); overflow: visible; }
  .rail-nav .navbtn { flex: 0 0 auto; width: 38px; height: 38px; }
  .rail-nav .navbtn svg { width: 20px; height: 20px; }
  .xday { min-height: 64px; } .xev { font-size: 10px; padding: 1px 3px; }
  .xlrow { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- отчёт по проекту ---------- */
.xframe { width: 100%; height: min(70vh, 720px); border: 1px solid var(--line); border-radius: 12px; background: #fff; }
/* ---------- «Что нового» ---------- */
.xmodal.news { width: min(420px, 100%); padding: 0; overflow: hidden; animation: xnPop .45s cubic-bezier(.2, .9, .3, 1.2); }
.xnews { display: grid; gap: 10px; padding: 16px 18px 18px; }
.xnhead { display: flex; justify-content: space-between; align-items: center; }
.xnbadge { background: #FF5100; color: #121212; font-weight: 800; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; }
.xnstage { min-height: 210px; overflow: hidden; position: relative; }
.xncard { display: grid; gap: 8px; justify-items: center; text-align: center; padding: 10px 4px; }
.xncard .xnic { font-size: 46px; line-height: 1; animation: xnBounce .7s ease .1s both; }
.xncard h3 { margin: 4px 0 0; font-size: 20px; }
.xncard p { margin: 0; color: var(--ink); opacity: .85; font-size: 14px; line-height: 1.45; }
.xncard small { color: var(--accent); font-weight: 700; font-size: 12px; }
.xncard.in-r { animation: xnInR .38s ease both; } .xncard.in-l { animation: xnInL .38s ease both; } .xncard.in-up { animation: xnUp .45s ease both; }
.xndots { display: flex; justify-content: center; gap: 6px; }
.xndots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); cursor: pointer; transition: width .25s, background .25s; }
.xndots i.on { width: 20px; border-radius: 4px; background: #FF5100; }
.xnbtns { display: flex; gap: 8px; justify-content: space-between; }
.xnbtns .btn { flex: 1; }
@keyframes xnPop { from { opacity: 0; transform: translateY(30px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes xnInR { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: none; } }
@keyframes xnInL { from { opacity: 0; transform: translateX(-60px); } to { opacity: 1; transform: none; } }
@keyframes xnUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes xnBounce { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .xmodal.news, .xncard, .xncard .xnic { animation: none !important; } }
.logo { cursor: pointer; }

.xrep { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

/* вход: код из Telegram или логин и пароль */
.gate .login-tabs { margin: 4px auto 14px; }
.gate .login-tabs button { padding: 7px 14px; }

/* совсем узкий экран: не помещается — прокрутка только вбок, без обрезки по высоте */
@media (max-width: 350px) { .rail-nav { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; } }

/* все разделы, кроме канбана, прокручиваются внутри своей области (страница целиком не прокручивается):
   иначе в низком окне содержимое уходило под нижнее меню и его нельзя было прокрутить */
.views > section:not(.board) { height: 100%; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding-bottom: 24px; box-sizing: border-box; }
.views > section.notes { padding-bottom: 96px; }
/* раздел «Мои заметки»: не наследовать старый класс .notes (серый мелкий текст с отступом) */
.views > section.notes { margin: 0; padding-left: 0; color: var(--ink); font-size: 14px; }
/* заметки: 📌 яркий только у закреплённых, у остальных — бледный (иначе кажется, что закреплено всё) */
.notes .nacts [data-pin] { opacity: .35; filter: grayscale(1); }
.notes .nacts [data-pin]:hover { opacity: .8; filter: none; }
.notes .nnote.pin .nacts [data-pin] { opacity: 1; filter: none; }
/* панель выбора и подсказки не закрывают нижнее меню на телефоне; последняя заметка не прячется под панелью */
.views > section.notes { padding-bottom: 80px; }
@media (max-width: 700px) { .notes .nselbar { bottom: 70px; } .toast { bottom: 74px; } }
/* файлы в обсуждении проекта (пришли из заметок) */
.msg .cfiles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.msg .cfiles img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; cursor: zoom-in; background: var(--panel-2); }
.msg .cfile { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 5px 8px; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; max-width: 100%; }
.msg .cfile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
@media (max-width: 700px) { .notes .nselbar { gap: 4px; padding: 6px 6px 6px 10px; width: calc(100% - 16px); }
  .notes .nselbar .btn { padding: 7px 8px; font-size: 13px; } .notes .nselbar b { font-size: 13px; } }

/* ---------- правки по ревью 05.11 ---------- */
/* отчёты: сетка раздела фиксированной высоты сжимала таблицы до одной строки */
.views > section.xrepv { grid-auto-rows: max-content; align-content: start; }
/* календарь: расшифровка цветов и нажатие на день */
.xlegend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 8px; font-size: 11px; color: var(--muted); }
.xlegend span { display: inline-flex; align-items: center; gap: 5px; }
.xlegend .xev { display: inline-block; width: 12px; height: 10px; padding: 0; border-radius: 3px; }
.xday[data-day] { cursor: pointer; }
/* команда: роль не обрезается, «это вы» не прилипает к полю */
.tbl.team select { min-width: 150px; }
.tbl.team td .chip { display: inline-block; margin-top: 5px; }
@media (max-width: 700px) {
  /* карточка проекта на телефоне листается целиком — шапка не съедает 40% экрана */
  #drawer { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  #drawer .d-body { overflow: visible; flex: none; height: auto; min-height: 0; }
  /* вкладки карточки — в одну строку с прокруткой вбок */
  .subtabs { display: flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .subtabs button { white-space: nowrap; flex: 0 0 auto; padding: 0 12px; }
}

/* выбор «здесь / в браузере» при открытии из синей кнопки бота */
.pickwhere{position:fixed;inset:0;z-index:9999;display:grid;place-items:center;padding:16px;background:rgba(0,0,0,.45)}
.pickwhere .pw-card{background:var(--panel);color:var(--ink);border-radius:var(--r-lg);padding:20px;width:100%;max-width:360px;display:grid;gap:10px;box-shadow:var(--shadow)}
.pickwhere .pw-card b{font-size:17px}
.pickwhere .pw-card .btn{width:100%;justify-content:center;padding:12px}
.pickwhere .pw-card small{color:var(--muted);text-align:center}
.pickwhere .pw-rem{display:flex;gap:8px;align-items:center;justify-content:center;color:var(--muted);font-size:14px}
.pickwhere .pw-card .pw-reset{background:transparent;border:0;color:var(--muted);text-decoration:underline;padding:4px}
